基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
namespace LSFileClient
|
||||
{
|
||||
using LSServerService;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size=1)]
|
||||
internal struct LSParamsFormatter
|
||||
{
|
||||
private static int _paramsCount;
|
||||
public static bool bParseResult;
|
||||
private static Dictionary<string, string> m_dataDic;
|
||||
public static bool parseParams(string strParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] strArray = strParams.Split(new char[] { '|', '=' }, StringSplitOptions.None);
|
||||
if (strArray.Length <= 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (strArray[0] != "paramsCount")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_paramsCount = int.Parse(strArray[1]);
|
||||
for (int i = 2; i < (strArray.Length - 1); i += 2)
|
||||
{
|
||||
m_dataDic.Add(strArray[i], strArray[i + 1]);
|
||||
}
|
||||
if (m_dataDic.Count != _paramsCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
PubUtils.WriteLog("error: {0}", new object[] { exception });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int paramsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _paramsCount;
|
||||
}
|
||||
}
|
||||
public static int userId
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(m_dataDic["userId"]);
|
||||
}
|
||||
}
|
||||
public static string fileNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dataDic["fileNumber"];
|
||||
}
|
||||
}
|
||||
public static string filePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dataDic["filePath"];
|
||||
}
|
||||
}
|
||||
|
||||
public static string specieNo
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dataDic["specieNo"];
|
||||
}
|
||||
}
|
||||
public static fmTypes type
|
||||
{
|
||||
get
|
||||
{
|
||||
return (fmTypes) Enum.Parse(typeof(fmTypes), m_dataDic["type"]);
|
||||
}
|
||||
}
|
||||
public static int[] fileIds
|
||||
{
|
||||
get
|
||||
{
|
||||
string[] strArray = m_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;
|
||||
}
|
||||
}
|
||||
public static int directoryId
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(m_dataDic["directoryId"]);
|
||||
}
|
||||
}
|
||||
public static void setPosistion(FrmBase frm)
|
||||
{
|
||||
frm.Left = int.Parse(m_dataDic["left"]);
|
||||
frm.Top = int.Parse(m_dataDic["top"]);
|
||||
frm.Width = int.Parse(m_dataDic["width"]);
|
||||
frm.Height = int.Parse(m_dataDic["height"]);
|
||||
}
|
||||
|
||||
public static IntPtr mainHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
return new IntPtr(int.Parse(m_dataDic["mainHandle"]));
|
||||
}
|
||||
}
|
||||
public static int commonModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _paramsCount;
|
||||
}
|
||||
}
|
||||
public static string downloadPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dataDic["downloadPath"].Replace('*', ' ');
|
||||
}
|
||||
}
|
||||
public static string savePath
|
||||
{
|
||||
get
|
||||
{
|
||||
string path = Environment.CurrentDirectory + "//tempfiles//";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
string fileName = Path.GetFileName(downloadPath);
|
||||
return (path + fileName);
|
||||
}
|
||||
}
|
||||
static LSParamsFormatter()
|
||||
{
|
||||
_paramsCount = 0;
|
||||
bParseResult = true;
|
||||
m_dataDic = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user