private static bool ReadPCUHead(PCUFile pcu_file, BinaryReader br) { char[] Header = br.ReadChars(PCUFile.Header.Length); for (int i = 0; i < PCUFile.Header.Length; i++) if (Header[i] != PCUFile.Header[i]) return false; pcu_file.Version = br.ReadInt16(); pcu_file.CRC = br.ReadInt64(); pcu_file.IncludeDebugInfo = br.ReadBoolean(); return true; }
public static PCUFileHeadState GetPCUFileHeadState(string fileName) { FileStream fs = File.OpenRead(fileName); BinaryReader br = new BinaryReader(fs); PCUFileHeadState State = new PCUFileHeadState(); PCUFile pcuHead = new PCUFile(); State.IsPCUFile=ReadPCUHead(pcuHead, br); br.Close(); fs.Close(); if (!State.IsPCUFile) return State; State.SupportedVersion = PCUFile.SupportedVersion == pcuHead.Version; State.IncludetDebugInfo= pcuHead.IncludeDebugInfo; State.FileHead = pcuHead; return State; }