基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Assembly LSTest, Version 1.0.0.14
[assembly: System.Runtime.CompilerServices.CompilationRelaxations(8)]
[assembly: System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations | System.Diagnostics.DebuggableAttribute.DebuggingModes.EnableEditAndContinue | System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | System.Diagnostics.DebuggableAttribute.DebuggingModes.Default)]
[assembly: System.Runtime.InteropServices.Guid("825b2939-86c3-4e50-9f1a-e05b05c3a6b3")]
[assembly: System.Reflection.AssemblyTitle("LSTest")]
[assembly: System.Reflection.AssemblyTrademark("")]
[assembly: System.Reflection.AssemblyCopyright("Copyright 2012")]
[assembly: System.Reflection.AssemblyDescription("")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.Reflection.AssemblyProduct("朗速通讯客户端")]
[assembly: System.Reflection.AssemblyConfiguration("")]
[assembly: System.Reflection.AssemblyFileVersion("1.0.0.14")]
[assembly: System.Reflection.AssemblyCompany("")]
+1
View File
@@ -0,0 +1 @@
@@ -0,0 +1,98 @@
namespace LSFileClient
{
using Microsoft.Win32;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using LSServerService;
internal class ClientManager
{
public static void init(string[] args)
{
// new
string serverIP = "";
string dBName = "";
string isInternet = "0";
string IsConsumer = "0";
//MessageBox.Show("1---------------"+args[0].ToString());
//string inputString = args[0].Replace("^^", " ");
string inputString = @"paramsCount=12|userId=1|type=0|left=100|top=100|width=800|height=500|directoryId=17248|fileIds=|mainHandle=1314908|fileNumber=001|specieNo=01|filePath=D:\LsErpNew\Cs\Debug\TempFiles/001_5e7846e905f14faf934c0c8eaea9bee6.jpg|";
inputString = "paramsCount=9|userId=1|type=2|left=100|top=100|width=800|height=500|directoryId=140697|fileIds=89|mainHandle=726320|";
System.Windows.Forms.Clipboard.SetText(inputString);
LSParamsFormatter.bParseResult = LSParamsFormatter.parseParams(inputString);
if (!LSParamsFormatter.bParseResult)
{
MessageBox.Show("参数错误\r\n" + args[0].ToString());
}
else
{
RegistryKey key2 = Registry.CurrentUser.OpenSubKey("AA_ls_Erp V2.0");
if (key2 != null)
{
RegistryKey key3 = key2.OpenSubKey("File");
if (key3 != null)
{
dBName = key3.GetValue("datastr", "").ToString();
serverIP = key3.GetValue("ServerName", "").ToString();
isInternet = key3.GetValue("Internet", "1").ToString();
IsConsumer = key3.GetValue("IsConsumer", "1").ToString();
}
}
if ((serverIP == "") || (dBName == ""))
{
MessageBox.Show("连接服务器参数无效,请联系管理员.");
}
else
{
if (((LSParamsFormatter.commonModel == 9) || (LSParamsFormatter.commonModel == 11)) || (LSParamsFormatter.commonModel == 3) || (LSParamsFormatter.commonModel == 4) || LSParamsFormatter.commonModel == 12)
{
LSGlobleVariable.userId = (uint) LSParamsFormatter.userId;
}
LSClientMain main = new LSClientMain();
main.ProgramEntry(serverIP, dBName, isInternet, IsConsumer);
int num = 0;
while (num < 6)
{
if (main.checkSocketState())
{
break;
}
num++;
Thread.Sleep(300);
}
if (num >= 6)
{
MessageBox.Show("连接服务器失败,请联系管理员.");
SendMessage(LSParamsFormatter.mainHandle, 1305, IntPtr.Zero, IntPtr.Zero);
}
else if ((LSParamsFormatter.commonModel == 9) || (LSParamsFormatter.commonModel == 11) || (LSParamsFormatter.commonModel == 12))
{
Application.Run(new FrmBatchProgress(main, serverIP, dBName, IsConsumer));
}
else if (LSParamsFormatter.commonModel == 2)
{
Application.Run(new frmSingleDownload(main, serverIP, dBName, IsConsumer));
}
else if (LSParamsFormatter.commonModel == 3)
{
Application.Run(new frmSmartClient(main, serverIP, dBName, IsConsumer));
}
else if (LSParamsFormatter.commonModel == 4)
{
Application.Run(new frmDelete(main, serverIP, dBName, IsConsumer));
}
}
}
}
[DllImport("user32.dll")]
protected static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
}
}
+322
View File
@@ -0,0 +1,322 @@
namespace LSFileClient
{
using LSServerService;
using LSUtils;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class FrmBase : Form
{
protected LSClientMain clientMain;
protected S2C_DownloadFile m_curDownloadingFileInfo;
protected ListNodeData m_currentNodeData;
protected string m_databaseName;
protected List<ListNodeData> m_listNode;
protected string m_serverIP;
protected const int WM_COPYDATA = 74;
protected string isConsumer;
public FrmBase() : this(null, "", "","1")
{
}
public FrmBase(LSClientMain _clientMain, string _serverIP, string _databaseName, string _isConsumer)
{
this.m_serverIP = "";
this.m_databaseName = "";
this.m_currentNodeData = null;
this.m_listNode = new List<ListNodeData>();
this.clientMain = _clientMain;
this.m_serverIP = _serverIP;
this.m_databaseName = _databaseName;
this.isConsumer = _isConsumer;
}
protected ListNodeData getByItem(ListViewItem item)
{
foreach (ListNodeData data in this.m_listNode)
{
if (data.item == item)
{
return data;
}
}
return null;
}
protected ListNodeData getDataById(int fileId)
{
foreach (ListNodeData data in this.m_listNode)
{
if (data.fileId == fileId)
{
return data;
}
}
return null;
}
protected ListNodeData getDataByName(string fileName)
{
foreach (ListNodeData data in this.m_listNode)
{
if (Path.GetFileName(data.absoluteFileName) == fileName)
{
return data;
}
}
return null;
}
protected virtual bool hasParsedMsg(byte[] byteData, LSSocket client, MsgHeader header)
{
return false;
}
[DllImport("user32.dll")]
protected static extern bool IsWindow(IntPtr hWnd);
public void ParseDataFromServerMsg(LSSocketRev socketRev)
{
byte[] byteData = socketRev.ByteData;
LSSocket clientSocket = socketRev.ClientSocket;
MsgHeader header = (MsgHeader) PubUtils.BytesToStruct(byteData, typeof(MsgHeader));
if (header.dwType == S2C2S_Heart.ID)
{
clientSocket.Send(byteData);
}
else if (!this.hasParsedMsg(byteData, clientSocket, header))
{
switch (header.dwType)
{
case 18:
{
S2C_AddFile file = (S2C_AddFile) PubUtils.BytesToStruct(byteData, typeof(S2C_AddFile));
if (file.dwErrId <= 0)
{
this.m_currentNodeData.fileId = file.fi.dwFileId;
this.updateInfoForUp(file.fi.dwFileId);
this.uploadFile(file.fi.dwFileId);
return;
}
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(file.dwErrId), IntPtr.Zero);
return;
}
case 20:
{
S2C_DownloadFile file3 = (S2C_DownloadFile) PubUtils.BytesToStruct(byteData, typeof(S2C_DownloadFile));
this.m_currentNodeData = null;
if (file3.dwErrId <= 0)
{
this.m_currentNodeData = this.getDataById(file3.fi.dwFileId);
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.NOTIFY_READY, IntPtr.Zero, IntPtr.Zero);
string strName = file3.fi.strName;
LSFileData fd = LSFileManage.createClientFile(strName);
if (fd == null)
{
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, IntPtr.Zero, IntPtr.Zero);
}
else
{
fd.dwUserId = LSGlobleVariable.userId;
fd.dwFileId = file3.fi.dwFileId;
LSFileManage.insertFileData(fd);
this.m_curDownloadingFileInfo = file3;
LSWriteLog.WriteLog("downloadfile.log", false, "准备下载文件《{0}》", new object[] { strName });
}
return;
}
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, IntPtr.Zero, IntPtr.Zero);
return;
}
case 23:
{
S2C_DeleteFile file2 = (S2C_DeleteFile) PubUtils.BytesToStruct(byteData, typeof(S2C_DeleteFile));
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.DELETEFILE_MESSAGE, new IntPtr(file2.dwErrId), new IntPtr(file2.dwFileId));
return;
}
case 4097:
{
C2S2C_FileData data = (C2S2C_FileData) PubUtils.BytesToStruct(byteData, typeof(C2S2C_FileData));
if (data.dwErrId <= 0)
{
C2S2C_FileTranslateComplete complete2;
int num = (data.dwTotalBytes == 0) ? 100 : ((int) (100.0 * ((data.dwPacketOrder * 1.0) / ((double) data.dwTotalCount))));
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SETPROGRESS, (IntPtr) num, IntPtr.Zero);
if (LSFileManage.createFileData(data, out complete2))
{
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SUCCESS_MESSAGE, IntPtr.Zero, IntPtr.Zero);
if (this.m_curDownloadingFileInfo.dwTotalCount <= this.m_curDownloadingFileInfo.dwCurrentIndex)
{
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.CLOSE_WINDOW, IntPtr.Zero, IntPtr.Zero);
}
}
return;
}
LSFileManage.eraseFile(this.m_curDownloadingFileInfo.fi.dwFileId);
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, IntPtr.Zero, IntPtr.Zero);
return;
}
case 4098:
{
C2S2C_FileTranslateComplete complete = (C2S2C_FileTranslateComplete) PubUtils.BytesToStruct(byteData, typeof(C2S2C_FileTranslateComplete));
if (complete.dwErrId <= 0)
{
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SUCCESS_MESSAGE, IntPtr.Zero, IntPtr.Zero);
return;
}
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, IntPtr.Zero, IntPtr.Zero);
return;
}
}
LSWriteLog.WriteLog("cantParseData.log", "从服务端接收到的数据不能解析,类型是={0},数据长度={1} 数据是:\n{2} ", new object[] { header.dwType, byteData.Length, byteData });
}
}
protected void removeItem(ListViewItem item)
{
ListNodeData data = this.getByItem(item);
if (data != null)
{
this.m_listNode.Remove(data);
}
}
[DllImport("user32.dll", EntryPoint="SendMessage")]
protected static extern IntPtr SendCopyData(IntPtr hWnd, int msg, IntPtr wParam, ref COPYDATASTRUCT lParam);
[DllImport("user32.dll")]
protected static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
protected void setItemState(int success)
{
this.setItemState(success, "");
}
protected void setItemState(int success, string desc)
{
if (this.m_currentNodeData != null)
{
this.m_currentNodeData.success = success;
this.m_currentNodeData.selected = false;
string str = this.m_currentNodeData.isDownload ? "下载" : "上传";
this.m_currentNodeData.item.SubItems[5].Text = str + ((success == 2) ? "成功" : "失败");
if (success == 3)
{
this.m_currentNodeData.item.SubItems[6].Text = desc + "请联系管理员!";
}
}
LSGlobleVariable.notifyEvent.Set();
}
private void updateInfoForUp(int dwFileId)
{
LSWriteLog.WriteLog("updateInfoForUp.log", false, "开始dwFileId=《{0}》", new object[] { dwFileId });
ListNodeData data = this.getDataById(dwFileId);
if (data != null)
{
//string connectionString = LSIniFile.ReadValue("/Root/ClientSettings", "connectionStr");
//if (connectionString == "")
//{
string connectionString = string.Format("Server={0};Database={1};Persist Security Info=True;User ID=wlms;Password=mymsserver", this.m_serverIP, this.m_databaseName);
if (isConsumer.Equals("0"))
connectionString = string.Format("Server=114.116.145.208,14331;Database=lscrm;Persist Security Info=True;User ID=Lserp_crm;Password=lserp_ERP_@#$_123", this.m_serverIP, this.m_databaseName);
//}
SqlConnection connection = new SqlConnection(connectionString);
try
{
connection.Open();
SqlCommand command = new SqlCommand(string.Format("update P_fm_FileTab set fileNo='{0}', speciesno='{1}',SPNAME='{2}' where fileId={3}", new object[] { data.fileNo, data.specieNo, data.specieName, data.fileId }), connection);
command.ExecuteNonQuery();
command.Dispose();
command = null;
}
catch (Exception exception)
{
PubUtils.WriteLog("updateInfoForUp error: {0}", new object[] { exception });
MessageBox.Show("连接服务器失败,请联系管理员.");
}
connection.Close();
connection = null;
LSWriteLog.WriteLog("updateInfoForUp.log", false, "结束dwFileId=《{0}》", new object[] { dwFileId });
}
}
private void uploadFile(int dwFileId)
{
FileStream stream = null;
try
{
stream = File.Open(this.m_currentNodeData.absoluteFileName, FileMode.Open, FileAccess.Read);
int length = (int) stream.Length;
int num2 = (int) Math.Ceiling((double) ((1.0 * length) / 1024.0));
int num3 = 1;
do
{
C2S2C_FileData structObj = new C2S2C_FileData(true);
int count = length - ((int) stream.Position);
count = (count > 1024) ? 1024 : count;
stream.Read(structObj.FileData, 0, count);
structObj.dwErrId = 0;
structObj.dwFileId = dwFileId;
structObj.dwTotalBytes = length;
structObj.dwTotalCount = num2;
structObj.dwPacketOrder = num3;
structObj.dwPacketLen = count;
this.clientMain.clientSocket.Send(structObj);
num3++;
int num5 = (length == 0) ? 100 : ((int) (100.0 * ((stream.Position * 1.0) / ((double) length))));
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SETPROGRESS, (IntPtr) num5, IntPtr.Zero);
}
while (stream.Position < length);
if (stream != null)
{
stream.Close();
stream = null;
}
}
catch (Exception exception)
{
PubUtils.WriteLog("uploadFile error: {0}", new object[] { exception });
C2S2C_FileData data2 = new C2S2C_FileData(true) {
dwErrId = ErrorType.UNKNOWN,
dwFileId = dwFileId
};
this.clientMain.clientSocket.Send(data2);
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, IntPtr.Zero, IntPtr.Zero);
}
finally
{
if (stream != null)
{
stream.Close();
stream = null;
}
}
}
[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
[MarshalAs(UnmanagedType.LPStr)]
public string lpData;
}
protected class ListNodeData
{
public string absoluteFileName = "";
public int fileId = 0;
public string fileNo = "";
public bool isDownload = false;
public ListViewItem item = null;
public bool selected = false;
public string specieName = "";
public string specieNo = "";
public int success = 0;
}
}
}
@@ -0,0 +1,443 @@
namespace LSFileClient
{
using LSServerService;
using LSUtils;
using System;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;
partial class FrmBatchProgress
{
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmBatchProgress));
this.folderDialog = new System.Windows.Forms.FolderBrowserDialog();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.editContainer = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.txtSpecieName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtSpecieNo = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtFileNo = new System.Windows.Forms.TextBox();
this.txtFileName = new System.Windows.Forms.TextBox();
this.btnSet = new System.Windows.Forms.Button();
this.lstVFileList = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnDelete = new System.Windows.Forms.ToolStripMenuItem();
this.proTranslate = new System.Windows.Forms.ProgressBar();
this.btnDeleteFile = new System.Windows.Forms.Button();
this.btnAddFiles = new System.Windows.Forms.Button();
this.btnRedo = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.editContainer.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.SystemColors.Control;
this.splitContainer1.Panel2.Controls.Add(this.button1);
this.splitContainer1.Panel2.Controls.Add(this.proTranslate);
this.splitContainer1.Panel2.Controls.Add(this.btnDeleteFile);
this.splitContainer1.Panel2.Controls.Add(this.btnAddFiles);
this.splitContainer1.Panel2.Controls.Add(this.btnRedo);
this.splitContainer1.Panel2.Controls.Add(this.btnOK);
this.splitContainer1.Panel2.Controls.Add(this.btnCancel);
this.splitContainer1.Panel2MinSize = 30;
this.splitContainer1.Size = new System.Drawing.Size(755, 476);
this.splitContainer1.SplitterDistance = 431;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 5;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.WhiteSmoke;
this.splitContainer2.Panel1.Controls.Add(this.editContainer);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.lstVFileList);
this.splitContainer2.Size = new System.Drawing.Size(755, 431);
this.splitContainer2.SplitterDistance = 28;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 2;
//
// editContainer
//
this.editContainer.BackColor = System.Drawing.SystemColors.Control;
this.editContainer.Controls.Add(this.label4);
this.editContainer.Controls.Add(this.txtSpecieName);
this.editContainer.Controls.Add(this.label3);
this.editContainer.Controls.Add(this.txtSpecieNo);
this.editContainer.Controls.Add(this.label2);
this.editContainer.Controls.Add(this.txtFileNo);
this.editContainer.Controls.Add(this.txtFileName);
this.editContainer.Controls.Add(this.btnSet);
this.editContainer.Dock = System.Windows.Forms.DockStyle.Top;
this.editContainer.Location = new System.Drawing.Point(0, 0);
this.editContainer.Name = "editContainer";
this.editContainer.Size = new System.Drawing.Size(755, 31);
this.editContainer.TabIndex = 1;
this.editContainer.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(489, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 12);
this.label4.TabIndex = 8;
this.label4.Text = "类别名称";
//
// txtSpecieName
//
this.txtSpecieName.Location = new System.Drawing.Point(542, 4);
this.txtSpecieName.Name = "txtSpecieName";
this.txtSpecieName.ReadOnly = true;
this.txtSpecieName.Size = new System.Drawing.Size(125, 21);
this.txtSpecieName.TabIndex = 7;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(341, 9);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 6;
this.label3.Text = "类别编码";
//
// txtSpecieNo
//
this.txtSpecieNo.Location = new System.Drawing.Point(393, 4);
this.txtSpecieNo.MaxLength = 50;
this.txtSpecieNo.Name = "txtSpecieNo";
this.txtSpecieNo.Size = new System.Drawing.Size(88, 21);
this.txtSpecieNo.TabIndex = 5;
this.txtSpecieNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtSpecieNo_KeyPress);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(182, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 4;
this.label2.Text = "文件编码";
//
// txtFileNo
//
this.txtFileNo.Location = new System.Drawing.Point(237, 4);
this.txtFileNo.MaxLength = 30;
this.txtFileNo.Name = "txtFileNo";
this.txtFileNo.Size = new System.Drawing.Size(99, 21);
this.txtFileNo.TabIndex = 3;
this.txtFileNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtFileNo_KeyPress);
//
// txtFileName
//
this.txtFileName.Location = new System.Drawing.Point(3, 5);
this.txtFileName.Name = "txtFileName";
this.txtFileName.ReadOnly = true;
this.txtFileName.Size = new System.Drawing.Size(177, 21);
this.txtFileName.TabIndex = 1;
//
// btnSet
//
this.btnSet.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSet.Location = new System.Drawing.Point(668, 3);
this.btnSet.Name = "btnSet";
this.btnSet.Size = new System.Drawing.Size(75, 22);
this.btnSet.TabIndex = 0;
this.btnSet.Text = "关联信息";
this.btnSet.UseVisualStyleBackColor = true;
this.btnSet.Click += new System.EventHandler(this.btnSet_Click);
//
// lstVFileList
//
this.lstVFileList.AllowDrop = true;
this.lstVFileList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6,
this.columnHeader7});
this.lstVFileList.ContextMenuStrip = this.contextMenuStrip1;
this.lstVFileList.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstVFileList.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lstVFileList.FullRowSelect = true;
this.lstVFileList.GridLines = true;
this.lstVFileList.HideSelection = false;
this.lstVFileList.Location = new System.Drawing.Point(0, 0);
this.lstVFileList.MultiSelect = false;
this.lstVFileList.Name = "lstVFileList";
this.lstVFileList.Size = new System.Drawing.Size(755, 402);
this.lstVFileList.TabIndex = 0;
this.lstVFileList.UseCompatibleStateImageBehavior = false;
this.lstVFileList.View = System.Windows.Forms.View.Details;
this.lstVFileList.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lstVFileList_ItemSelectionChanged);
this.lstVFileList.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstVFileList_DragDrop);
this.lstVFileList.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstVFileList_DragEnter);
//
// columnHeader1
//
this.columnHeader1.Text = "名称";
this.columnHeader1.Width = 180;
//
// columnHeader2
//
this.columnHeader2.Text = "大小";
this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.columnHeader2.Width = 80;
//
// columnHeader3
//
this.columnHeader3.Text = "创建时间";
this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.columnHeader3.Width = 130;
//
// columnHeader4
//
this.columnHeader4.Text = "类别名称";
this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.columnHeader4.Width = 120;
//
// columnHeader5
//
this.columnHeader5.Text = "文件编码";
this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.columnHeader5.Width = 80;
//
// columnHeader6
//
this.columnHeader6.Text = "状态";
this.columnHeader6.Width = 120;
//
// columnHeader7
//
this.columnHeader7.Text = "";
this.columnHeader7.Width = 120;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnDelete});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 26);
//
// btnDelete
//
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(124, 22);
this.btnDelete.Text = "删除记录";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// proTranslate
//
this.proTranslate.BackColor = System.Drawing.Color.Silver;
this.proTranslate.Dock = System.Windows.Forms.DockStyle.Top;
this.proTranslate.ForeColor = System.Drawing.SystemColors.ControlText;
this.proTranslate.Location = new System.Drawing.Point(0, 0);
this.proTranslate.Name = "proTranslate";
this.proTranslate.Size = new System.Drawing.Size(755, 12);
this.proTranslate.TabIndex = 11;
//
// btnDeleteFile
//
this.btnDeleteFile.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDeleteFile.Location = new System.Drawing.Point(371, 18);
this.btnDeleteFile.Name = "btnDeleteFile";
this.btnDeleteFile.Size = new System.Drawing.Size(89, 24);
this.btnDeleteFile.TabIndex = 10;
this.btnDeleteFile.Text = "删除文件";
this.btnDeleteFile.UseVisualStyleBackColor = true;
this.btnDeleteFile.Click += new System.EventHandler(this.btnDeleteFile_Click);
//
// btnAddFiles
//
this.btnAddFiles.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddFiles.Location = new System.Drawing.Point(276, 18);
this.btnAddFiles.Name = "btnAddFiles";
this.btnAddFiles.Size = new System.Drawing.Size(89, 24);
this.btnAddFiles.TabIndex = 9;
this.btnAddFiles.Text = "添加文件";
this.btnAddFiles.UseVisualStyleBackColor = true;
this.btnAddFiles.Visible = false;
this.btnAddFiles.Click += new System.EventHandler(this.btnAddFiles_Click);
//
// btnRedo
//
this.btnRedo.Enabled = false;
this.btnRedo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRedo.Location = new System.Drawing.Point(466, 17);
this.btnRedo.Name = "btnRedo";
this.btnRedo.Size = new System.Drawing.Size(89, 24);
this.btnRedo.TabIndex = 7;
this.btnRedo.Text = "重新下载";
this.btnRedo.UseVisualStyleBackColor = true;
this.btnRedo.Click += new System.EventHandler(this.btnRedo_Click);
//
// btnOK
//
this.btnOK.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(561, 17);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(89, 24);
this.btnOK.TabIndex = 5;
this.btnOK.Text = "确定下载";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(656, 17);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(89, 24);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消下载";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(184, 18);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(89, 24);
this.button1.TabIndex = 13;
this.button1.Text = "打开拍摄仪";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.Filter = "高拍仪程序|*.exe";
//
// timer1
//
this.timer1.Interval = 3000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmBatchProgress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
this.ClientSize = new System.Drawing.Size(755, 476);
this.Controls.Add(this.splitContainer1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "FrmBatchProgress";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Load += new System.EventHandler(this.FrmBatchProgress_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.editContainer.ResumeLayout(false);
this.editContainer.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
private IContainer components;
private Button btnAddFiles;
private Button btnCancel;
private ToolStripMenuItem btnDelete;
private Button btnDeleteFile;
private Button btnOK;
private Button btnRedo;
private Button btnSet;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader2;
private ColumnHeader columnHeader3;
private ColumnHeader columnHeader4;
private ColumnHeader columnHeader5;
private ColumnHeader columnHeader6;
private ColumnHeader columnHeader7;
private ContextMenuStrip contextMenuStrip1;
private Panel editContainer;
private FolderBrowserDialog folderDialog;
private Label label2;
private Label label3;
private Label label4;
private ListView lstVFileList;
private OpenFileDialog openFileDialog;
private SplitContainer splitContainer1;
private SplitContainer splitContainer2;
private TextBox txtFileName;
private TextBox txtFileNo;
private TextBox txtSpecieName;
private TextBox txtSpecieNo;
private ProgressBar proTranslate;
private Button button1;
private OpenFileDialog openFileDialog1;
private System.Windows.Forms.Timer timer1;
}
}
@@ -0,0 +1,863 @@
namespace LSFileClient
{
using LSServerService;
using LSUtils;
using System;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Data;
using CommonLib;
using System.Diagnostics;
using System.Drawing.Imaging;
public partial class FrmBatchProgress : FrmBase
{
private bool _imageUpLoad;
public FrmBatchProgress()
: this(null, "", "","1")
{
}
public FrmBatchProgress(LSClientMain _clientMain, string _serverIP, string _databaseName, string _isConsumer)
: base(_clientMain, _serverIP, _databaseName, _isConsumer)
{
this.components = null;
try
{
string file = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)), "SystemResources.ini");
string connectionStr = "";
if (File.Exists(file))
{
string lastIPPort = string.Format("{0}:{1}", IniUtil.Read(file, "LocalLastIP"), IniUtil.Read(file, "LocalLastPort"));
string downloadAESStrKey = string.Format("DownloadAESStr_{0}", lastIPPort);
string[] downloadAESStrValue = IniUtil.Read(file, downloadAESStrKey).Split('^');
string downloadAESStr = downloadAESStrValue.Length == 2 ? downloadAESStrValue[1] : "";
string configFlag = IniUtil.Read(file, "FrmConfigFlag");
if (configFlag.Equals("1"))
{
//string args = AESUtil.Decrypt(File.ReadAllText(file));
if (!string.IsNullOrEmpty(downloadAESStr))
{
string args = AESUtil.Decrypt(downloadAESStr);
string[] controlAfgs = args.Split('^');
if (controlAfgs != null && controlAfgs.Length == 5)
{
connectionStr = "Server=" + controlAfgs[0] + ";Database=" + controlAfgs[1] + ";Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
}
}
}
else
{
connectionStr = DBConfig.Instance.GetConStr();
}
}
if (string.IsNullOrEmpty(connectionStr))
{
connectionStr = DBConfig.Instance.GetConStr();
}
DBConfig.Instance.CreateNewConnection(connectionStr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
this.isConsumer = _isConsumer;
this.InitializeComponent();
}
private void addFiles(string[] files)
{
for (int i = 0; i < files.Length; i++)
{
string path = files[i];
if (File.Exists(path))
{
ListViewItem item = null;
FrmBase.ListNodeData data = base.getDataByName(Path.GetFileName(path));
bool flag = data != null;
if (data == null)
{
item = new ListViewItem();
data = new FrmBase.ListNodeData();
}
else
{
if (MessageBox.Show("确定覆盖文件\"" + Path.GetFileName(path) + "\"吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
continue;
}
item = data.item;
}
data.selected = true;
data.absoluteFileName = path;
item.Text = Path.GetFileName(path);
FileInfo info = new FileInfo(path);
if (flag)
{
item.SubItems[1].Text = info.Length.ToString();
item.SubItems[2].Text = "";
item.SubItems[3].Text = "";
item.SubItems[4].Text = "";
item.SubItems[5].Text = "";
item.SubItems[6].Text = "";
}
else
{
item.SubItems.Add(info.Length.ToString());
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
this.lstVFileList.Items.Add(item);
data.item = item;
base.m_listNode.Add(data);
}
if (LSParamsFormatter.paramsCount == 11 || LSParamsFormatter.paramsCount == 12)
{
item.Selected = true;
}
}
}
}
private void batchUploadThread()
{
Thread.CurrentThread.IsBackground = true;
try
{
for (int i = 0; i < base.m_listNode.Count; i++)
{
base.m_currentNodeData = base.m_listNode[i];
if (base.m_currentNodeData.selected)
{
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.NOTIFY_READY, IntPtr.Zero, IntPtr.Zero);
string absoluteFileName = base.m_currentNodeData.absoluteFileName;
LSWriteLog.WriteLog("createdir.log", false, "准备创建文件《{0}》", new object[] { absoluteFileName });
FileInfo info = new FileInfo(absoluteFileName);
int length = (int)info.Length;
int directoryId = LSParamsFormatter.directoryId;
string sName = _imageUpLoad ? Path.GetFileName(absoluteFileName) : base.m_currentNodeData.fileNo + "_" + Path.GetFileName(absoluteFileName);
// 上传检查记录
if (this.AttachOperation(1, LSParamsFormatter.userId, "", base.m_currentNodeData.specieNo, 0, sName, length))
{
if (base.clientMain.readyCreateFile(directoryId, sName, length, 0))
{
LSGlobleVariable.notifyEvent.WaitOne();
}
}
else
{
}
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("frmFileManager.batchUploadThread errorcode: {0} ", new object[] { exception });
}
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.BATCHUPLOADCOMPLETED, IntPtr.Zero, IntPtr.Zero);
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.CLOSE_WINDOW, IntPtr.Zero, IntPtr.Zero);
}
private void beginUploadBatch()
{
LSGlobleVariable.notifyEvent.Reset();
new Thread(new ThreadStart(this.batchUploadThread)).Start();
}
private void btnAddFiles_Click(object sender, EventArgs e)
{
if (this.openFileDialog.ShowDialog() == DialogResult.OK)
{
if (this.openFileDialog.FileNames.Length > 0)
{
this.addFiles(this.openFileDialog.FileNames);
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
base.Close();
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (this.lstVFileList.SelectedItems.Count > 0)
{
ListViewItem item = this.lstVFileList.SelectedItems[0];
base.removeItem(item);
if (this.editContainer.Visible)
{
this.txtFileName.Text = this.txtFileNo.Text = this.txtSpecieNo.Text = this.txtSpecieName.Text = "";
}
this.lstVFileList.Items.Remove(item);
}
}
private void btnDeleteFile_Click(object sender, EventArgs e)
{
if (this.lstVFileList.SelectedItems.Count <= 0)
{
MessageBox.Show("请选择一个文件删除");
}
else if (MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.Cancel)
{
try
{
ListViewItem item = this.lstVFileList.SelectedItems[0];
base.m_currentNodeData = base.getByItem(item);
if (base.m_currentNodeData != null)
{
if (!(base.m_currentNodeData.isDownload || (base.m_currentNodeData.fileId != 0)))
{
MessageBox.Show("还未上传无需删除!");
}
else
{
this.btnOK.Enabled = this.btnCancel.Enabled = this.btnRedo.Enabled = this.btnDelete.Enabled = this.btnAddFiles.Enabled = false;
C2S_DeleteFile structObj = new C2S_DeleteFile(true)
{
dwFileId = base.m_currentNodeData.fileId
};
base.clientMain.clientSocket.Send(structObj);
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DELETECOMPLETED, IntPtr.Zero, IntPtr.Zero);
}
}
}
catch (Exception)
{
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DELETEERROR, IntPtr.Zero, IntPtr.Zero);
}
}
}
private void btnOK_Click(object sender, EventArgs e)
{
if (LSParamsFormatter.type == fmTypes.upByParentId)
{
if (base.m_listNode.Count <= 0)
{
MessageBox.Show("列表没有文件,请添加要上传的文件。");
}
else
{
for (int i = 0; i < base.m_listNode.Count; i++)
{
FrmBase.ListNodeData data = base.m_listNode[i];
if (data.selected && ((data.specieName == "") || (data.fileNo == "")))
{
MessageBox.Show("有文件没有关联到必须的信息.");
return;
}
}
this.btnRedo.Enabled = this.btnOK.Enabled = this.btnCancel.Enabled = this.btnDelete.Enabled = this.btnAddFiles.Enabled = false;
this.beginUploadBatch();
}
}
else if (base.m_listNode.Count > 50)
{
MessageBox.Show(string.Format("最多支持{0}个下载", 50));
}
else if (this.folderDialog.ShowDialog() == DialogResult.OK)
{
string str = this.folderDialog.SelectedPath.Trim();
if (str != "")
{
LSFileManage.init(str + @"\");
this.btnRedo.Enabled = this.btnOK.Enabled = this.btnCancel.Enabled = this.btnDelete.Enabled = this.btnAddFiles.Enabled = false;
this.reqDownloadFiles();
}
}
}
/// <summary>
/// <para>说明:附件操作之前调用</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-09-28 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="operType">1=上传,2=下载,3=删除,4=锁定,5=解除锁定 必填</param>
/// <param name="userId">The user identifier.</param>
/// <param name="userName">Name of the user.</param>
/// <param name="fileSpecisNo">The file specis no.</param>
/// <param name="filename">The filename.</param>
/// <param name="filesize">The filesize.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool AttachOperation(int operType, int userId, string userName, string fileSpecisNo, int fileid, string filename, int filesize)
{
try
{
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
pMsg.Direction = ParameterDirection.Output;
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
returnValue.Direction = ParameterDirection.ReturnValue;
SqlParameter[] param =
{
new SqlParameter("@opertype",SqlDbType.Int),
new SqlParameter("@operatorid",SqlDbType.Int),
new SqlParameter("@operatorname",SqlDbType.VarChar,50),
new SqlParameter("@fileSpecisNo",SqlDbType.VarChar,50),
new SqlParameter("@fileid",SqlDbType.Int),
new SqlParameter("@filename",SqlDbType.VarChar,200),
new SqlParameter("@filesize",SqlDbType.Int),
pMsg,
returnValue
};
param[0].Value = operType;
param[1].Value = userId;
param[2].Value = userName;
param[3].Value = fileSpecisNo;
param[4].Value = fileid;
param[5].Value = filename;
param[6].Value = filesize;
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_SystemAttachOperation", "attach", param);
string msg = pMsg.Value.ToString();
int rVaule = Convert.ToInt32(returnValue.Value + "");
if (rVaule != 1)
{
MessageBox.Show(msg);
return false;
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return true;
}
private void btnRedo_Click(object sender, EventArgs e)
{
if (this.lstVFileList.SelectedItems.Count <= 0)
{
MessageBox.Show("请选择一个文件" + this.btnRedo.Text);
}
else if (MessageBox.Show("确定" + this.btnRedo.Text + "?", "提示", MessageBoxButtons.OKCancel) != DialogResult.Cancel)
{
ListViewItem item = this.lstVFileList.SelectedItems[0];
base.m_currentNodeData = base.getByItem(item);
if (base.m_currentNodeData != null)
{
base.m_currentNodeData.selected = true;
}
this.btnOK_Click(sender, e);
}
}
private void btnSet_Click(object sender, EventArgs e)
{
this.querySpeciesName(true);
}
private void FrmBatchProgress_Load(object sender, EventArgs e)
{
LSGlobleVariable.masterForm = this;
LSGlobleVariable.hWndMain = base.Handle;
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1298, base.Handle, IntPtr.Zero);
LSParamsFormatter.setPosistion(this);
switch (LSParamsFormatter.type)
{
case fmTypes.upByParentId:
this.Text = "上传文件";
this.btnRedo.Text = "重新上传";
this.btnOK.Text = "确定上传";
this.btnCancel.Text = "退出上传";
this.openFileDialog.Multiselect = true;
this.btnAddFiles.Visible = true;
this.editContainer.Visible = true;
this.splitContainer2.Panel1Collapsed = false;
if (LSParamsFormatter.commonModel == 12)
{
this._imageUpLoad = true;
this.addFiles(new string[] { LSParamsFormatter.filePath });
this.btnOK.PerformClick();
}
break;
case fmTypes.downByParentId:
if (MessageBox.Show("确认下载?", "询问", MessageBoxButtons.YesNo) != DialogResult.No)
{
break;
}
base.Close();
return;
case fmTypes.downByFileIds:
this.Text = "下载文件";
this.reqIdsDetais();
break;
}
this.Text = this.Text + " V1011-0.4 域名解析版";
}
private void lstVFileList_DragDrop(object sender, DragEventArgs e)
{
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
this.addFiles(data);
}
private void lstVFileList_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll;
}
}
private void lstVFileList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (this.editContainer.Visible)
{
string text = e.Item.Text;
FrmBase.ListNodeData data = base.getDataByName(Path.GetFileName(text));
if (data == null)
{
this.txtFileName.Text = this.txtFileNo.Text = this.txtSpecieNo.Text = this.txtSpecieName.Text = "";
}
else
{
this.txtFileName.Text = text;
this.txtFileNo.Text = data.fileNo;
this.txtSpecieNo.Text = data.specieNo;
this.txtSpecieName.Text = data.specieName;
this.txtFileNo.Focus();
if (LSParamsFormatter.paramsCount == 11 || LSParamsFormatter.paramsCount == 12)
{
this.txtSpecieNo.Text = LSParamsFormatter.specieNo;
this.txtFileNo.Text = LSParamsFormatter.fileNumber;
this.btnSet_Click(null, null);
}
}
}
}
private void NotifyPercent(int nPercent)
{
this.proTranslate.Value = nPercent;
}
private void querySpeciesName(bool commit)
{
if (commit && (this.txtFileName.Text == ""))
{
MessageBox.Show("请选择要关联的文件");
}
else
{
string str = this.txtFileNo.Text.Trim();
string str2 = this.txtSpecieNo.Text.Trim();
if (commit && (str == ""))
{
MessageBox.Show("请输入文件编码");
}
else if (commit && (str2 == ""))
{
MessageBox.Show("请输入类别编码");
}
else
{
string text = this.txtFileName.Text;
FrmBase.ListNodeData data = base.getDataByName(Path.GetFileName(text));
if (data == null)
{
MessageBox.Show("没关联到文件");
}
else
{
data.fileNo = str;
data.specieNo = str2;
this.txtSpecieName.Text = "";
//string connectionString = LSIniFile.ReadValue("/Root/ClientSettings", "connectionStr");
//if (connectionString == "")
//{
string connectionString = string.Format("Server={0};Database={1};Persist Security Info=True;User ID=wlms;Password=mymsserver", base.m_serverIP, base.m_databaseName);
//}
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand(string.Format("select speciesName from Bmp_productspeciestab where speciesNo='{0}' ", str2), connection);
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
if (commit)
{
data.specieName = reader["speciesName"].ToString();
}
this.txtSpecieName.Text = reader["speciesName"].ToString();
}
reader.Close();
}
command.Dispose();
connection.Close();
}
}
catch (Exception exception)
{
PubUtils.WriteLog("btnSet_Click error: {0}", new object[] { exception });
MessageBox.Show("连接服务器失败,请联系管理员.");
}
if (commit)
{
data.item.SubItems[4].Text = data.fileNo;
data.item.SubItems[3].Text = data.specieName;
}
if (this.txtSpecieName.Text.Trim() == "")
{
MessageBox.Show("类别编码输入有错");
}
}
}
}
}
private void reqDownloadFiles()
{
int index = 0;
bool canDownLoad = false;
int[] sourceArray = new int[50];
for (int i = 0; i < base.m_listNode.Count; i++)
{
FrmBase.ListNodeData data = base.m_listNode[i];
if (data.selected)
{
if (this.AttachOperation(2, LSParamsFormatter.userId, "", "", data.fileId, "", 0))
{
canDownLoad = true;
sourceArray[index] = data.fileId;
index++;
}
}
}
if (canDownLoad)
{
C2S_DownloadFile reqDownload = new C2S_DownloadFile(true);
Array.Copy(sourceArray, 0, reqDownload.dwFileIds, 0, (index > reqDownload.dwFileIds.Length) ? reqDownload.dwFileIds.Length : index);
base.clientMain.requestDownloadFile(reqDownload);
}
}
private void reqIdsDetais()
{
//string connectionString = LSIniFile.ReadValue("/Root/ClientSettings", "connectionStr");
//if (connectionString == "")
//{
string connectionString = string.Format("Server={0};Database={1};Persist Security Info=True;User ID=wlms;Password=mymsserver", base.m_serverIP, base.m_databaseName);
//}
SqlConnection connection = new SqlConnection(connectionString);
try
{
connection.Open();
int[] fileIds = LSParamsFormatter.fileIds;
string str2 = "select fileId,sName,CreateTime,fileSize from p_fm_fileTab where fileId in(";
for (int i = 0; i < fileIds.Length; i++)
{
str2 = str2 + fileIds[i].ToString() + ",";
}
SqlCommand command = new SqlCommand(str2.Substring(0, str2.Length - 1) + ")", connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
FrmBase.ListNodeData data = new FrmBase.ListNodeData
{
isDownload = true,
selected = true,
fileId = int.Parse(reader["fileId"].ToString())
};
ListViewItem item = new ListViewItem
{
Text = reader["sName"].ToString()
};
item.SubItems.Add(reader["fileSize"].ToString());
item.SubItems.Add(reader["CreateTime"].ToString());
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
this.lstVFileList.Items.Add(item);
data.item = item;
base.m_listNode.Add(data);
}
reader.Close();
reader.Dispose();
reader = null;
command.Dispose();
command = null;
}
catch (Exception exception)
{
PubUtils.WriteLog("reqIdsDetais error: {0}", new object[] { exception });
MessageBox.Show("连接服务器失败,请联系管理员.");
}
connection.Close();
connection = null;
}
private void txtFileNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar == '\r') && (this.txtFileNo.Text.Trim() != "")) && (this.txtFileName.Text != ""))
{
this.txtSpecieNo.Focus();
}
}
private void txtSpecieNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (((e.KeyChar == '\r') && (this.txtSpecieNo.Text.Trim() != "")) && (this.txtFileName.Text != ""))
{
this.querySpeciesName(false);
}
}
protected override void WndProc(ref Message msg)
{
if (msg.Msg == LSCustomWinMsg.SUCCESS_MESSAGE)
{
base.setItemState(2);
}
else
{
int wParam;
if (msg.Msg == LSCustomWinMsg.FAIL_MESSAGE)
{
wParam = (int)msg.WParam;
if (wParam == ErrorType.FILE_BEEN_LOCKED)
{
base.setItemState(3, "附件已经被锁定,");
}
else
{
base.setItemState(3);
}
}
else if (msg.Msg == LSCustomWinMsg.SETPROGRESS)
{
this.NotifyPercent((int)msg.WParam);
}
else if (msg.Msg == LSCustomWinMsg.CLOSE_WINDOW)
{
this.btnRedo.Enabled = true;
if (this.btnAddFiles.Visible)
{
this.btnOK.Enabled = this.btnAddFiles.Enabled = true;
}
this.btnCancel.Enabled = true;
}
else if (msg.Msg == LSCustomWinMsg.NOTIFY_READY)
{
if (base.m_currentNodeData != null)
{
base.m_currentNodeData.success = 1;
base.m_currentNodeData.selected = false;
base.m_currentNodeData.item.SubItems[5].Text = base.m_currentNodeData.isDownload ? "下载中.." : "上传中..";
}
}
else if (msg.Msg == LSCustomWinMsg.CONNECT_ERROR)
{
MessageBox.Show("连接服务器失败,请联系管理员!");
}
else
{
if (msg.Msg == LSCustomWinMsg.DELETEFILE_MESSAGE)
{
this.btnOK.Enabled = this.btnCancel.Enabled = this.btnRedo.Enabled = this.btnDelete.Enabled = this.btnAddFiles.Enabled = true;
wParam = (int)msg.WParam;
int lParam = (int)msg.LParam;
if (wParam > 0)
{
if (wParam == ErrorType.FILE_BEEN_LOCKED)
{
MessageBox.Show("附件已经被锁定,请联系管理员!");
}
else
{
MessageBox.Show("删除出错!");
}
}
else
{
base.m_currentNodeData = base.getDataById(lParam);
if (base.m_currentNodeData != null)
{
ListViewItem item = base.m_currentNodeData.item;
base.removeItem(item);
this.lstVFileList.Items.Remove(item);
}
MessageBox.Show("删除成功.");
}
}
base.WndProc(ref msg);
}
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string path = IniUtil.ReadFileConfig("GPYPath");
string psy_Images = Application.StartupPath + "/Psy_Images";
if (string.IsNullOrEmpty(path))
{
MessageBox.Show("请先选择拍摄仪运行程序");
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (this.openFileDialog1.FileNames.Length > 0)
{
path = openFileDialog1.FileName;
IniUtil.WriteFileConfig("GPYPath", path);
}
}
}
try
{
Directory.Delete(psy_Images, true);
}
catch (Exception)
{
}
if (!Directory.Exists(psy_Images))
{
Directory.CreateDirectory(psy_Images);
}
if (!string.IsNullOrEmpty(path))
{
timer1.Start();
StartProcess(path);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public static void StartProcess(string exeName, string[] args = null)
{
try
{
if (args == null) args = new string[] { };
string arg = string.Empty;
foreach (string s in args)
{
arg += s + " ";
}
Process myprocess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(exeName, arg.Trim());
myprocess.StartInfo = startInfo;
myprocess.StartInfo.UseShellExecute = false;
myprocess.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
try
{
string psy_Images = Application.StartupPath + "/Psy_Images";
DirectoryInfo root = new DirectoryInfo(psy_Images);
foreach (FileInfo f in root.GetFiles("*.bmp"))
{
string name = f.Name;
string pngPath = Path.Combine(root.FullName, f.Name.Replace(".bmp", "") + ".png");
if (File.Exists(pngPath)) continue;
ImageUtil.Format(f.FullName, pngPath, ImageFormat.Png, ImageUtil.ImgDeep.D8, 100, 100);//此图片作为判断依据
pngPath = Path.Combine(root.FullName, DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png");
ImageUtil.Format(f.FullName, pngPath, ImageFormat.Png, ImageUtil.ImgDeep.D8, 1366, 1366);//此图片作为上传图片
if (File.Exists(pngPath))
{
this.addFiles(new string[] { pngPath }, false);
}
}
}
catch (Exception)
{
}
}
private void addFiles(string[] files, bool isTip = true)
{
for (int i = 0; i < files.Length; i++)
{
string path = files[i];
if (File.Exists(path))
{
ListViewItem item = null;
FrmBase.ListNodeData data = base.getDataByName(Path.GetFileName(path));
bool flag = data != null;
if (data == null)
{
item = new ListViewItem();
data = new FrmBase.ListNodeData();
}
else
{
if (!isTip) continue;
if (MessageBox.Show("确定覆盖文件\"" + Path.GetFileName(path) + "\"吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
continue;
}
item = data.item;
}
data.selected = true;
data.absoluteFileName = path;
item.Text = Path.GetFileName(path);
FileInfo info = new FileInfo(path);
if (flag)
{
item.SubItems[1].Text = info.Length.ToString();
item.SubItems[2].Text = "";
item.SubItems[3].Text = "";
item.SubItems[4].Text = "";
item.SubItems[5].Text = "";
item.SubItems[6].Text = "";
}
else
{
item.SubItems.Add(info.Length.ToString());
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add("");
this.lstVFileList.Items.Add(item);
data.item = item;
base.m_listNode.Add(data);
}
if (LSParamsFormatter.paramsCount == 11 || LSParamsFormatter.paramsCount == 12)
{
item.Selected = true;
}
}
}
}
}
}
@@ -0,0 +1,470 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="folderDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>318, 17</value>
</metadata>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>182, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>439, 18</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>580, 20</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAcAICAQAAEABADoAgAAdgAAABAQEAABAAQAKAEAAF4DAAAgIAAAAQAIAKgIAACGBAAAEBAAAAEA
CABoBQAALg0AADAwAAABACAAqCUAAJYSAAAgIAAAAQAgAKgQAAA+OAAAEBAAAAEAIABoBAAA5kgAACgA
AAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA
gACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAA////8AAAAAAA
AAAAAAAAD4MzM48AAAAAB3d3d3d3d/gzMzg48AAAAIAAAAAAAADzMzOPg/cAAACAAAAAAAAA8zMzMzP3
AAAAgAIiACIP//MzM/////8AAIAAAAAA+ETzMzMzMzM48ACAAiIAL4RE8zMzMzMzM48AgAAAAA9ERPgz
MzMzMzM/AIACIgAvRESPgzMzMzMzPwCAAAAAD0RESP////gzMz8AgAIiAC9ERERERESPgzM/AIAAAAAP
RERERERESPMzPwCAAiIAL4RERERERETzM48AgAAAAAD4RERERERE8zjwAIACIgAiL/////hERP//AACA
AAAAAAAA9ERERET3AAAAgAIiACIiAPSPhERE9wAAAIAAAAAAAAD4SERESPcAAACAAiIAIiIiD4RERI93
AAAAgAAAAAAAAAD////3BwAAAIACIg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cVH/T3xV/014U/9Jak3/9Pb1/1fe
//9H2P//Q9X//z/S//87zv//Nsv//zLI//9u1///9vz//2bR//8wvv///v7+8AAAAAIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtSUlL/U1NT/0dUSf9KZE7/TnJT/0tmT/9Sf1j/R1NJ/0RE
RP9HVEn/TGtQ/0ZWSP9Se1f/T29U/1BwVP9QcVX/TmxS/1F4Vv9JWEv/Q0VD/0dXSf9LZ0//R1pK/01z
Uv9LblD//////0/e//9L2///R9j//0LU//8+0f//Os7//zXK//9w2P//9vz//2nT//8kvP///////wAA
AAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtUVFT/VVVV/0VHRf9GT0f/SVdL/0lW
S/9KWEz/SlVL/0ZJRv9BQUH/QUZC/0VLRv9JT0r/SlJL/0pSS/9KUkv/SlJL/0lPSv9ITEj/R01I/0hQ
Sf9HT0j/Rk5H/0VMRv9ES0X//////1Ph//9O3v//Str//0bX//9C1P//PdD//znN//81yv//MMX//yzC
//8ov////////wAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtVVVX/VlZW/0dK
R/9IUkr/SlZM/01aTv9NXU//SlJL/0ZLR/9AQUD/Rk9H/0lPSv9OWk//TVhP/05bUP9PXlH/TltQ/1Nv
V/9OYFD/SE5J/1dkWf+4vbj/9fb1/////////////////1bk//9S4f//Tt3//0na//9F1///sO3/////
////////////////////////////////////////////8f///5oAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAtXV1f/WFhY/0xXTv9TeFj/VHhZ/1Z7W/9PYlL/UnBW/0NFQ/9HWEn/T2hT/1V2Wv9XeVv/WH1d/1qD
X/9YfF3/V3lb/0tOS/9JTkr/W4Ng/+Dv4v/RuZ3/pXxK/5pxP/+Wb0D//////1rm//9V4///UeD//03d
//9J2f//RNb//0DT//88z///N8z//zPJ//8vxP//K8H//ya+//8iuv//Lbz//47c///+///MAAAAAAAA
AAAAAAAAAAAAAAAAAAtZWVn/Wlpa/05bUP9Ra1X/Vnpb/1NuV/9SaVX/TWFQ/z9AQP9JV0v/TVdP/1Vt
WP9Ze17/U2RV/1ZvWf9Zel3/VnNa/0tNS/9JTUr/qc2t/9/MtP+ndzz/o3U9/55zPv+acT///////13p
//9Z5v//VeP//1Df//9M3P//SNn//0PV//8/0v//O8///zfL//8yyP//LsT//yrA//8lvf//Ibr//x+4
//+q5f//////gQAAAAAAAAAAAAAAAAAAAAtbW1v/XFxc/0xOTf9NVk//UF5S/1FdU/9QZFP/Rk5H/0FE
Qv9HR0f/T1JP/1BVUf9RV1L/UVlT/1FXUv9QU1D/T1JP/0xPTP9ITEn/3N3c/8CXZP+reTz/pnc9/6J1
Pf+dcz7//////2Hs//9c6f//WOX//1Ti//9Q3///S9v//0fY//9D1f//PtH//zrO//82y///Mcf//y3D
//8pwP//Jbz//yC5//9PyP//////zgAAAAAAAAAAAAAAAAAAAAtdXV3/XV1d/05RTv9PWVH/UVxT/1Ff
U/9LWE3/RE1F/0ZKR/9NTk3/U1pU/1VhV/9XZln/VWBX/1VhV/9bd1//V2xa/0pNSv9IUEn/+vr6/7WB
Qf+uezv/qnk8/6V3Pf+hdD7//////3Pv//9g6///XOj//1fl//9T4f//T97//0rb//9G1///QtT//z7R
//85zf//Ncr//zHH//8swv//KL///yS8//8ou///////9wAAAAAAAAAAAAAAAAAAAAteXl7/X19f/1Ne
VP9bfmD/W39g/1l+Xv9Yg17/R1FI/0xPTP9XZln/X4Bj/1+BZP9fgmT/YYdm/1pvXf9TWFT/TU1N/1Rw
WP9LWUz//////7d/Of+yfDr/rno7/6l4PP+ldj3/9fDq/9f6//9z7///X+v//1vn//9X5P//UuH//07d
//9K2v//Rdf//0HT//890P//OM3//zTJ//8wxf//LML//ye///8ju////////wAAAAAAAAAAAAAAAAAA
AAtgYGD/YGBg/1ViV/9Zclz/XH9h/1FrVf9HVUn/U2pW/1BRUP9ZZVr/Y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J/wkJCf8JCQn/CQkJ/+/v
7/9n5P//TNz//0bX//9A0///O87//zXK///U8///z/H//z/E///8/PzxAAAAFwAAAAMAAAAAAAAAAAAA
AAAAAAABAAAAFjQ0NOc3Nzf/OlA9/zpRPf87TT3/Nzc3/zpEO/87TD3/O0g8/zxPPv89VkD/O0w9/ztQ
Pv87Sz3//////1bk//9R4P//S9v//0XX//8/0v//Oc3//9X0///Q8v//KL////////8AAAAhAAAABgAA
AAAAAAAAAAAAAAAAAAIAAAAZUlJS/0hISP9GbEv/SHBN/0VXR/9BQUH/Rl1J/0dfSv9Jb07/SGZM/0p1
UP9JcE7/SXFO/0JKQ///////W+j//1Xj//9Q3///Str//0TW//8+0f//OM3//zLI//8tw////////wAA
ACUAAAAHAAAAAAAAAAAAAAAAAAAAAgAAABlVVVX/S0tL/0RORf9DRkP/RlFH/0RERP9ERET/Q0ND/0RE
RP9FRUX/oqKi//T09P////////////////9g6///Wuf//1Ti//9P3v//tPD/////////////////////
///////////////////////v////gQAAAAAAAAACAAAAGVdXV/9NTU3/SV5L/0lZS/9KXEz/R0dH/0lZ
S/9EUkb/S2ZP/4+YkP/t5dr/p4NW/5VvQP+ObEH//////2Lt//9f6v//Web//1Pi//9N3f//R9j//0LU
//88z///Nsv//zDF//8rwf//Jbz//zzB///V8v//////gQAAAAIAAAAZWlpa/09PT/9PdFT/S11O/09q
Uv9ISEj/SV5L/0ZRR/9RdFb/2t3a/7uZbf+gdD7/mnE//5NuQP//////Yu3//2Lt//9e6v//WOX//1Lh
//9M3P//Rtj//0HT//87z///Ncr//y/F//8pwP//JLz//1nL///////IAAAAAgAAABlcXFz/UlJS/0tV
Tf9LUUz/TVVO/0dHR/9BQUH/SUlJ/01NTf/5+fn/rn5D/6V2Pf+ecz7/mHA///////9i7f//Yu3//2Hs
//9d6f//V+T//1Hg//9L2///Rdf//0DS//86zv//NMn//y7E//8ov///K73///////YAAAACAAAAGV5e
Xv9UVFT/UWVT/1NuV/9PXFD/QkJC/0lXS/9QVVD/VnBZ//////+wezv/qXg8/6N2Pf+dcz7/9O/q/4Hx
//9i7f//Yu3//2Hs//9b6P//VuP//1Df//9K2v//RNb//z/R//85zf//M8j//y3D//8nvv///////wAA
AAIAAAAZYWFh/1ZWVv9XfFz/U2JV/09nUv9BQUH/VW9Y/1yEYf9bfV///////7V+Ov+uezv/qHg8/6J1
Pf+2l3D/9O/p///////////////////////////////////////q+v//ct///z3R//83zP//Msj//yzC
////////AAAAAgAAABljY2P/WVlZ/1JaU/9PVFD/REpE/0hISP9TU1P/VVVV/1VVVf//////uYA5/7N9
Ov+tejv/p3c8/6F1Pv+bcj//lW9A/49sQf+JaUL/g2ZE/31kRf98Y0X/fGNF/5aCaf/q+v//QtT//zzQ
//82y///Mcf///////8AAAACAAAAGWVlZf9bW1v/VmVY/0lOSv9LXE3/UlJS/1tsXv9db1//XnVh//r6
+v/Bhz//uH85/7J9Ov+sejv/pnc9/6B0Pv+acT//lG5A/45rQf+IaUP/gmZE/31jRf98Y0X/fWRG////
//9H2P//QdP//zvP//89zP//////9gAAAAIAAAAZZ2dn/11dXf9Wa1n/T2xT/1l5Xf9YWFj/YHZj/11n
Xv9khmj/3N3c/9Kjaf+9gjj/t385/7F8Ov+reTz/pXY9/59zPv+ZcT//k25A/41rQv+HaEP/gGVE/3xj
Rf98Y0X//////0zc//9G1///QNP//23b///////IAAAAAgAAABloaGj/XV1d/0lQSf9HS0f/WV9a/1tb
W/9cXFz/XFxc/11dXf+VlZX/9OjZ/8qTUP+8gTj/tn45/7B7O/+qeTz/pHY9/55zPv+YcD//km1B/4tq
Qv+FZ0P/f2VE/3xjRf//////UN///0rb//9c2///3Pf//////4EAAAACAAAAGWpqav9WVlb/SVhL/1Rh
Vv9idGT/XV1d/2R0Zv9jcWX/ZX9o/1dsWv+uw7H/9PT0////////////////////////////////////
///Twq//kG1B/4pqQv+EZ0P/fmRF/////////////////////+////+BAAAAAAAAAAIAAAAZZ2dn/0pK
Sv9QZFP/ZYVp/2R4Z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1pK/0ZN
R/9MbFD/S2FN/05tUv9MaFD/ysrK/67x//9T2///PdD//z/L//+b4v//////twAAAAAAAAAARkZG/0hI
SP9HR0f/QkJC/0dHR/9LS0v/SkpK//j4+P9f6f//UeD//0bX///S9P//NMf///////YAAAAAAAAAAEpK
Sv9NUU7/R1JI/0taTf9od2r/ztDO//j4+P//////Ye3//1rn//+38v//////////////////////9f//
/7ZOTk7/UWFT/05pUf9ae17/0dbR/9C8pP+Rb0X//////2Pt//9h7P//WOX//03d//9C1P//N8z//zDD
//+Z4P//UVFR/0BAQP9DQ0P/WFhY//n5+f+pfkn/mXE///Pv6v+b9P//Y+3//2Dr//9W4///S9v//0DS
//81yv//OMX//0lJSf9IWkv/WWdb/2mFbP//////rXo7/6J1Pf+zlXH/8+/q/////////////////+v7
//924v//PtH//zPI//87Ozv/Tl9Q/2FnYv9ujHL/+fn5/7uGRf+reTz/oHQ+/5RuQP+JaUL/fmRF/31k
Rv+snIn/6/v//0fY//9I0v//ODg4/1dXV/9jY2P/ZmZm/9PT0//gxKH/toA9/6l4PP+ecz7/km1B/4do
Q/99ZEX/fWVH//////9T3///qOz//0RERP9mdmj/cIx0/3GFc/90jHf/zs/O//n5+f//////////////
///QwbD/hWdD/31jRf//////////9f///7VXV1f/ZHBm/26Hcv9pi27/YH5l/1BbUv9FRUX/+Pj4/7F+
Pv/q4NP/mXE//45rQf+FaUf/////9AAAAAAAAAAAWlpa/19fX/9eXl7/Pz8//0BAQP9BQUH/QUFB/8nJ
yf/ewqL/soJH/6N1Pf+deEv/yrqn/////7UAAAAAAAAAAFhYWP9jd2b/UGFS/1FuVf9PZlL/Wn1f/1Fq
Vf9bY1z/0tXT//r8+v//////+Pj4//v7+7kAAAAAAAAAAAAAAABWVlbiWGlb/zc9OP9Na1H/R1tK/05p
Uv9MZVD/S0tL/19zYv9dc2D/T09P/01NTX8AAAAAAAAAAAAAAAAAAAAAVFRUQjo6OuYvLy//MTEx/zIy
Mv8zMzP/Nzc3/1VVVf9UVFT/UVFR/05OTn8AAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAABwAAAAMAAAAD
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAABwAAAA8AAAAfAAA=
</value>
</data>
</root>
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
namespace LSFileClient
{
public static class ImageUtil
{
public enum ImgDeep
{
D8,
D32
}
public static void Format(string path, string savePath, ImageFormat format, ImgDeep deep = ImgDeep.D32, int nwidth = 0, int nheight = 0)
{
//string a = path + "\r\n" + savePath + "\r\n" + format + "\r\n" + deep + "\r\n" + nwidth + "\r\n" + nheight;
//MessageBox.Show(a);
Bitmap srcImage = null;
if (nwidth > 0 && nheight > 0)
{
srcImage = ReSize(path, nwidth, nheight);
}
else
{
srcImage = new Bitmap(path);
}
if (deep == ImgDeep.D8)
{
// Bitmap b8Img = srcImage.Clone(new Rectangle(0, 0, srcImage.Width, srcImage.Height), PixelFormat.Format8bppIndexed);
string temp = savePath + ".temp";
srcImage.Format(temp, ImageFormat.Gif);//gif为8位图
Format(temp, savePath, format);
File.Delete(temp);
// b8Img.Format(savePath,format);
return;
}
srcImage.Format(savePath, format);
}
public static Bitmap ReSize(string path, int nwidth, int nheight)
{
System.Drawing.Image iSource = System.Drawing.Image.FromFile(path);
int sW = 0, sH = 0;
Size temSize = new Size(iSource.Width, iSource.Height);
if (temSize.Width > nheight || temSize.Width > nwidth)
{
if ((temSize.Width * nheight) > (temSize.Height * nwidth))
{
sW = nwidth;
sH = (nwidth * temSize.Height) / temSize.Width;
}
else
{
sH = nheight;
sW = (temSize.Width * nheight) / temSize.Height;
}
}
else
{
sW = temSize.Width;
sH = temSize.Height;
}
Bitmap ob = new Bitmap(sW, sH);
Graphics g = Graphics.FromImage(ob);
// g.Clear(Color.WhiteSmoke);
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
// g.InterpolationMode = InterpolationMode.Default;
g.DrawImage(iSource, new Rectangle(0, 0, sW, sH), 0, 0, iSource.Width, iSource.Height, GraphicsUnit.Pixel);
g.Dispose();
return ob;
}
public static void Format(this Bitmap bmp, string filename, ImageFormat format)
{
EncoderParameters encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
bmp.Save(filename, GetEncoder(format), encoderParameters);
bmp.Dispose();
encoderParameters.Param[0].Dispose();
encoderParameters.Dispose();
}
public static void Format(this Bitmap bmp, Stream stream, ImageFormat format)
{
EncoderParameters encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
bmp.Save(stream, GetEncoder(format), encoderParameters);
bmp.Dispose();
encoderParameters.Param[0].Dispose();
encoderParameters.Dispose();
}
public static ImageCodecInfo GetEncoder(ImageFormat format)
{
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
foreach (ImageCodecInfo codec in codecs)
{
if (codec.FormatID == format.Guid)
{
return codec;
}
}
return null;
}
}
}
+132
View File
@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
namespace LSFileClient
{
public static class IniUtil
{
/// <summary>
/// 写入INI文件
/// </summary>
/// <param name="section">节点名称[如[TypeName]]</param>
/// <param name="key">键</param>
/// <param name="val">值</param>
/// <param name="filepath">文件路径</param>
/// <returns></returns>
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filepath);
/// <summary>
/// 读取INI文件
/// </summary>
/// <param name="section">节点名称</param>
/// <param name="key">键</param>
/// <param name="def">值</param>
/// <param name="retval">stringbulider对象</param>
/// <param name="size">字节大小</param>
/// <param name="filePath">文件路径</param>
/// <returns></returns>
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retval, int size, string filePath);
/// <summary>
/// <para>说明:通过Key获取Value值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-22</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="key">键</param>
/// <returns>值</returns>
public static string ReadFileConfig(string key)
{
string value = string.Empty;
try
{
//判读INI文件是否存在
string filePath = Application.StartupPath + "/MenuConfig.ini";
if (File.Exists(filePath))
{
StringBuilder temp = new StringBuilder(1024);
string fileName = Path.GetFileNameWithoutExtension(filePath);
GetPrivateProfileString(fileName, key, "", temp, 1024, filePath);
return temp + "";
}
}
catch (Exception)
{
}
return value;
}
/// <summary>
/// <para>说明:通过Key获取Value值</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-22</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="key">键</param>
/// <returns>值</returns>
public static string Read(string iniPath, string key)
{
string value = string.Empty;
try
{
//判读INI文件是否存在
string filePath = iniPath;
if (File.Exists(filePath))
{
StringBuilder temp = new StringBuilder(1024);
string fileName = Path.GetFileNameWithoutExtension(filePath);
GetPrivateProfileString(fileName, key, "", temp, 1024, filePath);
return temp + "";
}
}
catch (Exception)
{
}
return value;
}
/// <summary>
/// <para>说明:写入Ini文件(以键值对的形式存放)</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-07-22</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <returns></returns>
public static void WriteFileConfig(string key, string value)
{
try
{
//根据INI文件名设置要写入INI文件的节点名称
//此处的节点名称完全可以根据实际需要进行配置
string filePath = Application.StartupPath + "/MenuConfig.ini";
if (!File.Exists(filePath))
{
File.Create(filePath);
}
string fileName = Path.GetFileNameWithoutExtension(filePath);
WritePrivateProfileString(fileName, key, value, filePath);
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,280 @@
namespace LSFileClient
{
using LSServerService;
using LSUtils;
using System;
using System.Data.SqlClient;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
public class LSClientMain
{
private LSSocket m_clientSocket;
public bool checkSocketState()
{
return ((this.m_clientSocket != null) && (this.m_clientSocket.SocketState == 1));
}
private void ConnectServer(string ServerIP, string DBName, string isInternet, string IsConsumer)
{
Exception exception;
//uint nPort = uint.Parse(LSIniFile.ReadValue("/Root/ClientSettings", "Port"));
//string connectionString = LSIniFile.ReadValue("/Root/ClientSettings", "connectionStr");
//if (connectionString == "")
//{
uint nPort = 7859;
string connectionString = string.Format("Server={0};Database={1};Persist Security Info=True;User ID=wlms;Password=mymsserver", ServerIP, DBName);
if (IsConsumer == "0")
connectionString = string.Format("Server=114.116.145.208,14331;Database=lscrm;Persist Security Info=True;User ID=Lserp_crm;Password=lserp_ERP_@#$_123", ServerIP, DBName);
//}
try
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand(string.Format("select LanIP,LanPort,InternetIP,InternetPort from p_systemtab ", new object[0]), connection);
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
if (isInternet == "1")
{
ServerIP = reader["InternetIP"].ToString();
nPort = uint.Parse(reader["InternetPort"].ToString());
}
else
{
ServerIP = reader["LanIP"].ToString();
nPort = uint.Parse(reader["LanPort"].ToString());
}
}
reader.Close();
}
command.Dispose();
connection.Close();
}
}
catch (Exception exception1)
{
exception = exception1;
//MessageBox.Show("ServerIP:" + ServerIP + ";port:" + nPort + exception1.Message);
PubUtils.WriteLog("ConnectServer 连接数据库错误 error: {0}", new object[] { exception });
return;
}
LSWriteLog.WriteTrace(" 准备连接服务的端口={0},ServerIP={1}", new object[] { nPort, ServerIP });
// 已调整到lsMain程序中进行解析
//try
//{
// //ServerIP = Dns.GetHostEntry(ServerIP).AddressList[0].ToString();
// foreach (IPAddress ip in Dns.GetHostEntry(ServerIP).AddressList)
// {
// if (ip.AddressFamily.ToString() == "InterNetwork")
// {
// ServerIP = ip.ToString();
// break;
// }
// }
//}
//catch(Exception ex)
//{
// LSWriteLog.WriteTrace("---------------"+ ex.Message);
//}
LSWriteLog.WriteTrace(" 解析服务器={0},ServerIP={1}", new object[] { nPort, ServerIP });
try
{
LSWriteLog.WriteTrace(" 准备连接服务的端口={0},ServerIP={1}", new object[] { nPort, ServerIP });
this.m_clientSocket = new LSSocket();
this.m_clientSocket.Connect(ServerIP, nPort);
this.m_clientSocket.ParseReceiveDataEvent += new LSSocket.ParseReceiveDataEventHandle(this.onRevServerSocketData);
this.m_clientSocket.SocketCloseEvent += new LSASyncSocket.SocketCloseEventHandle(this.SocketClientCloseDone);
}
catch (Exception exception2)
{
exception = exception2;
PubUtils.WriteLog("LSClientMain.ConnectServer error: {0}", new object[] { exception });
SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.CONNECT_ERROR, IntPtr.Zero, IntPtr.Zero);
}
}
public void FreeAllResouce()
{
Thread.Sleep(100);
LSGlobleVariable.bNeedExit = true;
Thread.Sleep(1000);
LSGlobleVariable.hThread.Interrupt();
LSFileManage.dispose();
LSWriteLog.CloseAllFile();
}
public bool getDirectoryList(int dwReqType, int parentId)
{
return false;
}
private void onHeartTimer(object sender, ElapsedEventArgs e)
{
S2C2S_Heart structObj = new S2C2S_Heart(true);
this.m_clientSocket.Send(structObj);
}
private void onRevServerSocketData(LSSocket ClientSocket, byte[] byteData)
{
LSSocketRev socketRev = new LSSocketRev {
ClientSocket = ClientSocket,
ByteData = byteData
};
LSQueueManage.InsertSocketRevData(socketRev);
LSWriteLog.WriteTrace("onRevServerSocketData 插入列表数据执行完毕", new object[0]);
}
private void ProcessRevDataFromServer()
{
Thread.CurrentThread.IsBackground = true;
LSSocketRev socketRev = null;
while (!LSGlobleVariable.bNeedExit)
{
Exception exception;
try
{
try
{
socketRev = LSQueueManage.GetSocketRevData();
LSWriteLog.WriteTrace("------------------ProcessRevDataFromServer----已经获取到列表数据", new object[0]);
if (LSGlobleVariable.bNeedExit)
{
break;
}
}
catch (Exception exception1)
{
exception = exception1;
PubUtils.WriteLog("ProcessRevDataFromServer 前面的 error: {0}", new object[] { exception.Message.ToString() });
throw new Exception(exception.Message.ToString());
}
LSGlobleVariable.masterForm.ParseDataFromServerMsg(socketRev);
}
catch (ThreadAbortException exception2)
{
PubUtils.WriteLog("ProcessRevDataFromServer ThreadAbortException: {0}", new object[] { exception2 });
break;
}
catch (ThreadInterruptedException exception3)
{
PubUtils.WriteLog("ProcessRevDataFromServer ThreadInterruptedException: {0}", new object[] { exception3 });
break;
}
catch (Exception exception6)
{
exception = exception6;
if (socketRev != null)
{
PubUtils.WriteLog("ProcessRevDataFromServer error: {0},ProxySocket.SocketState: {1} ,byte data is:\n{2}", new object[] { exception, socketRev.ClientSocket.SocketState, socketRev.ByteData });
}
else
{
PubUtils.WriteLog("ProcessRevDataFromServer error: {0}", new object[] { exception });
}
}
finally
{
if (socketRev != null)
{
socketRev = null;
}
}
}
}
public void ProgramEntry(string ServerIP, string DBName, string isInternet, string IsConsumer)
{
try
{
LSWriteLog.Init("clientLogs", "TraceClient.log");
//LSIniFile.IniPath = "LSClientConfig.xml";
PubUtils.WriteLog("程序被调用", new object[0]);
LSGlobleVariable.hThread = new Thread(new ThreadStart(this.ProcessRevDataFromServer));
LSGlobleVariable.hThread.Start();
this.ConnectServer(ServerIP, DBName, isInternet, IsConsumer);
LSGlobleVariable.timer = new System.Timers.Timer(30000.0);
LSGlobleVariable.timer.Elapsed += new ElapsedEventHandler(this.onHeartTimer);
}
catch (Exception exception)
{
PubUtils.WriteLog("error: {0}", new object[] { exception });
}
}
public bool readyCreateDir(int parentId, string sDirName)
{
return false;
}
public bool readyCreateFile(int parentId, string sName, int fileSize, int productId)
{
try
{
C2S_AddFile structObj = new C2S_AddFile(true);
structObj.header.dwUserId = LSGlobleVariable.userId;
structObj.fi.dwParentId = parentId;
structObj.fi.strName = sName;
structObj.fi.dwCreator = (int) LSGlobleVariable.userId;
structObj.fi.dwFileSize = fileSize;
this.m_clientSocket.Send(structObj);
return true;
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.readyCreateFile error: {0}", new object[] { exception });
}
return false;
}
public bool requestDownloadFile(C2S_DownloadFile reqDownload)
{
try
{
reqDownload.header.dwUserId = LSGlobleVariable.userId;
this.m_clientSocket.Send(reqDownload);
return true;
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.requestDownloadFile error: {0}", new object[] { exception });
}
return false;
}
public void Send(object structObj)
{
this.m_clientSocket.Send(structObj);
}
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
private void SocketClientCloseDone(LSASyncSocket AsyncSocket)
{
try
{
((LSSocket) AsyncSocket).HandledCloseEvent();
LSWriteLog.WriteTrace("连接断开了,通知外部", new object[0]);
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.FlashClientCloseDone error: {0},", new object[] { exception });
}
}
public LSSocket clientSocket
{
get
{
return this.m_clientSocket;
}
}
}
}
@@ -0,0 +1,48 @@
namespace LSFileClient
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Size=1)]
internal struct LSCustomWinMsg
{
private static readonly int CUSTOM_MESSAGE;
public static readonly int SUCCESS_MESSAGE;
public static readonly int FAIL_MESSAGE;
public static readonly int SETPROGRESS;
public static readonly int CLOSE_WINDOW;
public static readonly int NOTIFY_READY;
public static readonly int CONNECT_ERROR;
public static readonly int DELETEFILE_MESSAGE;
public static readonly int READYTOCLOSE;
public static readonly int BATCHUPLOADCOMPLETED;
/// <summary>
/// 删除成功
/// </summary>
public static readonly int DELETECOMPLETED;
/// <summary>
/// 删除失败
/// </summary>
public static readonly int DELETEERROR;
public static readonly int DOWNLOADCOMPLETED;
public static readonly int DOWNLOADERROR;
static LSCustomWinMsg()
{
CUSTOM_MESSAGE = 36864;
SUCCESS_MESSAGE = CUSTOM_MESSAGE + 1;
FAIL_MESSAGE = CUSTOM_MESSAGE + 2;
SETPROGRESS = CUSTOM_MESSAGE + 3;
CLOSE_WINDOW = CUSTOM_MESSAGE + 4;
NOTIFY_READY = CUSTOM_MESSAGE + 5;
CONNECT_ERROR = CUSTOM_MESSAGE + 6;
DELETEFILE_MESSAGE = CUSTOM_MESSAGE + 7;
READYTOCLOSE = CUSTOM_MESSAGE + 8;
BATCHUPLOADCOMPLETED = CUSTOM_MESSAGE + 9;
DOWNLOADCOMPLETED = CUSTOM_MESSAGE + 10;
DOWNLOADERROR = CUSTOM_MESSAGE + 11;
DELETECOMPLETED = CUSTOM_MESSAGE + 12;
DELETEERROR = CUSTOM_MESSAGE + 13;
}
}
}
@@ -0,0 +1,32 @@
namespace LSFileClient
{
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Timers;
[StructLayout(LayoutKind.Sequential, Size=1)]
internal struct LSGlobleVariable
{
public static System.Timers.Timer timer;
public static Thread hThread;
public static bool bNeedExit;
public static object mutexObj;
public static uint userId;
public static IntPtr hWndMain;
public static FrmBase masterForm;
public static AutoResetEvent notifyEvent;
static LSGlobleVariable()
{
timer = null;
hThread = null;
bNeedExit = false;
mutexObj = 1;
userId = 0;
hWndMain = IntPtr.Zero;
masterForm = null;
notifyEvent = new AutoResetEvent(true);
}
}
}
@@ -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>();
}
}
}
@@ -0,0 +1,17 @@
namespace LSFileClient
{
using System;
using System.Windows.Forms;
internal static class Program
{
[STAThread]
private static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ClientManager.init(args);
}
}
}
@@ -0,0 +1,12 @@
namespace LSFileClient
{
using System;
public enum fmTypes
{
upByParentId,
downByParentId,
downByFileIds
}
}
+46
View File
@@ -0,0 +1,46 @@
namespace LSFileClient
{
partial class frmDelete
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// frmDelete
//
this.ClientSize = new System.Drawing.Size(472, 274);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "frmDelete";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmDelete_FormClosed);
this.Load += new System.EventHandler(this.frmDelete_Load);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using CommonLib;
using LSServerService;
namespace LSFileClient
{
public partial class frmDelete : LSFileClient.FrmBase
{
public frmDelete()
{
this.components = null;
InitializeComponent();
}
private string serverIP;
private string databaseName;
//public frmDelete(LSClientMain _clientMain, string _serverIP, string _databaseName)
// : base(_clientMain, _serverIP, _databaseName)
//{
// this.components = null;
// serverIP = _serverIP;
// databaseName = _databaseName;
// InitializeComponent();
//}
public frmDelete(LSClientMain _clientMain, string _serverIP, string _databaseName, string _isConsumer)
: base(_clientMain, _serverIP, _databaseName, _isConsumer)
{
this.components = null;
//this.isConsumer = _isConsumer;
serverIP = _serverIP;
databaseName = _databaseName;
try
{
string file = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)), "SystemResources.ini");
string connectionStr = "";
if (File.Exists(file))
{
string lastIPPort = string.Format("{0}:{1}", IniUtil.Read(file, "LocalLastIP"), IniUtil.Read(file, "LocalLastPort"));
string downloadAESStrKey = string.Format("DownloadAESStr_{0}", lastIPPort);
string[] downloadAESStrValue = IniUtil.Read(file, downloadAESStrKey).Split('^');
string downloadAESStr = downloadAESStrValue.Length == 2 ? downloadAESStrValue[1] : "";
string configFlag = IniUtil.Read(file, "FrmConfigFlag");
if (configFlag.Equals("1"))
{
//string args = AESUtil.Decrypt(File.ReadAllText(file));
if (!string.IsNullOrEmpty(downloadAESStr))
{
string args = AESUtil.Decrypt(downloadAESStr);
string[] controlAfgs = args.Split('^');
if (controlAfgs != null && controlAfgs.Length == 5)
{
connectionStr = "Server=" + controlAfgs[0] + ";Database=" + controlAfgs[1] + ";Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
}
}
}
else
{
connectionStr = DBConfig.Instance.GetConStr();
}
}
if (string.IsNullOrEmpty(connectionStr))
{
connectionStr = DBConfig.Instance.GetConStr();
}
DBConfig.Instance.CreateNewConnection(connectionStr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
this.isConsumer = _isConsumer;
this.InitializeComponent();
}
private void frmDelete_Load(object sender, EventArgs e)
{
base.Width = base.Height = 0;
C2S_DeleteFile structObj = new C2S_DeleteFile(true);
int succCount = 0;
int failCount = 0;
try
{
if (SqlHelper.CreateConnection(serverIP, databaseName))
{
foreach (int ids in LSParamsFormatter.fileIds)
{
structObj.dwFileId = ids;
if (base.clientMain.clientSocket.Send(structObj))
{
succCount += 1;
try
{
int result = SqlHelper.ExecuteNonQuery(CommandType.Text, string.Format("delete P_fm_FileTab where fileid='{0}'", ids));
}
catch (Exception)
{
}
}
else
failCount += 1;
}
}
SqlHelper.conn.Close();
MessageBox.Show("删除文件完成" + succCount.ToString() + "个成功," + failCount.ToString() + "个失败");
}
catch (Exception ex)
{
//MessageBox.Show("删除出错!"+ex.Message);
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DELETEERROR, IntPtr.Zero, IntPtr.Zero);
}
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DELETECOMPLETED, IntPtr.Zero, IntPtr.Zero);
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.CLOSE_WINDOW, IntPtr.Zero, IntPtr.Zero);
this.Close();
this.Dispose();
}
protected override void WndProc(ref Message msg)
{
if (msg.Msg == LSCustomWinMsg.SUCCESS_MESSAGE)
{
base.setItemState(2);
}
else
{
int wParam;
if (msg.Msg == LSCustomWinMsg.FAIL_MESSAGE)
{
wParam = (int)msg.WParam;
if (wParam == ErrorType.FILE_BEEN_LOCKED)
{
base.setItemState(3, "附件已经被锁定,");
}
else
{
base.setItemState(3);
}
}
else if (msg.Msg == LSCustomWinMsg.CONNECT_ERROR)
{
MessageBox.Show("连接服务器失败,请联系管理员!");
}
else
{
if (msg.Msg == LSCustomWinMsg.DELETEFILE_MESSAGE)
{
wParam = (int)msg.WParam;
int lParam = (int)msg.LParam;
if (wParam > 0)
{
if (wParam == ErrorType.FILE_BEEN_LOCKED)
{
MessageBox.Show("附件已经被锁定,请联系管理员!");
}
else
{
MessageBox.Show("删除出错!");
}
}
else
{
//base.m_currentNodeData = base.getDataById(lParam);
//if (base.m_currentNodeData != null)
//{
// ListViewItem item = base.m_currentNodeData.item;
// base.removeItem(item);
//}
//MessageBox.Show("删除成功.");
}
}
base.WndProc(ref msg);
}
}
}
private void frmDelete_FormClosed(object sender, FormClosedEventArgs e)
{
base.clientMain.clientSocket.CloseSocket();
base.clientMain.FreeAllResouce();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,56 @@
namespace LSFileClient
{
using LSServerService;
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
partial class frmSingleDownload
{
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.proTranslate = new ProgressBar();
base.SuspendLayout();
this.proTranslate.BackColor = Color.Silver;
this.proTranslate.Dock = DockStyle.Bottom;
this.proTranslate.ForeColor = SystemColors.ControlText;
this.proTranslate.Location = new Point(0, -1);
this.proTranslate.Name = "proTranslate";
this.proTranslate.Size = new Size(360, 23);
this.proTranslate.TabIndex = 4;
base.AutoScaleDimensions = new SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new Size(360, 22);
base.Controls.Add(this.proTranslate);
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
base.Name = "frmSingleDownload";
base.StartPosition = FormStartPosition.CenterScreen;
this.Text = "frmSingleDownload";
base.Load += new EventHandler(this.frmSingleDownload_Load);
base.FormClosed += new FormClosedEventHandler(this.frmSingleDownload_FormClosed);
base.FormClosing += new FormClosingEventHandler(this.frmSingleDownload_FormClosing);
base.ResumeLayout(false);
}
private IContainer components;
private bool canClosed;
private FileStream fs;
private ProgressBar proTranslate;
}
}
@@ -0,0 +1,257 @@
namespace LSFileClient
{
using CommonLib;
using LSServerService;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
public partial class frmSingleDownload : FrmBase
{
public frmSingleDownload()
: this(null, "", "", "1")
{
}
public frmSingleDownload(LSClientMain _clientMain, string _serverIP, string _databaseName, string _isConsumer)
: base(_clientMain, _serverIP, _databaseName, _isConsumer)
{
this.fs = null;
this.canClosed = false;
this.components = null;
try
{
string file = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)), "SystemResources.ini");
string connectionStr = "";
if (File.Exists(file))
{
string lastIPPort = string.Format("{0}:{1}", IniUtil.Read(file, "LocalLastIP"), IniUtil.Read(file, "LocalLastPort"));
string downloadAESStrKey = string.Format("DownloadAESStr_{0}", lastIPPort);
string[] downloadAESStrValue = IniUtil.Read(file, downloadAESStrKey).Split('^');
string downloadAESStr = downloadAESStrValue.Length == 2 ? downloadAESStrValue[1] : "";
string configFlag = IniUtil.Read(file, "FrmConfigFlag");
if (configFlag.Equals("1"))
{
//string args = AESUtil.Decrypt(File.ReadAllText(file));
if (!string.IsNullOrEmpty(downloadAESStr))
{
string args = AESUtil.Decrypt(downloadAESStr);
string[] controlAfgs = args.Split('^');
if (controlAfgs != null && controlAfgs.Length == 5)
{
connectionStr = "Server=" + controlAfgs[0] + ";Database=" + controlAfgs[1] + ";Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
}
}
}
else
{
connectionStr = DBConfig.Instance.GetConStr();
}
}
if (string.IsNullOrEmpty(connectionStr))
{
connectionStr = DBConfig.Instance.GetConStr();
}
DBConfig.Instance.CreateNewConnection(connectionStr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
this.isConsumer = _isConsumer;
this.InitializeComponent();
}
private bool closeFile()
{
if (this.fs == null)
{
return false;
}
try
{
this.fs.Flush();
this.fs.Close();
this.fs.Dispose();
this.fs = null;
}
catch (Exception exception)
{
PubUtils.WriteLog("frmSingleDownload.hasParsedMsg error: {0}", new object[] { exception });
return false;
}
return true;
}
private void closeWin()
{
this.canClosed = true;
this.closeFile();
base.Close();
}
private void frmSingleDownload_FormClosed(object sender, FormClosedEventArgs e)
{
}
private void frmSingleDownload_FormClosing(object sender, FormClosingEventArgs e)
{
if (!this.canClosed)
{
e.Cancel = true;
}
}
private void frmSingleDownload_Load(object sender, EventArgs e)
{
//MessageBox.Show(LSParamsFormatter.downloadPath);
LSGlobleVariable.masterForm = this;
LSGlobleVariable.hWndMain = base.Handle;
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1298, base.Handle, IntPtr.Zero);
this.Text = Path.GetFileName(LSParamsFormatter.downloadPath) + " 下载中............";
C2S_ReqBackgroundDownload structObj = new C2S_ReqBackgroundDownload(true) {
strPath = LSParamsFormatter.downloadPath
};
if (Path.GetFileName(LSParamsFormatter.downloadPath) == "")
{
structObj.reqType = 2;
}
try
{
base.clientMain.Send(structObj);
Process.Start(LSParamsFormatter.savePath);
}
catch (Exception exception)
{
//MessageBox.Show(exception.Message);
PubUtils.WriteLog("frmSingleDownload.frmSingleDownload_Load error: {0}", new object[] { exception });
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1305, base.Handle, IntPtr.Zero);
}
}
protected override bool hasParsedMsg(byte[] byteData, LSSocket client, MsgHeader header)
{
Exception exception;
if (header.dwType == 65544)
{
S2C_ReqBackgroundDownload structure = (S2C_ReqBackgroundDownload) PubUtils.BytesToStruct(byteData, typeof(S2C_ReqBackgroundDownload));
if (structure.dwErrId > 0)
{
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(structure.dwErrId), IntPtr.Zero);
return true;
}
try
{
if (structure.isDownloadModel)
{
this.fs = File.Open(LSParamsFormatter.savePath, FileMode.Create, FileAccess.Write, FileShare.Read);
}
else if (structure.isGetFileListModel)
{
int startIndex = Marshal.SizeOf(structure);
StringBuilder builder = new StringBuilder();
for (int i = 0; i < structure.dwCount; i++)
{
StructFileInfo info = (StructFileInfo) PubUtils.BytesToStruct(byteData, typeof(StructFileInfo), startIndex);
startIndex += Marshal.SizeOf(info);
builder.AppendLine(info.strName);
builder.AppendLine(info.strCreateTime);
}
DWriteClipData method = new DWriteClipData(this.writeClipData);
base.Invoke(method, new object[] { builder.ToString() });
method = null;
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SUCCESS_MESSAGE, IntPtr.Zero, IntPtr.Zero);
}
}
catch (Exception exception1)
{
exception = exception1;
PubUtils.WriteLog("frmSingleDownload.hasParsedMsg error: {0}", new object[] { exception });
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(structure.dwErrId), IntPtr.Zero);
return false;
}
return true;
}
if (header.dwType == 65545)
{
C2S2C_BackgroundFileData data2 = (C2S2C_BackgroundFileData) PubUtils.BytesToStruct(byteData, typeof(C2S2C_BackgroundFileData));
if (data2.dwErrId > 0)
{
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(data2.dwErrId), IntPtr.Zero);
return true;
}
try
{
this.fs.Write(data2.FileData, 0, data2.dwPacketLen);
}
catch (Exception exception2)
{
exception = exception2;
PubUtils.WriteLog("frmSingleDownload.hasParsedMsg error: {0}", new object[] { exception });
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(data2.dwErrId), IntPtr.Zero);
return false;
}
int num3 = (int) (100.0 * ((data2.dwPacketOrder * 1.0) / ((double) data2.dwTotalCount)));
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SETPROGRESS, (IntPtr) num3, IntPtr.Zero);
if (data2.dwTotalCount == data2.dwPacketOrder)
{
if (!this.closeFile())
{
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.FAIL_MESSAGE, new IntPtr(data2.dwErrId), IntPtr.Zero);
return false;
}
FrmBase.SendMessage(LSGlobleVariable.hWndMain, LSCustomWinMsg.SUCCESS_MESSAGE, IntPtr.Zero, IntPtr.Zero);
}
return true;
}
return false;
}
protected override void WndProc(ref Message msg)
{
if (msg.Msg == LSCustomWinMsg.SUCCESS_MESSAGE)
{
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DOWNLOADCOMPLETED, base.Handle, IntPtr.Zero);
this.closeWin();
}
else if (msg.Msg == LSCustomWinMsg.FAIL_MESSAGE)
{
MessageBox.Show("下载失败,请联系管理员!");
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DOWNLOADERROR, base.Handle, IntPtr.Zero);
this.closeWin();
}
else if (msg.Msg == LSCustomWinMsg.CONNECT_ERROR)
{
MessageBox.Show("连接服务器失败,请联系管理员!");
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.DOWNLOADERROR, base.Handle, IntPtr.Zero);
this.closeWin();
}
else if (msg.Msg == LSCustomWinMsg.SETPROGRESS)
{
this.proTranslate.Value = (int)msg.WParam;
}
else
{
base.WndProc(ref msg);
}
}
private void writeClipData(string str)
{
Clipboard.Clear();
Clipboard.SetDataObject(str, true);
}
private delegate void DWriteClipData(string str);
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,53 @@
namespace LSFileClient
{
using LSServerService;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
partial class frmSmartClient
{
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.timer1 = new System.Windows.Forms.Timer();
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// frmSmartClient
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(799, 504);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "frmSmartClient";
this.Text = "frmSmartClient";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmSmartClient_FormClosed);
this.Load += new System.EventHandler(this.frmSmartClient_Load);
this.ResumeLayout(false);
}
private IContainer components;
private System.Windows.Forms.Timer timer1;
}
}
@@ -0,0 +1,131 @@
namespace LSFileClient
{
using LSServerService;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
public partial class frmSmartClient : FrmBase
{
public frmSmartClient() : this(null, "", "", "1")
{
}
public frmSmartClient(LSClientMain _clientMain, string _serverIP, string _databaseName, string _isConsumer) : base(_clientMain, _serverIP, _databaseName, _isConsumer)
{
//MessageBox.Show("OK");
this.components = null;
this.isConsumer = _isConsumer;
this.InitializeComponent();
}
private void frmSmartClient_FormClosed(object sender, FormClosedEventArgs e)
{
base.clientMain.clientSocket.CloseSocket();
base.clientMain.FreeAllResouce();
}
private void frmSmartClient_Load(object sender, EventArgs e)
{
base.Width = base.Height = 0;
LSGlobleVariable.masterForm = this;
LSGlobleVariable.hWndMain = base.Handle;
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1298, base.Handle, IntPtr.Zero);
base.clientMain.clientSocket.SocketCloseEvent += new LSASyncSocket.SocketCloseEventHandle(this.onClientSocketClose);
C2S_SmartClientLogin structObj = new C2S_SmartClientLogin(true);
structObj.header.dwUserId = (uint) LSParamsFormatter.userId;
try
{
base.clientMain.Send(structObj);
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.frmSmartClient_Load error: {0}", new object[] { exception });
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1305, base.Handle, IntPtr.Zero);
}
}
protected override bool hasParsedMsg(byte[] byteData, LSSocket client, MsgHeader header)
{
if (header.dwType == 69634)
{
try
{
C2S2C_SmartResponse structure = (C2S2C_SmartResponse) PubUtils.BytesToStruct(byteData, typeof(C2S2C_SmartResponse));
FrmBase.COPYDATASTRUCT lParam = new FrmBase.COPYDATASTRUCT {
dwData = (IntPtr) structure.dwFieldCount,
cbData = ((int) structure.dwDataLen) + 1
};
int index = Marshal.SizeOf(structure);
lParam.lpData = Encoding.Default.GetString(byteData, index, (int) structure.dwDataLen);
FrmBase.SendCopyData(LSParamsFormatter.mainHandle, 74, IntPtr.Zero, ref lParam);
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.hasParsedMsg error: {0}", new object[] { exception });
}
return true;
}
return false;
}
private void onClientSocketClose(LSASyncSocket AsyncSocket)
{
try
{
FrmBase.SendMessage(LSParamsFormatter.mainHandle, LSCustomWinMsg.READYTOCLOSE, IntPtr.Zero, IntPtr.Zero);
base.Close();
}
catch (Exception exception)
{
PubUtils.WriteLog("LSClientMain.onClientSocketClose error: {0},", new object[] { exception });
}
}
private void reConnect()
{
PubUtils.WriteLog("LSClientMain.reConnect error: 链接被关闭,即将重链", new object[0]);
for (int i = 0; i < 1000000; i++)
{
base.clientMain.clientSocket.reConnect();
int num2 = 0;
while (num2 < 20)
{
if (base.clientMain.checkSocketState())
{
break;
}
num2++;
Thread.Sleep(1000);
}
}
}
private void timer1_Tick(object sender, EventArgs e)
{
this.timer1.Enabled = false;
base.Visible = false;
}
protected override void WndProc(ref Message msg)
{
if (msg.Msg == LSCustomWinMsg.CONNECT_ERROR)
{
MessageBox.Show("连接服务器失败,请联系管理员!");
FrmBase.SendMessage(LSParamsFormatter.mainHandle, 1305, base.Handle, IntPtr.Zero);
base.Close();
}
else
{
base.WndProc(ref msg);
}
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace LSServerService
{
/// <summary>
/// AES对称加密
/// </summary>
public class AESUtil
{
private static string key = "lserpasebygyc222";
#region AES加解密
/// <summary>
///AES加密(加密步骤)
///1,加密字符串得到2进制数组;
///2,将2进制数组转为16进制;
///3,进行base64编码
/// </summary>
/// <param name="toEncrypt">要加密的字符串</param>
/// <param name="key">密钥</param>
public static string Encrypt(string toEncrypt)
{
if (string.IsNullOrEmpty(toEncrypt)) return "";
byte[] _key = Encoding.ASCII.GetBytes(key);
byte[] _source = Encoding.UTF8.GetBytes(toEncrypt);
Aes aes = Aes.Create("AES");
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;
aes.Key = _key;
ICryptoTransform cTransform = aes.CreateEncryptor();
byte[] cryptData = cTransform.TransformFinalBlock(_source, 0, _source.Length);
string hexCryptString = Hex_2To16(cryptData);
byte[] hexCryptData = Encoding.UTF8.GetBytes(hexCryptString);
return Convert.ToBase64String(hexCryptData);
}
/// <summary>
/// AES解密(解密步骤)
/// 1,将BASE64字符串转为16进制数组
/// 2,将16进制数组转为字符串
/// 3,将字符串转为2进制数据
/// 4,用AES解密数据
/// </summary>
/// <param name="encryptedSource">已加密的内容</param>
/// <param name="key">密钥</param>
public static string Decrypt(string toDecrypt)
{
if (string.IsNullOrEmpty(toDecrypt)) return "";
try
{
byte[] _key = Encoding.ASCII.GetBytes(key);
Aes aes = Aes.Create("AES");
aes.Mode = CipherMode.ECB;
aes.Padding = PaddingMode.PKCS7;
aes.Key = _key;
ICryptoTransform cTransform = aes.CreateDecryptor();
byte[] encryptedData = Convert.FromBase64String(toDecrypt);
string encryptedString = Encoding.UTF8.GetString(encryptedData);
byte[] _source = Hex_16To2(encryptedString);
byte[] originalSrouceData = cTransform.TransformFinalBlock(_source, 0, _source.Length);
return Encoding.UTF8.GetString(originalSrouceData);
}
catch (Exception)
{
return "";
}
}
/// <summary>
/// 2进制转16进制
/// </summary>
static string Hex_2To16(byte[] bytes)
{
string hexString = string.Empty;
Int32 iLength = 65535;
if (bytes != null)
{
StringBuilder strB = new StringBuilder();
if (bytes.Length < iLength)
{
iLength = bytes.Length;
}
for (int i = 0; i < iLength; i++)
{
strB.Append(bytes[i].ToString("X2"));
}
hexString = strB.ToString();
}
return hexString;
}
/// <summary>
/// 16进制转2进制
/// </summary>
static byte[] Hex_16To2(string hexString)
{
if ((hexString.Length % 2) != 0)
{
hexString += " ";
}
byte[] returnBytes = new Byte[hexString.Length / 2];
for (Int32 i = 0; i < returnBytes.Length; i++)
{
returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
}
return returnBytes;
}
#endregion
}
}
@@ -0,0 +1,27 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S2C_BackgroundFileData
{
public const uint ID = 65545;
public MsgHeader header;
public int dwErrId;
public int dwTotalCount;
public int dwPacketOrder;
public int dwPacketLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1024)]
public byte[] FileData;
public C2S2C_BackgroundFileData(bool autoSet)
{
this.FileData = new byte[1024];
this.dwErrId = this.dwTotalCount = this.dwPacketOrder = this.dwPacketLen = 0;
this.header = new MsgHeader();
this.header.dwType = 65545;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,29 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S2C_FileData
{
public const uint ID = 4097;
public MsgHeader header;
public int dwErrId;
public int dwFileId;
public int dwTotalBytes;
public int dwTotalCount;
public int dwPacketOrder;
public int dwPacketLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1024)]
public byte[] FileData;
public C2S2C_FileData(bool autoSet)
{
this.FileData = new byte[1024];
this.dwErrId = this.dwFileId = this.dwTotalCount = this.dwPacketOrder = this.dwPacketLen = this.dwTotalBytes = 0;
this.header = new MsgHeader();
this.header.dwType = 4097;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,26 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S2C_FileTranslateComplete
{
public const uint ID = 4098;
public MsgHeader header;
public int dwErrId;
public int dwFileId;
public int dwTotalBytes;
public int dwTotalCount;
public int dwRevPacketCount;
public int dwRevBytesLen;
public C2S2C_FileTranslateComplete(bool autoSet)
{
this.dwErrId = this.dwFileId = this.dwTotalBytes = this.dwTotalCount = this.dwRevPacketCount = this.dwRevBytesLen = 0;
this.header = new MsgHeader();
this.header.dwType = 4098;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,22 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S2C_SmartResponse
{
public const uint ID = 69634;
public MsgHeader header;
public uint dwFieldCount;
public uint dwDataLen;
public C2S2C_SmartResponse(bool autoSet)
{
this.dwFieldCount = this.dwDataLen = 0;
this.header = new MsgHeader();
this.header.dwType = 69634;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_AddFile
{
public const uint ID = 17;
public MsgHeader header;
public StructFileInfo fi;
public C2S_AddFile(bool autoSet)
{
this.header = new MsgHeader();
this.fi = new StructFileInfo(true);
this.header.dwType = 17;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_AddFileDirectory
{
public const uint ID = 1;
public MsgHeader header;
public StructFileInfo fi;
public C2S_AddFileDirectory(bool autoSet)
{
this.header = new MsgHeader();
this.fi = new StructFileInfo(true);
this.header.dwType = 1;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_DeleteFile
{
public const uint ID = 22;
public MsgHeader header;
public int dwFileId;
public C2S_DeleteFile(bool autoSet)
{
this.header = new MsgHeader();
this.dwFileId = 0;
this.header.dwType = 22;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,55 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_DownloadFile
{
public const uint ID = 19;
public MsgHeader header;
public int dwDirectoryId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=50)]
public int[] dwFileIds;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=50)]
public int[] dwProductIds;
public C2S_DownloadFile(bool autoSet)
{
this.header = new MsgHeader();
this.dwDirectoryId = 0;
this.dwFileIds = new int[50];
this.dwProductIds = new int[50];
this.header.dwType = 19;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
public string strFileIds
{
get
{
return this.getIds(this.dwFileIds);
}
}
public string strProductIds
{
get
{
return this.getIds(this.dwProductIds);
}
}
private string getIds(int[] arr)
{
string str = "";
for (int i = 0; i < arr.Length; i++)
{
int num2 = arr[i];
if (num2 != 0)
{
str = str + num2.ToString() + "|";
}
}
return str;
}
}
}
@@ -0,0 +1,24 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_EditFileDirectory
{
public const uint ID = 3;
public MsgHeader header;
public uint dwFileId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=512)]
public byte[] szDirName;
public C2S_EditFileDirectory(bool autoSet)
{
this.dwFileId = 0;
this.szDirName = new byte[512];
this.header = new MsgHeader();
this.header.dwType = 3;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_RemoveFileDirectory
{
public const uint ID = 5;
public MsgHeader header;
public uint dwFileId;
public C2S_RemoveFileDirectory(bool autoSet)
{
this.dwFileId = 0;
this.header = new MsgHeader();
this.header.dwType = 5;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,54 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_ReqBackgroundDownload
{
public const int DownLoadModel = 1;
public const int GetFileListModel = 2;
public const uint ID = 65543;
public MsgHeader header;
public int reqType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1024)]
public byte[] szPath;
public C2S_ReqBackgroundDownload(bool autoSet)
{
this.header = new MsgHeader();
this.reqType = 1;
this.szPath = new byte[1024];
this.header.dwType = 65543;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
public bool isDownloadModel
{
get
{
return (this.reqType == 1);
}
}
public bool isGetFileListModel
{
get
{
return (this.reqType == 2);
}
}
public string strPath
{
get
{
return PubUtils.BytesToStr(this.szPath);
}
set
{
byte[] src = PubUtils.StrToBytes(value);
Buffer.BlockCopy(src, 0, this.szPath, 0, src.Length);
src = null;
}
}
}
}
@@ -0,0 +1,24 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_ReqestFileList
{
public const uint ID = 33;
public MsgHeader header;
public int dwParentId;
public int dwReqType;
public int dwFileId;
public C2S_ReqestFileList(bool autoSet)
{
this.header = new MsgHeader();
this.dwParentId = -1;
this.dwReqType = this.dwFileId = 0;
this.header.dwType = 33;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,19 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct C2S_SmartClientLogin
{
public const uint ID = 69633;
public MsgHeader header;
public C2S_SmartClientLogin(bool autoSet)
{
this.header = new MsgHeader();
this.header.dwType = 69633;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,38 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Size=1)]
internal struct ErrorType
{
private static readonly int NONE;
public static readonly int SUCCESS;
public static readonly int FILE_EXIST;
public static readonly int DIRECTORY_EXIST;
public static readonly int FILE_NOT_EXIST;
public static readonly int DIRECTORY_NOT_EXIST;
public static readonly int DELETE_FILE_ERROR;
public static readonly int DELETEFILE_FROMDB_ERROR;
public static readonly int FILE_BEEN_LOCKED;
public static readonly int FAIL;
public static readonly int UNKNOWN;
private static readonly int MAX;
static ErrorType()
{
NONE = 0;
SUCCESS = NONE++;
FILE_EXIST = NONE++;
DIRECTORY_EXIST = NONE++;
FILE_NOT_EXIST = NONE++;
DIRECTORY_NOT_EXIST = NONE++;
DELETE_FILE_ERROR = NONE++;
DELETEFILE_FROMDB_ERROR = NONE++;
FILE_BEEN_LOCKED = NONE++;
FAIL = NONE++;
UNKNOWN = NONE++;
MAX = NONE++;
}
}
}
@@ -0,0 +1,256 @@
namespace LSServerService
{
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
public static class GLEncrypt
{
private static byte[] Aes_Key;
private static byte[] Aes_Vector;
private static byte[] Des_Key;
private static byte[] Des_Vector;
public static string AESDecrypt(string DeString)
{
byte[] bytes = AESDecrypt(Convert.FromBase64String(DeString), Aes_Key, Aes_Vector);
return Encoding.Default.GetString(bytes);
}
public static string AESDecrypt(string DeString, string Key)
{
byte[] bytes = AESDecrypt(Convert.FromBase64String(DeString), Key, "S\x000eL\x00154Zf-y9 ");
return Encoding.Default.GetString(bytes);
}
public static string AESDecrypt(string DeString, byte[] bKey, byte[] bVector)
{
byte[] bytes = AESDecrypt(Convert.FromBase64String(DeString), bKey, bVector);
return Encoding.Default.GetString(bytes);
}
public static byte[] AESDecrypt(byte[] Data, string Key, string Vector)
{
byte[] destinationArray = new byte[32];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(destinationArray.Length)), destinationArray, destinationArray.Length);
byte[] buffer2 = new byte[16];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(buffer2.Length)), buffer2, buffer2.Length);
return AESDecrypt(Data, destinationArray, buffer2);
}
public static byte[] AESDecrypt(byte[] Data, byte[] bKey, byte[] bVector)
{
byte[] buffer = null;
Rijndael rijndael = Rijndael.Create();
try
{
using (MemoryStream stream = new MemoryStream(Data))
{
using (CryptoStream stream2 = new CryptoStream(stream, rijndael.CreateDecryptor(bKey, bVector), CryptoStreamMode.Read))
{
using (MemoryStream stream3 = new MemoryStream())
{
byte[] buffer2 = new byte[1024];
int count = 0;
while ((count = stream2.Read(buffer2, 0, buffer2.Length)) > 0)
{
stream3.Write(buffer2, 0, count);
}
return stream3.ToArray();
}
}
}
}
catch
{
buffer = null;
}
return buffer;
}
public static string AESEncrypt(string EnString)
{
return Convert.ToBase64String(AESEncrypt(Encoding.Default.GetBytes(EnString), Aes_Key, Aes_Vector));
}
public static string AESEncrypt(string EnString, string Key)
{
return Convert.ToBase64String(AESEncrypt(Encoding.Default.GetBytes(EnString), Key, "S\x000eL\x00154Zf-y9 "));
}
public static string AESEncrypt(string EnString, byte[] bKey, byte[] bVector)
{
return Convert.ToBase64String(AESEncrypt(Encoding.Default.GetBytes(EnString), bKey, bVector));
}
public static byte[] AESEncrypt(byte[] Data, string Key, string Vector)
{
byte[] destinationArray = new byte[32];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(destinationArray.Length)), destinationArray, destinationArray.Length);
byte[] buffer2 = new byte[16];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(buffer2.Length)), buffer2, buffer2.Length);
return AESEncrypt(Data, destinationArray, buffer2);
}
public static byte[] AESEncrypt(byte[] Data, byte[] bKey, byte[] bVector)
{
byte[] buffer = null;
Rijndael rijndael = Rijndael.Create();
try
{
using (MemoryStream stream = new MemoryStream())
{
using (CryptoStream stream2 = new CryptoStream(stream, rijndael.CreateEncryptor(bKey, bVector), CryptoStreamMode.Write))
{
stream2.Write(Data, 0, Data.Length);
stream2.FlushFinalBlock();
return stream.ToArray();
}
}
}
catch
{
buffer = null;
}
return buffer;
}
public static void CreateAesKeyVector(out byte[] Key, out byte[] Vector)
{
Rijndael rijndael = Rijndael.Create();
rijndael.GenerateKey();
rijndael.GenerateIV();
Key = rijndael.Key;
Vector = rijndael.IV;
rijndael = null;
}
public static void CreateDesKeyVector(out byte[] Key, out byte[] Vector)
{
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
provider.GenerateKey();
provider.GenerateIV();
Key = provider.Key;
Vector = provider.IV;
provider = null;
}
public static void CreateKeyVector()
{
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
provider.GenerateKey();
provider.GenerateIV();
Des_Key = provider.Key;
Des_Vector = provider.IV;
provider = null;
Rijndael rijndael = Rijndael.Create();
rijndael.GenerateKey();
rijndael.GenerateIV();
Aes_Key = rijndael.Key;
Aes_Vector = rijndael.IV;
rijndael = null;
}
public static string DESDecrypt(string DeString)
{
byte[] bytes = DESDecrypt(Convert.FromBase64String(DeString), Des_Key, Des_Vector);
return Encoding.Default.GetString(bytes);
}
public static string DESDecrypt(string DeString, string Key)
{
byte[] bytes = DESDecrypt(Convert.FromBase64String(DeString), Key, "ޠj$6\x000fH");
return Encoding.Default.GetString(bytes);
}
public static byte[] DESDecrypt(byte[] Data, string Key, string Vector)
{
byte[] destinationArray = new byte[8];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(destinationArray.Length)), destinationArray, destinationArray.Length);
byte[] buffer2 = new byte[8];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(buffer2.Length)), buffer2, buffer2.Length);
return DESDecrypt(Data, destinationArray, buffer2);
}
public static byte[] DESDecrypt(byte[] Data, byte[] bKey, byte[] bVector)
{
byte[] buffer = null;
DESCryptoServiceProvider provider = new DESCryptoServiceProvider {
Mode = CipherMode.CBC,
Padding = PaddingMode.Zeros
};
try
{
using (MemoryStream stream = new MemoryStream(Data))
{
using (CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(bKey, bVector), CryptoStreamMode.Read))
{
using (MemoryStream stream3 = new MemoryStream())
{
byte[] buffer2 = new byte[1024];
int count = 0;
while ((count = stream2.Read(buffer2, 0, buffer2.Length)) > 0)
{
stream3.Write(buffer2, 0, count);
}
return stream3.ToArray();
}
}
}
}
catch
{
buffer = null;
}
return buffer;
}
public static string DESEncrypt(string EnString)
{
return Convert.ToBase64String(DESEncrypt(Encoding.Default.GetBytes(EnString), Des_Key, Des_Vector));
}
public static string DESEncrypt(string EnString, string Key)
{
return Convert.ToBase64String(DESEncrypt(Encoding.Default.GetBytes(EnString), Key, "ޠj$6\x000fH"));
}
public static byte[] DESEncrypt(byte[] Data, string Key, string Vector)
{
byte[] destinationArray = new byte[8];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(destinationArray.Length)), destinationArray, destinationArray.Length);
byte[] buffer2 = new byte[8];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(buffer2.Length)), buffer2, buffer2.Length);
return DESEncrypt(Data, destinationArray, buffer2);
}
public static byte[] DESEncrypt(byte[] Data, byte[] bKey, byte[] bVector)
{
byte[] buffer = null;
DESCryptoServiceProvider provider = new DESCryptoServiceProvider {
Mode = CipherMode.CBC,
Padding = PaddingMode.Zeros
};
try
{
using (MemoryStream stream = new MemoryStream())
{
using (CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(bKey, bVector), CryptoStreamMode.Write))
{
stream2.Write(Data, 0, Data.Length);
stream2.FlushFinalBlock();
return stream.ToArray();
}
}
}
catch
{
buffer = null;
}
return buffer;
}
}
}
@@ -0,0 +1,383 @@
namespace LSServerService
{
using LSUtils;
using System;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
public abstract class LSASyncSocket
{
private byte _HandledCloseEventCounter = 0;
private int _LastExchangeStamp = 0;
protected int _ReceivedLen = 0;
private int _SendedLen = 0;
protected Socket _socket;
protected int _socketstate = 0;
private object[] _source;
private int nSendLength = 0;
public object ObjClient2Server = 2;
public object ObjServer2Client = 1;
protected const uint PACKETMAXLEN = 102400;
private AutoResetEvent RevDone_Event = new AutoResetEvent(true);
private AutoResetEvent SendDone_Event = new AutoResetEvent(true);
protected StateObject StateObj = new StateObject();
public event SocketCloseEventHandle SocketCloseEvent;
protected LSASyncSocket()
{
}
protected void CheckCloseState(int ErrorCode)
{
LSWriteLog.WriteString("RecordSocketCloseReason.log", "socket.Handle= {0},_socket.Connected= {1},ErrorCode= {2}", new object[] { this._socket.Handle, this._socket.Connected, ErrorCode });
switch (ErrorCode)
{
case 10053:
case 10054:
case 10057:
case 10058:
this.CloseSocket();
break;
}
}
public void CloseSocket()
{
if (this._socketstate != 2)
{
try
{
this._socketstate = 2;
if ((this._socket != null) && this._socket.Connected)
{
string str = ((IPEndPoint) this._socket.RemoteEndPoint).Port.ToString();
LSWriteLog.WriteLog("SocketCloseInfo.log", true, "closesocket : socketid={0} _socketstate={1},RemotePort= {2} ", new object[] { this._socket.Handle.ToString(), this._socketstate, str });
this._socket.Shutdown(SocketShutdown.Receive);
Thread.Sleep(1);
this._socket.Close();
}
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSASyncSocket.CloseSocket SOCKET errorcode: {0} errormsg: {1} _socketstate={2}", new object[] { exception.SocketErrorCode, exception, this._socketstate });
}
catch (Exception exception2)
{
PubUtils.WriteLog("LSASyncSocket.CloseSocket error: {0}", new object[] { exception2 });
}
if (this.SocketCloseEvent != null)
{
this.SocketCloseEvent(this);
}
}
}
protected void ContinueReceive()
{
try
{
if (((this._socket != null) && this._socket.Connected) && (this._socketstate != 2))
{
this._ReceivedLen = 0;
if (this.StateObj.buffer.Length > this.StateObj.BufferSize)
{
this.StateObj.buffer = new byte[this.StateObj.BufferSize];
}
this.SetLastStamp();
this._socket.BeginReceive(this.StateObj.buffer, 0, this.StateObj.BufferSize, SocketFlags.None, new AsyncCallback(this.ReceiveCallback), this._socket);
}
}
catch (Exception exception)
{
PubUtils.WriteLog("ReceiveCallback error: {0}", new object[] { exception });
}
}
~LSASyncSocket()
{
if (this.SendDone_Event != null)
{
this.SendDone_Event.Close();
this.SendDone_Event = null;
}
if (this.RevDone_Event != null)
{
this.RevDone_Event.Close();
this.RevDone_Event = null;
}
}
public void HandledCloseEvent()
{
this._HandledCloseEventCounter = (byte) (this._HandledCloseEventCounter + 1);
}
protected abstract void ParseReceiveData(byte[] byteData);
protected abstract void ReceiveCallback(IAsyncResult ar);
protected void ReceiveReady()
{
this._socketstate = 1;
this._ReceivedLen = 0;
try
{
this._socket.BeginReceive(this.StateObj.buffer, 0, this.StateObj.BufferSize, SocketFlags.None, new AsyncCallback(this.ReceiveCallback), this._socket);
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSASyncSocket.ReceiveReady socket error: {0}", new object[] { exception });
this.CheckCloseState(exception.ErrorCode);
}
catch (Exception exception2)
{
PubUtils.WriteLog("LSASyncSocket.ReceiveReady error: {0}", new object[] { exception2 });
}
}
public bool Send(object structObj)
{
byte[] byteData = PubUtils.StructToBytes(structObj);
return this.Send(byteData);
}
public bool Send(byte[] byteData)
{
return this.Send(byteData, byteData.Length);
}
public bool Send(byte[] byteData, int sendLength)
{
int tickCount = Environment.TickCount;
if (((this._socket == null) || !this._socket.Connected) || (this._socketstate == 2))
{
if (this._socket == null)
{
PubUtils.WriteLog(this.ToString() + ".send 过程即将要发送数据,但是不能发出去,socket = null, _socketstate=={0}, 要发送的数据内容是:\n{1}", new object[] { this._socketstate, byteData });
}
else
{
PubUtils.WriteLog(this.ToString() + ".send 过程即将要发送数据,但是不能发出去,socket id= {0}, socket.Connected=={1},_socketstate=={2}, 要发送的数据内容是:\n{3}", new object[] { this._socket.Handle, this._socket.Connected, this._socketstate, byteData });
}
return false;
}
this.SendDone_Event.WaitOne();
if (((this._socket == null) || !this._socket.Connected) || (this._socketstate == 2))
{
this.SendDone_Event.Set();
return false;
}
LSWriteLog.WriteString("SocketSendDataWaitOneTime.log", "Socket Send Data WaitOne过程等待周期 = {0}", new object[] { Environment.TickCount - tickCount });
this.SetLastStamp();
this._SendedLen = 0;
this.nSendLength = sendLength;
try
{
this._socket.BeginSend(byteData, 0, sendLength, SocketFlags.None, new AsyncCallback(this.SendCallback), tickCount);
return true;
}
catch (SocketException exception)
{
this.SendDone_Event.Set();
PubUtils.WriteLog("LSASyncSocket.Sen SOCKET errorcode: {0} errormsg: {1}", new object[] { exception.SocketErrorCode, exception });
this.CheckCloseState(exception.ErrorCode);
}
catch (Exception exception2)
{
this.SendDone_Event.Set();
PubUtils.WriteLog("LSASyncSocket.Send error: {0}", new object[] { exception2 });
}
return false;
}
private void SendCallback(IAsyncResult ar)
{
if (((this._socket == null) || !this._socket.Connected) || (this._socketstate == 2))
{
LSWriteLog.WriteTrace("{0}.SendCallback send state,_socket= {1} ,_socket.Connected= {2}, _socketstate= {3}", new object[] { this, this._socket.Handle, this._socket.Connected, this._socketstate });
this.SendDone_Event.Set();
}
else
{
int asyncState = 2147483647;
try
{
asyncState = (int) ar.AsyncState;
int num2 = this._socket.EndSend(ar);
this._SendedLen += num2;
if (this.nSendLength != this._SendedLen)
{
PubUtils.WriteLog("严重错误!!!需要发送的长度是= {0},但实际发送的长度为= {1}", new object[] { this._SendedLen, this.nSendLength });
this.CloseSocket();
}
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSASyncSocket.SendCallback SOCKET errorcode: {0} errormsg: {1}, ", new object[] { exception.SocketErrorCode, exception.Message.ToString() });
this.CheckCloseState(exception.ErrorCode);
}
catch (Exception exception2)
{
if (this._socket == null)
{
PubUtils.WriteLog("LSASyncSocket.SendCallback error: {0}, _socket=null,this={1}", new object[] { exception2, this });
}
else
{
PubUtils.WriteLog("LSASyncSocket.SendCallback error: {0}, socket id={1},_socket.Connected={2},_socketstate={3},this={4}", new object[] { exception2, this._socket.Handle, this._socket.Connected, this._socketstate, this });
}
}
asyncState = Environment.TickCount - asyncState;
LSWriteLog.WriteString("SocketSendDataCostTime.log", "Socket Send Data周期(包含WaitOne) = {0}", new object[] { asyncState });
this.SendDone_Event.Set();
}
}
public void SetLastStamp()
{
this._LastExchangeStamp = Environment.TickCount;
}
private void SetOptBuffer(int SendBufSize, int RevBufSize)
{
if (SendBufSize <= 0)
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1024);
}
else
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, SendBufSize);
}
if (RevBufSize <= 0)
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 1024);
}
else
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, RevBufSize);
}
}
private void SetOptKeepAlive()
{
uint num = 10000;
uint num2 = 2000;
uint structure = 0;
byte[] array = new byte[Marshal.SizeOf(structure) * 3];
BitConverter.GetBytes((uint) 1).CopyTo(array, 0);
BitConverter.GetBytes(num).CopyTo(array, Marshal.SizeOf(structure));
BitConverter.GetBytes(num2).CopyTo(array, (int) (Marshal.SizeOf(structure) * 2));
this._socket.IOControl(IOControlCode.KeepAliveValues, array, null);
}
private void SetOptLinger(int nMilliSecond)
{
LingerOption optionValue = null;
if (nMilliSecond <= 0)
{
optionValue = new LingerOption(true, 1000);
}
else
{
optionValue = new LingerOption(true, nMilliSecond);
}
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, optionValue);
}
private void SetOptTimeOut(int nMilliSecond)
{
if (nMilliSecond <= 0)
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000);
}
else
{
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, nMilliSecond);
}
}
public bool TimeOutCheck(int TimeOutValue)
{
return ((Environment.TickCount - this._LastExchangeStamp) > TimeOutValue);
}
public bool HandledCloseEventCounter
{
get
{
return (this._HandledCloseEventCounter > 0);
}
}
public int ReceivedLen
{
get
{
return this._ReceivedLen;
}
}
public int SendedLen
{
get
{
return this._SendedLen;
}
}
public Socket socket
{
get
{
return this._socket;
}
}
public int SocketState
{
get
{
return this._socketstate;
}
}
public object[] source
{
get
{
return this._source;
}
set
{
this._source = value;
}
}
public delegate void SocketCloseEventHandle(LSASyncSocket AsyncSocket);
protected class StateObject
{
private const int _BufferSize = 10240;
public byte[] buffer = new byte[10240];
public void ExtentBuffer()
{
int num = this.buffer.Length * 2;
byte[] dst = new byte[num];
Buffer.BlockCopy(this.buffer, 0, dst, 0, this.buffer.Length);
this.buffer = dst;
}
public int BufferSize
{
get
{
return 10240;
}
}
}
}
}
@@ -0,0 +1,325 @@
namespace LSServerService
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.Text;
internal class LSDBManage
{
public SqlConnection conn = null;
public static string connectionStr = "";
public static Dictionary<string, LSDBManage> dbmanageList = new Dictionary<string, LSDBManage>();
public int checkFileLockState(int fileId, int parentId, string name)
{
int num = 0;
try
{
SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@RetParam", SqlDbType.Int), new SqlParameter("@fileId", SqlDbType.Int), new SqlParameter("@parentId", SqlDbType.Int), new SqlParameter("@name", SqlDbType.VarChar, 64) };
parameterArray[0].Direction = ParameterDirection.ReturnValue;
parameterArray[1].Value = fileId;
parameterArray[2].Value = parentId;
parameterArray[3].Value = name;
using (SqlCommand command = new SqlCommand("pr_fm_CheckFileLockState", this.conn))
{
command.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter parameter in parameterArray)
{
command.Parameters.Add(parameter);
}
command.ExecuteNonQuery();
num = int.Parse(parameterArray[0].Value.ToString());
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.createFile error is : {0} ", new object[] { exception });
}
return num;
}
public int createFile(int parentId, string name, int fileSize, int creator, int productId)
{
int num = 0;
try
{
SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@RetParam", SqlDbType.Int), new SqlParameter("@parentId", SqlDbType.Int), new SqlParameter("@name", SqlDbType.VarChar, 500), new SqlParameter("@fileSize", SqlDbType.Int), new SqlParameter("@creator", SqlDbType.Int), new SqlParameter("@productId", SqlDbType.Int) };
parameterArray[0].Direction = ParameterDirection.ReturnValue;
parameterArray[1].Value = parentId;
parameterArray[2].Value = name;
parameterArray[3].Value = fileSize;
parameterArray[4].Value = creator;
parameterArray[5].Value = productId;
using (SqlCommand command = new SqlCommand("pr_fm_createFile", this.conn))
{
command.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter parameter in parameterArray)
{
command.Parameters.Add(parameter);
}
command.ExecuteNonQuery();
num = int.Parse(parameterArray[0].Value.ToString());
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.createFile error is : {0} ", new object[] { exception });
}
return num;
}
public bool deleteFile(int fileId)
{
bool flag = false;
try
{
SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@RetParam", SqlDbType.Int), new SqlParameter("@fileId", SqlDbType.Int) };
parameterArray[0].Direction = ParameterDirection.ReturnValue;
parameterArray[1].Value = fileId;
using (SqlCommand command = new SqlCommand("pr_fm_deleteFile", this.conn))
{
command.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter parameter in parameterArray)
{
command.Parameters.Add(parameter);
}
command.ExecuteNonQuery();
flag = int.Parse(parameterArray[0].Value.ToString()) == 1;
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.deleteFile fileId={0} error is : {1} ", new object[] { fileId, exception });
}
return flag;
}
public void dispose()
{
if (this.conn != null)
{
try
{
lock (this.conn)
{
this.conn.Close();
this.conn.Dispose();
this.conn = null;
SqlHelper.conn = null;
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.dispose error is : {0} ", new object[] { exception });
}
}
}
public bool existFile(int parentId, string name)
{
bool flag = false;
try
{
SqlCommand command = new SqlCommand(string.Format("select * from P_fm_FileTab where parentId={0} and sName='{1}'", parentId, name), this.conn) {
CommandType = CommandType.Text
};
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
flag = true;
}
}
command.Dispose();
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.existFile error is : {0} ", new object[] { exception });
}
return flag;
}
public static void freeAll()
{
foreach (KeyValuePair<string, LSDBManage> pair in dbmanageList)
{
pair.Value.dispose();
}
}
public string getAbsoluteFile(int dwFileId)
{
if (dwFileId <= 0)
{
return "";
}
string str = "";
try
{
using (SqlDataReader reader = this.querySql(string.Format("select dbo.[fun_fm_getAbsolutePath]({0}) as absolutePath", dwFileId)))
{
if ((reader != null) && reader.Read())
{
str = reader["absolutePath"].ToString();
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.getAbsoluteFile error is : {0} ", new object[] { exception });
}
return str;
}
public SqlDataReader getDownloadFileList(int parentId, string fileIds, string strProductIds)
{
try
{
SqlCommand command = new SqlCommand("pr_fm_getDownloadFileInfo", this.conn) {
CommandType = CommandType.StoredProcedure
};
SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@parentId", SqlDbType.Int), new SqlParameter("@fileIds", SqlDbType.VarChar, 1000), new SqlParameter("@productIds", SqlDbType.VarChar, 1000) };
parameterArray[0].Value = parentId;
parameterArray[1].Value = fileIds;
parameterArray[2].Value = strProductIds;
command.Parameters.Add(parameterArray[0]);
command.Parameters.Add(parameterArray[1]);
command.Parameters.Add(parameterArray[2]);
return command.ExecuteReader();
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.getDownloadFileList error is : {0} ", new object[] { exception });
}
return null;
}
public string getRelativePath(int parentId)
{
if (parentId <= 0)
{
return "";
}
string str = "";
try
{
using (SqlDataReader reader = this.querySql(string.Format("select dbo.[fun_fm_getRelativePath]({0}) as relativePath", parentId)))
{
if ((reader != null) && reader.Read())
{
str = reader["relativePath"].ToString();
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.getRelativePath error is : {0} ", new object[] { exception });
}
return str;
}
public bool init()
{
try
{
this.conn = new SqlConnection(connectionStr);
this.conn.Open();
SqlHelper.conn = this.conn;
return true;
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.init error is : {0} ", new object[] { exception });
}
return false;
}
public SqlDataReader querySql(string strSql)
{
try
{
SqlCommand command = new SqlCommand(strSql, this.conn) {
CommandType = CommandType.Text
};
return command.ExecuteReader();
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.querySql error is : {0} ", new object[] { exception });
}
return null;
}
public void sendPushData(SortedList<uint, LSSocket> smartClients)
{
try
{
string str = LSIniFile.ReadValue("/Root/ServerSettings", "PushDataProcedure");
if (str != "")
{
string[] strArray = str.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
if (strArray.Length == 2)
{
string cmdText = strArray[0];
string str3 = strArray[1];
DataSet set = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, cmdText, "getPushdataTab", null);
if (set != null)
{
for (int i = 0; i < set.Tables.Count; i++)
{
foreach (DataRow row in set.Tables[i].Rows)
{
uint key = uint.Parse(row[str3].ToString());
if (smartClients.ContainsKey(key))
{
if (smartClients[key].SocketState == 2)
{
smartClients.Remove(key);
}
else
{
C2S2C_SmartResponse structObj = new C2S2C_SmartResponse(true);
string s = "";
string str5 = "";
for (int j = 0; j < set.Tables[i].Columns.Count; j++)
{
if (!(set.Tables[i].Columns[j].ColumnName == str3))
{
structObj.dwFieldCount++;
string str6 = row[j].ToString().Trim();
str5 = str5 + Encoding.Default.GetBytes(str6).Length.ToString() + "|";
s = s + str6;
}
}
if (s != "")
{
s = str5 + s;
byte[] bytes = Encoding.Default.GetBytes(s);
structObj.header.dwLen += (uint) bytes.Length;
structObj.dwDataLen = (uint) bytes.Length;
byte[] destBytes = new byte[structObj.header.dwLen];
PubUtils.CopyStructToBytes(structObj, destBytes, 0);
Buffer.BlockCopy(bytes, 0, destBytes, Marshal.SizeOf(structObj), bytes.Length);
smartClients[key].Send(destBytes);
destBytes = null;
bytes = null;
}
}
}
}
}
}
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSDBManage.sendPushData error is : {0} ", new object[] { exception });
}
}
}
}
@@ -0,0 +1,42 @@
namespace LSServerService
{
using System;
using System.Collections.Generic;
internal static class LSErrorManage
{
private static Dictionary<int, string> m_errList = new Dictionary<int, string>();
public static string getDes(int dwErrId)
{
try
{
return m_errList[dwErrId];
}
catch (Exception exception)
{
PubUtils.WriteLog("LSErrorManage.getDes errormsg: {0}", new object[] { exception });
}
return "";
}
public static void init()
{
try
{
m_errList.Add(ErrorType.SUCCESS, "成功");
m_errList.Add(ErrorType.FILE_EXIST, "文件已经存在");
m_errList.Add(ErrorType.DIRECTORY_EXIST, "文件夹已经存在");
m_errList.Add(ErrorType.FILE_NOT_EXIST, "文件不存在");
m_errList.Add(ErrorType.DIRECTORY_NOT_EXIST, "文件夹不存在");
m_errList.Add(ErrorType.FAIL, "失败");
m_errList.Add(ErrorType.UNKNOWN, "未知错误");
}
catch (Exception exception)
{
PubUtils.WriteLog("LSErrorManage.init errormsg: {0}", new object[] { exception });
}
}
}
}
@@ -0,0 +1,24 @@
namespace LSServerService
{
using System;
using System.IO;
internal class LSFileData
{
public int dwFileId;
public int dwRevPacketCount;
public int dwTotalBytes;
public int dwTotalCount;
public uint dwUserId = 0;
public FileStream fs;
public int lastWriteTime;
public LSFileData()
{
this.dwFileId = this.dwTotalBytes = this.dwTotalCount = this.dwRevPacketCount = 0;
this.fs = null;
this.lastWriteTime = Environment.TickCount;
}
}
}
@@ -0,0 +1,256 @@
namespace LSServerService
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
internal static class LSFileManage
{
private static Dictionary<int, LSFileData> m_fileList = new Dictionary<int, LSFileData>();
private static string m_rootPath = "";
public static void createClientDirectory(string strPath)
{
if (strPath != "")
{
try
{
string str = "";
string[] strArray = strPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
str = str + strArray[i] + "/";
if (!Directory.Exists(m_rootPath + str))
{
Directory.CreateDirectory(m_rootPath + str);
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.createClientDirectory errorcode: {0} ", new object[] { exception });
}
}
}
public static LSFileData createClientFile(string strName)
{
if (strName == "")
{
return null;
}
LSFileData fd = new LSFileData();
try
{
string path = m_rootPath + strName;
fd.fs = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read);
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.createClientFile errorcode: {0} ", new object[] { exception });
eraseFile(fd);
}
return fd;
}
public static bool createDir(LSDBManage dbmanager, int parentId, string dirName)
{
try
{
Directory.CreateDirectory(m_rootPath + dbmanager.getRelativePath(parentId) + dirName);
return true;
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.createDir errorcode: {0} ", new object[] { exception });
}
return false;
}
public static LSFileData createFile(LSDBManage dbmanager, int parentId, string fileName, bool saveOld)
{
LSFileData data = new LSFileData();
try
{
string str = dbmanager.getRelativePath(parentId);
string rootPath = m_rootPath;
string[] strArray = str.Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < strArray.Length; i++)
{
rootPath = rootPath + strArray[i] + "//";
if (!Directory.Exists(rootPath))
{
Directory.CreateDirectory(rootPath);
}
}
string path = m_rootPath + str + fileName;
if (saveOld && File.Exists(path))
{
File.Move(path, path + "#" + DateTime.Now.ToString("yyyy_MM_dd#hh_mm_ss"));
}
data.fs = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read);
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.createFile errorcode: {0} ", new object[] { exception });
}
return data;
}
public static bool createFileData(C2S2C_FileData data, out C2S2C_FileTranslateComplete structComplete)
{
structComplete = new C2S2C_FileTranslateComplete(true);
try
{
LSFileData data2 = m_fileList[data.dwFileId];
if (data2 != null)
{
data2.fs.Write(data.FileData, 0, data.dwPacketLen);
data2.dwTotalBytes = data.dwTotalBytes;
data2.dwTotalCount = data.dwTotalCount;
data2.dwRevPacketCount++;
data2.lastWriteTime = Environment.TickCount;
if (data2.fs.Length >= data2.dwTotalBytes)
{
structComplete.dwFileId = data2.dwFileId;
structComplete.dwTotalBytes = data2.dwTotalBytes;
structComplete.dwTotalCount = data2.dwTotalCount;
structComplete.dwRevPacketCount = data2.dwRevPacketCount;
structComplete.dwRevBytesLen = (int) data2.fs.Length;
data2.fs.Flush();
data2.fs.Close();
data2.fs.Dispose();
data2.fs = null;
lock (m_fileList)
{
m_fileList.Remove(data.dwFileId);
}
return true;
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.createFileData errorcode: {0} ", new object[] { exception });
}
return false;
}
public static bool deleteFile(LSDBManage dbmanager, int fileId)
{
try
{
string path = m_rootPath + dbmanager.getAbsoluteFile(fileId);
if (File.Exists(path))
{
File.Move(path, path + "#" + DateTime.Now.ToString("yyyy_MM_dd#hh_mm_ss"));
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.deleteFile errorcode: {0} ", new object[] { exception });
return false;
}
return true;
}
public static void dispose()
{
try
{
lock (m_fileList)
{
foreach (KeyValuePair<int, LSFileData> pair in m_fileList)
{
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.dispose errorcode: {0} ", new object[] { exception });
}
}
public static void eraseFile(LSFileData fd)
{
if ((fd != null) && (fd.fs != null))
{
try
{
string name = fd.fs.Name;
fd.fs.Flush();
fd.fs.Close();
fd.fs.Dispose();
fd.fs = null;
File.Delete(name);
if (File.Exists(name))
{
PubUtils.WriteLog("LSFileManage.eraseFile 无法删除指定文件: {0} ", new object[] { name });
}
}
catch (Exception exception)
{
PubUtils.WriteLog("LSFileManage.eraseFile errorcode: {0} ", new object[] { exception });
}
lock (m_fileList)
{
m_fileList.Remove(fd.dwFileId);
}
}
}
public static void eraseFile(int dwFileId)
{
lock (m_fileList)
{
LSFileData fd = m_fileList[dwFileId];
eraseFile(fd);
}
}
public static bool existDir(LSDBManage dbmanager, int parentId, string dirName)
{
string str = dbmanager.getRelativePath(parentId);
return Directory.Exists(m_rootPath + str + dirName);
}
public static bool existFile(LSDBManage dbmanager, int parentId, string fileName)
{
string str = dbmanager.getRelativePath(parentId);
return File.Exists(m_rootPath + str + fileName);
}
public static bool init(string rootPath)
{
m_rootPath = rootPath;
return Directory.Exists(rootPath);
}
public static void insertFileData(LSFileData fd)
{
lock (m_fileList)
{
if (m_fileList.ContainsKey(fd.dwFileId))
{
m_fileList.Remove(fd.dwFileId);
}
else
{
m_fileList.Add(fd.dwFileId, fd);
}
}
}
public static string joinFileName(string filename)
{
string path = m_rootPath + filename;
if (File.Exists(path))
{
return path;
}
return "";
}
}
}
@@ -0,0 +1,143 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Xml;
public static class LSIniFile
{
private static string _IniPath = "";
private static XmlDocument xmlDoc = new XmlDocument();
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
public static XmlNodeList ReadNodeList(string strNodeName)
{
XmlNodeList elementsByTagName;
try
{
elementsByTagName = xmlDoc.GetElementsByTagName(strNodeName);
}
catch (Exception exception)
{
PubUtils.WriteLog("error: {0}", new object[] { exception });
return null;
}
return elementsByTagName;
}
public static string ReadNodeValue(XmlNode node, string strName)
{
string str = null;
if (node.HasChildNodes)
{
for (int i = 0; i < node.ChildNodes.Count; i++)
{
if (node.ChildNodes[i].LocalName == strName)
{
return node.ChildNodes[i].InnerXml;
}
}
return str;
}
return null;
}
public static XmlNode ReadSingleNode(string strNodeName)
{
XmlNode node = null;
try
{
node = xmlDoc.DocumentElement.SelectSingleNode(strNodeName);
}
catch (Exception exception)
{
PubUtils.WriteLog("error: {0}", new object[] { exception });
return null;
}
return node;
}
public static string ReadValue(string NodePath, string NodeName)
{
try
{
for (XmlNode node = xmlDoc.DocumentElement.SelectNodes(NodePath)[0].FirstChild; node != null; node = node.NextSibling)
{
if (node.Name == NodeName)
{
return node.InnerText;
}
}
}
catch (Exception exception)
{
PubUtils.WriteLog("error: {0}", new object[] { exception });
}
return "";
}
public static bool ReadValue(string NodeName, int index, params string[] NodeValues)
{
try
{
XmlNode node = ReadSingleNode(NodeName);
if (node.ChildNodes.Count <= index)
{
return false;
}
node = node.ChildNodes[index];
int num = 0;
for (XmlNode node2 = node.FirstChild; (node2 != null) && (num < NodeValues.Length); node2 = node2.NextSibling)
{
if (node2.NodeType == XmlNodeType.Element)
{
NodeValues[num] = node2.InnerText;
num++;
}
}
return true;
}
catch (Exception exception)
{
PubUtils.WriteLog("error: {0}", new object[] { exception });
return false;
}
}
public static string ReadValue(string Section, string Key, string path)
{
StringBuilder retVal = new StringBuilder(255);
int num = GetPrivateProfileString(Section, Key, "", retVal, 255, path);
return retVal.ToString();
}
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
public static void WriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, _IniPath);
}
public static void WriteValue(string Section, string Key, string Value, string path)
{
WritePrivateProfileString(Section, Key, Value, path);
}
public static string IniPath
{
set
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
if (!baseDirectory.EndsWith(@"\"))
{
baseDirectory = baseDirectory + @"\";
}
_IniPath = baseDirectory + value;
xmlDoc.Load(_IniPath);
}
}
}
}
@@ -0,0 +1,14 @@
namespace LSServerService
{
using System;
public static class LSProtocol
{
public const int LS_DOWNLOADFILE_MAXCOUNT = 50;
public const int LS_FILEDATAPACKET_LEN = 1024;
public const int LS_FILENAM_LEN = 512;
public const int LS_PATH_LEN = 1024;
public const uint PACKETMAXLEN = 102400;
}
}
@@ -0,0 +1,51 @@
namespace LSServerService
{
using System;
using System.Collections.Generic;
using System.Threading;
internal static class LSQueueManage
{
private static Queue<LSSocketRev> LSSocketRevQueue = new Queue<LSSocketRev>();
private static AutoResetEvent Rev_Event = new AutoResetEvent(true);
public static LSSocketRev GetSocketRevData()
{
LSSocketRev socketRevData = null;
if (LSSocketRevQueue.Count > 0)
{
lock (LSSocketRevQueue)
{
socketRevData = LSSocketRevQueue.Dequeue();
}
}
else
{
Rev_Event.WaitOne();
}
if (socketRevData == null)
{
socketRevData = GetSocketRevData();
}
return socketRevData;
}
public static void InsertSocketRevData(LSSocketRev socketRev)
{
lock (LSSocketRevQueue)
{
LSSocketRevQueue.Enqueue(socketRev);
}
Rev_Event.Set();
}
public static int LSSocketRevQueueCount
{
get
{
return LSSocketRevQueue.Count;
}
}
}
}
@@ -0,0 +1,234 @@
namespace LSServerService
{
using LSUtils;
using System;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
public class LSSocket : LSASyncSocket
{
private int _selDirectoryId = 0;
private string _ServerIP = "";
private uint _ServerPort = 0;
private const int FIONREAD = 1074030207;
private uint m_dwUserId = 0;
private string m_remoteIP;
private int m_remotePort;
public event ParseReceiveDataEventHandle ParseReceiveDataEvent;
public LSSocket()
{
base._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
public void clientAdd(Socket s)
{
base._socket = s;
base.ReceiveReady();
}
public void Connect(string strHost, uint nPort)
{
try
{
this.ServerIP = strHost;
this.ServerPort = nPort;
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(strHost), (int) nPort);
LSWriteLog.WriteTrace("begin connect server ip={0}, port={1} ", new object[] { strHost, nPort });
base._socket.BeginConnect(remoteEP, new AsyncCallback(this.ConnectCallback), base._socket);
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSSocket.Connect SOCKET error: {0}", new object[] { exception });
}
catch (Exception exception2)
{
PubUtils.WriteLog("LSSocket.Connect error: {0}", new object[] { exception2 });
}
}
private void ConnectCallback(IAsyncResult ar)
{
try
{
((Socket) ar.AsyncState).EndConnect(ar);
LSWriteLog.WriteTrace("connected server ip={0} port={1} success", new object[] { this.ServerIP, this.ServerPort });
base.ReceiveReady();
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSSocket.Connect SOCKET errorcode: {0} errormsg: {1}", new object[] { exception.SocketErrorCode, exception });
base.CheckCloseState(exception.ErrorCode);
}
catch (Exception exception2)
{
PubUtils.WriteLog("LSSocket.ConnectCallback error: {0}", new object[] { exception2 });
}
}
protected override void ParseReceiveData(byte[] byteData)
{
this.ParseReceiveDataEvent(this, byteData);
}
protected override void ReceiveCallback(IAsyncResult ar)
{
try
{
LSWriteLog.WriteTrace(this.ToString() + ".ReceiveCallback is running socketid = " + base._socket.Handle, new object[0]);
if (!((base._socket != null) && base._socket.Connected))
{
base.CloseSocket();
return;
}
LSWriteLog.WriteTrace(string.Concat(new object[] { this.ToString(), ".ReceiveCallback socketid = ", base._socket.Handle, " bytesAvailable is ", base._socket.Available.ToString(), " _socketstate=", this._socketstate.ToString() }), new object[0]);
if ((base._socket.Available == 0) && (base._socketstate == 2))
{
return;
}
int count = base._socket.EndReceive(ar);
byte[] dst = new byte[count];
Buffer.BlockCopy(base.StateObj.buffer, 0, dst, 0, count);
if (count > 0)
{
int num3;
base._ReceivedLen += count;
for (int i = 0; i < base._ReceivedLen; i += num3)
{
bool flag = (base._ReceivedLen - i) <= 8;
Label_0158:
if (flag)
{
if ((base._ReceivedLen - i) < base.StateObj.buffer.Length)
{
Buffer.BlockCopy(base.StateObj.buffer, i, base.StateObj.buffer, 0, base._ReceivedLen - i);
}
else
{
base.StateObj.ExtentBuffer();
}
base._ReceivedLen -= i;
base._socket.BeginReceive(base.StateObj.buffer, base._ReceivedLen, base.StateObj.buffer.Length - base._ReceivedLen, SocketFlags.None, new AsyncCallback(this.ReceiveCallback), base._socket);
return;
}
num3 = BitConverter.ToInt32(base.StateObj.buffer, 4 + i);
if ((num3 + i) > base._ReceivedLen)
{
flag = true;
goto Label_0158;
}
byte[] buffer2 = new byte[num3];
Buffer.BlockCopy(base.StateObj.buffer, i, buffer2, 0, num3);
if (num3 > 102400)
{
byte[] buffer3 = new byte[base._ReceivedLen];
Buffer.BlockCopy(base.StateObj.buffer, 0, buffer3, 0, base._ReceivedLen);
PubUtils.WriteLog("received proxy data is unnormal! socketid= {0} and a packet data is :{1} and whole data is :{2}", new object[] { base._socket.Handle, buffer2, buffer3 });
}
else
{
this.ParseReceiveData(buffer2);
}
}
}
else
{
base.CloseSocket();
}
}
catch (SocketException exception)
{
PubUtils.WriteLog("LSSocket.ReceiveCallback SOCKET errorcode: {0} errormsg: {1}", new object[] { exception.SocketErrorCode, exception });
base.CheckCloseState(exception.ErrorCode);
}
catch (Exception exception2)
{
PubUtils.WriteLog("LSSocket.ReceiveCallback error: {0}", new object[] { exception2 });
}
base.ContinueReceive();
}
public void reConnect()
{
base._socketstate = 0;
this.Connect(this.m_remoteIP, (uint) this.m_remotePort);
}
public uint dwUserId
{
get
{
return this.m_dwUserId;
}
set
{
this.m_dwUserId = value;
}
}
public string remoteIP
{
get
{
return this.m_remoteIP;
}
set
{
this.m_remoteIP = value;
}
}
public int remotePort
{
get
{
return this.m_remotePort;
}
set
{
this.m_remotePort = value;
}
}
public int selDirectoryId
{
get
{
return this._selDirectoryId;
}
set
{
this._selDirectoryId = value;
}
}
public string ServerIP
{
get
{
return this._ServerIP;
}
set
{
this._ServerIP = value;
}
}
public uint ServerPort
{
get
{
return this._ServerPort;
}
set
{
this._ServerPort = value;
}
}
public delegate void ParseReceiveDataEventHandle(LSSocket ProxySocket, byte[] byteData);
}
}
@@ -0,0 +1,35 @@
namespace LSServerService
{
using System;
public class LSSocketRev
{
private byte[] _ByteData = null;
private LSSocket _ClientSocket = null;
public byte[] ByteData
{
get
{
return this._ByteData;
}
set
{
this._ByteData = value;
}
}
public LSSocket ClientSocket
{
get
{
return this._ClientSocket;
}
set
{
this._ClientSocket = value;
}
}
}
}
@@ -0,0 +1,15 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct MsgHeader
{
public const uint sizeOf = 8;
public uint dwType;
public uint dwLen;
public uint dwUserId;
}
}
@@ -0,0 +1,344 @@
namespace LSServerService
{
using LSUtils;
using System;
using System.ComponentModel;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
public class PubUtils
{
public static readonly PubUtils Instance = new PubUtils();
private PubUtils()
{
}
public static byte[] BytesAddStruct(byte[] bytesHead, object structObj)
{
byte[] src = StructToBytes(structObj);
if ((bytesHead == null) || (bytesHead.Length <= 0))
{
return src;
}
int num = bytesHead.Length + src.Length;
byte[] dst = new byte[num];
Buffer.BlockCopy(bytesHead, 0, dst, 0, bytesHead.Length);
Buffer.BlockCopy(src, 0, dst, bytesHead.Length, src.Length);
return dst;
}
public static byte[] BytesAddStruct(object structObj, byte[] bytesTail)
{
byte[] src = StructToBytes(structObj);
if ((bytesTail == null) || (bytesTail.Length <= 0))
{
return src;
}
int num = src.Length + bytesTail.Length;
byte[] dst = new byte[num];
Buffer.BlockCopy(src, 0, dst, 0, src.Length);
Buffer.BlockCopy(bytesTail, 0, dst, src.Length, bytesTail.Length);
return dst;
}
public static byte[] BytesIntercept(byte[] SrcBytes, uint FixedLen)
{
byte[] dst = new byte[FixedLen];
int count = (SrcBytes.Length > FixedLen) ? ((int) FixedLen) : SrcBytes.Length;
Buffer.BlockCopy(SrcBytes, 0, dst, 0, count);
return dst;
}
public static string BytesToStr(byte[] SrcBytes)
{
return Encoding.Default.GetString(SrcBytes).Replace("\0", "");
}
public static string BytesToStr(byte[] SrcBytes, int index, int count)
{
return Encoding.Default.GetString(SrcBytes, index, count).Replace("\0", "");
}
public static object BytesToStruct(byte[] bytes, Type structType)
{
return BytesToStruct(bytes, structType, 0, 0);
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex)
{
return BytesToStruct(bytes, structType, startIndex, 0);
}
public static object BytesToStruct(byte[] bytes, Type structType, string ExceptField)
{
return BytesToStruct(bytes, structType, 0, 0, new string[] { ExceptField });
}
public static object BytesToStruct(byte[] bytes, Type structType, string[] ExceptFields)
{
return BytesToStruct(bytes, structType, 0, 0, ExceptFields);
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex, int decCount)
{
object obj2 = null;
int num = 1;
int num2 = 0;
int num3 = 0;
while (num > 0)
{
int cb = Marshal.SizeOf(structType);
IntPtr destination = Marshal.AllocHGlobal(cb);
try
{
num3 = 0;
Marshal.Copy(bytes, startIndex, destination, cb - decCount);
num3 = 1;
obj2 = Marshal.PtrToStructure(destination, structType);
num3 = 2;
}
catch (Exception exception)
{
WriteLog("PubUtils.BytesToStruct error is {0},size={1},startIndex={2},decCount={3},bError={4},LinePos={5},bytes is:\n{6}", new object[] { exception.Message.ToString(), cb, startIndex, decCount, num2, num3, bytes });
num++;
if (num2 > 2)
{
throw new Exception(exception.Message.ToString());
}
num2++;
}
finally
{
Marshal.FreeHGlobal(destination);
}
num--;
}
return obj2;
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex, string ExceptField)
{
return BytesToStruct(bytes, structType, startIndex, 0, new string[] { ExceptField });
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex, string[] ExceptFields)
{
return BytesToStruct(bytes, structType, startIndex, 0, ExceptFields);
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex, int decCount, string ExceptField)
{
return BytesToStruct(bytes, structType, startIndex, decCount, new string[] { ExceptField });
}
public static object BytesToStruct(byte[] bytes, Type structType, int startIndex, int decCount, string[] ExceptFields)
{
object obj3;
try
{
string str = "|";
for (int i = 0; i < ExceptFields.Length; i++)
{
str = str + ExceptFields[i] + "|";
}
int dstOffset = 0;
int num3 = Marshal.SizeOf(structType) - decCount;
byte[] buffer = new byte[num3];
object obj2 = BytesToStruct(buffer, structType);
FieldInfo[] fields = structType.GetFields();
foreach (FieldInfo info in fields)
{
int count = 0;
if (info.FieldType.IsArray)
{
Array array = (Array) info.GetValue(obj2);
count = array.Length;
}
else
{
count = Marshal.SizeOf(info.FieldType);
}
string str2 = "|" + info.Name + "|";
if (!str.Contains(str2))
{
Buffer.BlockCopy(bytes, startIndex, buffer, dstOffset, count);
startIndex += count;
}
dstOffset += count;
}
obj3 = BytesToStruct(buffer, structType);
}
catch (Exception exception)
{
WriteLog("PubUtils.BytesToStruct error: {0},bytes is :\n{1} \n,ExceptFields is \n{2}", new object[] { exception.Message.ToString(), bytes, ExceptFields });
throw new Exception(exception.Message.ToString());
}
return obj3;
}
public static byte[] ComposeTwoBytes(byte[] bytesHead, byte[] bytesTail)
{
int num = bytesHead.Length + bytesTail.Length;
byte[] dst = new byte[num];
Buffer.BlockCopy(bytesHead, 0, dst, 0, bytesHead.Length);
Buffer.BlockCopy(bytesTail, 0, dst, bytesHead.Length, bytesTail.Length);
return dst;
}
public static byte[] CopyArrayData(byte[] source, int startIndex, int length)
{
byte[] buffer = new byte[length];
for (int i = 0; i < length; i++)
{
buffer[i] = source[startIndex + i];
}
return buffer;
}
public static void CopyStructToBytes(object structObj, byte[] destBytes, int dstOffset)
{
int cb = Marshal.SizeOf(structObj);
IntPtr ptr = Marshal.AllocHGlobal(cb);
try
{
Marshal.StructureToPtr(structObj, ptr, false);
Marshal.Copy(ptr, destBytes, dstOffset, cb);
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
public static IPAddress GetServerIP()
{
IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress address in hostEntry.AddressList)
{
if (address.AddressFamily == AddressFamily.InterNetwork)
{
return address;
}
}
return null;
}
public static uint IPToLong(string strIP)
{
return (uint) IPAddress.Parse(strIP).Address;
}
public static string LongToIP(uint dwIP)
{
return new IPAddress((long) dwIP).ToString();
}
public static string ReadXmlStr(string SrcStr)
{
return SrcStr.Replace("&lt;", "<").Replace("&gt;", ">").Replace("&amp;", "&").Replace("&apos;", "'").Replace("&quot;", "\"");
}
public static byte[] StrToBytes(string SrcString)
{
return Encoding.Default.GetBytes(SrcString);
}
public static byte[] StrToBytes(string SrcString, uint FixedLen)
{
return StrToBytes(SrcString.ToCharArray(), FixedLen);
}
public static byte[] StrToBytes(char[] SrcChar, uint FixedLen)
{
return BytesIntercept(Encoding.Default.GetBytes(SrcChar), FixedLen);
}
public static byte[] StructToBytes(object structObj)
{
byte[] buffer2;
int cb = Marshal.SizeOf(structObj);
IntPtr ptr = Marshal.AllocHGlobal(cb);
try
{
Marshal.StructureToPtr(structObj, ptr, false);
byte[] destination = new byte[cb];
Marshal.Copy(ptr, destination, 0, cb);
buffer2 = destination;
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return buffer2;
}
public static byte[] StructToBytes(object structObj, int decCount)
{
byte[] buffer2;
int cb = Marshal.SizeOf(structObj);
IntPtr ptr = Marshal.AllocHGlobal(cb);
try
{
Marshal.StructureToPtr(structObj, ptr, false);
byte[] destination = new byte[cb - decCount];
Marshal.Copy(ptr, destination, 0, cb - decCount);
buffer2 = destination;
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return buffer2;
}
public static void WriteLog(string ErrMsg, params object[] args)
{
LSWriteLog.WriteLog("sysError.log", ErrMsg, args);
Win32Exception exception = new Win32Exception();
LSWriteLog.WriteLog("sysError.log", "Win32Exception= {0}", new object[] { exception });
exception = null;
}
public static string WriteXmlStr(string SrcStr)
{
return SrcStr.Replace("<", "&lt;").Replace(">", "&gt;").Replace("&", "&amp;").Replace("'", "&apos;").Replace("\"", "&quot;");
}
public static IPAddress LocalFirstIPAddr
{
get
{
return Dns.Resolve(LocalMachineName).AddressList[0];
}
}
public static uint LocalFirstIPLong
{
get
{
return (uint) LocalFirstIPAddr.Address;
}
}
public static string LocalFirstIPStr
{
get
{
return LocalFirstIPAddr.Address.ToString();
}
}
public static string LocalMachineName
{
get
{
return Environment.MachineName;
}
}
}
}
@@ -0,0 +1,24 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C2S_Heart
{
public static uint ID;
public MsgHeader header;
public S2C2S_Heart(bool autoSet)
{
this.header = new MsgHeader();
this.header.dwType = ID;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
static S2C2S_Heart()
{
ID = 65542;
}
}
}
@@ -0,0 +1,23 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_AddFile
{
public const uint ID = 18;
public MsgHeader header;
public int dwErrId;
public StructFileInfo fi;
public S2C_AddFile(bool autoSet)
{
this.dwErrId = 0;
this.fi = new StructFileInfo(true);
this.header = new MsgHeader();
this.header.dwType = 18;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,23 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_AddFileDirectory
{
public const uint ID = 2;
public MsgHeader header;
public int dwErrId;
public StructFileInfo fi;
public S2C_AddFileDirectory(bool autoSet)
{
this.dwErrId = 0;
this.fi = new StructFileInfo(true);
this.header = new MsgHeader();
this.header.dwType = 2;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,22 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_DeleteFile
{
public const uint ID = 23;
public MsgHeader header;
public int dwErrId;
public int dwFileId;
public S2C_DeleteFile(bool autoSet)
{
this.dwErrId = this.dwFileId = 0;
this.header = new MsgHeader();
this.header.dwType = 23;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,25 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_DownloadFile
{
public const uint ID = 20;
public MsgHeader header;
public int dwErrId;
public int dwTotalCount;
public int dwCurrentIndex;
public StructFileInfo fi;
public S2C_DownloadFile(bool autoSet)
{
this.header = new MsgHeader();
this.dwErrId = this.dwTotalCount = this.dwCurrentIndex = 0;
this.fi = new StructFileInfo(true);
this.header.dwType = 20;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,22 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_EditFileDirectory
{
public const uint ID = 4;
public MsgHeader header;
public int dwErrId;
public int dwFileId;
public S2C_EditFileDirectory(bool autoSet)
{
this.dwErrId = this.dwFileId = 0;
this.header = new MsgHeader();
this.header.dwType = 4;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,22 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_RemoveFileDirectory
{
public const uint ID = 6;
public MsgHeader header;
public int dwErrId;
public int dwFileId;
public S2C_RemoveFileDirectory(bool autoSet)
{
this.header = new MsgHeader();
this.dwErrId = this.dwFileId = 0;
this.header.dwType = 6;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,39 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_ReqBackgroundDownload
{
public const uint ID = 65544;
public MsgHeader header;
public int dwErrId;
public int reqType;
public int dwCount;
public S2C_ReqBackgroundDownload(bool autoSet)
{
this.dwErrId = this.dwCount = 0;
this.reqType = 1;
this.header = new MsgHeader();
this.header.dwType = 65544;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
public bool isDownloadModel
{
get
{
return (this.reqType == 1);
}
}
public bool isGetFileListModel
{
get
{
return (this.reqType == 2);
}
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_ReqUpdateFile
{
public const uint ID = 4099;
public MsgHeader header;
public StructFileInfo fi;
public S2C_ReqUpdateFile(bool autoSet)
{
this.fi = new StructFileInfo(true);
this.header = new MsgHeader();
this.header.dwType = 4099;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,23 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct S2C_ReqestFileList
{
public const uint ID = 34;
public MsgHeader header;
public int dwErrId;
public int dwReqType;
public int dwCount;
public S2C_ReqestFileList(bool autoSet)
{
this.dwErrId = this.dwCount = this.dwReqType = 0;
this.header = new MsgHeader();
this.header.dwType = 34;
this.header.dwLen = (uint) Marshal.SizeOf(this);
}
}
}
@@ -0,0 +1,21 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct StructDirectoryInfo
{
public int dwParentId;
public int dwFileId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=512)]
public byte[] szName;
public int isDir;
public StructDirectoryInfo(bool autoSet)
{
this.dwParentId = this.dwFileId = this.isDir = 0;
this.szName = new byte[512];
}
}
}
@@ -0,0 +1,77 @@
namespace LSServerService
{
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct StructFileInfo
{
public int dwParentId;
public int dwFileId;
public int dwCreator;
public int dwFileSize;
public long dwCreateTime;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=512)]
public byte[] szName;
public StructFileInfo(bool autoSet)
{
this.dwParentId = this.dwFileId = this.dwCreator = this.dwFileSize = 0;
this.dwCreateTime = 0L;
this.szName = new byte[512];
}
public StructFileInfo clone()
{
StructFileInfo fi = new StructFileInfo(true);
this.clone(fi);
return fi;
}
public void clone(StructFileInfo fi)
{
fi.dwParentId = this.dwParentId;
fi.dwFileId = this.dwFileId;
fi.dwCreator = this.dwCreator;
fi.dwFileSize = this.dwFileSize;
fi.dwCreateTime = this.dwCreateTime;
Buffer.BlockCopy(this.szName, 0, fi.szName, 0, this.szName.Length);
}
public string strName
{
get
{
return PubUtils.BytesToStr(this.szName);
}
set
{
byte[] src = PubUtils.StrToBytes(value);
Buffer.BlockCopy(src, 0, this.szName, 0, src.Length);
src = null;
}
}
public string strCreateTime
{
get
{
return DateTime.FromFileTime(this.dwCreateTime).ToString("yyyy-MM-dd HH:mm:ss");
}
set
{
this.dwCreateTime = DateTime.Parse(value).ToFileTime();
}
}
public DateTime dtCreateTime
{
get
{
return DateTime.FromFileTime(this.dwCreateTime);
}
set
{
this.dwCreateTime = value.ToFileTime();
}
}
}
}
+154
View File
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectType>local</ProjectType>
<ProjectVersion>7.10.377</ProjectVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{932B2CE5-845F-48E4-AA58-B04AA333B6AD}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<AssemblyName>LSTest</AssemblyName>
<OutputType>WinExe</OutputType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\Attach\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Release\Attach\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>none</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Reference Include="LSWriteLog">
<HintPath>..\publish\LSWriteLog.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Global.cs" />
<Compile Include="LSFileClient\FrmBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LSFileClient\FrmBatchProgress.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LSFileClient\frmDelete.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LSFileClient\frmDelete.Designer.cs">
<DependentUpon>frmDelete.cs</DependentUpon>
</Compile>
<Compile Include="LSFileClient\ImageUtil.cs" />
<Compile Include="LSFileClient\IniUtil.cs" />
<Compile Include="LSServerService\AESUtil.cs" />
<Compile Include="SqlHelper.cs" />
<Compile Include="LSFileClient\FrmBatchProgress.Designer.cs">
<DependentUpon>FrmBatchProgress.cs</DependentUpon>
</Compile>
<Compile Include="LSServerService\LSProtocol.cs" />
<Compile Include="LSServerService\MsgHeader.cs" />
<Compile Include="LSServerService\C2S_ReqestFileList.cs" />
<Compile Include="LSServerService\S2C_ReqestFileList.cs" />
<Compile Include="LSServerService\StructFileInfo.cs" />
<Compile Include="LSServerService\StructDirectoryInfo.cs" />
<Compile Include="LSServerService\C2S_AddFileDirectory.cs" />
<Compile Include="LSServerService\S2C_AddFileDirectory.cs" />
<Compile Include="LSServerService\C2S_EditFileDirectory.cs" />
<Compile Include="LSServerService\S2C_EditFileDirectory.cs" />
<Compile Include="LSServerService\C2S_RemoveFileDirectory.cs" />
<Compile Include="LSServerService\S2C_RemoveFileDirectory.cs" />
<Compile Include="LSServerService\C2S_AddFile.cs" />
<Compile Include="LSServerService\S2C_AddFile.cs" />
<Compile Include="LSServerService\C2S_DownloadFile.cs" />
<Compile Include="LSServerService\S2C_DownloadFile.cs" />
<Compile Include="LSServerService\C2S_DeleteFile.cs" />
<Compile Include="LSServerService\S2C_DeleteFile.cs" />
<Compile Include="LSServerService\C2S2C_FileData.cs" />
<Compile Include="LSServerService\C2S2C_FileTranslateComplete.cs" />
<Compile Include="LSServerService\S2C_ReqUpdateFile.cs" />
<Compile Include="LSServerService\S2C2S_Heart.cs" />
<Compile Include="LSServerService\C2S_ReqBackgroundDownload.cs" />
<Compile Include="LSServerService\S2C_ReqBackgroundDownload.cs" />
<Compile Include="LSServerService\C2S2C_BackgroundFileData.cs" />
<Compile Include="LSServerService\C2S_SmartClientLogin.cs" />
<Compile Include="LSServerService\C2S2C_SmartResponse.cs" />
<Compile Include="LSTest\Properties\Resources.cs" />
<Compile Include="LSFileClient\Program.cs" />
<Compile Include="LSFileClient\frmSingleDownload.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LSServerService\LSFileData.cs" />
<Compile Include="LSFileClient\frmSingleDownload.Designer.cs">
<DependentUpon>frmSingleDownload.cs</DependentUpon>
</Compile>
<Compile Include="LSServerService\LSFileManage.cs" />
<Compile Include="LSServerService\LSDBManage.cs" />
<Compile Include="LSServerService\PubUtils.cs" />
<Compile Include="LSServerService\LSIniFile.cs" />
<Compile Include="LSServerService\GLEncrypt.cs" />
<Compile Include="LSServerService\ErrorType.cs" />
<Compile Include="LSServerService\LSErrorManage.cs" />
<Compile Include="LSServerService\LSSocketRev.cs" />
<Compile Include="LSServerService\LSQueueManage.cs" />
<Compile Include="LSTest\Properties\Settings.cs" />
<Compile Include="LSFileClient\frmSmartClient.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LSFileClient\ClientManager.cs" />
<Compile Include="LSFileClient\frmSmartClient.Designer.cs">
<DependentUpon>frmSmartClient.cs</DependentUpon>
</Compile>
<Compile Include="LSFileClient\fmTypes.cs" />
<Compile Include="LSFileClient\LSParamsFormatter.cs" />
<Compile Include="LSFileClient\LSGlobleVariable.cs" />
<Compile Include="LSFileClient\LSCustomWinMsg.cs" />
<Compile Include="LSFileClient\LSClientMain.cs" />
<Compile Include="LSServerService\LSASyncSocket.cs" />
<Compile Include="LSServerService\LSSocket.cs" />
<EmbeddedResource Include="LSFileClient\FrmBatchProgress.resx">
<SubType>Designer</SubType>
<DependentUpon>FrmBatchProgress.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LSFileClient\frmDelete.resx">
<DependentUpon>frmDelete.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LSFileClient\frmSingleDownload.resx">
<SubType>Designer</SubType>
<DependentUpon>frmSingleDownload.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LSFileClient\frmSmartClient.resx">
<SubType>Designer</SubType>
<DependentUpon>frmSmartClient.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LSTest\Properties\Resources.resx">
<SubType>Designer</SubType>
<DependentUpon>Resources.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\插件库\CommonLib\CommonLib.csproj">
<Project>{3E8E6529-5D8A-4F17-8C41-27CD7380178D}</Project>
<Name>CommonLib</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>IF EXIST $(TargetDir)LSTest.vshost.exe DEL $(TargetDir)LSTest.vshost.exe
IF EXIST $(TargetDir)LSTest.vshost.exe.manifest DEL $(TargetDir)LSTest.vshost.exe.manifest</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -0,0 +1,49 @@
namespace LSTest.Properties
{
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
[DebuggerNonUserCode, GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), CompilerGenerated]
internal class Resources
{
private static CultureInfo resourceCulture;
private static System.Resources.ResourceManager resourceMan;
internal Resources()
{
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
System.Resources.ResourceManager manager = new System.Resources.ResourceManager("LSTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = manager;
}
return resourceMan;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,21 @@
namespace LSTest.Properties
{
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
[CompilerGenerated, GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed class Settings : ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings) SettingsBase.Synchronized(new Settings()));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
File diff suppressed because it is too large Load Diff
+255
View File
@@ -0,0 +1,255 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
public abstract class SqlHelper
{
public static SqlConnection conn;
protected SqlHelper()
{
}
public static DataSet ExecuteDataSet(CommandType cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
{
DataSet set;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, tabName);
set = dataSet;
}
catch
{
throw;
}
return set;
}
public static DataSet ExecuteDataSet(int cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
{
CommandType text = CommandType.Text;
switch (cmdType)
{
case 4:
text = CommandType.StoredProcedure;
break;
case 512:
text = CommandType.TableDirect;
break;
}
return ExecuteDataSet(text, cmdText, tabName, commandParameters);
}
public static DataSet ExecuteDataSet(string procedureName, string tabName, string[] parameterNames, object[] parameterValues)
{
DataSet set;
try
{
SqlCommand selectCommand = new SqlCommand(procedureName, conn)
{
CommandType = CommandType.StoredProcedure
};
if ((parameterNames != null) && (parameterValues != null))
{
for (int i = 0; (i < parameterNames.Length) && (i < parameterValues.Length); i++)
{
selectCommand.Parameters.AddWithValue(parameterNames[i], parameterValues[i]);
}
}
SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, tabName);
set = dataSet;
}
catch
{
throw;
}
return set;
}
public static int ExecuteNonQuery(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
public static int ExecuteNonQuery(SqlConnection connection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
public static int ExecuteNonQuery(SqlTransaction trans, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
int num = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return num;
}
public static SqlDataReader ExecuteReader(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlDataReader reader;
SqlCommand cmd = new SqlCommand();
try
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
SqlDataReader reader2 = cmd.ExecuteReader();
cmd.Parameters.Clear();
reader = reader2;
}
catch
{
throw;
}
return reader;
}
public static object ExecuteScalar(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
public static object ExecuteScalar(SqlConnection connection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
object obj2 = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return obj2;
}
public static DataTable PageDataQuery(int ToPage, int PageSize, string Sele_mx, string id, string Froms, out int AllRecords)
{
return PageDataQuery(ToPage, PageSize, "", "", Sele_mx, id, Froms, out AllRecords);
}
public static DataTable PageDataQuery(int ToPage, int PageSize, string Order_by, string Sele_mx, string id, string Froms, out int AllRecords)
{
return PageDataQuery(ToPage, PageSize, "", Order_by, Sele_mx, id, Froms, out AllRecords);
}
public static DataTable PageDataQuery(int ToPage, int PageSize, string WhereString, string Order_by, string Sele_mx, string id, string Froms, out int AllRecords)
{
DataTable table = new DataTable();
SqlCommand command = new SqlCommand("Common_FenYe", conn)
{
CommandType = CommandType.StoredProcedure
};
command.Parameters.Add("@ToPage", SqlDbType.Int).Value = ToPage;
command.Parameters.Add("@PageSize", SqlDbType.Int).Value = PageSize;
command.Parameters.Add("@WhereString", SqlDbType.VarChar, 4000).Value = WhereString;
command.Parameters.Add("@Order_by", SqlDbType.VarChar, 500).Value = Order_by;
command.Parameters.Add("@Sele_mx", SqlDbType.VarChar, 1000).Value = Sele_mx;
command.Parameters.Add("@id", SqlDbType.VarChar, 30).Value = id;
command.Parameters.Add("@Froms", SqlDbType.VarChar, 2000).Value = Froms;
command.Parameters.Add("@AllRecords", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
try
{
SqlDataReader reader = command.ExecuteReader();
table.Load(reader);
reader.Close();
AllRecords = int.Parse(command.Parameters["@AllRecords"].Value.ToString());
}
catch
{
throw;
}
finally
{
command.Dispose();
}
return table;
}
private static void PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[] cmdParms)
{
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
{
cmd.Transaction = trans;
}
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parameter in cmdParms)
{
cmd.Parameters.Add(parameter);
}
}
}
/// <summary>
/// <para>说明:获取C#连接字符串</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns>System.String.</returns>
public static string GetConnection(string ServerName, string DataBase)
{
return string.Format("Server={0};Database={1};Persist Security Info=True;User ID=lserpAdmin;Password=lserp110;Connection Timeout=5", ServerName, DataBase);
}
/// <summary>
/// <para>说明:创建数据库连接</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-07 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool CreateConnection(string servername, string dataBase)
{
string sqlconStr = GetConnection(servername, dataBase);
if (SqlHelper.conn != null)
{
try
{
SqlHelper.conn.Close();
SqlHelper.conn.Dispose();
}
catch (Exception)
{
}
SqlHelper.conn = null;
}
try
{
SqlHelper.conn = new SqlConnection(sqlconStr);
SqlHelper.conn.Open();
return true;
}
catch (Exception ex)
{
return false;
}
}
}