1. 修改配置文件不存在导致系统异常问题

2. 和服务联调,修正接口属性名称
3. 格式化代码
This commit is contained in:
hzhuangxin01 2019-02-26 16:49:11 +08:00
parent 23aedbc47a
commit 1ce879d762
11 changed files with 1236 additions and 1067 deletions

View File

@ -12,14 +12,14 @@
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
using IniParser;
using IniParser.Model;
using JetBrains.Annotations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Timers; using System.Timers;
using IniParser;
using IniParser.Model;
using JetBrains.Annotations;
namespace GeneratorCode.Configure namespace GeneratorCode.Configure
{ {
@ -28,6 +28,11 @@ namespace GeneratorCode.Configure
/// </summary> /// </summary>
public static class NConfig public static class NConfig
{ {
/// <summary>
/// Delegate ConfigChangedHandle
/// </summary>
public delegate void ConfigChangedHandle();
/// <summary> /// <summary>
/// The CFG file name /// The CFG file name
/// </summary> /// </summary>
@ -38,11 +43,6 @@ namespace GeneratorCode.Configure
/// </summary> /// </summary>
private static IniData _cfgData; private static IniData _cfgData;
/// <summary>
/// Delegate ConfigChangedHandle
/// </summary>
public delegate void ConfigChangedHandle();
/// <summary> /// <summary>
/// Occurs when [on configuration changed]. /// Occurs when [on configuration changed].
/// </summary> /// </summary>
@ -52,25 +52,24 @@ namespace GeneratorCode.Configure
/// Gets the CFG value. /// Gets the CFG value.
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="secName">Name of the sec.</param> /// <param name="segName">Name of the segment.</param>
/// <param name="keyName">Name of the key.</param> /// <param name="keyName">Name of the key.</param>
/// <param name="defValue">The definition value.</param> /// <param name="defValue">The definition value.</param>
/// <returns>T.</returns> /// <returns>T.</returns>
public static T GetCfgValue<T>([NotNull] string secName, [NotNull] string keyName, T defValue = default(T)) public static T GetCfgValue<T>([NotNull] string segName, [NotNull] string keyName, T defValue = default(T))
{ {
var ret = defValue; var ret = defValue;
if (_cfgData.Equals(null)) return ret; if (_cfgData.Equals(null)) return ret;
try try
{ {
ret = (T)Convert.ChangeType(_cfgData[secName][keyName], typeof(T)); ret = (T) Convert.ChangeType(_cfgData[segName][keyName], typeof(T));
} }
catch (Exception e) catch (Exception e)
{ {
Trace.WriteLine("[" + _cfgData[secName][keyName] + "] :" + e.Message); Trace.WriteLine("[" + _cfgData[segName][keyName] + "] :" + e.Message);
ret = defValue; ret = defValue;
throw e;
} }
return ret; return ret;
@ -90,12 +89,13 @@ namespace GeneratorCode.Configure
var fw = new FileSystemWatcher var fw = new FileSystemWatcher
{ {
NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite, NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite,
Filter = _cfgFileName, Filter = _cfgFileName,
Path = Path.GetDirectoryName(appPath), Path = Path.GetDirectoryName(appPath),
IncludeSubdirectories = false IncludeSubdirectories = false
}; };
fw.Changed += (sender, e) => fw.Changed += (sender, e) =>
{ {
if (Path.GetFileName(appPath) != _cfgFileName) return; if (Path.GetFileName(appPath) != _cfgFileName) return;
@ -107,7 +107,7 @@ namespace GeneratorCode.Configure
cfgTask.Add(e.FullPath); cfgTask.Add(e.FullPath);
} }
var tm = new Timer(1000) { AutoReset = false }; var tm = new Timer(1000) {AutoReset = false};
tm.Elapsed += (obj, args) => tm.Elapsed += (obj, args) =>
{ {
@ -152,7 +152,7 @@ namespace GeneratorCode.Configure
var iniPraser = new FileIniDataParser(); var iniPraser = new FileIniDataParser();
iniPraser.Parser.Configuration.CommentString = ";"; iniPraser.Parser.Configuration.CommentString = ";";
_cfgData = iniPraser.ReadFile(_cfgFileName); _cfgData = iniPraser.ReadFile(_cfgFileName);
//Trace.WriteLine(_cfgData); //Trace.WriteLine(_cfgData);
} }
catch (Exception e) catch (Exception e)

View File

@ -13,6 +13,21 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -70,59 +85,70 @@
<None Include="App.config" /> <None Include="App.config" />
<Content Include="Libs\itextsharp.dll" /> <Content Include="Libs\itextsharp.dll" />
<Content Include="OIDPublishImageGenerator\AppVersionType.ini"> <Content Include="OIDPublishImageGenerator\AppVersionType.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OID PG.ini"> <Content Include="OIDPublishImageGenerator\OID PG.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\oida.bin"> <Content Include="OIDPublishImageGenerator\oida.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDPatternGenerator.bin"> <Content Include="OIDPublishImageGenerator\OIDPatternGenerator.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="config.ini"> <Content Include="config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="OIDPublishImageGenerator\certifyforDll.dll"> <Content Include="OIDPublishImageGenerator\certifyforDll.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\libeay32.dll"> <Content Include="OIDPublishImageGenerator\libeay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDPatternGenerator.dll"> <Content Include="OIDPublishImageGenerator\OIDPatternGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDPDFFileGenerator.dll"> <Content Include="OIDPublishImageGenerator\OIDPDFFileGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDPGHelper.dll"> <Content Include="OIDPublishImageGenerator\OIDPGHelper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDPublishImageGenerator.dll"> <Content Include="OIDPublishImageGenerator\OIDPublishImageGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDScanConverter.dll"> <Content Include="OIDPublishImageGenerator\OIDScanConverter.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDTiffConvertor.dll"> <Content Include="OIDPublishImageGenerator\OIDTiffConvertor.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\OIDVectorDiagramGenerator.dll"> <Content Include="OIDPublishImageGenerator\OIDVectorDiagramGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\PDFReader.dll"> <Content Include="OIDPublishImageGenerator\PDFReader.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\PluginEntry.xml"> <Content Include="OIDPublishImageGenerator\PluginEntry.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OIDPublishImageGenerator\ssleay32.dll"> <Content Include="OIDPublishImageGenerator\ssleay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
// Created : 02-14-2019 // Created : 02-14-2019
// //
// Last Modified By : 黄昕 <hzhuangxin01@corp.netease.com> // Last Modified By : 黄昕 <hzhuangxin01@corp.netease.com>
// Last Modified On : 02-20-2019 // Last Modified On : 02-26-2019
// *********************************************************************** // ***********************************************************************
// <copyright file="MainCode.cs" company="NetEase"> // <copyright file="MainCode.cs" company="NetEase">
// Copyright © 2019 // Copyright © 2019
@ -28,20 +28,21 @@ namespace GeneratorCode
/// <summary> /// <summary>
/// Class GeneratorParams. /// Class GeneratorParams.
/// </summary> /// </summary>
[JsonObject(MemberSerialization.OptOut)]
public class GeneratorParams public class GeneratorParams
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GeneratorParams"/> class. /// Initializes a new instance of the <see cref="GeneratorParams" /> class.
/// </summary> /// </summary>
public GeneratorParams() public GeneratorParams()
{ {
dpi = new[] { 0, 0, 0, 0 }; dpi = new[] {0, 0, 0, 0};
point_type = new[] { 0, 0, 0, 0 }; pointType = new[] {0, 0, 0, 0};
image_type = new[] { false, false, false, true }; imageType = new[] {false, false, false, true};
StartPageID = 0; startPageId = 0;
key = "S0,O000,B0000,P000-255,D2018/12/31;CCAFBQMXYPOAOCIRK52S8QC8SO4A0AGA8Y"; key = "S0,O000,B0000,P000-255,D2018/12/31;CCAFBQMXYPOAOCIRK52S8QC8SO4A0AGA8Y";
filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf"; //filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf";
//filePath = "C:\\Works\\pdf\\123.pdf"; filePath = "C:\\Works\\pdf\\123.pdf";
sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191"; sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191";
} }
@ -52,16 +53,16 @@ namespace GeneratorCode
public int[] dpi { get; set; } public int[] dpi { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of the point. /// Gets or sets the file path.
/// </summary> /// </summary>
/// <value>The type of the point.</value> /// <value>The file path.</value>
public int[] point_type { get; set; } public string filePath { get; set; }
/// <summary> /// <summary>
/// Gets or sets the type of the image. /// Gets or sets the type of the image.
/// </summary> /// </summary>
/// <value>The type of the image.</value> /// <value>The type of the image.</value>
public bool[] image_type { get; set; } public bool[] imageType { get; set; }
/// <summary> /// <summary>
/// Gets or sets the key. /// Gets or sets the key.
@ -70,22 +71,23 @@ namespace GeneratorCode
public string key { get; set; } public string key { get; set; }
/// <summary> /// <summary>
/// Gets or sets the file path. /// Gets or sets the type of the point.
/// </summary> /// </summary>
/// <value>The file path.</value> /// <value>The type of the point.</value>
public string filePath { get; set; } public int[] pointType { get; set; }
/// <summary>
/// Gets or sets the start page identifier.
/// </summary>
/// <value>The start page identifier.</value>
public int StartPageID { get; set; }
/// <summary> /// <summary>
/// Gets or sets the session identifier. /// Gets or sets the session identifier.
/// </summary> /// </summary>
/// <value>The session identifier.</value> /// <value>The session identifier.</value>
[JsonIgnore]
public string sessionId { get; set; } public string sessionId { get; set; }
/// <summary>
/// Gets or sets the start page identifier.
/// </summary>
/// <value>The start page identifier.</value>
public int startPageId { get; set; }
} }
/// <summary> /// <summary>
@ -94,27 +96,27 @@ namespace GeneratorCode
public class GenerCodeRet public class GenerCodeRet
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GenerCodeRet"/> class. /// Initializes a new instance of the <see cref="GenerCodeRet" /> class.
/// </summary> /// </summary>
/// <param name="sId">The s identifier.</param> /// <param name="sId">The s identifier.</param>
/// <param name="prg">The PRG.</param> /// <param name="prg">The PRG.</param>
public GenerCodeRet(string sId, int prg) public GenerCodeRet(string sId, int prg)
{ {
sessionId = sId; sessionId = sId;
progress = prg; progress = prg;
} }
/// <summary>
/// Gets or sets the session identifier.
/// </summary>
/// <value>The session identifier.</value>
public string sessionId { get; set; }
/// <summary> /// <summary>
/// Gets or sets the progress. /// Gets or sets the progress.
/// </summary> /// </summary>
/// <value>The progress.</value> /// <value>The progress.</value>
public int progress { get; set; } public int progress { get; set; }
/// <summary>
/// Gets or sets the session identifier.
/// </summary>
/// <value>The session identifier.</value>
public string sessionId { get; set; }
} }
/// <summary> /// <summary>
@ -133,7 +135,7 @@ namespace GeneratorCode
private readonly object _cfgLock = new object(); private readonly object _cfgLock = new object();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="MainConfig"/> class. /// Initializes a new instance of the <see cref="MainConfig" /> class.
/// </summary> /// </summary>
public MainConfig() public MainConfig()
{ {
@ -146,30 +148,24 @@ namespace GeneratorCode
/// </summary> /// </summary>
/// <value><c>true</c> if [base64 MSG content]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [base64 MSG content]; otherwise, <c>false</c>.</value>
public bool Base64MsgContent { get; set; } public bool Base64MsgContent { get; set; }
/// <summary>
/// Gets or sets the server port.
/// </summary>
/// <value>The server port.</value>
public int ServerPort { get; set; }
/// <summary> /// <summary>
/// Gets or sets the server addr. /// Gets or sets the server addr.
/// </summary> /// </summary>
/// <value>The server addr.</value> /// <value>The server addr.</value>
public string ServerAddr { get; set; } public string ServerAddr { get; set; }
/// <summary>
/// Gets or sets the server port.
/// </summary>
/// <value>The server port.</value>
public int ServerPort { get; set; }
/// <summary> /// <summary>
/// Occurs when [on main CFG changed]. /// Occurs when [on main CFG changed].
/// </summary> /// </summary>
public static event MainCfgChangedHandle OnMainCfgChanged; public static event MainCfgChangedHandle OnMainCfgChanged;
/// <summary>
/// Mains the CFG changed.
/// </summary>
protected static void MainCfgChanged()
{
OnMainCfgChanged?.Invoke();
}
/// <summary> /// <summary>
/// Loads the configuration. /// Loads the configuration.
/// </summary> /// </summary>
@ -177,11 +173,19 @@ namespace GeneratorCode
{ {
lock (_cfgLock) lock (_cfgLock)
{ {
Base64MsgContent = NConfig.GetCfgValue("Main", "ProBase64Msg", true); Base64MsgContent = NConfig.GetCfgValue("Main", "ProBase64Msg", true);
ServerPort = NConfig.GetCfgValue("Main", "ProServerPort", 10088); ServerPort = NConfig.GetCfgValue("Main", "ProServerPort", 10088);
ServerAddr = NConfig.GetCfgValue("Main", "ProServerAddr", "127.0.0.1"); ServerAddr = NConfig.GetCfgValue("Main", "ProServerAddr", "127.0.0.1");
} }
} }
/// <summary>
/// Mains the CFG changed.
/// </summary>
protected static void MainCfgChanged()
{
OnMainCfgChanged?.Invoke();
}
} }
/// <summary> /// <summary>
@ -195,7 +199,7 @@ namespace GeneratorCode
private readonly UdpClient _udp = new UdpClient(); private readonly UdpClient _udp = new UdpClient();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="MessageProcess"/> class. /// Initializes a new instance of the <see cref="MessageProcess" /> class.
/// </summary> /// </summary>
/// <param name="cfg">The CFG.</param> /// <param name="cfg">The CFG.</param>
public MessageProcess(MainConfig cfg) public MessageProcess(MainConfig cfg)
@ -231,28 +235,34 @@ namespace GeneratorCode
public class RspMessage public class RspMessage
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="RspMessage"/> class. /// Initializes a new instance of the <see cref="RspMessage" /> class.
/// </summary> /// </summary>
/// <param name="sId">The s identifier.</param> /// <param name="sId">The s identifier.</param>
public RspMessage(string sId) public RspMessage(string sId)
{ {
err = 0; err = 0;
msg = ""; msg = "";
data = new GenerCodeRet(sId, 0); data = new GenerCodeRet(sId, 0);
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="RspMessage"/> class. /// Initializes a new instance of the <see cref="RspMessage" /> class.
/// </summary> /// </summary>
/// <param name="sId">The s identifier.</param> /// <param name="sId">The s identifier.</param>
/// <param name="prg">The PRG.</param> /// <param name="prg">The PRG.</param>
public RspMessage(string sId, int prg) public RspMessage(string sId, int prg)
{ {
err = 0; err = 0;
msg = ""; msg = "";
data = new GenerCodeRet(sId, prg); data = new GenerCodeRet(sId, prg);
} }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
public GenerCodeRet data { get; set; }
/// <summary> /// <summary>
/// Gets or sets the error. /// Gets or sets the error.
/// </summary> /// </summary>
@ -265,12 +275,6 @@ namespace GeneratorCode
/// <value>The MSG.</value> /// <value>The MSG.</value>
public string msg { get; set; } public string msg { get; set; }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
public GenerCodeRet data { get; set; }
/// <summary> /// <summary>
/// Formats the RSP message. /// Formats the RSP message.
/// </summary> /// </summary>
@ -308,10 +312,10 @@ namespace GeneratorCode
NConfig.InitConfigure(); NConfig.InitConfigure();
NLog.NLog_Init(); NLog.NLog_Init();
GeneratorParams inParams = null; GeneratorParams inParams = null;
RspMessage rspMsg; RspMessage rspMsg;
var mainCfg = new MainConfig(); var mainCfg = new MainConfig();
var msgProcess = new MessageProcess(mainCfg); var msgProcess = new MessageProcess(mainCfg);
var tmObj = new TmatrixClass(); var tmObj = new TmatrixClass();
AppDomain.CurrentDomain.UnhandledException += (sender, e) => AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{ {
@ -352,15 +356,15 @@ namespace GeneratorCode
{ {
if (args.Length == 1) if (args.Length == 1)
{ {
var deCode = Convert.FromBase64String(args[0]); var deCode = Convert.FromBase64String(args[0]);
var strParams = Encoding.Default.GetString(deCode); var strParams = Encoding.Default.GetString(deCode);
inParams = JsonConvert.DeserializeObject<GeneratorParams>(strParams); inParams = JsonConvert.DeserializeObject<GeneratorParams>(strParams);
} }
else if (args.Length == 2) else if (args.Length == 2)
{ {
var deCode = Convert.FromBase64String(args[1]); var deCode = Convert.FromBase64String(args[1]);
var strParams = Encoding.Default.GetString(deCode); var strParams = Encoding.Default.GetString(deCode);
inParams = JsonConvert.DeserializeObject<GeneratorParams>(strParams); inParams = JsonConvert.DeserializeObject<GeneratorParams>(strParams);
inParams.sessionId = args[0]; inParams.sessionId = args[0];
} }
else else
@ -374,11 +378,8 @@ namespace GeneratorCode
var msg = rspMsg.FormatRspMessage(10, e.Message, 0, mainCfg.Base64MsgContent); var msg = rspMsg.FormatRspMessage(10, e.Message, 0, mainCfg.Base64MsgContent);
msgProcess.SendMessage(msg); msgProcess.SendMessage(msg);
if (inParams != null) if (inParams != null) NLog.Crash(string.Format("[{0}]: ", inParams.sessionId) + e.Message);
{
NLog.Crash(string.Format("[{0}]: ", inParams.sessionId) + e.Message);
}
return -(int) ErrCode.ErrJsonDecode; return -(int) ErrCode.ErrJsonDecode;
} }
@ -396,7 +397,7 @@ namespace GeneratorCode
var jsInput = JsonConvert.SerializeObject(inParams); var jsInput = JsonConvert.SerializeObject(inParams);
NLog.Debug("Input:" + jsInput + Environment.NewLine); NLog.Debug("Input:" + jsInput + Environment.NewLine);
if (!File.Exists(inParams.filePath)) if (!File.Exists(inParams.filePath))
{ {
NLog.Error("File Not Exists: " + inParams.filePath + Environment.NewLine); NLog.Error("File Not Exists: " + inParams.filePath + Environment.NewLine);
@ -418,8 +419,8 @@ namespace GeneratorCode
try try
{ {
var ret = tmObj.GenerateTmatrixCode_OID4(inParams.key, var ret = tmObj.GenerateTmatrixCode_OID4(inParams.key,
inParams.filePath, inParams.StartPageID, inParams.point_type, inParams.filePath, inParams.startPageId, inParams.pointType,
inParams.image_type, inParams.dpi); inParams.imageType, inParams.dpi);
if (ret.Substring(0, 1) != "0") if (ret.Substring(0, 1) != "0")
{ {
@ -461,18 +462,21 @@ namespace GeneratorCode
/// The error input parameters /// The error input parameters
/// </summary> /// </summary>
ErrInputParams = 1, ErrInputParams = 1,
/// <summary> /// <summary>
/// The error file notexists /// The error file notexists
/// </summary> /// </summary>
ErrFileNotexists, ErrFileNotexists,
/// <summary> /// <summary>
/// The error except throw /// The error except throw
/// </summary> /// </summary>
ErrExceptThrow, ErrExceptThrow,
/// <summary> /// <summary>
/// The error json decode /// The error json decode
/// </summary> /// </summary>
ErrJsonDecode ErrJsonDecode
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace JetBrains.Annotations
/// <example> /// <example>
/// <code> /// <code>
/// [CanBeNull] object Test() => null; /// [CanBeNull] object Test() => null;
/// ///
/// void UseTest() { /// void UseTest() {
/// var p = Test(); /// var p = Test();
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
@ -105,7 +105,7 @@ namespace JetBrains.Annotations
/// <code> /// <code>
/// [StringFormatMethod("message")] /// [StringFormatMethod("message")]
/// void ShowError(string message, params object[] args) { /* do something */ } /// void ShowError(string message, params object[] args) { /* do something */ }
/// ///
/// void Foo() { /// void Foo() {
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
/// } /// }
@ -191,12 +191,12 @@ namespace JetBrains.Annotations
/// <code> /// <code>
/// public class Foo : INotifyPropertyChanged { /// public class Foo : INotifyPropertyChanged {
/// public event PropertyChangedEventHandler PropertyChanged; /// public event PropertyChangedEventHandler PropertyChanged;
/// ///
/// [NotifyPropertyChangedInvocator] /// [NotifyPropertyChangedInvocator]
/// protected virtual void NotifyChanged(string propertyName) { ... } /// protected virtual void NotifyChanged(string propertyName) { ... }
/// ///
/// string _name; /// string _name;
/// ///
/// public string Name { /// public string Name {
/// get { return _name; } /// get { return _name; }
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ } /// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
@ -279,7 +279,7 @@ namespace JetBrains.Annotations
/// // A method that returns null if the parameter is null, /// // A method that returns null if the parameter is null,
/// // and not null if the parameter is not null /// // and not null if the parameter is not null
/// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")] /// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")]
/// public object Transform(object data) /// public object Transform(object data)
/// </code> /// </code>
/// </item> /// </item>
/// <item> /// <item>
@ -345,7 +345,7 @@ namespace JetBrains.Annotations
/// <code> /// <code>
/// [CannotApplyEqualityOperator] /// [CannotApplyEqualityOperator]
/// class NoEquality { } /// class NoEquality { }
/// ///
/// class UsesNoEquality { /// class UsesNoEquality {
/// void Test() { /// void Test() {
/// var ca1 = new NoEquality(); /// var ca1 = new NoEquality();
@ -370,7 +370,7 @@ namespace JetBrains.Annotations
/// <code> /// <code>
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
/// class ComponentAttribute : Attribute { } /// class ComponentAttribute : Attribute { }
/// ///
/// [Component] // ComponentAttribute requires implementing IComponent interface /// [Component] // ComponentAttribute requires implementing IComponent interface
/// class MyComponent : IComponent { } /// class MyComponent : IComponent { }
/// </code> /// </code>
@ -527,7 +527,7 @@ namespace JetBrains.Annotations
/// <example> /// <example>
/// <code> /// <code>
/// [Pure] int Multiply(int x, int y) => x * y; /// [Pure] int Multiply(int x, int y) => x * y;
/// ///
/// void M() { /// void M() {
/// Multiply(123, 42); // Waring: Return value of pure method is not used /// Multiply(123, 42); // Waring: Return value of pure method is not used
/// } /// }
@ -565,7 +565,7 @@ namespace JetBrains.Annotations
/// <code> /// <code>
/// class Foo { /// class Foo {
/// [ProvidesContext] IBarService _barService = ...; /// [ProvidesContext] IBarService _barService = ...;
/// ///
/// void ProcessNode(INode node) { /// void ProcessNode(INode node) {
/// DoSomething(node, node.GetGlobalServices().Bar); /// DoSomething(node, node.GetGlobalServices().Bar);
/// // ^ Warning: use value of '_barService' field /// // ^ Warning: use value of '_barService' field
@ -1245,4 +1245,4 @@ namespace JetBrains.Annotations
internal sealed class RazorWriteMethodParameterAttribute : Attribute internal sealed class RazorWriteMethodParameterAttribute : Attribute
{ {
} }
} }

View File

@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0c720c54-d779-4204-b529-81360c796b32")] [assembly: Guid("0c720c54-d779-4204-b529-81360c796b32")]
// 程序集的版本信息由下列四个值组成: // 程序集的版本信息由下列四个值组成:
// //
// 主版本 // 主版本
// 次版本 // 次版本
@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”: : // 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -24,14 +24,17 @@ namespace OIDModule.Generator
/// The e bb state ok /// The e bb state ok
/// </summary> /// </summary>
eBBState_OK, eBBState_OK,
/// <summary> /// <summary>
/// The e bb state image file not exist /// The e bb state image file not exist
/// </summary> /// </summary>
eBBState_ImageFileNotExist, eBBState_ImageFileNotExist,
/// <summary> /// <summary>
/// The e bb state fail to open image file /// The e bb state fail to open image file
/// </summary> /// </summary>
eBBState_FailToOpenImageFile, eBBState_FailToOpenImageFile,
/// <summary> /// <summary>
/// The e bb state unknown /// The e bb state unknown
/// </summary> /// </summary>
@ -47,10 +50,12 @@ namespace OIDModule.Generator
/// The e oid print point type 2X2 /// The e oid print point type 2X2
/// </summary> /// </summary>
eOID_PrintPointType_2x2, eOID_PrintPointType_2x2,
/// <summary> /// <summary>
/// The e oid print point type 3X3 /// The e oid print point type 3X3
/// </summary> /// </summary>
eOID_PrintPointType_3x3, eOID_PrintPointType_3x3,
/// <summary> /// <summary>
/// The e oid print point type 4X4 /// The e oid print point type 4X4
/// </summary> /// </summary>
@ -66,6 +71,7 @@ namespace OIDModule.Generator
/// The e oid publish image dpi 600 /// The e oid publish image dpi 600
/// </summary> /// </summary>
eOID_PublishImageDPI_600, eOID_PublishImageDPI_600,
/// <summary> /// <summary>
/// The e oid publish image dpi 1200 /// The e oid publish image dpi 1200
/// </summary> /// </summary>
@ -81,14 +87,17 @@ namespace OIDModule.Generator
/// The e oid pit publish image /// The e oid pit publish image
/// </summary> /// </summary>
eOID_PIT_Publish_Image, eOID_PIT_Publish_Image,
/// <summary> /// <summary>
/// The e oid pit vertor image /// The e oid pit vertor image
/// </summary> /// </summary>
eOID_PIT_Vertor_Image, eOID_PIT_Vertor_Image,
/// <summary> /// <summary>
/// The e oid pit bg vertor image /// The e oid pit bg vertor image
/// </summary> /// </summary>
eOID_PIT_BG_Vertor_Image, eOID_PIT_BG_Vertor_Image,
/// <summary> /// <summary>
/// The e oid pit publish bg image /// The e oid pit publish bg image
/// </summary> /// </summary>
@ -104,6 +113,7 @@ namespace OIDModule.Generator
/// The e oid ot element code /// The e oid ot element code
/// </summary> /// </summary>
eOID_OT_ElementCode, eOID_OT_ElementCode,
/// <summary> /// <summary>
/// The e oid ot position code /// The e oid ot position code
/// </summary> /// </summary>
@ -191,6 +201,37 @@ namespace OIDModule.Generator
return OID_PIG_Initialize(); return OID_PIG_Initialize();
} }
/// <summary>
/// Sets the publish pages.
/// </summary>
/// <param name="arPageNumbers">The ar page numbers.</param>
/// <param name="nPageCount">The n page count.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetPublishPages(int[] arPageNumbers, int nPageCount)
{
return OID_PIG_SetPublishPages(arPageNumbers, nPageCount);
}
/// <summary>
/// Sets the start position.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="nXStart">The n x start.</param>
/// <param name="nYStart">The n y start.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetStartPosition(int nPageIndex, int nXStart, int nYStart)
{
return OID_PIG_SetStartPosition(nPageIndex, nXStart, nYStart);
}
/// <summary>
/// Uninitializes this instance.
/// </summary>
public void Uninitialize()
{
OID_PIG_Uninitialize();
}
/// <summary> /// <summary>
/// Oids the pig add object information. /// Oids the pig add object information.
/// </summary> /// </summary>
@ -288,36 +329,5 @@ namespace OIDModule.Generator
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention = [DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)] CallingConvention.StdCall)]
private static extern void OID_PIG_Uninitialize(); private static extern void OID_PIG_Uninitialize();
/// <summary>
/// Sets the publish pages.
/// </summary>
/// <param name="arPageNumbers">The ar page numbers.</param>
/// <param name="nPageCount">The n page count.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetPublishPages(int[] arPageNumbers, int nPageCount)
{
return OID_PIG_SetPublishPages(arPageNumbers, nPageCount);
}
/// <summary>
/// Sets the start position.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="nXStart">The n x start.</param>
/// <param name="nYStart">The n y start.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetStartPosition(int nPageIndex, int nXStart, int nYStart)
{
return OID_PIG_SetStartPosition(nPageIndex, nXStart, nYStart);
}
/// <summary>
/// Uninitializes this instance.
/// </summary>
public void Uninitialize()
{
OID_PIG_Uninitialize();
}
} }
} }

View File

@ -11,12 +11,12 @@
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
using iTextSharp.text.pdf;
using OIDModule.Generator;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using iTextSharp.text.pdf;
using OIDModule.Generator;
namespace TmatrixLibrary namespace TmatrixLibrary
{ {
@ -25,222 +25,152 @@ namespace TmatrixLibrary
/// </summary> /// </summary>
public class TmatrixClass public class TmatrixClass
{ {
/// <summary>
/// Delegate ProgressChangedEvent
/// </summary>
/// <param name="step">The step.</param>
public delegate void ProgressChangedEvent(int step);
/// <summary> /// <summary>
/// The default dpi /// The default dpi
/// </summary> /// </summary>
private readonly int Default_DPI = 300; private readonly int Default_DPI = 300;
/// <summary>
/// The g bid
/// </summary>
private int gBID;
/// <summary>
/// The gb key validate
/// </summary>
private bool gbKeyValidate;
/// <summary>
/// The g current page index
/// </summary>
private int gCurPageIndex;
/// <summary>
/// The g current page identifier
/// </summary>
private int gCurrentPageID;
/// <summary>
/// The g oid
/// </summary>
private int gOID;
/// <summary>
/// The g page number
/// </summary>
private int gPageNum;
/// <summary>
/// The g pi d1
/// </summary>
private int gPID1;
/// <summary>
/// The g pi d2
/// </summary>
private int gPID2;
/// <summary>
/// The g point type
/// </summary>
private string gPointType = "";
/// <summary>
/// The gs bid
/// </summary>
private string gsBID;
/// <summary>
/// The gs expiration
/// </summary>
private string gsExpiration;
/// <summary>
/// The g sid
/// </summary>
private int gSID;
/// <summary>
/// The gs oid
/// </summary>
private string gsOID;
/// <summary>
/// The gs pi d1
/// </summary>
private string gsPID1;
/// <summary>
/// The gs pi d2
/// </summary>
private string gsPID2;
/// <summary> /// <summary>
/// The gs point dpi /// The gs point dpi
/// </summary> /// </summary>
private readonly string[] gsPointDPI = new string[4]; private readonly string[] gsPointDPI = new string[4];
/// <summary> /// <summary>
/// The gs point type /// The gs point type
/// </summary> /// </summary>
private readonly string[] gsPointType = new string[4]; private readonly string[] gsPointType = new string[4];
/// <summary>
/// The gs sid
/// </summary>
private string gsSID;
/// <summary>
/// The gs size
/// </summary>
private string gsSize;
/// <summary>
/// The g step
/// </summary>
private int gStep;
/// <summary>
/// The g total page identifier
/// </summary>
private int gTotalPageID;
/// <summary> /// <summary>
/// The g tpdfbgi name /// The g tpdfbgi name
/// </summary> /// </summary>
private readonly string[] gTPDFBGIName = new string[0x100]; private readonly string[] gTPDFBGIName = new string[0x100];
/// <summary> /// <summary>
/// The g TPDF name /// The g TPDF name
/// </summary> /// </summary>
private readonly string[] gTPDFName = new string[0x100]; private readonly string[] gTPDFName = new string[0x100];
/// <summary> /// <summary>
/// The g tpdfvi name /// The g tpdfvi name
/// </summary> /// </summary>
private readonly string[] gTPDFVIName = new string[0x100]; private readonly string[] gTPDFVIName = new string[0x100];
/// <summary> /// <summary>
/// The g tpdfwovi name /// The g tpdfwovi name
/// </summary> /// </summary>
private readonly string[] gTPDFWOVIName = new string[0x100]; private readonly string[] gTPDFWOVIName = new string[0x100];
/// <summary> /// <summary>
/// The oid pi generator /// The oid pi generator
/// </summary> /// </summary>
private readonly OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator(); private readonly OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator();
/// <summary> /// <summary>
/// Gets the progerss. /// The g bid
/// </summary> /// </summary>
/// <returns>System.Int32.</returns> private int gBID;
public int GetProgerss()
{
return gStep;
}
/// <summary> /// <summary>
/// Sets the progress. /// The gb key validate
/// </summary>
private bool gbKeyValidate;
/// <summary>
/// The g current page index
/// </summary>
private int gCurPageIndex;
/// <summary>
/// The g current page identifier
/// </summary>
private int gCurrentPageID;
/// <summary>
/// The g oid
/// </summary>
private int gOID;
/// <summary>
/// The g page number
/// </summary>
private int gPageNum;
/// <summary>
/// The g pi d1
/// </summary>
private int gPID1;
/// <summary>
/// The g pi d2
/// </summary>
private int gPID2;
/// <summary>
/// The g point type
/// </summary>
private string gPointType = "";
/// <summary>
/// The gs bid
/// </summary>
private string gsBID;
/// <summary>
/// The gs expiration
/// </summary>
private string gsExpiration;
/// <summary>
/// The g sid
/// </summary>
private int gSID;
/// <summary>
/// The gs oid
/// </summary>
private string gsOID;
/// <summary>
/// The gs pi d1
/// </summary>
private string gsPID1;
/// <summary>
/// The gs pi d2
/// </summary>
private string gsPID2;
/// <summary>
/// The gs sid
/// </summary>
private string gsSID;
/// <summary>
/// The gs size
/// </summary>
private string gsSize;
/// <summary>
/// The g step
/// </summary>
private int gStep;
/// <summary>
/// The g total page identifier
/// </summary>
private int gTotalPageID;
/// <summary>
/// Delegate ProgressChangedEvent
/// </summary> /// </summary>
/// <param name="step">The step.</param> /// <param name="step">The step.</param>
public void SetProgress(int step) public delegate void ProgressChangedEvent(int step);
{
if (gStep != step)
{
gStep = step;
OnProgressChanged(gStep);
}
}
/// <summary> /// <summary>
/// Occurs when [progress change]. /// Occurs when [progress change].
/// </summary> /// </summary>
public event ProgressChangedEvent ProgressChange; public event ProgressChangedEvent ProgressChange;
/// <summary>
/// Called when [progress changed].
/// </summary>
/// <param name="step">The step.</param>
protected virtual void OnProgressChanged(int step)
{
if (ProgressChange != null)
ProgressChange(step);
else
ProgressChange(-1);
}
/// <summary>
/// Determines whether [is key validate].
/// </summary>
/// <returns><c>true</c> if [is key validate]; otherwise, <c>false</c>.</returns>
private bool IsKeyValidate()
{
return gbKeyValidate;
}
/// <summary>
/// Checks the expiration validate.
/// </summary>
/// <param name="dstr">The DSTR.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool CheckExpirationValidate(string dstr)
{
var strArray = dstr.Substring(1, dstr.Length - 1).Split('/');
var num = int.Parse(strArray[0]);
var num2 = int.Parse(strArray[1]);
var num3 = int.Parse(strArray[2]);
var today = DateTime.Today;
var year = today.Year;
var month = today.Month;
var day = today.Day;
return year <= num ? year != num || (month <= num2 ? month != num2 || day <= num3 : false) : false;
}
/// <summary>
/// Checks the state of the oid build.
/// </summary>
/// <param name="eBeginBuildState">State of the e begin build.</param>
/// <returns>System.String.</returns>
private string CheckOidBuildState(OIDBeginBuildState eBeginBuildState)
{
switch (eBeginBuildState)
{
case OIDBeginBuildState.eBBState_ImageFileNotExist:
//MessageBox.Show();
return "eBBState_ImageFileNotExist";
case OIDBeginBuildState.eBBState_FailToOpenImageFile:
//MessageBox.Show("eBBState_FailToOpenImageFile");
return "eBBState_FailToOpenImageFile";
case OIDBeginBuildState.eBBState_Unknown:
//MessageBox.Show("eBBState_Unknown");
return "eBBState_Unknown";
}
return "";
}
/// <summary>
/// Called when [progress percent].
/// </summary>
/// <param name="msg">The MSG.</param>
/// <returns>System.String.</returns>
public string OnProgressPercent(string msg)
{
return msg;
}
/// <summary> /// <summary>
/// Decodes the license tmatrix key. /// Decodes the license tmatrix key.
/// </summary> /// </summary>
@ -258,15 +188,15 @@ namespace TmatrixLibrary
for (var i = 0L; i < length; i += 1L) for (var i = 0L; i < length; i += 1L)
{ {
long num3 = Convert.ToByte(chArray[(int) (IntPtr) i]); long num3 = Convert.ToByte(chArray[(int)(IntPtr)i]);
if (i > 1L) num4 = Convert.ToByte(chArray[(int) (IntPtr) (length + 1 - i)]); if (i > 1L) num4 = Convert.ToByte(chArray[(int)(IntPtr)(length + 1 - i)]);
num3 = ((num3 * 2L + num5 * 2L + num4) * (i + num5) + num5 * i - 12) % 0x24; num3 = ((num3 * 2L + num5 * 2L + num4) * (i + num5) + num5 * i - 12) % 0x24;
if (num3 < 0L || num3 > 9) if (num3 < 0L || num3 > 9)
chArray2[(int) (IntPtr) i] = Convert.ToChar(num3 + 0x37); chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x37);
else else
chArray2[(int) (IntPtr) i] = Convert.ToChar(num3 + 0x30); chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x30);
num5 = num3 * num3 * i; num5 = num3 * num3 * i;
str = str + chArray2[(int) (IntPtr) i]; str = str + chArray2[(int)(IntPtr)i];
} }
return str; return str;
@ -342,7 +272,7 @@ namespace TmatrixLibrary
var str4 = sPath + @"\BA_Im_.tif"; var str4 = sPath + @"\BA_Im_.tif";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0); (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateVImage || bGenerateImage)) if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateVImage || bGenerateImage))
@ -406,8 +336,8 @@ namespace TmatrixLibrary
break; break;
} }
var num22 = (uint) (dWidth * 75.0 / 25.4); var num22 = (uint)(dWidth * 75.0 / 25.4);
var num23 = (uint) (dHeight * 75.0 / 25.4); var num23 = (uint)(dHeight * 75.0 / 25.4);
var gSID = this.gSID; var gSID = this.gSID;
switch (gSID) switch (gSID)
@ -533,7 +463,7 @@ namespace TmatrixLibrary
var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf"; var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -595,8 +525,8 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename); var image = Image.FromFile(filename);
var num21 = (uint) (image.Width + 0x48); var num21 = (uint)(image.Width + 0x48);
var num22 = (uint) (image.Height + 0x48); var num22 = (uint)(image.Height + 0x48);
image.Dispose(); image.Dispose();
var numArray3 = new uint[5]; var numArray3 = new uint[5];
numArray3[1] = 0x1372; numArray3[1] = 0x1372;
@ -662,7 +592,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -817,7 +747,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -894,11 +824,11 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename); var image = Image.FromFile(filename);
var width = (uint) image.Width; var width = (uint)image.Width;
var height = (uint) image.Height; var height = (uint)image.Height;
image.Dispose(); image.Dispose();
var num16 = (uint) (width * 25.4 / Default_DPI); var num16 = (uint)(width * 25.4 / Default_DPI);
var num17 = (uint) (height * 25.4 / Default_DPI); var num17 = (uint)(height * 25.4 / Default_DPI);
width += 0x48; width += 0x48;
height += 0x48; height += 0x48;
var gSID = this.gSID; var gSID = this.gSID;
@ -982,7 +912,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -1191,7 +1121,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
SetProgress(10); SetProgress(10);
@ -1262,11 +1192,11 @@ namespace TmatrixLibrary
imgFile.Add(filename); imgFile.Add(filename);
var horizontalResolution = image.HorizontalResolution; var horizontalResolution = image.HorizontalResolution;
var verticalResolution = image.VerticalResolution; var verticalResolution = image.VerticalResolution;
var width = (uint) image.Width; var width = (uint)image.Width;
var height = (uint) image.Height; var height = (uint)image.Height;
image.Dispose(); image.Dispose();
var num16 = (uint) (width * 25.4 / Default_DPI); var num16 = (uint)(width * 25.4 / Default_DPI);
var num17 = (uint) (height * 25.4 / Default_DPI); var num17 = (uint)(height * 25.4 / Default_DPI);
width += 0x48; width += 0x48;
height += 0x48; height += 0x48;
var gSID = this.gSID; var gSID = this.gSID;
@ -1350,7 +1280,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -1517,7 +1447,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -1596,10 +1526,10 @@ namespace TmatrixLibrary
var nObjectType = 0; var nObjectType = 0;
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename); var image = Image.FromFile(filename);
var width = (uint) image.Width; var width = (uint)image.Width;
image.Dispose(); image.Dispose();
width += 0x48; width += 0x48;
var num23 = (uint) (image.Height + 0x48); var num23 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5]; var numArray3 = new uint[5];
numArray3[1] = 0x1372; numArray3[1] = 0x1372;
numArray3[2] = 0x1372; numArray3[2] = 0x1372;
@ -1690,7 +1620,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -1886,7 +1816,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -1950,10 +1880,10 @@ namespace TmatrixLibrary
var nObjectType = 0; var nObjectType = 0;
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename); var image = Image.FromFile(filename);
var width = (uint) image.Width; var width = (uint)image.Width;
image.Dispose(); image.Dispose();
width += 0x48; width += 0x48;
var num24 = (uint) (image.Height + 0x48); var num24 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5]; var numArray3 = new uint[5];
numArray3[1] = 0x1372; numArray3[1] = 0x1372;
numArray3[2] = 0x1372; numArray3[2] = 0x1372;
@ -2044,7 +1974,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK; eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -2185,7 +2115,7 @@ namespace TmatrixLibrary
var str3 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf"; var str3 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK; var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState = eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage, (OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI); Default_DPI);
CheckOidBuildState(eBeginBuildState); CheckOidBuildState(eBeginBuildState);
@ -2253,10 +2183,10 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png"; var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename); var image = Image.FromFile(filename);
var width = (uint) image.Width; var width = (uint)image.Width;
image.Dispose(); image.Dispose();
width += 0x48; width += 0x48;
var num22 = (uint) (image.Height + 0x48); var num22 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5]; var numArray3 = new uint[5];
numArray3[1] = 0x1372; numArray3[1] = 0x1372;
numArray3[2] = 0x1372; numArray3[2] = 0x1372;
@ -2325,6 +2255,250 @@ namespace TmatrixLibrary
return obj.NumberOfPages; return obj.NumberOfPages;
} }
/// <summary>
/// Gets the progerss.
/// </summary>
/// <returns>System.Int32.</returns>
public int GetProgerss()
{
return gStep;
}
/// <summary>
/// Called when [progress percent].
/// </summary>
/// <param name="msg">The MSG.</param>
/// <returns>System.String.</returns>
public string OnProgressPercent(string msg)
{
return msg;
}
/// <summary>
/// Sets the progress.
/// </summary>
/// <param name="step">The step.</param>
public void SetProgress(int step)
{
if (gStep != step)
{
gStep = step;
OnProgressChanged(gStep);
}
}
/// <summary>
/// Tmatrixes the initialize.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool TmatrixInitialize()
{
return oidPIGenerator.Initialize();
}
/// <summary>
/// Tmatrixes the key check.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck(string sKey)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 4) return "1 It might be Old key file format, please use new key file !";
if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O") return "1Element Key has not supported yet !";
gsSize = strArray2[0];
gsBID = strArray2[1].Substring(1, 2);
gsPID1 = strArray2[2].Substring(1, 3);
gsPID2 = strArray2[2].Substring(5, 3);
gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <param name="type">The type.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck(string sKey, int type)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 4) return "1Old key file format, please use new key file !";
if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !";
gsSize = strArray2[0];
gsBID = strArray2[1].Substring(1, 2);
gsPID1 = strArray2[2].Substring(1, 3);
gsPID2 = strArray2[2].Substring(5, 3);
gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check oi d4.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck_OID4(string sKey)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 5) return "2It might be old key file format, please use OID4 key file !";
if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4]))
{
//return "3Key is expired!";
}
gsSID = strArray2[0].Substring(1, 1);
gsOID = strArray2[1].Substring(1, 3);
gsBID = strArray2[2].Substring(1, 4);
gsPID1 = strArray2[3].Substring(1, 3);
gsPID2 = strArray2[3].Substring(5, 3);
gSID = int.Parse(gsSID);
gOID = int.Parse(gsOID);
gBID = int.Parse(gsBID);
gPID1 = int.Parse(gsPID1);
gPID2 = int.Parse(gsPID2);
gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check oi d4.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <param name="type">The type.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck_OID4(string sKey, int type)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 5) return "1Old key file format, please use new key file !";
if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !";
if (type != 0x63)
{
gsSID = strArray2[0].Substring(1, 1);
gsOID = strArray2[1].Substring(1, 3);
gsBID = strArray2[2].Substring(1, 4);
gsPID1 = strArray2[3].Substring(1, 3);
gsPID2 = strArray2[3].Substring(5, 3);
gSID = int.Parse(gsSID);
gOID = int.Parse(gsOID);
gBID = int.Parse(gsBID);
gPID1 = int.Parse(gsPID1);
gPID2 = int.Parse(gsPID2);
gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1);
gbKeyValidate = true;
}
return "0";
}
/// <summary>
/// Tmatrixes the uninitialize.
/// </summary>
public void TmatrixUninitialize()
{
oidPIGenerator.Uninitialize();
}
/// <summary>
/// Called when [progress changed].
/// </summary>
/// <param name="step">The step.</param>
protected virtual void OnProgressChanged(int step)
{
if (ProgressChange != null)
ProgressChange(step);
else
ProgressChange(-1);
}
/// <summary>
/// Checks the expiration validate.
/// </summary>
/// <param name="dstr">The DSTR.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool CheckExpirationValidate(string dstr)
{
var strArray = dstr.Substring(1, dstr.Length - 1).Split('/');
var num = int.Parse(strArray[0]);
var num2 = int.Parse(strArray[1]);
var num3 = int.Parse(strArray[2]);
var today = DateTime.Today;
var year = today.Year;
var month = today.Month;
var day = today.Day;
return year <= num ? year != num || (month <= num2 ? month != num2 || day <= num3 : false) : false;
}
/// <summary>
/// Checks the state of the oid build.
/// </summary>
/// <param name="eBeginBuildState">State of the e begin build.</param>
/// <returns>System.String.</returns>
private string CheckOidBuildState(OIDBeginBuildState eBeginBuildState)
{
switch (eBeginBuildState)
{
case OIDBeginBuildState.eBBState_ImageFileNotExist:
//MessageBox.Show();
return "eBBState_ImageFileNotExist";
case OIDBeginBuildState.eBBState_FailToOpenImageFile:
//MessageBox.Show("eBBState_FailToOpenImageFile");
return "eBBState_FailToOpenImageFile";
case OIDBeginBuildState.eBBState_Unknown:
//MessageBox.Show("eBBState_Unknown");
return "eBBState_Unknown";
}
return "";
}
/// <summary>
/// Determines whether [is key validate].
/// </summary>
/// <returns><c>true</c> if [is key validate]; otherwise, <c>false</c>.</returns>
private bool IsKeyValidate()
{
return gbKeyValidate;
}
/// <summary> /// <summary>
/// Renames the big area tmatrix PDF oi d4. /// Renames the big area tmatrix PDF oi d4.
/// </summary> /// </summary>
@ -3719,153 +3893,5 @@ namespace TmatrixLibrary
} }
} }
} }
/// <summary>
/// Tmatrixes the initialize.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool TmatrixInitialize()
{
return oidPIGenerator.Initialize();
}
/// <summary>
/// Tmatrixes the key check.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck(string sKey)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 4) return "1 It might be Old key file format, please use new key file !";
if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O") return "1Element Key has not supported yet !";
gsSize = strArray2[0];
gsBID = strArray2[1].Substring(1, 2);
gsPID1 = strArray2[2].Substring(1, 3);
gsPID2 = strArray2[2].Substring(5, 3);
gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <param name="type">The type.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck(string sKey, int type)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 4) return "1Old key file format, please use new key file !";
if (strArray2[3].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[3]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !";
gsSize = strArray2[0];
gsBID = strArray2[1].Substring(1, 2);
gsPID1 = strArray2[2].Substring(1, 3);
gsPID2 = strArray2[2].Substring(5, 3);
gsExpiration = strArray2[3].Substring(1, strArray2[3].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check oi d4.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck_OID4(string sKey)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 5) return "2It might be old key file format, please use OID4 key file !";
if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4]))
{
//return "3Key is expired!";
}
gsSID = strArray2[0].Substring(1, 1);
gsOID = strArray2[1].Substring(1, 3);
gsBID = strArray2[2].Substring(1, 4);
gsPID1 = strArray2[3].Substring(1, 3);
gsPID2 = strArray2[3].Substring(5, 3);
gSID = int.Parse(gsSID);
gOID = int.Parse(gsOID);
gBID = int.Parse(gsBID);
gPID1 = int.Parse(gsPID1);
gPID2 = int.Parse(gsPID2);
gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1);
gTotalPageID = int.Parse(gsBID) * 0x100;
gbKeyValidate = true;
return "0";
}
/// <summary>
/// Tmatrixes the key check oi d4.
/// </summary>
/// <param name="sKey">The s key.</param>
/// <param name="type">The type.</param>
/// <returns>System.String.</returns>
public string TmatrixKeyCheck_OID4(string sKey, int type)
{
gbKeyValidate = false;
var strArray = sKey.Split(';');
if (DecodeLicense_TmatrixKey(strArray[0]) != strArray[1])
return "1Key is not correct, it should be modified !";
var strArray2 = strArray[0].Split(',');
if (strArray2.Length < 5) return "1Old key file format, please use new key file !";
if (strArray2[4].Substring(1, 4) != "0000" && !CheckExpirationValidate(strArray2[4]))
return "1Key is expired !";
if (strArray2[1].Substring(0, 1) == "O" && type == 0) return "1Element Key has not supported yet !";
if (type != 0x63)
{
gsSID = strArray2[0].Substring(1, 1);
gsOID = strArray2[1].Substring(1, 3);
gsBID = strArray2[2].Substring(1, 4);
gsPID1 = strArray2[3].Substring(1, 3);
gsPID2 = strArray2[3].Substring(5, 3);
gSID = int.Parse(gsSID);
gOID = int.Parse(gsOID);
gBID = int.Parse(gsBID);
gPID1 = int.Parse(gsPID1);
gPID2 = int.Parse(gsPID2);
gsExpiration = strArray2[4].Substring(1, strArray2[4].Length - 1);
gbKeyValidate = true;
}
return "0";
}
/// <summary>
/// Tmatrixes the uninitialize.
/// </summary>
public void TmatrixUninitialize()
{
oidPIGenerator.Uninitialize();
}
} }
} }

