private string ReadName() { string retVal = null; if (BinUtils.BinCompare(NAME, mData, mCurrentPos)) { ConsumeBytes(4); uint nameLen = BinUtils.GetNumberAtLocation(mCurrentPos, mData); ConsumeBytes(4); retVal = ReadString((int)nameLen); } return(retVal); }
public static void VerifyUcfbFile(string filename) { FileStream fs = new FileStream(filename, FileMode.Open); byte[] buff = new byte[8]; fs.Read(buff, 0, buff.Length); fs.Close(); byte[] UCFB = new byte[] { (byte)'u', (byte)'c', (byte)'f', (byte)'b' }; if (!BinUtils.BinCompare(UCFB, buff, 0)) { throw new Exception("Error! File is not UCFB! " + filename); } }
private string ReadNameHash() { string retVal = null; if (BinUtils.BinCompare(NAME, mData, mCurrentPos)) { ConsumeBytes(4); uint nameLen = BinUtils.GetNumberAtLocation(mCurrentPos, mData); ConsumeBytes(4); uint nameHash = BinUtils.GetNumberAtLocation(mCurrentPos, mData); ConsumeBytes(4); retVal = String.Format("0x{0:x}", nameHash); } return(retVal); }
/// <summary> /// Returns the path to the extraction folder /// </summary> /// <returns></returns> public string ExtractContents() { mCurrentPos = 0; //mPlanFileCount = 0; string retVal = CreateExtractDir(); //read file header if (!BinUtils.BinCompare(UCFB, mData, mCurrentPos)) { Program.MessageUser("ERROR! This is not a UCF file: " + FileName); return(null); } //ConsumeBytes(4); // advance past ucfb header uint bytesLeftInFile = InitializeRead(); if (mData.Length - (mCurrentPos + bytesLeftInFile) != 0) { Program.MessageUser("WARNING! ucfb length data kinda sketchy: " + FileName); } mManifest.Clear(); try { while (RipChunk(true) != null) { ; } } catch (System.IndexOutOfRangeException) { } WriteManifest(); if (FileName.EndsWith(".lvl")) { string reqFileName = FileName.Replace(".lvl", ".req"); int lastSlash = reqFileName.LastIndexOf("\\"); reqFileName = reqFileName.Substring(lastSlash + 1); reqFileName = retVal + reqFileName; string req = ReqMaker.GetReq(retVal); File.WriteAllText(reqFileName, req); } return(retVal); }
bool HasInfo() { return(BinUtils.BinCompare(INFO, mData, mCurrentPos)); }
bool HasName() { return(BinUtils.BinCompare(NAME, mData, mCurrentPos)); }