public AICHHash CreateAICHHash(Mpd.Generic.IO.FileDataIO fileInput) { AICHHash hash = CreateAICHHash(); hash.Read(fileInput); return(hash); }
public bool ReadHashSetsFromPacket(Mpd.Generic.IO.FileDataIO pFile, ref bool rbMD4, ref bool rbAICH) { byte byOptions = pFile.ReadUInt8(); bool bMD4Present = (byOptions & 0x01) > 0; bool bAICHPresent = (byOptions & 0x02) > 0; // We don't abort on unkown option, because even if there is another unknown hashset, there is no data afterwards we // try to read on the only occasion this function is used. So we might be able to add optional flags in the future // without having to adjust the protocol any further (new additional data/hashs should not be appended without adjustement however) if (bMD4Present && !rbMD4) { // Even if we don't want it, we still have to read the file to skip it byte[] tmpHash = new byte[16]; pFile.ReadHash16(tmpHash); uint parts = pFile.ReadUInt16(); for (uint i = 0; i < parts; i++) { pFile.ReadHash16(tmpHash); } } else if (!bMD4Present) { rbMD4 = false; } else if (bMD4Present && rbMD4) { if (!LoadMD4HashsetFromFile(pFile, true)) { // corrupt rbMD4 = false; rbAICH = false; return(false); } } if (bAICHPresent && !rbAICH) { // Even if we don't want it, we still have to read the file to skip it AICHHash tmpHash = MuleApplication.Instance.AICHObjectManager.CreateAICHHash(pFile); ushort nCount = pFile.ReadUInt16(); for (int i = 0; i < nCount; i++) { tmpHash.Read(pFile); } } else if (!bAICHPresent || !HasAICHHash) { rbAICH = false; } else if (bAICHPresent && rbAICH) { if (!LoadAICHHashsetFromFile(pFile, true)) { // corrupt if (rbMD4) { DeleteMD4Hashset(); rbMD4 = false; } rbAICH = false; return(false); } } return(true); }