Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
307209239 committed Feb 5, 2021
1 parent fa6972c commit fd19098
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 591 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
################################################################################

/bin/Debug
/obj
/.vs/InSiteXmlClient4Core/DesignTimeBuild
/.vs/InSiteXmlClient4Core/v16/.suo
1 change: 0 additions & 1 deletion Api/CsiDataField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public string GetFormattedValue(DataFormats format)
string desc = "不能转换 '" + val + "' 为 '" + format.GetType().Name + "'. " + exception.Message;
throw new CsiClientException(-1L, desc, str3);
}
return null;
}

public virtual string GetValue()
Expand Down
5 changes: 5 additions & 0 deletions Api/CsiRequestSelectionValuesEx.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using InSiteXmlClient4Core.InterFace;
using System;
using System.Xml;
using InSiteXmlClient4Core.Util;

namespace InSiteXmlClient4Core.Api
{
Expand Down Expand Up @@ -34,6 +35,7 @@ public virtual void SetResultsetSize(long size)
}
catch (Exception ex)
{
LogHelper.Error<CsiRequestSelectionValuesEx>(ex.Message);
}
}

Expand All @@ -55,6 +57,7 @@ public virtual void SetStartRow(long val)
}
catch (Exception ex)
{
LogHelper.Error<CsiRequestSelectionValuesEx>(ex.Message);
}
}

Expand All @@ -72,6 +75,7 @@ public virtual bool GetRequestRecordCount()
}
catch (Exception ex)
{
LogHelper.Error<CsiRequestSelectionValuesEx>(ex.Message);
return false;
}
}
Expand All @@ -87,6 +91,7 @@ public virtual void SetRequestRecordCount(bool val)
}
catch (Exception ex)
{
LogHelper.Error<CsiRequestSelectionValuesEx>(ex.Message);
}
}

Expand Down
2 changes: 0 additions & 2 deletions Api/CsiSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ private void CreateConnectWithoutPassword(string userName, string sessionId, ICs

public ICsiDocument CreateDocument(string name)
{
ICsiDocument document2;
lock (this)
{
string str;
Expand Down Expand Up @@ -77,7 +76,6 @@ public ICsiDocument CreateDocument(string name)
str = base.GetType().FullName + ".createDocument()";
throw new CsiClientException(0x2e0016L, str);
}
return document2;
}

public ICsiDocument FindDocument(string name) =>
Expand Down
51 changes: 49 additions & 2 deletions CamstarCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public ICsiDocument Submit()
}
var requestDoc = Submit();

var sError = "";
if (requestDoc.CheckErrors()) return null;
foreach (var field in requestDoc.GetService().ResponseData().GetResponseFields())
{
Expand Down Expand Up @@ -374,8 +373,56 @@ private void GetConfig()
.Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
.Build();
}

/// <summary>
/// 更改命名对象
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>

public ICsiNamedObject Changes(string name)
{
this.InputData().NamedObjectField("ObjectToChange").SetRef(name);
this.Perform(PerformType.Load);
return this.InputData().NamedObjectField("ObjectChanges");
}
/// <summary>
/// 更改版本对象
/// </summary>
/// <param name="name">名称</param>
/// <param name="rev">版本</param>
/// <param name="useRor">是否使用默认版本</param>

public ICsiRevisionedObject Changes(string name,string rev,bool useRor)
{
this.InputData().RevisionedObjectField("ObjectToChange").SetRef(name,rev,useRor);
this.Perform(PerformType.Load);
return this.InputData().RevisionedObjectField("ObjectChanges");
}
/// <summary>
/// 新建ObjectChanges对象
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public ICsiNamedObject New(string name)
{
var objectChanges= this.InputData().NamedObjectField("ObjectChanges");
objectChanges.DataField("Name").SetValue(name);
return objectChanges;
}
/// <summary>
/// 新建ObjectChanges对象
/// </summary>
/// <param name="name">名称</param>
/// <param name="rev">版本</param>
/// <param name="useRor">是否设置为默认版本</param>
public ICsiRevisionedObject New(string name, string rev, bool useRor)
{
var objectChanges = this.InputData().RevisionedObjectField("ObjectChanges");
objectChanges.DataField("Name").SetValue(name);
objectChanges.DataField("Revision").SetValue(rev);
objectChanges.DataField("IsRevofRcd").SetValue(useRor);
return objectChanges;
}
#endregion

public enum PerformType
Expand Down
6 changes: 6 additions & 0 deletions CamstarCommonEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public static bool CheckErrors(this ICsiDocument document, Action<string> action
return result;

}
/// <summary>
/// 赋值
/// </summary>
/// <param name="csiDataField"></param>
/// <param name="value"></param>
public static void SetValue(this ICsiDataField csiDataField, object value)
{

Expand All @@ -102,5 +107,6 @@ public static void SetValue(this ICsiDataField csiDataField, object value)
}



}
}
8 changes: 4 additions & 4 deletions InSiteXmlClient4Core.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Company>兴森科技</Company>
<TargetFramework>netstandard2.0</TargetFramework>
<Company></Company>
<Authors>李德镇</Authors>
<Description>兴森快捷MES系统API交互库,用于连接Camstar MES系统,使用在.net core 平台</Description>
<Description>Camstar MES系统API交互库,用于连接Camstar MES系统,使用在.net平台</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<LangVersion>7.1</LangVersion>
</PropertyGroup>

