diff --git a/GeneratorCode/Configure/NConfig.cs b/GeneratorCode/Configure/NConfig.cs
index b1a5e87..33e696a 100644
--- a/GeneratorCode/Configure/NConfig.cs
+++ b/GeneratorCode/Configure/NConfig.cs
@@ -12,14 +12,14 @@
//
// ***********************************************************************
-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
///
public static class NConfig
{
+ ///
+ /// Delegate ConfigChangedHandle
+ ///
+ public delegate void ConfigChangedHandle();
+
///
/// The CFG file name
///
@@ -38,11 +43,6 @@ namespace GeneratorCode.Configure
///
private static IniData _cfgData;
- ///
- /// Delegate ConfigChangedHandle
- ///
- public delegate void ConfigChangedHandle();
-
///
/// Occurs when [on configuration changed].
///
@@ -52,25 +52,24 @@ namespace GeneratorCode.Configure
/// Gets the CFG value.
///
///
- /// Name of the sec.
+ /// Name of the segment.
/// Name of the key.
/// The definition value.
/// T.
- public static T GetCfgValue([NotNull] string secName, [NotNull] string keyName, T defValue = default(T))
+ public static T GetCfgValue([NotNull] string segName, [NotNull] string keyName, T defValue = default(T))
{
var ret = defValue;
if (_cfgData.Equals(null)) return ret;
-
+
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;
@@ -90,12 +89,13 @@ namespace GeneratorCode.Configure
var fw = new FileSystemWatcher
{
- NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite,
- Filter = _cfgFileName,
- Path = Path.GetDirectoryName(appPath),
+ NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite,
+ Filter = _cfgFileName,
+ Path = Path.GetDirectoryName(appPath),
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) =>
{
@@ -152,7 +152,7 @@ namespace GeneratorCode.Configure
var iniPraser = new FileIniDataParser();
iniPraser.Parser.Configuration.CommentString = ";";
- _cfgData = iniPraser.ReadFile(_cfgFileName);
+ _cfgData = iniPraser.ReadFile(_cfgFileName);
//Trace.WriteLine(_cfgData);
}
catch (Exception e)
diff --git a/GeneratorCode/GeneratorCode.csproj b/GeneratorCode/GeneratorCode.csproj
index 3de6985..a7afb06 100644
--- a/GeneratorCode/GeneratorCode.csproj
+++ b/GeneratorCode/GeneratorCode.csproj
@@ -13,6 +13,21 @@
true
true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
AnyCPU
@@ -70,59 +85,70 @@
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
PreserveNewest
-
+
+
+ False
+ Microsoft .NET Framework 4.6.1 %28x86 和 x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
- PreserveNewest
+ Always
diff --git a/GeneratorCode/GeneratorCode.csproj.user b/GeneratorCode/GeneratorCode.csproj.user
new file mode 100644
index 0000000..2c7a9c0
--- /dev/null
+++ b/GeneratorCode/GeneratorCode.csproj.user
@@ -0,0 +1,13 @@
+
+
+
+ publish\
+
+
+
+
+
+ zh-CN
+ false
+
+
\ No newline at end of file
diff --git a/GeneratorCode/Logs/NLog.cs b/GeneratorCode/Logs/NLog.cs
index 338b7e3..a1879ef 100644
--- a/GeneratorCode/Logs/NLog.cs
+++ b/GeneratorCode/Logs/NLog.cs
@@ -11,6 +11,7 @@
//
//
// ***********************************************************************
+
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -28,464 +29,132 @@ using Timer = System.Timers.Timer;
namespace GeneratorCode.Logs
{
///
- /// Enum NLogLevel
- ///
- public enum NLogLevel
- {
- ///
- /// The fatal
- ///
- Fatal = 0,
- ///
- /// The crash
- ///
- Crash,
- ///
- /// The error
- ///
- Error,
- ///
- /// The warring
- ///
- Warring,
- ///
- /// The information
- ///
- Info,
- ///
- /// The debug
- ///
- Debug,
- ///
- /// The maximum level
- ///
- MaxLevel
- }
-
- ///
- /// Enum CacheOptMode
+ /// Enum CacheOptMode
///
public enum CacheOptMode
{
///
- /// The drop
+ /// The drop
///
Drop = 0,
+
///
- /// The replease
+ /// The replease
///
Replease
}
///
- /// Class NLogConfig.
+ /// Enum NLogLevel
///
- public class NLogConfig
+ public enum NLogLevel
{
///
- /// Delegate LogCfgChangedHandle
+ /// The fatal
///
- public delegate void LogCfgChangedHandle();
+ Fatal = 0,
///
- /// The CFG lock
+ /// The crash
///
- private readonly object _cfgLock = new object();
+ Crash,
///
- /// Initializes a new instance of the class.
+ /// The error
///
- public NLogConfig()
- {
- LogConfig();
- NConfig.OnConfigChanged += () => { LogCfgChanged(); };
- }
+ Error,
///
- /// Gets or sets a value indicating whether [log enable].
+ /// The warring
///
- /// true if [log enable]; otherwise, false.
- public bool LogEnable { get; set; }
- ///
- /// Gets or sets the log level.
- ///
- /// The log level.
- public NLogLevel LogLevel { get; set; }
- ///
- /// Gets or sets the default level.
- ///
- /// The default level.
- public NLogLevel DefaultLevel { get; set; }
- ///
- /// Gets or sets a value indicating whether [asynchronous mode].
- ///
- /// true if [asynchronous mode]; otherwise, false.
- public bool AsyncMode { get; set; }
- ///
- /// Gets or sets a value indicating whether [force new line].
- ///
- /// true if [force new line]; otherwise, false.
- public bool ForceNewLine { get; set; }
- ///
- /// Gets or sets a value indicating whether [automatic cleanup].
- ///
- /// true if [automatic cleanup]; otherwise, false.
- public bool AutoCleanup { get; set; }
+ Warring,
///
- /// Gets or sets a value indicating whether [show date].
+ /// The information
///
- /// true if [show date]; otherwise, false.
- public bool ShowDate { get; set; }
- ///
- /// Gets or sets a value indicating whether [show time].
- ///
- /// true if [show time]; otherwise, false.
- public bool ShowTime { get; set; }
- ///
- /// Gets or sets a value indicating whether [show m sec].
- ///
- /// true if [show m sec]; otherwise, false.
- public bool ShowMSec { get; set; }
- ///
- /// Gets or sets a value indicating whether [show level].
- ///
- /// true if [show level]; otherwise, false.
- public bool ShowLevel { get; set; }
- ///
- /// Gets or sets a value indicating whether [show code file].
- ///
- /// true if [show code file]; otherwise, false.
- public bool ShowCodeFile { get; set; }
- ///
- /// Gets or sets a value indicating whether [show function].
- ///
- /// true if [show function]; otherwise, false.
- public bool ShowFunction { get; set; }
- ///
- /// Gets or sets a value indicating whether [show code line].
- ///
- /// true if [show code line]; otherwise, false.
- public bool ShowCodeLine { get; set; }
+ Info,
///
- /// Gets or sets a value indicating whether [en console].
+ /// The debug
///
- /// true if [en console]; otherwise, false.
- public bool EnConsole { get; set; }
- ///
- /// Gets or sets a value indicating whether [en trace].
- ///
- /// true if [en trace]; otherwise, false.
- public bool EnTrace { get; set; }
- ///
- /// Gets or sets a value indicating whether [en debug].
- ///
- /// true if [en debug]; otherwise, false.
- public bool EnDebug { get; set; }
- ///
- /// Gets or sets a value indicating whether [en file].
- ///
- /// true if [en file]; otherwise, false.
- public bool EnFile { get; set; }
-
+ Debug,
///
- /// Gets or sets the maximum items cache.
+ /// The maximum level
///
- /// The maximum items cache.
- public int MaxItemsCache { get; set; }
- ///
- /// Gets or sets the cache mode.
- ///
- /// The cache mode.
- public CacheOptMode CacheMode { get; set; }
- ///
- /// Gets or sets the sleep time.
- ///
- /// The sleep time.
- public int SleepTime { get; set; }
- ///
- /// Gets or sets the number out items.
- ///
- /// The number out items.
- public int NumOutItems { get; set; }
-
- ///
- /// Gets or sets the dir path.
- ///
- /// The dir path.
- public string DirPath { get; set; }
- ///
- /// Gets or sets the file name pre.
- ///
- /// The file name pre.
- public string FileNamePre { get; set; }
- ///
- /// Gets or sets a value indicating whether [en split log].
- ///
- /// true if [en split log]; otherwise, false.
- public bool EnSplitLog { get; set; }
- ///
- /// Gets or sets a value indicating whether [split by data].
- ///
- /// true if [split by data]; otherwise, false.
- public bool SplitByData { get; set; }
- ///
- /// Gets or sets the size of the split by.
- ///
- /// The size of the split by.
- public int SplitBySize { get; set; }
- ///
- /// Gets or sets a value indicating whether [roolback file].
- ///
- /// true if [roolback file]; otherwise, false.
- public bool RoolbackFile { get; set; }
- ///
- /// Gets or sets the maximum file number.
- ///
- /// The maximum file number.
- public int MaxFileNum { get; set; }
-
- ///
- /// Gets or sets the keep days.
- ///
- /// The keep days.
- public int KeepDays { get; set; }
- ///
- /// Gets or sets the backup days.
- ///
- /// The backup days.
- public int BackupDays { get; set; }
-
- ///
- /// Occurs when [on log CFG changed].
- ///
- public static event LogCfgChangedHandle OnLogCfgChanged;
-
- ///
- /// Logs the CFG changed.
- ///
- protected static void LogCfgChanged()
- {
- OnLogCfgChanged?.Invoke();
- }
-
- ///
- /// Logs the configuration.
- ///
- public void LogConfig()
- {
- lock (_cfgLock)
- {
- LogEnable = NConfig.GetCfgValue("LogGlobal", "LogEnable", false);
- LogLevel = (NLogLevel) NConfig.GetCfgValue("LogGlobal", "LogLevel", (int) NLogLevel.MaxLevel);
- DefaultLevel = (NLogLevel) NConfig.GetCfgValue("LogGlobal", "DefaultLogLevel", (int) NLogLevel.Info);
- AsyncMode = NConfig.GetCfgValue("LogGlobal", "AsyncMode", false);
- ForceNewLine = NConfig.GetCfgValue("LogGlobal", "AutoForceNewLine", false);
- AutoCleanup = NConfig.GetCfgValue("LogGlobal", "AutoCleanup", true);
-
- ShowDate = NConfig.GetCfgValue("LogFormat", "ShowDate", true);
- ShowTime = NConfig.GetCfgValue("LogFormat", "ShowTime", true);
- ShowMSec = NConfig.GetCfgValue("LogFormat", "ShowMSec", true);
- ShowLevel = NConfig.GetCfgValue("LogFormat", "ShowLevel", true);
- ShowCodeFile = NConfig.GetCfgValue("LogFormat", "ShowCodeFile", true);
- ShowFunction = NConfig.GetCfgValue("LogFormat", "ShowFunction", true);
- ShowCodeLine = NConfig.GetCfgValue("LogFormat", "ShowCodeLine", true);
-
- EnConsole = NConfig.GetCfgValue("LogOutput", "Console", true);
- EnTrace = NConfig.GetCfgValue("LogOutput", "Trace", false);
- EnDebug = NConfig.GetCfgValue("LogOutput", "Debug", true);
- EnFile = NConfig.GetCfgValue("LogOutput", "File", false);
-
- if (AsyncMode)
- {
- MaxItemsCache = NConfig.GetCfgValue("AsyncLogSetting", "MaxItemsCache", 0);
-
- if (MaxItemsCache == 0) MaxItemsCache = int.MaxValue;
-
- CacheMode = (CacheOptMode) NConfig.GetCfgValue("AsyncLogSetting", "CacheFullOpts",
- (int) CacheOptMode.Drop);
- NumOutItems = NConfig.GetCfgValue("AsyncLogSetting", "NumItemsOutEachTime", 10);
- }
-
- SleepTime = NConfig.GetCfgValue("AsyncLogSetting", "ThreadSleep", 10);
-
- if (EnFile)
- {
- DirPath = NConfig.GetCfgValue("FileLogSetting", "Path", @"");
-
- if (DirPath == "" || !Directory.Exists(DirPath) || DirPath == @".\")
- DirPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\";
-
- if (!Directory.Exists(DirPath)) Directory.CreateDirectory(DirPath);
-
- if (!DirPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
- DirPath += Path.DirectorySeparatorChar;
-
- FileNamePre = NConfig.GetCfgValue("FileLogSetting", "FileNamePrefix", "");
- EnSplitLog = NConfig.GetCfgValue("FileLogSetting", "AutoSplitFile", true);
-
- if (EnSplitLog)
- {
- SplitByData = NConfig.GetCfgValue("SplitFiles", "SplitByDate", true);
- SplitBySize = NConfig.GetCfgValue("SplitFiles", "SplitBySize", 4);
- RoolbackFile = NConfig.GetCfgValue("SplitFiles", "FileNameRollback", true);
- MaxFileNum = NConfig.GetCfgValue("SplitFiles", "MaxFileNameNum", 10);
- }
- }
-
- if (AutoCleanup)
- {
- KeepDays = NConfig.GetCfgValue("CleanUpLog", "KeepSaveDays", 30);
- BackupDays = NConfig.GetCfgValue("CleanUpLog", "ZipBeforDays", 1);
- }
- }
- }
+ MaxLevel
}
///
- /// Class NLogItem.
- ///
- public class NLogItem
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The level.
- /// Content of the log.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- /// The dt.
- public NLogItem(NLogLevel level = NLogLevel.Debug,
- [NotNull] string logContent = "",
- [NotNull] string fileName = "",
- [NotNull] string funName = "",
- int lineNo = 0,
- DateTime? dt = null)
- {
- if (dt == null)
- LogStamp = DateTime.Now;
- else
- LogStamp = (DateTime) dt;
-
- LogLevel = level;
- LogContent = logContent;
- CodeFile = fileName;
- CodeFunction = funName;
- CodeLine = lineNo;
- }
-
- ///
- /// Gets or sets the log stamp.
- ///
- /// The log stamp.
- public DateTime LogStamp { get; set; }
- ///
- /// Gets or sets the log level.
- ///
- /// The log level.
- public NLogLevel LogLevel { get; set; }
- ///
- /// Gets or sets the content of the log.
- ///
- /// The content of the log.
- public string LogContent { get; set; }
- ///
- /// Gets or sets the code file.
- ///
- /// The code file.
- public string CodeFile { get; set; }
- ///
- /// Gets or sets the code line.
- ///
- /// The code line.
- public int CodeLine { get; set; }
- ///
- /// Gets or sets the code function.
- ///
- /// The code function.
- public string CodeFunction { get; set; }
- }
-
- ///
- /// Class NLog.
+ /// Class NLog.
///
public static class NLog
{
///
- /// The log CFG
- ///
- private static NLogConfig _logCfg;
- ///
- /// The log output lock
- ///
- private static readonly object LogOutputLock = new object();
- ///
- /// The log item collection
+ /// The log item collection
///
private static readonly ConcurrentQueue LogItemCollection = new ConcurrentQueue();
+
///
- /// The log file name
+ /// The log output lock
+ ///
+ private static readonly object LogOutputLock = new object();
+
+ ///
+ /// The log CFG
+ ///
+ private static NLogConfig _logCfg;
+
+ ///
+ /// The log file name
///
private static string _logFileName = "";
+
///
- /// The log file number
+ /// The log file number
///
private static uint _logFileNum;
+
///
- /// The log sw
+ /// The log sw
///
private static StreamWriter _logSw;
///
- /// Creates the log file head.
+ /// Logs the out.
///
- private static void CreateLogFileHead()
+ /// The log MSG.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ public static void LogOut([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
{
- _logSw?.WriteLine("FileName: " + _logFileName);
- _logSw?.WriteLine("CreateTime: " + string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
- _logSw?.WriteLine("Program: " + Process.GetCurrentProcess().MainModule.FileName);
- _logSw?.WriteLine("PID: " + Process.GetCurrentProcess().Id);
- _logSw?.WriteLine("Split Count: " + (_logFileNum - 1));
- _logSw?.WriteLine("--------------------------------------------------");
- _logSw?.Flush();
- }
+ if (NLogLevel.Debug >= _logCfg.LogLevel || !_logCfg.LogEnable) return;
- ///
- /// Configurations the initialize.
- ///
- private static void ConfigInit()
- {
- if (_logCfg.EnFile)
+ if (_logCfg.AsyncMode)
{
- _logFileName = string.Format("{0}{1}[{3:yyyy-MM-dd_HH-mm}][{4:d}]_{2}",
- _logCfg.DirPath,
- _logCfg.FileNamePre.Length > 0 ? _logCfg.FileNamePre + "_" : "",
- Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName),
- DateTime.Now,
- Process.GetCurrentProcess().Id);
-
- if (_logCfg.EnSplitLog && _logCfg.RoolbackFile && _logCfg.MaxFileNum > 0)
+ if (LogItemCollection.Count >= _logCfg.MaxItemsCache)
{
- _logFileName += $"_{_logFileNum:d3}";
- _logFileNum = Convert.ToUInt32((_logFileNum + 1) % _logCfg.MaxFileNum);
+ if (_logCfg.CacheMode == CacheOptMode.Drop) return;
+
+ LogItemCollection.TryDequeue(out _);
}
- _logFileName += ".log";
-
- if (File.Exists(_logFileName))
- if (_logCfg.EnSplitLog)
- File.Delete(_logFileName);
-
- _logSw = new StreamWriter(_logFileName, true);
- CreateLogFileHead();
+ var logItem = new NLogItem(_logCfg.DefaultLevel, logMsg, fileName, funName, lineNo, DateTime.Now);
+ LogItemCollection.Enqueue(logItem);
+ }
+ else
+ {
+ var logItem = new NLogItem(_logCfg.DefaultLevel, logMsg, fileName, funName, lineNo, DateTime.Now);
+ LogOutput(logItem);
}
}
///
- /// ns the log finish.
+ /// ns the log finish.
///
public static void NLog_Finish()
{
@@ -497,7 +166,7 @@ namespace GeneratorCode.Logs
}
///
- /// ns the log initialize.
+ /// ns the log initialize.
///
public static void NLog_Init()
{
@@ -524,8 +193,12 @@ namespace GeneratorCode.Logs
var tolOut = Math.Min(_logCfg.NumOutItems, LogItemCollection.Count);
for (var i = 0; i < tolOut; i++)
+ {
if (LogItemCollection.TryDequeue(out var logItem))
+ {
LogOutput(logItem);
+ }
+ }
Thread.Sleep(_logCfg.SleepTime);
@@ -539,10 +212,14 @@ namespace GeneratorCode.Logs
var isNeedSplit = false;
if (_logCfg.SplitByData && lastDt.Day != DateTime.Now.Day)
+ {
isNeedSplit = true;
- else if (_logCfg.SplitBySize > 0 &&
+ }
+ else if (_logCfg.SplitBySize > 0 &&
new FileInfo(_logFileName).Length > _logCfg.SplitBySize * 1024 * 1024)
+ {
isNeedSplit = true;
+ }
if (isNeedSplit)
{
@@ -564,12 +241,12 @@ namespace GeneratorCode.Logs
if (_logCfg.EnSplitLog && _logCfg.RoolbackFile && _logCfg.MaxFileNum > 0)
{
_logFileName += $"_{_logFileNum:d3}";
- parttn += $"_{_logFileNum:d3}";
- _logFileNum = Convert.ToUInt32((_logFileNum + 1) % _logCfg.MaxFileNum);
+ parttn += $"_{_logFileNum:d3}";
+ _logFileNum = Convert.ToUInt32((_logFileNum + 1) % _logCfg.MaxFileNum);
}
_logFileName += ".log";
- parttn += ".log";
+ parttn += ".log";
foreach (var f in Directory.EnumerateFiles(_logCfg.DirPath, parttn,
SearchOption.TopDirectoryOnly))
@@ -583,15 +260,11 @@ namespace GeneratorCode.Logs
}
}
}
- })
- {
- Name = "Log Async Output Thread",
- IsBackground = true
- };
+ }) {Name = "Log Async Output Thread", IsBackground = true};
asynWork.Start();
- var tm = new Timer(1000) { AutoReset = true };
+ var tm = new Timer(1000) {AutoReset = true};
tm.Elapsed += (obj, args) =>
{
@@ -620,7 +293,10 @@ namespace GeneratorCode.Logs
var diff = (DateTime.Now - dt).Days;
- if (diff > _logCfg.KeepDays) File.Delete(f);
+ if (diff > _logCfg.KeepDays)
+ {
+ File.Delete(f);
+ }
}
}
@@ -637,10 +313,13 @@ namespace GeneratorCode.Logs
var diff = (DateTime.Now - dt).Days;
if (diff > _logCfg.KeepDays)
+ {
File.Delete(f);
- else if (diff > _logCfg.BackupDays) backList.Add(f);
- else
+ }
+ else if (diff > _logCfg.BackupDays)
+ {
backList.Add(f);
+ }
}
}
@@ -663,21 +342,56 @@ namespace GeneratorCode.Logs
}
///
- /// Logs the level to string.
+ /// Configurations the initialize.
///
- /// The log level.
- /// System.String.
- private static string LogLevelToString(NLogLevel logLevel)
+ private static void ConfigInit()
{
- string[] level = { "F", "C", "E", "I", "W", "D" };
+ if (_logCfg.EnFile)
+ {
+ _logFileName = string.Format("{0}{1}[{3:yyyy-MM-dd_HH-mm}][{4:d}]_{2}",
+ _logCfg.DirPath,
+ _logCfg.FileNamePre.Length > 0 ? _logCfg.FileNamePre + "_" : "",
+ Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName),
+ DateTime.Now,
+ Process.GetCurrentProcess().Id);
- if ((int) logLevel < level.Length && (int) logLevel >= 0)
- return level[(int) logLevel];
- return "U";
+ if (_logCfg.EnSplitLog && _logCfg.RoolbackFile && _logCfg.MaxFileNum > 0)
+ {
+ _logFileName += $"_{_logFileNum:d3}";
+ _logFileNum = Convert.ToUInt32((_logFileNum + 1) % _logCfg.MaxFileNum);
+ }
+
+ _logFileName += ".log";
+
+ if (File.Exists(_logFileName))
+ {
+ if (_logCfg.EnSplitLog)
+ {
+ File.Delete(_logFileName);
+ }
+ }
+
+ _logSw = new StreamWriter(_logFileName, true);
+ CreateLogFileHead();
+ }
}
///
- /// Logs the format.
+ /// Creates the log file head.
+ ///
+ private static void CreateLogFileHead()
+ {
+ _logSw?.WriteLine("FileName: " + _logFileName);
+ _logSw?.WriteLine("CreateTime: " + string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
+ _logSw?.WriteLine("Program: " + Process.GetCurrentProcess().MainModule.FileName);
+ _logSw?.WriteLine("PID: " + Process.GetCurrentProcess().Id);
+ _logSw?.WriteLine("Split Count: " + (_logFileNum - 1));
+ _logSw?.WriteLine("--------------------------------------------------");
+ _logSw?.Flush();
+ }
+
+ ///
+ /// Logs the format.
///
/// The log level.
/// The log MSG.
@@ -687,7 +401,7 @@ namespace GeneratorCode.Logs
/// The dt.
/// System.String.
private static string LogFormat(NLogLevel logLevel, string logMsg, string fileName, string funName, int lineNo,
- DateTime dt)
+ DateTime dt)
{
var msg = "";
@@ -716,8 +430,12 @@ namespace GeneratorCode.Logs
if (_logCfg.ShowFunction) msg += "- " + funName;
if (_logCfg.ShowCodeFile || _logCfg.ShowFunction)
+ {
if (_logCfg.ShowCodeLine)
+ {
msg += "(" + lineNo + ")";
+ }
+ }
msg += ": " + logMsg;
@@ -725,71 +443,24 @@ namespace GeneratorCode.Logs
}
///
- /// Logs the output.
+ /// Logs the level to string.
///
- /// The log item.
- private static void LogOutput(NLogItem logItem)
+ /// The log level.
+ /// System.String.
+ private static string LogLevelToString(NLogLevel logLevel)
{
- var msg = LogFormat(logItem.LogLevel,
- logItem.LogContent,
- logItem.CodeFile,
- logItem.CodeFunction,
- logItem.CodeLine,
- logItem.LogStamp);
+ string[] level = {"F", "C", "E", "I", "W", "D"};
- if (_logCfg.ForceNewLine) msg += Environment.NewLine;
-
- lock (LogOutputLock)
+ if ((int) logLevel < level.Length && (int) logLevel >= 0)
{
- if (_logCfg.EnConsole) Console.Write(msg);
-
- if (_logCfg.EnDebug | _logCfg.EnTrace)
- {
- if (_logCfg.EnTrace)
- Trace.Write(msg);
- else
- System.Diagnostics.Debug.WriteLine(msg);
- }
-
- if (_logCfg.EnFile) _logSw?.Write(msg);
+ return level[(int) logLevel];
}
+
+ return "U";
}
///
- /// Logs the out.
- ///
- /// The log MSG.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- public static void LogOut([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
- {
- if (NLogLevel.Debug >= _logCfg.LogLevel || !_logCfg.LogEnable) return;
-
- if (_logCfg.AsyncMode)
- {
- if (LogItemCollection.Count >= _logCfg.MaxItemsCache)
- {
- if (_logCfg.CacheMode == CacheOptMode.Drop) return;
-
- LogItemCollection.TryDequeue(out _);
- }
-
- var logItem = new NLogItem(_logCfg.DefaultLevel, logMsg, fileName, funName, lineNo, DateTime.Now);
- LogItemCollection.Enqueue(logItem);
- }
- else
- {
- var logItem = new NLogItem(_logCfg.DefaultLevel, logMsg, fileName, funName, lineNo, DateTime.Now);
- LogOutput(logItem);
- }
- }
-
- ///
- /// Logs the out.
+ /// Logs the out.
///
/// The log level.
/// The log MSG.
@@ -797,10 +468,10 @@ namespace GeneratorCode.Logs
/// Name of the fun.
/// The line no.
private static void LogOut(NLogLevel logLevel = NLogLevel.Info,
- [NotNull] string logMsg = "",
- string fileName = "",
- string funName = "",
- int lineNo = 0)
+ [NotNull] string logMsg = "",
+ string fileName = "",
+ string funName = "",
+ int lineNo = 0)
{
if (logLevel >= _logCfg.LogLevel || !_logCfg.LogEnable) return;
@@ -823,98 +494,505 @@ namespace GeneratorCode.Logs
}
}
+ ///
+ /// Logs the output.
+ ///
+ /// The log item.
+ private static void LogOutput(NLogItem logItem)
+ {
+ var msg = LogFormat(logItem.LogLevel,
+ logItem.LogContent,
+ logItem.CodeFile,
+ logItem.CodeFunction,
+ logItem.CodeLine,
+ logItem.LogStamp);
+
+ if (_logCfg.ForceNewLine) msg += Environment.NewLine;
+
+ lock (LogOutputLock)
+ {
+ if (_logCfg.EnConsole) Console.Write(msg);
+
+ if (_logCfg.EnDebug | _logCfg.EnTrace)
+ {
+ if (_logCfg.EnTrace)
+ {
+ Trace.Write(msg);
+ }
+ else
+ {
+ System.Diagnostics.Debug.WriteLine(msg);
+ }
+ }
+
+ if (_logCfg.EnFile) _logSw?.Write(msg);
+ }
+ }
+
#region LogOutputMethod
///
- /// Debugs the specified log MSG.
+ /// Crashes the specified log MSG.
///
/// The log MSG.
/// Name of the file.
/// Name of the fun.
/// The line no.
- public static void Debug([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
- {
- LogOut(NLogLevel.Debug, logMsg, fileName, funName, lineNo);
- }
-
- ///
- /// Warrings the specified log MSG.
- ///
- /// The log MSG.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- public static void Warring([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
- {
- LogOut(NLogLevel.Warring, logMsg, fileName, funName, lineNo);
- }
-
- ///
- /// Informations the specified log MSG.
- ///
- /// The log MSG.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- public static void Info([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
- {
- LogOut(NLogLevel.Info, logMsg, fileName, funName, lineNo);
- }
-
- ///
- /// Errors the specified log MSG.
- ///
- /// The log MSG.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- public static void Error([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
- {
- LogOut(NLogLevel.Error, logMsg, fileName, funName, lineNo);
- }
-
- ///
- /// Crashes the specified log MSG.
- ///
- /// The log MSG.
- /// Name of the file.
- /// Name of the fun.
- /// The line no.
- public static void Crash([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
+ public static void Crash([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
{
LogOut(NLogLevel.Crash, logMsg, fileName, funName, lineNo);
}
///
- /// Fatals the specified log MSG.
+ /// Debugs the specified log MSG.
///
/// The log MSG.
/// Name of the file.
/// Name of the fun.
/// The line no.
- public static void Fatal([NotNull] string logMsg = "",
- [CallerFilePath] string fileName = "",
- [CallerMemberName] string funName = "",
- [CallerLineNumber] int lineNo = 0)
+ public static void Debug([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
+ {
+ LogOut(NLogLevel.Debug, logMsg, fileName, funName, lineNo);
+ }
+
+ ///
+ /// Errors the specified log MSG.
+ ///
+ /// The log MSG.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ public static void Error([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
+ {
+ LogOut(NLogLevel.Error, logMsg, fileName, funName, lineNo);
+ }
+
+ ///
+ /// Fatals the specified log MSG.
+ ///
+ /// The log MSG.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ public static void Fatal([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
{
LogOut(NLogLevel.Fatal, logMsg, fileName, funName, lineNo);
}
- #endregion
+ ///
+ /// Informations the specified log MSG.
+ ///
+ /// The log MSG.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ public static void Info([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
+ {
+ LogOut(NLogLevel.Info, logMsg, fileName, funName, lineNo);
+ }
+
+ ///
+ /// Warrings the specified log MSG.
+ ///
+ /// The log MSG.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ public static void Warring([NotNull] string logMsg = "",
+ [CallerFilePath] string fileName = "",
+ [CallerMemberName] string funName = "",
+ [CallerLineNumber] int lineNo = 0)
+ {
+ LogOut(NLogLevel.Warring, logMsg, fileName, funName, lineNo);
+ }
+
+ #endregion LogOutputMethod
}
-}
+
+ ///
+ /// Class NLogConfig.
+ ///
+ public class NLogConfig
+ {
+ ///
+ /// Delegate LogCfgChangedHandle
+ ///
+ public delegate void LogCfgChangedHandle();
+
+ ///
+ /// The CFG lock
+ ///
+ private readonly object _cfgLock = new object();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public NLogConfig()
+ {
+ LogConfig();
+ NConfig.OnConfigChanged += () =>
+ {
+ LogCfgChanged();
+ };
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [asynchronous mode].
+ ///
+ /// true if [asynchronous mode]; otherwise, false.
+ public bool AsyncMode { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [automatic cleanup].
+ ///
+ /// true if [automatic cleanup]; otherwise, false.
+ public bool AutoCleanup { get; set; }
+
+ ///
+ /// Gets or sets the backup days.
+ ///
+ /// The backup days.
+ public int BackupDays { get; set; }
+
+ ///
+ /// Gets or sets the cache mode.
+ ///
+ /// The cache mode.
+ public CacheOptMode CacheMode { get; set; }
+
+ ///
+ /// Gets or sets the default level.
+ ///
+ /// The default level.
+ public NLogLevel DefaultLevel { get; set; }
+
+ ///
+ /// Gets or sets the dir path.
+ ///
+ /// The dir path.
+ public string DirPath { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [en console].
+ ///
+ /// true if [en console]; otherwise, false.
+ public bool EnConsole { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [en debug].
+ ///
+ /// true if [en debug]; otherwise, false.
+ public bool EnDebug { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [en file].
+ ///
+ /// true if [en file]; otherwise, false.
+ public bool EnFile { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [en split log].
+ ///
+ /// true if [en split log]; otherwise, false.
+ public bool EnSplitLog { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [en trace].
+ ///
+ /// true if [en trace]; otherwise, false.
+ public bool EnTrace { get; set; }
+
+ ///
+ /// Gets or sets the file name pre.
+ ///
+ /// The file name pre.
+ public string FileNamePre { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [force new line].
+ ///
+ /// true if [force new line]; otherwise, false.
+ public bool ForceNewLine { get; set; }
+
+ ///
+ /// Gets or sets the keep days.
+ ///
+ /// The keep days.
+ public int KeepDays { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [log enable].
+ ///
+ /// true if [log enable]; otherwise, false.
+ public bool LogEnable { get; set; }
+
+ ///
+ /// Gets or sets the log level.
+ ///
+ /// The log level.
+ public NLogLevel LogLevel { get; set; }
+
+ ///
+ /// Gets or sets the maximum file number.
+ ///
+ /// The maximum file number.
+ public int MaxFileNum { get; set; }
+
+ ///
+ /// Gets or sets the maximum items cache.
+ ///
+ /// The maximum items cache.
+ public int MaxItemsCache { get; set; }
+
+ ///
+ /// Gets or sets the number out items.
+ ///
+ /// The number out items.
+ public int NumOutItems { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [roolback file].
+ ///
+ /// true if [roolback file]; otherwise, false.
+ public bool RoolbackFile { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show code file].
+ ///
+ /// true if [show code file]; otherwise, false.
+ public bool ShowCodeFile { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show code line].
+ ///
+ /// true if [show code line]; otherwise, false.
+ public bool ShowCodeLine { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show date].
+ ///
+ /// true if [show date]; otherwise, false.
+ public bool ShowDate { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show function].
+ ///
+ /// true if [show function]; otherwise, false.
+ public bool ShowFunction { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show level].
+ ///
+ /// true if [show level]; otherwise, false.
+ public bool ShowLevel { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show m sec].
+ ///
+ /// true if [show m sec]; otherwise, false.
+ public bool ShowMSec { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [show time].
+ ///
+ /// true if [show time]; otherwise, false.
+ public bool ShowTime { get; set; }
+
+ ///
+ /// Gets or sets the sleep time.
+ ///
+ /// The sleep time.
+ public int SleepTime { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether [split by data].
+ ///
+ /// true if [split by data]; otherwise, false.
+ public bool SplitByData { get; set; }
+
+ ///
+ /// Gets or sets the size of the split by.
+ ///
+ /// The size of the split by.
+ public int SplitBySize { get; set; }
+
+ ///
+ /// Occurs when [on log CFG changed].
+ ///
+ public static event LogCfgChangedHandle OnLogCfgChanged;
+
+ ///
+ /// Logs the configuration.
+ ///
+ public void LogConfig()
+ {
+ lock (_cfgLock)
+ {
+ LogEnable = NConfig.GetCfgValue("LogGlobal", "LogEnable", false);
+ LogLevel =
+ (NLogLevel) NConfig.GetCfgValue("LogGlobal", "LogLevel", (int) NLogLevel.MaxLevel);
+ DefaultLevel = (NLogLevel) NConfig.GetCfgValue("LogGlobal", "DefaultLogLevel", (int) NLogLevel.Info);
+ AsyncMode = NConfig.GetCfgValue("LogGlobal", "AsyncMode", false);
+ ForceNewLine = NConfig.GetCfgValue("LogGlobal", "AutoForceNewLine", false);
+ AutoCleanup = NConfig.GetCfgValue("LogGlobal", "AutoCleanup", true);
+
+ ShowDate = NConfig.GetCfgValue("LogFormat", "ShowDate", true);
+ ShowTime = NConfig.GetCfgValue("LogFormat", "ShowTime", true);
+ ShowMSec = NConfig.GetCfgValue("LogFormat", "ShowMSec", true);
+ ShowLevel = NConfig.GetCfgValue("LogFormat", "ShowLevel", true);
+ ShowCodeFile = NConfig.GetCfgValue("LogFormat", "ShowCodeFile", true);
+ ShowFunction = NConfig.GetCfgValue("LogFormat", "ShowFunction", true);
+ ShowCodeLine = NConfig.GetCfgValue("LogFormat", "ShowCodeLine", true);
+
+ EnConsole = NConfig.GetCfgValue("LogOutput", "Console", true);
+ EnTrace = NConfig.GetCfgValue("LogOutput", "Trace", false);
+ EnDebug = NConfig.GetCfgValue("LogOutput", "Debug", true);
+ EnFile = NConfig.GetCfgValue("LogOutput", "File", false);
+
+ if (AsyncMode)
+ {
+ MaxItemsCache = NConfig.GetCfgValue("AsyncLogSetting", "MaxItemsCache", 0);
+
+ if (MaxItemsCache == 0) MaxItemsCache = int.MaxValue;
+
+ CacheMode = (CacheOptMode) NConfig.GetCfgValue("AsyncLogSetting", "CacheFullOpts",
+ (int) CacheOptMode.Drop);
+ NumOutItems = NConfig.GetCfgValue("AsyncLogSetting", "NumItemsOutEachTime", 10);
+ }
+
+ SleepTime = NConfig.GetCfgValue("AsyncLogSetting", "ThreadSleep", 10);
+
+ if (EnFile)
+ {
+ DirPath = NConfig.GetCfgValue("FileLogSetting", "Path", @"");
+
+ if (DirPath == "" || !Directory.Exists(DirPath) || DirPath == @".\")
+ {
+ DirPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\";
+ }
+
+ if (!Directory.Exists(DirPath)) Directory.CreateDirectory(DirPath);
+
+ if (!DirPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
+ {
+ DirPath += Path.DirectorySeparatorChar;
+ }
+
+ FileNamePre = NConfig.GetCfgValue("FileLogSetting", "FileNamePrefix", "");
+ EnSplitLog = NConfig.GetCfgValue("FileLogSetting", "AutoSplitFile", true);
+
+ if (EnSplitLog)
+ {
+ SplitByData = NConfig.GetCfgValue("SplitFiles", "SplitByDate", true);
+ SplitBySize = NConfig.GetCfgValue("SplitFiles", "SplitBySize", 4);
+ RoolbackFile = NConfig.GetCfgValue("SplitFiles", "FileNameRollback", true);
+ MaxFileNum = NConfig.GetCfgValue("SplitFiles", "MaxFileNameNum", 10);
+ }
+ }
+
+ if (AutoCleanup)
+ {
+ KeepDays = NConfig.GetCfgValue("CleanUpLog", "KeepSaveDays", 30);
+ BackupDays = NConfig.GetCfgValue("CleanUpLog", "ZipBeforDays", 1);
+ }
+ }
+ }
+
+ ///
+ /// Logs the CFG changed.
+ ///
+ protected static void LogCfgChanged()
+ {
+ OnLogCfgChanged?.Invoke();
+ }
+ }
+
+ ///
+ /// Class NLogItem.
+ ///
+ public class NLogItem
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The level.
+ /// Content of the log.
+ /// Name of the file.
+ /// Name of the fun.
+ /// The line no.
+ /// The dt.
+ public NLogItem(NLogLevel level = NLogLevel.Debug,
+ [NotNull] string logContent = "",
+ [NotNull] string fileName = "",
+ [NotNull] string funName = "",
+ int lineNo = 0,
+ DateTime? dt = null)
+ {
+ if (dt == null)
+ {
+ LogStamp = DateTime.Now;
+ }
+ else
+ {
+ LogStamp = (DateTime) dt;
+ }
+
+ LogLevel = level;
+ LogContent = logContent;
+ CodeFile = fileName;
+ CodeFunction = funName;
+ CodeLine = lineNo;
+ }
+
+ ///
+ /// Gets or sets the code file.
+ ///
+ /// The code file.
+ public string CodeFile { get; set; }
+
+ ///
+ /// Gets or sets the code function.
+ ///
+ /// The code function.
+ public string CodeFunction { get; set; }
+
+ ///
+ /// Gets or sets the code line.
+ ///
+ /// The code line.
+ public int CodeLine { get; set; }
+
+ ///
+ /// Gets or sets the content of the log.
+ ///
+ /// The content of the log.
+ public string LogContent { get; set; }
+
+ ///
+ /// Gets or sets the log level.
+ ///
+ /// The log level.
+ public NLogLevel LogLevel { get; set; }
+
+ ///
+ /// Gets or sets the log stamp.
+ ///
+ /// The log stamp.
+ public DateTime LogStamp { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/GeneratorCode/MainCode.cs b/GeneratorCode/MainCode.cs
index f5601e5..7d3e60d 100644
--- a/GeneratorCode/MainCode.cs
+++ b/GeneratorCode/MainCode.cs
@@ -4,7 +4,7 @@
// Created : 02-14-2019
//
// Last Modified By : 黄昕
-// Last Modified On : 02-20-2019
+// Last Modified On : 02-26-2019
// ***********************************************************************
//
// Copyright © 2019
@@ -28,20 +28,21 @@ namespace GeneratorCode
///
/// Class GeneratorParams.
///
+ [JsonObject(MemberSerialization.OptOut)]
public class GeneratorParams
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public GeneratorParams()
{
- dpi = new[] { 0, 0, 0, 0 };
- point_type = new[] { 0, 0, 0, 0 };
- image_type = 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";
+ 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";
sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191";
}
@@ -52,16 +53,16 @@ namespace GeneratorCode
public int[] dpi { get; set; }
///
- /// Gets or sets the type of the point.
+ /// Gets or sets the file path.
///
- /// The type of the point.
- public int[] point_type { get; set; }
+ /// The file path.
+ public string filePath { get; set; }
///
/// Gets or sets the type of the image.
///
/// The type of the image.
- public bool[] image_type { get; set; }
+ public bool[] imageType { get; set; }
///
/// Gets or sets the key.
@@ -70,22 +71,23 @@ namespace GeneratorCode
public string key { get; set; }
///
- /// Gets or sets the file path.
+ /// Gets or sets the type of the point.
///
- /// The file path.
- public string filePath { get; set; }
-
- ///
- /// Gets or sets the start page identifier.
- ///
- /// The start page identifier.
- public int StartPageID { get; set; }
+ /// The type of the point.
+ public int[] pointType { get; set; }
///
/// Gets or sets the session identifier.
///
/// The session identifier.
+ [JsonIgnore]
public string sessionId { get; set; }
+
+ ///
+ /// Gets or sets the start page identifier.
+ ///
+ /// The start page identifier.
+ public int startPageId { get; set; }
}
///
@@ -94,27 +96,27 @@ namespace GeneratorCode
public class GenerCodeRet
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The s identifier.
/// The PRG.
public GenerCodeRet(string sId, int prg)
{
sessionId = sId;
- progress = prg;
+ progress = prg;
}
- ///
- /// Gets or sets the session identifier.
- ///
- /// The session identifier.
- public string sessionId { get; set; }
-
///
/// Gets or sets the progress.
///
/// The progress.
public int progress { get; set; }
+
+ ///
+ /// Gets or sets the session identifier.
+ ///
+ /// The session identifier.
+ public string sessionId { get; set; }
}
///
@@ -133,7 +135,7 @@ namespace GeneratorCode
private readonly object _cfgLock = new object();
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public MainConfig()
{
@@ -146,30 +148,24 @@ namespace GeneratorCode
///
/// true if [base64 MSG content]; otherwise, false.
public bool Base64MsgContent { get; set; }
- ///
- /// Gets or sets the server port.
- ///
- /// The server port.
- public int ServerPort { get; set; }
+
///
/// Gets or sets the server addr.
///
/// The server addr.
public string ServerAddr { get; set; }
+ ///
+ /// Gets or sets the server port.
+ ///
+ /// The server port.
+ public int ServerPort { get; set; }
+
///
/// Occurs when [on main CFG changed].
///
public static event MainCfgChangedHandle OnMainCfgChanged;
- ///
- /// Mains the CFG changed.
- ///
- protected static void MainCfgChanged()
- {
- OnMainCfgChanged?.Invoke();
- }
-
///
/// Loads the configuration.
///
@@ -177,11 +173,19 @@ namespace GeneratorCode
{
lock (_cfgLock)
{
- Base64MsgContent = NConfig.GetCfgValue("Main", "ProBase64Msg", true);
- ServerPort = NConfig.GetCfgValue("Main", "ProServerPort", 10088);
- ServerAddr = NConfig.GetCfgValue("Main", "ProServerAddr", "127.0.0.1");
+ Base64MsgContent = NConfig.GetCfgValue("Main", "ProBase64Msg", true);
+ ServerPort = NConfig.GetCfgValue("Main", "ProServerPort", 10088);
+ ServerAddr = NConfig.GetCfgValue("Main", "ProServerAddr", "127.0.0.1");
}
}
+
+ ///
+ /// Mains the CFG changed.
+ ///
+ protected static void MainCfgChanged()
+ {
+ OnMainCfgChanged?.Invoke();
+ }
}
///
@@ -195,7 +199,7 @@ namespace GeneratorCode
private readonly UdpClient _udp = new UdpClient();
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The CFG.
public MessageProcess(MainConfig cfg)
@@ -231,28 +235,34 @@ namespace GeneratorCode
public class RspMessage
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The s identifier.
public RspMessage(string sId)
{
- err = 0;
- msg = "";
+ err = 0;
+ msg = "";
data = new GenerCodeRet(sId, 0);
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// The s identifier.
/// The PRG.
public RspMessage(string sId, int prg)
{
- err = 0;
- msg = "";
+ err = 0;
+ msg = "";
data = new GenerCodeRet(sId, prg);
}
+ ///
+ /// Gets or sets the data.
+ ///
+ /// The data.
+ public GenerCodeRet data { get; set; }
+
///
/// Gets or sets the error.
///
@@ -265,12 +275,6 @@ namespace GeneratorCode
/// The MSG.
public string msg { get; set; }
- ///
- /// Gets or sets the data.
- ///
- /// The data.
- public GenerCodeRet data { get; set; }
-
///
/// Formats the RSP message.
///
@@ -308,10 +312,10 @@ namespace GeneratorCode
NConfig.InitConfigure();
NLog.NLog_Init();
GeneratorParams inParams = null;
- RspMessage rspMsg;
- var mainCfg = new MainConfig();
- var msgProcess = new MessageProcess(mainCfg);
- var tmObj = new TmatrixClass();
+ RspMessage rspMsg;
+ var mainCfg = new MainConfig();
+ var msgProcess = new MessageProcess(mainCfg);
+ var tmObj = new TmatrixClass();
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
@@ -352,15 +356,15 @@ namespace GeneratorCode
{
if (args.Length == 1)
{
- var deCode = Convert.FromBase64String(args[0]);
+ var deCode = Convert.FromBase64String(args[0]);
var strParams = Encoding.Default.GetString(deCode);
inParams = JsonConvert.DeserializeObject(strParams);
}
else if (args.Length == 2)
{
- var deCode = Convert.FromBase64String(args[1]);
+ var deCode = Convert.FromBase64String(args[1]);
var strParams = Encoding.Default.GetString(deCode);
- inParams = JsonConvert.DeserializeObject(strParams);
+ inParams = JsonConvert.DeserializeObject(strParams);
inParams.sessionId = args[0];
}
else
@@ -374,11 +378,8 @@ 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;
}
@@ -396,7 +397,7 @@ namespace GeneratorCode
var jsInput = JsonConvert.SerializeObject(inParams);
NLog.Debug("Input:" + jsInput + Environment.NewLine);
-
+
if (!File.Exists(inParams.filePath))
{
NLog.Error("File Not Exists: " + inParams.filePath + Environment.NewLine);
@@ -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,18 +462,21 @@ namespace GeneratorCode
/// The error input parameters
///
ErrInputParams = 1,
+
///
/// The error file notexists
///
ErrFileNotexists,
+
///
/// The error except throw
///
ErrExceptThrow,
+
///
/// The error json decode
///
ErrJsonDecode
}
}
-}
+}
\ No newline at end of file
diff --git a/GeneratorCode/Properties/Annotations.cs b/GeneratorCode/Properties/Annotations.cs
index a9e7868..c8eb3d3 100644
--- a/GeneratorCode/Properties/Annotations.cs
+++ b/GeneratorCode/Properties/Annotations.cs
@@ -39,7 +39,7 @@ namespace JetBrains.Annotations
///
///
/// [CanBeNull] object Test() => null;
- ///
+ ///
/// void UseTest() {
/// var p = Test();
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
@@ -105,7 +105,7 @@ namespace JetBrains.Annotations
///
/// [StringFormatMethod("message")]
/// void ShowError(string message, params object[] args) { /* do something */ }
- ///
+ ///
/// void Foo() {
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
/// }
@@ -191,12 +191,12 @@ namespace JetBrains.Annotations
///
/// public class Foo : INotifyPropertyChanged {
/// public event PropertyChangedEventHandler PropertyChanged;
- ///
+ ///
/// [NotifyPropertyChangedInvocator]
/// protected virtual void NotifyChanged(string propertyName) { ... }
- ///
+ ///
/// string _name;
- ///
+ ///
/// public string Name {
/// get { return _name; }
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
@@ -279,7 +279,7 @@ namespace JetBrains.Annotations
/// // A method that returns null if the parameter is null,
/// // and not null if the parameter is not null
/// [ContractAnnotation("null => null; notnull => notnull")]
- /// public object Transform(object data)
+ /// public object Transform(object data)
///
///
/// -
@@ -345,7 +345,7 @@ namespace JetBrains.Annotations
///
/// [CannotApplyEqualityOperator]
/// class NoEquality { }
- ///
+ ///
/// class UsesNoEquality {
/// void Test() {
/// var ca1 = new NoEquality();
@@ -370,7 +370,7 @@ namespace JetBrains.Annotations
///
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
/// class ComponentAttribute : Attribute { }
- ///
+ ///
/// [Component] // ComponentAttribute requires implementing IComponent interface
/// class MyComponent : IComponent { }
///
@@ -527,7 +527,7 @@ namespace JetBrains.Annotations
///
///
/// [Pure] int Multiply(int x, int y) => x * y;
- ///
+ ///
/// void M() {
/// Multiply(123, 42); // Waring: Return value of pure method is not used
/// }
@@ -565,7 +565,7 @@ namespace JetBrains.Annotations
///
/// class Foo {
/// [ProvidesContext] IBarService _barService = ...;
- ///
+ ///
/// void ProcessNode(INode node) {
/// DoSomething(node, node.GetGlobalServices().Bar);
/// // ^ Warning: use value of '_barService' field
@@ -1245,4 +1245,4 @@ namespace JetBrains.Annotations
internal sealed class RazorWriteMethodParameterAttribute : Attribute
{
}
-}
+}
\ No newline at end of file
diff --git a/GeneratorCode/Properties/AssemblyInfo.cs b/GeneratorCode/Properties/AssemblyInfo.cs
index de2d561..7bd313b 100644
--- a/GeneratorCode/Properties/AssemblyInfo.cs
+++ b/GeneratorCode/Properties/AssemblyInfo.cs
@@ -21,7 +21,7 @@ using System.Runtime.InteropServices;
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0c720c54-d779-4204-b529-81360c796b32")]
-// 程序集的版本信息由下列四个值组成:
+// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/GeneratorCode/TmatrixSDK/OIDPublishImageGenerator.cs b/GeneratorCode/TmatrixSDK/OIDPublishImageGenerator.cs
index e6abe4b..8083381 100644
--- a/GeneratorCode/TmatrixSDK/OIDPublishImageGenerator.cs
+++ b/GeneratorCode/TmatrixSDK/OIDPublishImageGenerator.cs
@@ -24,14 +24,17 @@ namespace OIDModule.Generator
/// The e bb state ok
///
eBBState_OK,
+
///
/// The e bb state image file not exist
///
eBBState_ImageFileNotExist,
+
///
/// The e bb state fail to open image file
///
eBBState_FailToOpenImageFile,
+
///
/// The e bb state unknown
///
@@ -47,10 +50,12 @@ namespace OIDModule.Generator
/// The e oid print point type 2X2
///
eOID_PrintPointType_2x2,
+
///
/// The e oid print point type 3X3
///
eOID_PrintPointType_3x3,
+
///
/// The e oid print point type 4X4
///
@@ -66,6 +71,7 @@ namespace OIDModule.Generator
/// The e oid publish image dpi 600
///
eOID_PublishImageDPI_600,
+
///
/// The e oid publish image dpi 1200
///
@@ -81,14 +87,17 @@ namespace OIDModule.Generator
/// The e oid pit publish image
///
eOID_PIT_Publish_Image,
+
///
/// The e oid pit vertor image
///
eOID_PIT_Vertor_Image,
+
///
/// The e oid pit bg vertor image
///
eOID_PIT_BG_Vertor_Image,
+
///
/// The e oid pit publish bg image
///
@@ -104,6 +113,7 @@ namespace OIDModule.Generator
/// The e oid ot element code
///
eOID_OT_ElementCode,
+
///
/// The e oid ot position code
///
@@ -191,6 +201,37 @@ namespace OIDModule.Generator
return OID_PIG_Initialize();
}
+ ///
+ /// Sets the publish pages.
+ ///
+ /// The ar page numbers.
+ /// The n page count.
+ /// true if XXXX, false otherwise.
+ public bool SetPublishPages(int[] arPageNumbers, int nPageCount)
+ {
+ return OID_PIG_SetPublishPages(arPageNumbers, nPageCount);
+ }
+
+ ///
+ /// Sets the start position.
+ ///
+ /// Index of the n page.
+ /// The n x start.
+ /// The n y start.
+ /// true if XXXX, false otherwise.
+ public bool SetStartPosition(int nPageIndex, int nXStart, int nYStart)
+ {
+ return OID_PIG_SetStartPosition(nPageIndex, nXStart, nYStart);
+ }
+
+ ///
+ /// Uninitializes this instance.
+ ///
+ public void Uninitialize()
+ {
+ OID_PIG_Uninitialize();
+ }
+
///
/// Oids the pig add object information.
///
@@ -288,36 +329,5 @@ namespace OIDModule.Generator
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
private static extern void OID_PIG_Uninitialize();
-
- ///
- /// Sets the publish pages.
- ///
- /// The ar page numbers.
- /// The n page count.
- /// true if XXXX, false otherwise.
- public bool SetPublishPages(int[] arPageNumbers, int nPageCount)
- {
- return OID_PIG_SetPublishPages(arPageNumbers, nPageCount);
- }
-
- ///
- /// Sets the start position.
- ///
- /// Index of the n page.
- /// The n x start.
- /// The n y start.
- /// true if XXXX, false otherwise.
- public bool SetStartPosition(int nPageIndex, int nXStart, int nYStart)
- {
- return OID_PIG_SetStartPosition(nPageIndex, nXStart, nYStart);
- }
-
- ///
- /// Uninitializes this instance.
- ///
- public void Uninitialize()
- {
- OID_PIG_Uninitialize();
- }
}
-}
+}
\ No newline at end of file
diff --git a/GeneratorCode/TmatrixSDK/TmatrixClass.cs b/GeneratorCode/TmatrixSDK/TmatrixClass.cs
index 8d76be1..762ddc4 100644
--- a/GeneratorCode/TmatrixSDK/TmatrixClass.cs
+++ b/GeneratorCode/TmatrixSDK/TmatrixClass.cs
@@ -11,12 +11,12 @@
//
//
// ***********************************************************************
+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
///
public class TmatrixClass
{
- ///
- /// Delegate ProgressChangedEvent
- ///
- /// The step.
- public delegate void ProgressChangedEvent(int step);
-
///
/// The default dpi
///
private readonly int Default_DPI = 300;
- ///
- /// The g bid
- ///
- private int gBID;
- ///
- /// The gb key validate
- ///
- private bool gbKeyValidate;
- ///
- /// The g current page index
- ///
- private int gCurPageIndex;
- ///
- /// The g current page identifier
- ///
- private int gCurrentPageID;
- ///
- /// The g oid
- ///
- private int gOID;
- ///
- /// The g page number
- ///
- private int gPageNum;
- ///
- /// The g pi d1
- ///
- private int gPID1;
- ///
- /// The g pi d2
- ///
- private int gPID2;
- ///
- /// The g point type
- ///
- private string gPointType = "";
- ///
- /// The gs bid
- ///
- private string gsBID;
- ///
- /// The gs expiration
- ///
- private string gsExpiration;
- ///
- /// The g sid
- ///
- private int gSID;
- ///
- /// The gs oid
- ///
- private string gsOID;
- ///
- /// The gs pi d1
- ///
- private string gsPID1;
- ///
- /// The gs pi d2
- ///
- private string gsPID2;
+
///
/// The gs point dpi
///
private readonly string[] gsPointDPI = new string[4];
+
///
/// The gs point type
///
private readonly string[] gsPointType = new string[4];
- ///
- /// The gs sid
- ///
- private string gsSID;
- ///
- /// The gs size
- ///
- private string gsSize;
- ///
- /// The g step
- ///
- private int gStep;
- ///
- /// The g total page identifier
- ///
- private int gTotalPageID;
+
///
/// The g tpdfbgi name
///
private readonly string[] gTPDFBGIName = new string[0x100];
+
///
/// The g TPDF name
///
private readonly string[] gTPDFName = new string[0x100];
+
///
/// The g tpdfvi name
///
private readonly string[] gTPDFVIName = new string[0x100];
+
///
/// The g tpdfwovi name
///
private readonly string[] gTPDFWOVIName = new string[0x100];
+
///
/// The oid pi generator
///
private readonly OIDPublishImageGenerator oidPIGenerator = new OIDPublishImageGenerator();
///
- /// Gets the progerss.
+ /// The g bid
///
- /// System.Int32.
- public int GetProgerss()
- {
- return gStep;
- }
+ private int gBID;
///
- /// Sets the progress.
+ /// The gb key validate
+ ///
+ private bool gbKeyValidate;
+
+ ///
+ /// The g current page index
+ ///
+ private int gCurPageIndex;
+
+ ///
+ /// The g current page identifier
+ ///
+ private int gCurrentPageID;
+
+ ///
+ /// The g oid
+ ///
+ private int gOID;
+
+ ///
+ /// The g page number
+ ///
+ private int gPageNum;
+
+ ///
+ /// The g pi d1
+ ///
+ private int gPID1;
+
+ ///
+ /// The g pi d2
+ ///
+ private int gPID2;
+
+ ///
+ /// The g point type
+ ///
+ private string gPointType = "";
+
+ ///
+ /// The gs bid
+ ///
+ private string gsBID;
+
+ ///
+ /// The gs expiration
+ ///
+ private string gsExpiration;
+
+ ///
+ /// The g sid
+ ///
+ private int gSID;
+
+ ///
+ /// The gs oid
+ ///
+ private string gsOID;
+
+ ///
+ /// The gs pi d1
+ ///
+ private string gsPID1;
+
+ ///
+ /// The gs pi d2
+ ///
+ private string gsPID2;
+
+ ///
+ /// The gs sid
+ ///
+ private string gsSID;
+
+ ///
+ /// The gs size
+ ///
+ private string gsSize;
+
+ ///
+ /// The g step
+ ///
+ private int gStep;
+
+ ///
+ /// The g total page identifier
+ ///
+ private int gTotalPageID;
+
+ ///
+ /// Delegate ProgressChangedEvent
///
/// The step.
- public void SetProgress(int step)
- {
- if (gStep != step)
- {
- gStep = step;
- OnProgressChanged(gStep);
- }
- }
+ public delegate void ProgressChangedEvent(int step);
///
/// Occurs when [progress change].
///
public event ProgressChangedEvent ProgressChange;
- ///
- /// Called when [progress changed].
- ///
- /// The step.
- protected virtual void OnProgressChanged(int step)
- {
- if (ProgressChange != null)
- ProgressChange(step);
- else
- ProgressChange(-1);
- }
-
- ///
- /// Determines whether [is key validate].
- ///
- /// true if [is key validate]; otherwise, false.
- private bool IsKeyValidate()
- {
- return gbKeyValidate;
- }
-
- ///
- /// Checks the expiration validate.
- ///
- /// The DSTR.
- /// true if XXXX, false otherwise.
- 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;
- }
-
- ///
- /// Checks the state of the oid build.
- ///
- /// State of the e begin build.
- /// System.String.
- 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 "";
- }
-
- ///
- /// Called when [progress percent].
- ///
- /// The MSG.
- /// System.String.
- public string OnProgressPercent(string msg)
- {
- return msg;
- }
-
///
/// Decodes the license tmatrix key.
///
@@ -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;
}
+ ///
+ /// Gets the progerss.
+ ///
+ /// System.Int32.
+ public int GetProgerss()
+ {
+ return gStep;
+ }
+
+ ///
+ /// Called when [progress percent].
+ ///
+ /// The MSG.
+ /// System.String.
+ public string OnProgressPercent(string msg)
+ {
+ return msg;
+ }
+
+ ///
+ /// Sets the progress.
+ ///
+ /// The step.
+ public void SetProgress(int step)
+ {
+ if (gStep != step)
+ {
+ gStep = step;
+ OnProgressChanged(gStep);
+ }
+ }
+
+ ///
+ /// Tmatrixes the initialize.
+ ///
+ /// true if XXXX, false otherwise.
+ public bool TmatrixInitialize()
+ {
+ return oidPIGenerator.Initialize();
+ }
+
+ ///
+ /// Tmatrixes the key check.
+ ///
+ /// The s key.
+ /// System.String.
+ 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";
+ }
+
+ ///
+ /// Tmatrixes the key check.
+ ///
+ /// The s key.
+ /// The type.
+ /// System.String.
+ 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";
+ }
+
+ ///
+ /// Tmatrixes the key check oi d4.
+ ///
+ /// The s key.
+ /// System.String.
+ 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";
+ }
+
+ ///
+ /// Tmatrixes the key check oi d4.
+ ///
+ /// The s key.
+ /// The type.
+ /// System.String.
+ 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";
+ }
+
+ ///
+ /// Tmatrixes the uninitialize.
+ ///
+ public void TmatrixUninitialize()
+ {
+ oidPIGenerator.Uninitialize();
+ }
+
+ ///
+ /// Called when [progress changed].
+ ///
+ /// The step.
+ protected virtual void OnProgressChanged(int step)
+ {
+ if (ProgressChange != null)
+ ProgressChange(step);
+ else
+ ProgressChange(-1);
+ }
+
+ ///
+ /// Checks the expiration validate.
+ ///
+ /// The DSTR.
+ /// true if XXXX, false otherwise.
+ 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;
+ }
+
+ ///
+ /// Checks the state of the oid build.
+ ///
+ /// State of the e begin build.
+ /// System.String.
+ 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 "";
+ }
+
+ ///
+ /// Determines whether [is key validate].
+ ///
+ /// true if [is key validate]; otherwise, false.
+ private bool IsKeyValidate()
+ {
+ return gbKeyValidate;
+ }
+
///
/// Renames the big area tmatrix PDF oi d4.
///
@@ -3719,153 +3893,5 @@ namespace TmatrixLibrary
}
}
}
-
- ///
- /// Tmatrixes the initialize.
- ///
- /// true if XXXX, false otherwise.
- public bool TmatrixInitialize()
- {
- return oidPIGenerator.Initialize();
- }
-
- ///
- /// Tmatrixes the key check.
- ///
- /// The s key.
- /// System.String.
- 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";
- }
-
- ///
- /// Tmatrixes the key check.
- ///
- /// The s key.
- /// The type.
- /// System.String.
- 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";
- }
-
- ///
- /// Tmatrixes the key check oi d4.
- ///
- /// The s key.
- /// System.String.
- 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";
- }
-
- ///
- /// Tmatrixes the key check oi d4.
- ///
- /// The s key.
- /// The type.
- /// System.String.
- 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";
- }
-
- ///
- /// Tmatrixes the uninitialize.
- ///
- public void TmatrixUninitialize()
- {
- oidPIGenerator.Uninitialize();
- }
}
-}
+}
\ No newline at end of file
diff --git a/GeneratorCode/config.ini b/GeneratorCode/config.ini
index 181ce76..888a55b 100644
--- a/GeneratorCode/config.ini
+++ b/GeneratorCode/config.ini
@@ -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]
diff --git a/TmatrixCodeGenerator.sln b/TmatrixCodeGenerator.sln
index b6d655b..bba320e 100644
--- a/TmatrixCodeGenerator.sln
+++ b/TmatrixCodeGenerator.sln
@@ -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