public static int Check(byte[] data, int dataLength) { ArjHeader header = new ArjHeader(); for (int i = 0; i < (dataLength - 0xa28); i++) { header.Mark = ByteArrayHelper.ReadUInt16(data, i); header.HeadSize = ByteArrayHelper.ReadUInt16(data, i + 2); header.FirstHeadSize = data[i + 4]; header.ArjVer = data[i + 5]; header.ArjExtrVer = data[i + 6]; if (((((header.Mark == 0xea60) && (header.HeadSize <= 0xa28)) && ((header.FirstHeadSize < 0x40) && (header.ArjVer < 0x40))) && (header.ArjExtrVer < 0x20)) && ((i == 0) || ((i > 0x20) && (Encoding.ASCII.GetString(data, 0x1c, 4) == "RJSX")))) { return i; } } return -1; }
private void Write40_ArjHeader(string n, string ns, ArjHeader o, bool needType) { if (!needType && (o.GetType() != typeof(ArjHeader))) { throw base.CreateUnknownTypeException(o); } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("ArjHeader", ""); } base.WriteElementStringRaw("Mark", "", XmlConvert.ToString(o.Mark)); base.WriteElementStringRaw("HeadSize", "", XmlConvert.ToString(o.HeadSize)); base.WriteElementStringRaw("FirstHeadSize", "", XmlConvert.ToString(o.FirstHeadSize)); base.WriteElementStringRaw("ArjVer", "", XmlConvert.ToString(o.ArjVer)); base.WriteElementStringRaw("ArjExtrVer", "", XmlConvert.ToString(o.ArjExtrVer)); base.WriteElementStringRaw("HostOS", "", XmlConvert.ToString(o.HostOS)); base.WriteElementStringRaw("Flags", "", XmlConvert.ToString(o.Flags)); base.WriteElementStringRaw("Method", "", XmlConvert.ToString(o.Method)); base.WriteElementStringRaw("FileType", "", XmlConvert.ToString(o.FileType)); base.WriteElementStringRaw("Reserved", "", XmlConvert.ToString(o.Reserved)); base.WriteElementStringRaw("ftime", "", XmlConvert.ToString(o.ftime)); base.WriteElementStringRaw("PackSize", "", XmlConvert.ToString(o.PackSize)); base.WriteElementStringRaw("UnpSize", "", XmlConvert.ToString(o.UnpSize)); base.WriteElementStringRaw("CRC", "", XmlConvert.ToString(o.CRC)); base.WriteElementStringRaw("FileSpec", "", XmlConvert.ToString(o.FileSpec)); base.WriteElementStringRaw("AccessMode", "", XmlConvert.ToString(o.AccessMode)); base.WriteElementStringRaw("HostData", "", XmlConvert.ToString(o.HostData)); base.WriteEndElement(o); }