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; } } } }