public static ChitinBiff CreateChitinBiff(ref FileStruct.TSChitinBiff tsChitinBiff, ref string name) { ChitinBiff cbiff = new ChitinBiff(); cbiff.name = name.ToUpper(); cbiff.size = tsChitinBiff.biffSize; cbiff.cdMask = tsChitinBiff.biffCdMask; return(cbiff); }
public static bool ReadChitinKeyFile(ChitinIndex chitinIndex, string fileName) { FileStream fileStream = Utils.ReadFileStream(fileName); if (fileStream == null) { return(false); } buff = new byte[FileStruct.TSChitinHeaderSize]; fileStream.Position = 0; FileStruct.TSChitinHeader chitinHead = (FileStruct.TSChitinHeader)ReadBuffer <FileStruct.TSChitinHeader> (fileStream, buff, FileStruct.TSChitinHeaderSize); if (GlobalDefs.CHITINKEY_SIGNATURE != Utils.CharsToString(chitinHead.signature)) { throw new ArgumentException("Warning: Invalid signature in *.key file."); } // Load up all the biffs into a collection buff = new byte[FileStruct.TSChitinBiffSize]; fileStream.Position = chitinHead.biffOffset; chitinIndex.CbiffCollection.SetCapacity(chitinHead.biffCount + 30); for (int c = 0; c < chitinHead.biffCount; c++) { FileStruct.TSChitinBiff tsBiff = (FileStruct.TSChitinBiff)ReadBuffer <FileStruct.TSChitinBiff> (fileStream, buff, FileStruct.TSChitinBiffSize); string biffName = ReadOffsetStringBuffer(fileStream, tsBiff.biffNameOffset, tsBiff.biffNameSize); chitinIndex.AddChitinBiff(ref tsBiff, ref biffName); } // Load up the chitinkeys into the super dictionary buff = new byte[FileStruct.TSChitinKeySize]; fileStream.Position = chitinHead.ckeyOffset; for (int c = 0; c < chitinHead.ckeyCount; c++) { FileStruct.TSChitinKey tsCkey = (FileStruct.TSChitinKey)ReadBuffer <FileStruct.TSChitinKey> (fileStream, buff, FileStruct.TSChitinKeySize); chitinIndex.AddChitinKey(ref tsCkey); } fileStream.Close(); return(true); }
public void AddChitinBiff(ref FileStruct.TSChitinBiff tsChitinBiff, ref string name) { ChitinBiff cbiff = CreateChitinBiff(ref tsChitinBiff, ref name); cbiffCollection.Add(cbiff); }