ab56a9bcf7
SVN-Revision: r240
186 lines
5.0 KiB
C#
186 lines
5.0 KiB
C#
/******************************
|
|
* 说明:参数处理类
|
|
* 创建人:龚宇超
|
|
* 创建日期:2018-01-22
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Util;
|
|
using System.IO;
|
|
|
|
namespace Lskj.Attach.Client.Model
|
|
{
|
|
/// <summary>
|
|
/// 参数处理类
|
|
/// </summary>
|
|
internal struct ParamFormatter
|
|
{
|
|
private static Dictionary<string, string> _dataDic = new Dictionary<string, string>();
|
|
|
|
/// <summary>
|
|
/// 参数处理结果(成功与否)
|
|
/// </summary>
|
|
public static bool ParseResult;
|
|
/// <summary>
|
|
/// 传入参数个数
|
|
/// </summary>
|
|
/// <value>The parameter count.</value>
|
|
public static int ParamCount { get; private set; }
|
|
/// <summary>
|
|
/// 附件目录ID
|
|
/// </summary>
|
|
/// <value>The directory identifier.</value>
|
|
public static int DirectoryId
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
Convert.ToInt32(_dataDic["directoryId"]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件前缀
|
|
/// </summary>
|
|
/// <value>The file number.</value>
|
|
public static string FileNumber
|
|
{
|
|
get
|
|
{
|
|
return _dataDic["fileNumber"];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件路径
|
|
/// </summary>
|
|
/// <value>The file path.</value>
|
|
public static string FilePath
|
|
{
|
|
get
|
|
{
|
|
return _dataDic["filePath"];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件编号
|
|
/// </summary>
|
|
/// <value>The species no.</value>
|
|
public static string SpeciesNo
|
|
{
|
|
get
|
|
{
|
|
return _dataDic["SpeciesNo"];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件下载路径
|
|
/// </summary>
|
|
/// <value>Down load path.</value>
|
|
public static string DownLoadPath
|
|
{
|
|
get
|
|
{
|
|
return _dataDic["downloadPath"].Replace('*', ' ');
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件下载存放路径
|
|
/// </summary>
|
|
/// <value>The save local path.</value>
|
|
public static string SaveLocalPath
|
|
{
|
|
get { return PubUtil.FileDownLoadTempPath + Path.GetFileName(DownLoadPath); }
|
|
}
|
|
/// <summary>
|
|
/// 附件操作类型
|
|
/// </summary>
|
|
/// <value>The type of the attach.</value>
|
|
public static AttachType AttachType
|
|
{
|
|
get
|
|
{
|
|
return (AttachType)Convert.ToInt32(_dataDic["type"]);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 附件ID集合
|
|
/// </summary>
|
|
/// <value>The file ids.</value>
|
|
public static int[] FileIds
|
|
{
|
|
get
|
|
{
|
|
string[] strArray = _dataDic["fileIds"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
int[] numArray = new int[strArray.Length];
|
|
for (int i = 0; i < strArray.Length; i++)
|
|
{
|
|
numArray[i] = int.Parse(strArray[i]);
|
|
}
|
|
return numArray;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 消息句柄
|
|
/// </summary>
|
|
/// <value>The handler.</value>
|
|
public static IntPtr Handler
|
|
{
|
|
get
|
|
{
|
|
return new IntPtr(int.Parse(_dataDic["mainHandle"]));
|
|
}
|
|
}
|
|
|
|
static ParamFormatter()
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:处理参数</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-22 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="args">The arguments.</param>
|
|
public static void ParseParams(string args)
|
|
{
|
|
try
|
|
{
|
|
string[] strArray = args.Split(new char[] { '|', '=' }, StringSplitOptions.None);
|
|
if (strArray.Length <= 2) return;
|
|
if ("paramsCount" != strArray[0]) return;
|
|
|
|
ParamCount = Convert.ToInt32(strArray[1]);
|
|
|
|
for (int i = 2; i < (strArray.Length - 1); i += 2)
|
|
{
|
|
_dataDic.Add(strArray[i], strArray[i + 1]);
|
|
}
|
|
if (_dataDic.Count != ParamCount) return;
|
|
|
|
ParseResult = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|