コード例 #1
0
ファイル: SCUMM3Factory.cs プロジェクト: Jither/SCUMMRevLib
        protected override SRFile CreateFromStream(string path, Stream stream)
        {
            var file = new SCUMM3File(path, (XorStream)stream);

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

            return(file);
        }
コード例 #2
0
ファイル: SCUMM3Factory.cs プロジェクト: Jither/SCUMMRevLib
        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);
        }