protected override SRFile CreateFromStream(string path, Stream stream) { var file = new SCUMM5File(path, (XorStream)stream); if (!CheckFormat(file)) { file.Close(); file = null; } return(file); }
private bool CheckFormat(SCUMM5File file) { foreach (byte enc in ENCRYPTION_VALUES) { file.Encryption = enc; file.Position = 0; FourCC fourCC = file.ReadFourCC(); uint size = file.ReadU32BE(); if (fourCC.IsValid && size <= file.Size) { file.FileVersion = SCUMMUtils.DetermineSCUMMVersion(file); return(true); } } return(false); }