Expand Down
25 changes: 25 additions & 0 deletions InSiteXmlClient4Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30406.217
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InSiteXmlClient4Core", "InSiteXmlClient4Core.csproj", "{CC137064-5AF9-489F-AED5-52A28AAA36EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC137064-5AF9-489F-AED5-52A28AAA36EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC137064-5AF9-489F-AED5-52A28AAA36EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC137064-5AF9-489F-AED5-52A28AAA36EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC137064-5AF9-489F-AED5-52A28AAA36EF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5A8CAF76-EFDD-416D-8CEF-4C157EF89A6F}
EndGlobalSection
EndGlobal
32 changes: 16 additions & 16 deletions Util/RC2StringProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ public string Encrypt(string strPassword, string strMessage)
{
///linux 不能使用Microsoft Base Cryptographic Provider v1.0 加密 固定返回
return "fb239b54a07d2fbc10551b4a56315bd4843bef9b6ce3b7bd";
CspParameters cspParams = new CspParameters(1, "Microsoft Base Cryptographic Provider v1.0");
PasswordDeriveBytes passwordDeriveBytes = new PasswordDeriveBytes(strPassword, (byte[])null, "MD5", 1, cspParams);
byte[] rgbIV = new byte[8];
byte[] numArray = passwordDeriveBytes.CryptDeriveKey("RC2", "MD5", 0, rgbIV);
RC2CryptoServiceProvider cryptoServiceProvider = new RC2CryptoServiceProvider();
cryptoServiceProvider.Key = numArray;
cryptoServiceProvider.IV = rgbIV;
byte[] bytes = new UnicodeEncoding().GetBytes(strMessage);
ICryptoTransform encryptor = cryptoServiceProvider.CreateEncryptor();
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(bytes, 0, bytes.Length);
cryptoStream.FlushFinalBlock();
byte[] array = memoryStream.ToArray();
cryptoStream.Close();
return this.ConvertToHex(array);
//CspParameters cspParams = new CspParameters(1, "Microsoft Base Cryptographic Provider v1.0");
//PasswordDeriveBytes passwordDeriveBytes = new PasswordDeriveBytes(strPassword, (byte[])null, "MD5", 1, cspParams);
//byte[] rgbIV = new byte[8];
//byte[] numArray = passwordDeriveBytes.CryptDeriveKey("RC2", "MD5", 0, rgbIV);
//RC2CryptoServiceProvider cryptoServiceProvider = new RC2CryptoServiceProvider();
//cryptoServiceProvider.Key = numArray;
//cryptoServiceProvider.IV = rgbIV;
//byte[] bytes = new UnicodeEncoding().GetBytes(strMessage);
//ICryptoTransform encryptor = cryptoServiceProvider.CreateEncryptor();
//MemoryStream memoryStream = new MemoryStream();
//CryptoStream cryptoStream = new CryptoStream((Stream)memoryStream, encryptor, CryptoStreamMode.Write);
//cryptoStream.Write(bytes, 0, bytes.Length);
//cryptoStream.FlushFinalBlock();
//byte[] array = memoryStream.ToArray();
//cryptoStream.Close();
//return this.ConvertToHex(array);
}

public string Decrypt(string strPassword, string strMessage)
Expand Down
3 changes: 2 additions & 1 deletion Utility/ServerConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public virtual bool Connect(string hostName, int portNo)
{
mTcpClient = null;
throw new Exception($"连接服务器:{Host} 端口{Port} 失败,{ex.Message}");
flag = false;

}

return flag;
Expand Down Expand Up @@ -560,6 +560,7 @@ protected virtual void LogDocument(string operation, string document)
}
catch (Exception ex)
{
LogHelper.Error<ServerConnection>(ex.Message);
}
}

Expand Down
12 changes: 6 additions & 6 deletions obj/InSiteXmlClient4Core.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">C:\Users\lidz\source\repos\FP.Mes\InSiteXmlClient4Core\obj\project.assets.json</ProjectAssetsFile>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\lidz\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Administrator\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.9.3</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.7.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="$([MSBuild]::EnsureTrailingSlash($(NuGetPackageFolders)))" />
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\build\netcoreapp2.2\Microsoft.NETCore.App.props" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\build\netcoreapp2.2\Microsoft.NETCore.App.props')" />
</ImportGroup>
</Project>
3 changes: 1 addition & 2 deletions obj/InSiteXmlClient4Core.csproj.nuget.g.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\build\netcoreapp2.2\Microsoft.NETCore.App.targets" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\build\netcoreapp2.2\Microsoft.NETCore.App.targets')" />
<Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
</ImportGroup>
</Project>
Loading

0 comments on commit fd19098

Please sign in to comment.