Esempio n. 1
0
        private void Parse_IW3_Unsigned(byte[] ff)
        {
            version        = ByteHandling.GetBytes(ff, 8, 12);
            compressedZone = ByteHandling.GetBytes(ff, 12);

            if (!version.SequenceEqual(HeaderIW3VersionUnsigned))
            {
                throw new Exception("Warning: fastfile version differs from default for this fastfile type."); //TODO: change exception type and message
            }
            ver = FastFileType.IW3_UNSIGNED;
        }
Esempio n. 2
0
        // Detects fastfile type and calls appropriate header parser.
        public void Parse()
        {
            byte[] ffContents;
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                ffContents   = new byte[fs.Length];
                originalSize = fs.Read(ffContents, 0, (int)fs.Length);
            }

            originalSize = ffContents.Length;
            if (originalSize < 8)
            {
                throw new Exception("Not a fastfile"); //TODO: new exception and correct message.
            }
            byte[] ffHeader = ByteHandling.GetBytes(ffContents, 0, 8);
            if (ffHeader.SequenceEqual(HeaderIW3Unsigned))
            {
                Parse_IW3_Unsigned(ffContents);
            }
            else
            {
                throw new Exception("Unknown fastfile type"); //TODO: new exception and correct message.
            }
        }