标准化错误代码
This commit is contained in:
parent
1ce879d762
commit
8f2c87b3b7
|
@ -64,7 +64,14 @@ namespace GeneratorCode.Configure
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = (T) Convert.ChangeType(_cfgData[segName][keyName], typeof(T));
|
string val;
|
||||||
|
|
||||||
|
|
||||||
|
if (_cfgData.TryGetKey(segName + _cfgData.SectionKeySeparator + keyName, out val))
|
||||||
|
{
|
||||||
|
ret = (T)Convert.ChangeType(val, typeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Created : 02-14-2019
|
// Created : 02-14-2019
|
||||||
//
|
//
|
||||||
// Last Modified By : 黄昕 <hzhuangxin01@corp.netease.com>
|
// Last Modified By : 黄昕 <hzhuangxin01@corp.netease.com>
|
||||||
// Last Modified On : 02-26-2019
|
// Last Modified On : 03-04-2019
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
// <copyright file="MainCode.cs" company="NetEase">
|
// <copyright file="MainCode.cs" company="NetEase">
|
||||||
// Copyright © 2019
|
// Copyright © 2019
|
||||||
|
@ -26,77 +26,77 @@ using TmatrixLibrary;
|
||||||
namespace GeneratorCode
|
namespace GeneratorCode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class GeneratorParams.
|
/// Class GeneratorParams.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonObject(MemberSerialization.OptOut)]
|
[JsonObject(MemberSerialization.OptOut)]
|
||||||
public class GeneratorParams
|
public class GeneratorParams
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="GeneratorParams" /> class.
|
/// Initializes a new instance of the <see cref="GeneratorParams" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GeneratorParams()
|
public GeneratorParams()
|
||||||
{
|
{
|
||||||
dpi = new[] {0, 0, 0, 0};
|
dpi = new[] {0, 0, 0, 0};
|
||||||
pointType = new[] {0, 0, 0, 0};
|
pointType = new[] {0, 0, 0, 0};
|
||||||
imageType = new[] {false, false, false, true};
|
imageType = new[] {false, false, false, true};
|
||||||
startPageId = 0;
|
startPageId = 0;
|
||||||
key = "S0,O000,B0000,P000-255,D2018/12/31;CCAFBQMXYPOAOCIRK52S8QC8SO4A0AGA8Y";
|
key = "S0,O000,B0000,P000-255,D2018/12/31;CCAFBQMXYPOAOCIRK52S8QC8SO4A0AGA8Y";
|
||||||
//filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf";
|
filePath = "E:\\NetEase\\轨迹笔\\Sample\\123.pdf"; //"C:\\Works\\pdf\\123.pdf";
|
||||||
filePath = "C:\\Works\\pdf\\123.pdf";
|
//filePath = "C:\\Works\\pdf\\123.pdf";
|
||||||
sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191";
|
sessionId = "4BD5D923-47EA-4DEF-A1CD-9B85B515B191";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the dpi.
|
/// Gets or sets the dpi.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The dpi.</value>
|
/// <value>The dpi.</value>
|
||||||
public int[] dpi { get; set; }
|
public int[] dpi { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the file path.
|
/// Gets or sets the file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file path.</value>
|
/// <value>The file path.</value>
|
||||||
public string filePath { get; set; }
|
public string filePath { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type of the image.
|
/// Gets or sets the type of the image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the image.</value>
|
/// <value>The type of the image.</value>
|
||||||
public bool[] imageType { get; set; }
|
public bool[] imageType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the key.
|
/// Gets or sets the key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The key.</value>
|
/// <value>The key.</value>
|
||||||
public string key { get; set; }
|
public string key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type of the point.
|
/// Gets or sets the type of the point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the point.</value>
|
/// <value>The type of the point.</value>
|
||||||
public int[] pointType { get; set; }
|
public int[] pointType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the session identifier.
|
/// Gets or sets the session identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The session identifier.</value>
|
/// <value>The session identifier.</value>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string sessionId { get; set; }
|
public string sessionId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the start page identifier.
|
/// Gets or sets the start page identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The start page identifier.</value>
|
/// <value>The start page identifier.</value>
|
||||||
public int startPageId { get; set; }
|
public int startPageId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class GenerCodeRet.
|
/// Class GenerCodeRet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GenerCodeRet
|
public class GenerCodeRet
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="GenerCodeRet" /> class.
|
/// Initializes a new instance of the <see cref="GenerCodeRet" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sId">The s identifier.</param>
|
/// <param name="sId">The s identifier.</param>
|
||||||
/// <param name="prg">The PRG.</param>
|
/// <param name="prg">The PRG.</param>
|
||||||
|
@ -107,35 +107,35 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the progress.
|
/// Gets or sets the progress.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The progress.</value>
|
/// <value>The progress.</value>
|
||||||
public int progress { get; set; }
|
public int progress { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the session identifier.
|
/// Gets or sets the session identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The session identifier.</value>
|
/// <value>The session identifier.</value>
|
||||||
public string sessionId { get; set; }
|
public string sessionId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MainConfig.
|
/// Class MainConfig.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MainConfig
|
public class MainConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate MainCfgChangedHandle
|
/// Delegate MainCfgChangedHandle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void MainCfgChangedHandle();
|
public delegate void MainCfgChangedHandle();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The CFG lock
|
/// The CFG lock
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly object _cfgLock = new object();
|
private readonly object _cfgLock = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MainConfig" /> class.
|
/// Initializes a new instance of the <see cref="MainConfig" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MainConfig()
|
public MainConfig()
|
||||||
{
|
{
|
||||||
|
@ -144,30 +144,30 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [base64 MSG content].
|
/// Gets or sets a value indicating whether [base64 MSG content].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [base64 MSG content]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [base64 MSG content]; otherwise, <c>false</c>.</value>
|
||||||
public bool Base64MsgContent { get; set; }
|
public bool Base64MsgContent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the server addr.
|
/// Gets or sets the server addr.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The server addr.</value>
|
/// <value>The server addr.</value>
|
||||||
public string ServerAddr { get; set; }
|
public string ServerAddr { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the server port.
|
/// Gets or sets the server port.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The server port.</value>
|
/// <value>The server port.</value>
|
||||||
public int ServerPort { get; set; }
|
public int ServerPort { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when [on main CFG changed].
|
/// Occurs when [on main CFG changed].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event MainCfgChangedHandle OnMainCfgChanged;
|
public static event MainCfgChangedHandle OnMainCfgChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the configuration.
|
/// Loads the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadConfig()
|
public void LoadConfig()
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mains the CFG changed.
|
/// Mains the CFG changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static void MainCfgChanged()
|
protected static void MainCfgChanged()
|
||||||
{
|
{
|
||||||
|
@ -189,17 +189,17 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MessageProcess.
|
/// Class MessageProcess.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MessageProcess
|
public class MessageProcess
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UDP
|
/// The UDP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly UdpClient _udp = new UdpClient();
|
private readonly UdpClient _udp = new UdpClient();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MessageProcess" /> class.
|
/// Initializes a new instance of the <see cref="MessageProcess" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cfg">The CFG.</param>
|
/// <param name="cfg">The CFG.</param>
|
||||||
public MessageProcess(MainConfig cfg)
|
public MessageProcess(MainConfig cfg)
|
||||||
|
@ -209,13 +209,13 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the server.
|
/// Gets the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The server.</value>
|
/// <value>The server.</value>
|
||||||
private IPEndPoint _server { get; }
|
private IPEndPoint _server { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends the message.
|
/// Sends the message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg">The MSG.</param>
|
/// <param name="msg">The MSG.</param>
|
||||||
public void SendMessage([NotNull] string msg)
|
public void SendMessage([NotNull] string msg)
|
||||||
|
@ -230,12 +230,12 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class RspMessage.
|
/// Class RspMessage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RspMessage
|
public class RspMessage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="RspMessage" /> class.
|
/// Initializes a new instance of the <see cref="RspMessage" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sId">The s identifier.</param>
|
/// <param name="sId">The s identifier.</param>
|
||||||
public RspMessage(string sId)
|
public RspMessage(string sId)
|
||||||
|
@ -246,7 +246,7 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="RspMessage" /> class.
|
/// Initializes a new instance of the <see cref="RspMessage" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sId">The s identifier.</param>
|
/// <param name="sId">The s identifier.</param>
|
||||||
/// <param name="prg">The PRG.</param>
|
/// <param name="prg">The PRG.</param>
|
||||||
|
@ -258,25 +258,25 @@ namespace GeneratorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the data.
|
/// Gets or sets the data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The data.</value>
|
/// <value>The data.</value>
|
||||||
public GenerCodeRet data { get; set; }
|
public GenerCodeRet data { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the error.
|
/// Gets or sets the error.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The error.</value>
|
/// <value>The error.</value>
|
||||||
public int err { get; set; }
|
public int err { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MSG.
|
/// Gets or sets the MSG.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The MSG.</value>
|
/// <value>The MSG.</value>
|
||||||
public string msg { get; set; }
|
public string msg { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Formats the RSP message.
|
/// Formats the RSP message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="errCode">The error code.</param>
|
/// <param name="errCode">The error code.</param>
|
||||||
/// <param name="readme">The readme.</param>
|
/// <param name="readme">The readme.</param>
|
||||||
|
@ -289,21 +289,65 @@ namespace GeneratorCode
|
||||||
rsp.err = errCode;
|
rsp.err = errCode;
|
||||||
|
|
||||||
if (enBase64)
|
if (enBase64)
|
||||||
|
{
|
||||||
rsp.msg = Convert.ToBase64String(Encoding.Default.GetBytes(readme));
|
rsp.msg = Convert.ToBase64String(Encoding.Default.GetBytes(readme));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rsp.msg = readme;
|
rsp.msg = readme;
|
||||||
|
}
|
||||||
|
|
||||||
return JsonConvert.SerializeObject(rsp);
|
return JsonConvert.SerializeObject(rsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MainCode.
|
/// Class MainCode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MainCode
|
internal class MainCode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the entry point of the application.
|
/// Gets the offical error code.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="err">The error.</param>
|
||||||
|
/// <returns>System.Int32.</returns>
|
||||||
|
private static int GetOfficalErrCode([NotNull] string err = "0")
|
||||||
|
{
|
||||||
|
switch (err)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
return (int) ErrCode.ErrSuccesed;
|
||||||
|
|
||||||
|
case "1":
|
||||||
|
return (int) ErrCode.ErrKeyTampered;
|
||||||
|
|
||||||
|
case "2":
|
||||||
|
return (int) ErrCode.ErrKeyOldStyle;
|
||||||
|
|
||||||
|
case "3":
|
||||||
|
return (int) ErrCode.ErrKeyExpired;
|
||||||
|
|
||||||
|
case "4":
|
||||||
|
return (int) ErrCode.ErrFileNotExists;
|
||||||
|
|
||||||
|
case "5":
|
||||||
|
return (int) ErrCode.ErrStartPage;
|
||||||
|
|
||||||
|
case "6":
|
||||||
|
return (int) ErrCode.ErrPageNotEnough;
|
||||||
|
|
||||||
|
case "7":
|
||||||
|
return (int) ErrCode.ErrSizeMoreThan780;
|
||||||
|
|
||||||
|
case "8":
|
||||||
|
return (int) ErrCode.ErrSizeMoreThan6242;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) ErrCode.ErrUnknownCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the entry point of the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The arguments.</param>
|
/// <param name="args">The arguments.</param>
|
||||||
/// <returns>System.Int32.</returns>
|
/// <returns>System.Int32.</returns>
|
||||||
|
@ -338,20 +382,6 @@ namespace GeneratorCode
|
||||||
NLog.NLog_Finish();
|
NLog.NLog_Finish();
|
||||||
};
|
};
|
||||||
|
|
||||||
//string inputArg =
|
|
||||||
// "eyJkcGkiOlswLDAsMCwwXSwicG9pbnRfdHlwZSI6WzAsMCwwLDBdLCJpbWFnZV90eXBlI" +
|
|
||||||
// "jpbZmFsc2UsZmFsc2UsZmFsc2UsdHJ1ZV0sImtleSI6IlMwLE8wMDAsQjAwMDAsUDAwMC0" +
|
|
||||||
// "yNTUsRDIwMTgvMTIvMzE7Q0NBRkJRTVhZUE9BT0NJUks1MlM4UUM4U080QTBBR0E4WSIsIm" +
|
|
||||||
// "ZpbGVQYXRoIjoiRTpcXE5ldEVhc2VcXLnsvKOxylxcU2FtcGxlXFwxMjMucGRmIiwiU3Rhcn" +
|
|
||||||
// "RQYWdlSUQiOjAsInNlc3Npb25JZCI6IjRCRDVEOTIzLTQ3RUEtNERFRi1BMUNELTlCODVCNT" +
|
|
||||||
// "E1QjE5MSJ9";
|
|
||||||
//string inputArg2 = "eyJkcGkiOlswLDAsMCwwXSwicG9pbnRfdHlwZSI6WzAsMCwwLDBdLCJpb" +
|
|
||||||
// "WFnZV90eXBlIjpbZmFsc2UsZmFsc2UsZmFsc2UsdHJ1ZV0sImtleSI6Il" +
|
|
||||||
// "MwLE8wMDAsQjAwMDAsUDAwMC0yNTUsRDIwMTgvMTIvMzE7Q0NBRkJRTVh" +
|
|
||||||
// "ZUE9BT0NJUks1MlM4UUM4U080QTBBR0E4WSIsImZpbGVQYXRoIjoiQzpc" +
|
|
||||||
// "XFdvcmtzXFxwZGZcXDEyMy5wZGYiLCJTdGFydFBhZ2VJRCI6MCwic2Vzc" +
|
|
||||||
// "2lvbklkIjoiNEJENUQ5MjMtNDdFQS00REVGLUExQ0QtOUI4NUI1MTVCMTkxIn0=";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (args.Length == 1)
|
if (args.Length == 1)
|
||||||
|
@ -380,7 +410,7 @@ namespace GeneratorCode
|
||||||
|
|
||||||
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;
|
return (int) ErrCode.ErrJsonDecode;
|
||||||
}
|
}
|
||||||
|
|
||||||
rspMsg = new RspMessage(inParams.sessionId);
|
rspMsg = new RspMessage(inParams.sessionId);
|
||||||
|
@ -401,7 +431,7 @@ namespace GeneratorCode
|
||||||
if (!File.Exists(inParams.filePath))
|
if (!File.Exists(inParams.filePath))
|
||||||
{
|
{
|
||||||
NLog.Error("File Not Exists: " + inParams.filePath + Environment.NewLine);
|
NLog.Error("File Not Exists: " + inParams.filePath + Environment.NewLine);
|
||||||
return -(int) ErrCode.ErrFileNotexists;
|
return (int) ErrCode.ErrFileNotExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -413,7 +443,7 @@ namespace GeneratorCode
|
||||||
var msg = rspMsg.FormatRspMessage(7, e.Message, 0, mainCfg.Base64MsgContent);
|
var msg = rspMsg.FormatRspMessage(7, e.Message, 0, mainCfg.Base64MsgContent);
|
||||||
msgProcess.SendMessage(msg);
|
msgProcess.SendMessage(msg);
|
||||||
NLog.Crash(e.ToString());
|
NLog.Crash(e.ToString());
|
||||||
return -(int) ErrCode.ErrExceptThrow;
|
return (int) ErrCode.ErrExceptThrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -422,7 +452,9 @@ namespace GeneratorCode
|
||||||
inParams.filePath, inParams.startPageId, inParams.pointType,
|
inParams.filePath, inParams.startPageId, inParams.pointType,
|
||||||
inParams.imageType, inParams.dpi);
|
inParams.imageType, inParams.dpi);
|
||||||
|
|
||||||
if (ret.Substring(0, 1) != "0")
|
var errCode = GetOfficalErrCode(ret.Substring(0, 1));
|
||||||
|
|
||||||
|
if (errCode != 0)
|
||||||
{
|
{
|
||||||
var msg = rspMsg.FormatRspMessage(int.Parse(ret.Substring(0, 1)),
|
var msg = rspMsg.FormatRspMessage(int.Parse(ret.Substring(0, 1)),
|
||||||
ret.Substring(1, ret.Length - 1),
|
ret.Substring(1, ret.Length - 1),
|
||||||
|
@ -441,42 +473,87 @@ namespace GeneratorCode
|
||||||
NLog.Debug(msg + Environment.NewLine);
|
NLog.Debug(msg + Environment.NewLine);
|
||||||
msgProcess.SendMessage(msg);
|
msgProcess.SendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return errCode;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var msg = rspMsg.FormatRspMessage(8, e.Message, tmObj.GetProgerss(), mainCfg.Base64MsgContent);
|
var msg = rspMsg.FormatRspMessage(8, e.Message, tmObj.GetProgerss(), mainCfg.Base64MsgContent);
|
||||||
msgProcess.SendMessage(msg);
|
msgProcess.SendMessage(msg);
|
||||||
NLog.Crash(e.ToString());
|
NLog.Crash(e.ToString());
|
||||||
return -(int) ErrCode.ErrExceptThrow;
|
return (int) ErrCode.ErrExceptThrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enum ErrCode
|
/// Enum ErrCode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private enum ErrCode
|
private enum ErrCode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The error input parameters
|
/// The error succesed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ErrInputParams = 1,
|
ErrSuccesed = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The error file notexists
|
/// The error size more than780
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ErrFileNotexists,
|
ErrSizeMoreThan780 = 105,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The error except throw
|
/// The error size more than6242
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ErrExceptThrow,
|
ErrSizeMoreThan6242 = 106,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The error json decode
|
/// The error start page
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ErrJsonDecode
|
ErrStartPage = 110,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error input parameters
|
||||||
|
/// </summary>
|
||||||
|
ErrInputParams = 122,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error key tampered
|
||||||
|
/// </summary>
|
||||||
|
ErrKeyTampered = 123,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error key old style
|
||||||
|
/// </summary>
|
||||||
|
ErrKeyOldStyle = 124,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error key expired
|
||||||
|
/// </summary>
|
||||||
|
ErrKeyExpired = 125,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error page not enough
|
||||||
|
/// </summary>
|
||||||
|
ErrPageNotEnough = 126,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error file not exists
|
||||||
|
/// </summary>
|
||||||
|
ErrFileNotExists = 127,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error except throw
|
||||||
|
/// </summary>
|
||||||
|
ErrExceptThrow = 128,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error json decode
|
||||||
|
/// </summary>
|
||||||
|
ErrJsonDecode = 129,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error unknown code
|
||||||
|
/// </summary>
|
||||||
|
ErrUnknownCode = 130
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1058,13 +1058,13 @@ namespace TmatrixLibrary
|
||||||
str = TmatrixKeyCheck_OID4(KeyStr);
|
str = TmatrixKeyCheck_OID4(KeyStr);
|
||||||
if (str.Substring(0, 1) != "0") return str;
|
if (str.Substring(0, 1) != "0") return str;
|
||||||
|
|
||||||
if (PDFFileName == "") return "1Please select PDF file first !";
|
if (PDFFileName == "") return "4Please select PDF file first !";
|
||||||
|
|
||||||
if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2))
|
if (StartPageID < int.Parse(gsPID1) || StartPageID > int.Parse(gsPID2))
|
||||||
return "2Start page ID must be located between " + gsPID1 + " ~ " + gsPID2;
|
return "5Start page ID must be located between " + gsPID1 + " ~ " + gsPID2;
|
||||||
gPageNum = GetPDFPageNumber(PDFFileName);
|
gPageNum = GetPDFPageNumber(PDFFileName);
|
||||||
if (gPageNum + StartPageID - 1 > int.Parse(gsPID2))
|
if (gPageNum + StartPageID - 1 > int.Parse(gsPID2))
|
||||||
return "3Not enough code page for this PDF to generate !";
|
return "6Not enough code page for this PDF to generate !";
|
||||||
|
|
||||||
SetProgress(1);
|
SetProgress(1);
|
||||||
|
|
||||||
|
@ -1207,11 +1207,11 @@ namespace TmatrixLibrary
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
if (num16 <= 780 && num17 <= 780) break;
|
if (num16 <= 780 && num17 <= 780) break;
|
||||||
return "4PDF page size's width or height > 780mm !";
|
return "7PDF page size's width or height > 780mm !";
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (num16 <= 0x1862 && num17 <= 0x1862) break;
|
if (num16 <= 0x1862 && num17 <= 0x1862) break;
|
||||||
return "5PDF page size's width or height > 6242mm !";
|
return "8PDF page size's width or height > 6242mm !";
|
||||||
}
|
}
|
||||||
|
|
||||||
var numArray3 = new uint[5];
|
var numArray3 = new uint[5];
|
||||||
|
|
Loading…
Reference in New Issue