Example #1
0
        protected override SRFile CreateFromStream(string path, Stream stream)
        {
            var file = new SCUMM3File(path, (XorStream)stream);

            if (!CheckFormat(file))
            {
                file.Close();
                file = null;
            }

            return(file);
        }
Example #2
0
        private bool CheckFormat(SCUMM3File file)
        {
            foreach (byte enc in ENCRYPTION_VALUES)
            {
                file.Encryption = enc;

                file.Position = 0;
                uint  size  = file.ReadU32LE();
                TwoCC twoCC = file.ReadTwoCC();

                if (twoCC.IsValid && size <= file.Size)
                {
                    file.FileVersion = SCUMMUtils.DetermineSCUMMVersion(file);
                    return(true);
                }
            }
            return(false);
        }