public bool LoadAreaInfo() { FileStream fs = null; try { fs = new FileStream(this.sFullPathName + ".jhr", FileMode.Open, FileAccess.Read); } catch { this.sDes += "(Err)"; return(false); } BinaryReader br = new BinaryReader(fs); fs.Seek(4, SeekOrigin.Begin); this.dtCreateTime = new CDateTime(br.ReadUInt32()); br.ReadInt32(); this.lMailCount = br.ReadUInt32(); br.Close(); return(true); }
public void LoadInfoFromStream(BinaryReader br) { // JAM... 4 byte br.ReadBytes(4); // 01 00 00 00 4 byte br.ReadInt32(); // 非固定长段的长度 4 byte. int len = br.ReadInt32(); // 0 4 byte br.ReadInt32(); // 未知 4 BYTE br.ReadInt32(); // 未知 4 BYTE br.ReadInt32(); // 0 8 byte br.ReadBytes(8); // 0 4 byte br.ReadBytes(4); // 发日期(C) 4 byte this.dtSendTime = new CDateTime(br.ReadUInt32()); // 0 4 byte br.ReadInt32(); // 收日期(C) 4 byte this.dtReciveTime = new CDateTime(br.ReadUInt32()); // 包内号 4 byte this.iIndex = br.ReadUInt32(); // 00000001 4 byte br.ReadInt32(); // 0 4 byte br.ReadInt32(); // 文本起始 4 byte this.uStartOffset = br.ReadInt32(); // 文本长度 4 byte this.uSize = br.ReadInt32(); // -1 4 byte br.ReadInt32(); // 0 4 byte br.ReadInt32(); int iReaded = 0; Encoding en = Encoding.GetEncoding(936); while (iReaded < len) { // 字段类别 int iItemType = br.ReadInt32(); // 字段长度 int iItemLen = br.ReadInt32(); byte [] buf = br.ReadBytes(iItemLen); string s = en.GetString(buf).Trim('\0', ' '); switch (iItemType) { // 02 00 00 00 4 byte // 发信人长 4 byte // 发信人 float len case 2: this.sFrom = s; break; // 03 00 00 00 4 byte // 收信人长 4 byte // 收信人 float len case 3: this.sTo = s; break; // 06 00 00 00 4 byte // 主题长 4 byte // 主题 float len case 6: this.sSubject = s; break; // 04 00 00 00 4 byte // sMsgID长度 4 byte // sMsgID float len case 4: this.sMsgID = s; break; // 05 00 00 00 4 byte // MSGID长度 4 byte // 发信站 float len case 5: this.sSendSite = s; break; // 07 00 00 00 4 byte // 写信器长 4 byte // 写信器 float len case 7: this.sWriter = s; break; // d0 07 00 00 float len // TID长 4 byte // TID float len case 0x07d0: this.sTID = s; break; // d2 07 00 00 float len // 转信路径长 4 byte // 转信路径 float len case 0x07d2: this.sRoute = s; break; default: break; } iReaded += 4 + 4 + iItemLen; } return; }