View File

@ -26,7 +26,7 @@ AsyncMode = true
; 是否在每条日志后加入换行 ; 是否在每条日志后加入换行
AutoForceNewLine = false AutoForceNewLine = false
; 是否自动清理日志 ; 是否自动清理日志
AutoCleanup = true AutoCleanup = false
; 日志输出格式控制 ; 日志输出格式控制
[LogFormat] [LogFormat]
@ -53,9 +53,9 @@ Console = true
; 是否允许在 Visual Studio 调试器中输出(Release 版本), 默认 false ; 是否允许在 Visual Studio 调试器中输出(Release 版本), 默认 false
Trace = true Trace = true
; 是否允许在 Visual Studio 调试器中输出(Debug 版本), 默认 false ; 是否允许在 Visual Studio 调试器中输出(Debug 版本), 默认 false
Debug = true Debug = false
; 是否允许在文件中输出, 默认 false ; 是否允许在文件中输出, 默认 false
File = true File = false
; 异步输出模式配置 ; 异步输出模式配置
[AsyncLogSetting] [AsyncLogSetting]

View File

@ -8,13 +8,25 @@ EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C720C54-D779-4204-B529-81360C796B32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C720C54-D779-4204-B529-81360C796B32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C720C54-D779-4204-B529-81360C796B32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Debug|x64.ActiveCfg = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Debug|x64.Build.0 = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Debug|x86.ActiveCfg = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Debug|x86.Build.0 = Debug|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C720C54-D779-4204-B529-81360C796B32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|Any CPU.Build.0 = Release|Any CPU {0C720C54-D779-4204-B529-81360C796B32}.Release|Any CPU.Build.0 = Release|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|x64.ActiveCfg = Release|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|x64.Build.0 = Release|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|x86.ActiveCfg = Release|Any CPU
{0C720C54-D779-4204-B529-81360C796B32}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE