Files
lserp_cs_5.0/Lskj.Test/LSServerService/StructFileInfo.cs
T
2026-07-10 15:25:05 +08:00

78 lines
2.1 KiB
C#

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