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>
// ***********************************************************************
using IniParser;
using IniParser.Model;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Timers;
using IniParser;
using IniParser.Model;
using JetBrains.Annotations;
namespace GeneratorCode.Configure
{
@ -28,6 +28,11 @@ namespace GeneratorCode.Configure
/// </summary>
public static class NConfig
{
/// <summary>
/// Delegate ConfigChangedHandle
/// </summary>
public delegate void ConfigChangedHandle();
/// <summary>
/// The CFG file name
/// </summary>
@ -38,11 +43,6 @@ namespace GeneratorCode.Configure
/// </summary>
private static IniData _cfgData;
/// <summary>
/// Delegate ConfigChangedHandle
/// </summary>
public delegate void ConfigChangedHandle();
/// <summary>
/// Occurs when [on configuration changed].
/// </summary>
@ -52,11 +52,11 @@ namespace GeneratorCode.Configure
/// Gets the CFG value.
/// </summary>
/// <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="defValue">The definition value.</param>
/// <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;
@ -64,13 +64,12 @@ namespace GeneratorCode.Configure
try
{
ret = (T)Convert.ChangeType(_cfgData[secName][keyName], typeof(T));
ret = (T) Convert.ChangeType(_cfgData[segName][keyName], typeof(T));
}
catch (Exception e)
{
Trace.WriteLine("[" + _cfgData[secName][keyName] + "] :" + e.Message);
Trace.WriteLine("[" + _cfgData[segName][keyName] + "] :" + e.Message);
ret = defValue;
throw e;
}
return ret;
@ -96,6 +95,7 @@ namespace GeneratorCode.Configure
IncludeSubdirectories = false
};
fw.Changed += (sender, e) =>
{
if (Path.GetFileName(appPath) != _cfgFileName) return;
@ -107,7 +107,7 @@ namespace GeneratorCode.Configure
cfgTask.Add(e.FullPath);
}
var tm = new Timer(1000) { AutoReset = false };
var tm = new Timer(1000) {AutoReset = false};
tm.Elapsed += (obj, args) =>
{

View File

@ -13,6 +13,21 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<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 Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -70,59 +85,70 @@
<None Include="App.config" />
<Content Include="Libs\itextsharp.dll" />
<Content Include="OIDPublishImageGenerator\AppVersionType.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OID PG.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\oida.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDPatternGenerator.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
</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>
<Content Include="OIDPublishImageGenerator\certifyforDll.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\libeay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDPatternGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDPDFFileGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDPGHelper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDPublishImageGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDScanConverter.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDTiffConvertor.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\OIDVectorDiagramGenerator.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\PDFReader.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\PluginEntry.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="OIDPublishImageGenerator\ssleay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<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
//
// 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 © 2019
@ -28,20 +28,21 @@ namespace GeneratorCode
/// <summary>
/// Class GeneratorParams.
/// </summary>
[JsonObject(MemberSerialization.OptOut)]
public class GeneratorParams
{
/// <summary>
/// Initializes a new instance of the <see cref="GeneratorParams"/> class.
/// Initializes a new instance of the <see cref="GeneratorParams" /> class.
/// </summary>
public GeneratorParams()
{
dpi = new[] { 0, 0, 0, 0 };
point_type = new[] { 0, 0, 0, 0 };
image_type = new[] { false, false, false, true };
StartPageID = 0;
dpi = new[] {0, 0, 0, 0};
pointType = new[] {0, 0, 0, 0};
imageType = new[] {false, false, false, true};
startPageId = 0;
key = "S0,O000,B0000,P000-255,D2018/12/31;CCAFBQMXYPOAOCIRK52S8QC8SO4A0AGA8Y";
filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf";
//filePath = "C:\\Works\\pdf\\123.pdf";
//filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf";
filePath = "C:\\Works\\pdf\\123.pdf";
sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191";
}
@ -52,16 +53,16 @@ namespace GeneratorCode
public int[] dpi { get; set; }
/// <summary>
/// Gets or sets the type of the point.
/// Gets or sets the file path.
/// </summary>
/// <value>The type of the point.</value>
public int[] point_type { get; set; }
/// <value>The file path.</value>
public string filePath { get; set; }
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
public bool[] image_type { get; set; }
public bool[] imageType { get; set; }
/// <summary>
/// Gets or sets the key.
@ -70,22 +71,23 @@ namespace GeneratorCode
public string key { get; set; }
/// <summary>
/// Gets or sets the file path.
/// Gets or sets the type of the point.
/// </summary>
/// <value>The file path.</value>
public string filePath { get; set; }
/// <summary>
/// Gets or sets the start page identifier.
/// </summary>
/// <value>The start page identifier.</value>
public int StartPageID { get; set; }
/// <value>The type of the point.</value>
public int[] pointType { get; set; }
/// <summary>
/// Gets or sets the session identifier.
/// </summary>
/// <value>The session identifier.</value>
[JsonIgnore]
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>
@ -94,7 +96,7 @@ namespace GeneratorCode
public class GenerCodeRet
{
/// <summary>
/// Initializes a new instance of the <see cref="GenerCodeRet"/> class.
/// Initializes a new instance of the <see cref="GenerCodeRet" /> class.
/// </summary>
/// <param name="sId">The s identifier.</param>
/// <param name="prg">The PRG.</param>
@ -104,17 +106,17 @@ namespace GeneratorCode
progress = prg;
}
/// <summary>
/// Gets or sets the session identifier.
/// </summary>
/// <value>The session identifier.</value>
public string sessionId { get; set; }
/// <summary>
/// Gets or sets the progress.
/// </summary>
/// <value>The progress.</value>
public int progress { get; set; }
/// <summary>
/// Gets or sets the session identifier.
/// </summary>
/// <value>The session identifier.</value>
public string sessionId { get; set; }
}
/// <summary>
@ -133,7 +135,7 @@ namespace GeneratorCode
private readonly object _cfgLock = new object();
/// <summary>
/// Initializes a new instance of the <see cref="MainConfig"/> class.
/// Initializes a new instance of the <see cref="MainConfig" /> class.
/// </summary>
public MainConfig()
{
@ -146,30 +148,24 @@ namespace GeneratorCode
/// </summary>
/// <value><c>true</c> if [base64 MSG content]; otherwise, <c>false</c>.</value>
public bool Base64MsgContent { get; set; }
/// <summary>
/// Gets or sets the server port.
/// </summary>
/// <value>The server port.</value>
public int ServerPort { get; set; }
/// <summary>
/// Gets or sets the server addr.
/// </summary>
/// <value>The server addr.</value>
public string ServerAddr { get; set; }
/// <summary>
/// Gets or sets the server port.
/// </summary>
/// <value>The server port.</value>
public int ServerPort { get; set; }
/// <summary>
/// Occurs when [on main CFG changed].
/// </summary>
public static event MainCfgChangedHandle OnMainCfgChanged;
/// <summary>
/// Mains the CFG changed.
/// </summary>
protected static void MainCfgChanged()
{
OnMainCfgChanged?.Invoke();
}
/// <summary>
/// Loads the configuration.
/// </summary>
@ -182,6 +178,14 @@ namespace GeneratorCode
ServerAddr = NConfig.GetCfgValue("Main", "ProServerAddr", "127.0.0.1");
}
}
/// <summary>
/// Mains the CFG changed.
/// </summary>
protected static void MainCfgChanged()
{
OnMainCfgChanged?.Invoke();
}
}
/// <summary>
@ -195,7 +199,7 @@ namespace GeneratorCode
private readonly UdpClient _udp = new UdpClient();
/// <summary>
/// Initializes a new instance of the <see cref="MessageProcess"/> class.
/// Initializes a new instance of the <see cref="MessageProcess" /> class.
/// </summary>
/// <param name="cfg">The CFG.</param>
public MessageProcess(MainConfig cfg)
@ -231,7 +235,7 @@ namespace GeneratorCode
public class RspMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="RspMessage"/> class.
/// Initializes a new instance of the <see cref="RspMessage" /> class.
/// </summary>
/// <param name="sId">The s identifier.</param>
public RspMessage(string sId)
@ -242,7 +246,7 @@ namespace GeneratorCode
}
/// <summary>
/// Initializes a new instance of the <see cref="RspMessage"/> class.
/// Initializes a new instance of the <see cref="RspMessage" /> class.
/// </summary>
/// <param name="sId">The s identifier.</param>
/// <param name="prg">The PRG.</param>
@ -253,6 +257,12 @@ namespace GeneratorCode
data = new GenerCodeRet(sId, prg);
}
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
public GenerCodeRet data { get; set; }
/// <summary>
/// Gets or sets the error.
/// </summary>
@ -265,12 +275,6 @@ namespace GeneratorCode
/// <value>The MSG.</value>
public string msg { get; set; }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
public GenerCodeRet data { get; set; }
/// <summary>
/// Formats the RSP message.
/// </summary>
@ -374,10 +378,7 @@ namespace GeneratorCode
var msg = rspMsg.FormatRspMessage(10, e.Message, 0, mainCfg.Base64MsgContent);
msgProcess.SendMessage(msg);
if (inParams != null)
{
NLog.Crash(string.Format("[{0}]: ", inParams.sessionId) + e.Message);
}
if (inParams != null) NLog.Crash(string.Format("[{0}]: ", inParams.sessionId) + e.Message);
return -(int) ErrCode.ErrJsonDecode;
}
@ -418,8 +419,8 @@ namespace GeneratorCode
try
{
var ret = tmObj.GenerateTmatrixCode_OID4(inParams.key,
inParams.filePath, inParams.StartPageID, inParams.point_type,
inParams.image_type, inParams.dpi);
inParams.filePath, inParams.startPageId, inParams.pointType,
inParams.imageType, inParams.dpi);
if (ret.Substring(0, 1) != "0")
{
@ -461,14 +462,17 @@ namespace GeneratorCode
/// The error input parameters
/// </summary>
ErrInputParams = 1,
/// <summary>
/// The error file notexists
/// </summary>
ErrFileNotexists,
/// <summary>
/// The error except throw
/// </summary>
ErrExceptThrow,
/// <summary>
/// The error json decode
/// </summary>

View File

@ -24,14 +24,17 @@ namespace OIDModule.Generator
/// The e bb state ok
/// </summary>
eBBState_OK,
/// <summary>
/// The e bb state image file not exist
/// </summary>
eBBState_ImageFileNotExist,
/// <summary>
/// The e bb state fail to open image file
/// </summary>
eBBState_FailToOpenImageFile,
/// <summary>
/// The e bb state unknown
/// </summary>
@ -47,10 +50,12 @@ namespace OIDModule.Generator
/// The e oid print point type 2X2
/// </summary>
eOID_PrintPointType_2x2,
/// <summary>
/// The e oid print point type 3X3
/// </summary>
eOID_PrintPointType_3x3,
/// <summary>
/// The e oid print point type 4X4
/// </summary>
@ -66,6 +71,7 @@ namespace OIDModule.Generator
/// The e oid publish image dpi 600
/// </summary>
eOID_PublishImageDPI_600,
/// <summary>
/// The e oid publish image dpi 1200
/// </summary>
@ -81,14 +87,17 @@ namespace OIDModule.Generator
/// The e oid pit publish image
/// </summary>
eOID_PIT_Publish_Image,
/// <summary>
/// The e oid pit vertor image
/// </summary>
eOID_PIT_Vertor_Image,
/// <summary>
/// The e oid pit bg vertor image
/// </summary>
eOID_PIT_BG_Vertor_Image,
/// <summary>
/// The e oid pit publish bg image
/// </summary>
@ -104,6 +113,7 @@ namespace OIDModule.Generator
/// The e oid ot element code
/// </summary>
eOID_OT_ElementCode,
/// <summary>
/// The e oid ot position code
/// </summary>
@ -191,6 +201,37 @@ namespace OIDModule.Generator
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>
/// Oids the pig add object information.
/// </summary>
@ -288,36 +329,5 @@ namespace OIDModule.Generator
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
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>
// <summary></summary>
// ***********************************************************************
using iTextSharp.text.pdf;
using OIDModule.Generator;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using iTextSharp.text.pdf;
using OIDModule.Generator;
namespace TmatrixLibrary
{
@ -25,222 +25,152 @@ namespace TmatrixLibrary
/// </summary>
public class TmatrixClass
{
/// <summary>
/// Delegate ProgressChangedEvent
/// </summary>
/// <param name="step">The step.</param>
public delegate void ProgressChangedEvent(int step);
/// <summary>
/// The default dpi
/// </summary>
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>
/// The gs point dpi
/// </summary>
private readonly string[] gsPointDPI = new string[4];
/// <summary>
/// The gs point type
/// </summary>
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>
/// The g tpdfbgi name
/// </summary>
private readonly string[] gTPDFBGIName = new string[0x100];
/// <summary>
/// The g TPDF name
/// </summary>
private readonly string[] gTPDFName = new string[0x100];
/// <summary>
/// The g tpdfvi name
/// </summary>
private readonly string[] gTPDFVIName = new string[0x100];
/// <summary>
/// The g tpdfwovi name
/// </summary>
private readonly string[] gTPDFWOVIName = new string[0x100];
/// <summary>
/// The oid pi generator
/// </summary>
private readonly OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator();
/// <summary>
/// Gets the progerss.
/// The g bid
/// </summary>
/// <returns>System.Int32.</returns>
public int GetProgerss()
{
return gStep;
}
private int gBID;
/// <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>
/// <param name="step">The step.</param>
public void SetProgress(int step)
{
if (gStep != step)
{
gStep = step;
OnProgressChanged(gStep);
}
}
public delegate void ProgressChangedEvent(int step);
/// <summary>
/// Occurs when [progress change].
/// </summary>
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>
/// Decodes the license tmatrix key.
/// </summary>
@ -258,15 +188,15 @@ namespace TmatrixLibrary
for (var i = 0L; i < length; i += 1L)
{
long num3 = Convert.ToByte(chArray[(int) (IntPtr) i]);
if (i > 1L) num4 = Convert.ToByte(chArray[(int) (IntPtr) (length + 1 - i)]);
long num3 = Convert.ToByte(chArray[(int)(IntPtr)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;
if (num3 < 0L || num3 > 9)
chArray2[(int) (IntPtr) i] = Convert.ToChar(num3 + 0x37);
chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x37);
else
chArray2[(int) (IntPtr) i] = Convert.ToChar(num3 + 0x30);
chArray2[(int)(IntPtr)i] = Convert.ToChar(num3 + 0x30);
num5 = num3 * num3 * i;
str = str + chArray2[(int) (IntPtr) i];
str = str + chArray2[(int)(IntPtr)i];
}
return str;
@ -342,7 +272,7 @@ namespace TmatrixLibrary
var str4 = sPath + @"\BA_Im_.tif";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0);
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImageByInfo(dWidth / 10.0, dHeight / 10.0);
CheckOidBuildState(eBeginBuildState);
if (eBeginBuildState == OIDBeginBuildState.eBBState_OK && (bGenerateVImage || bGenerateImage))
@ -406,8 +336,8 @@ namespace TmatrixLibrary
break;
}
var num22 = (uint) (dWidth * 75.0 / 25.4);
var num23 = (uint) (dHeight * 75.0 / 25.4);
var num22 = (uint)(dWidth * 75.0 / 25.4);
var num23 = (uint)(dHeight * 75.0 / 25.4);
var gSID = this.gSID;
switch (gSID)
@ -533,7 +463,7 @@ namespace TmatrixLibrary
var str5 = str2.Substring(0, str2.Length - 4) + "_WOVI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -595,8 +525,8 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename);
var num21 = (uint) (image.Width + 0x48);
var num22 = (uint) (image.Height + 0x48);
var num21 = (uint)(image.Width + 0x48);
var num22 = (uint)(image.Height + 0x48);
image.Dispose();
var numArray3 = new uint[5];
numArray3[1] = 0x1372;
@ -662,7 +592,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -817,7 +747,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -894,11 +824,11 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename);
var width = (uint) image.Width;
var height = (uint) image.Height;
var width = (uint)image.Width;
var height = (uint)image.Height;
image.Dispose();
var num16 = (uint) (width * 25.4 / Default_DPI);
var num17 = (uint) (height * 25.4 / Default_DPI);
var num16 = (uint)(width * 25.4 / Default_DPI);
var num17 = (uint)(height * 25.4 / Default_DPI);
width += 0x48;
height += 0x48;
var gSID = this.gSID;
@ -982,7 +912,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -1191,7 +1121,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
SetProgress(10);
@ -1262,11 +1192,11 @@ namespace TmatrixLibrary
imgFile.Add(filename);
var horizontalResolution = image.HorizontalResolution;
var verticalResolution = image.VerticalResolution;
var width = (uint) image.Width;
var height = (uint) image.Height;
var width = (uint)image.Width;
var height = (uint)image.Height;
image.Dispose();
var num16 = (uint) (width * 25.4 / Default_DPI);
var num17 = (uint) (height * 25.4 / Default_DPI);
var num16 = (uint)(width * 25.4 / Default_DPI);
var num17 = (uint)(height * 25.4 / Default_DPI);
width += 0x48;
height += 0x48;
var gSID = this.gSID;
@ -1350,7 +1280,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -1517,7 +1447,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -1596,10 +1526,10 @@ namespace TmatrixLibrary
var nObjectType = 0;
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename);
var width = (uint) image.Width;
var width = (uint)image.Width;
image.Dispose();
width += 0x48;
var num23 = (uint) (image.Height + 0x48);
var num23 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5];
numArray3[1] = 0x1372;
numArray3[2] = 0x1372;
@ -1690,7 +1620,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -1886,7 +1816,7 @@ namespace TmatrixLibrary
var str6 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -1950,10 +1880,10 @@ namespace TmatrixLibrary
var nObjectType = 0;
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename);
var width = (uint) image.Width;
var width = (uint)image.Width;
image.Dispose();
width += 0x48;
var num24 = (uint) (image.Height + 0x48);
var num24 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5];
numArray3[1] = 0x1372;
numArray3[2] = 0x1372;
@ -2044,7 +1974,7 @@ namespace TmatrixLibrary
eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -2185,7 +2115,7 @@ namespace TmatrixLibrary
var str3 = str2.Substring(0, str2.Length - 4) + "_BGI_.pdf";
var eBeginBuildState = OIDBeginBuildState.eBBState_OK;
eBeginBuildState =
(OIDBeginBuildState) oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
(OIDBeginBuildState)oidPIGenerator.BeginBuildPublishImage(str2.ToCharArray(), bExportPDFImage,
Default_DPI);
CheckOidBuildState(eBeginBuildState);
@ -2253,10 +2183,10 @@ namespace TmatrixLibrary
var filename = str2.Substring(0, str2.Length - 4) + "_Page" + nPageIndex + ".png";
var image = Image.FromFile(filename);
var width = (uint) image.Width;
var width = (uint)image.Width;
image.Dispose();
width += 0x48;
var num22 = (uint) (image.Height + 0x48);
var num22 = (uint)(image.Height + 0x48);
var numArray3 = new uint[5];
numArray3[1] = 0x1372;
numArray3[2] = 0x1372;
@ -2325,6 +2255,250 @@ namespace TmatrixLibrary
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>
/// Renames the big area tmatrix PDF oi d4.
/// </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
; 是否自动清理日志
AutoCleanup = true
AutoCleanup = false
; 日志输出格式控制
[LogFormat]
@ -53,9 +53,9 @@ Console = true
; 是否允许在 Visual Studio 调试器中输出(Release 版本), 默认 false
Trace = true
; 是否允许在 Visual Studio 调试器中输出(Debug 版本), 默认 false
Debug = true
Debug = false
; 是否允许在文件中输出, 默认 false
File = true
File = false
; 异步输出模式配置
[AsyncLogSetting]

View File

@ -8,13 +8,25 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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|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.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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE