public string GetPackageName() { // If the STFS info was already loaded... if (IsSTFSPackage && STFSInformation.Magic != null) { // Return it. return(STFSInformation.ContentName); } // If the file appears to match the requirements for an STFS package... else if (Size >= 0xB000 && !Name.ToLower().Contains(".xex") && !Name.ToLower().Contains(".xbe")) { byte[] Magic = new STFS.STFSInfo(this).Magic(); byte[] CON = Encoding.ASCII.GetBytes("CON "); byte[] LIVE = Encoding.ASCII.GetBytes("LIVE"); byte[] PIRS = Encoding.ASCII.GetBytes("PIRS"); if (ArrayComparer(Magic, CON) | ArrayComparer(Magic, LIVE) | ArrayComparer(Magic, PIRS)) { // Get the IO IOReader io = new IOReader(GetStream()); io.BaseStream.Position = (long)STFS.STFSInfo.Offsets.DisplayName; string ss = ""; for (int i = 0; i < 0x80; i += 2) { char c = (char)io.ReadUInt16(true); if (c != '\0') { ss += c; } } io.Close(); return(ss); } } return(""); }
public bool ExtractSS(string outFile) { if (DriveType != Info.DriveType.HDD) { throw new Exception("Drive is not a hard drive"); } //Create our io for the drive IOReader io = GetIO(); //Go to the location of the security sector io.BaseStream.Position = 0x2000; //Create our ref io for the file IOWriter bw = new IOWriter(new System.IO.FileStream(outFile, System.IO.FileMode.Create)); //Read the sector. The size is an estimation, since I have no idea how big it really is bw.Write(io.ReadBytes(0xE00)); //Close our io's io.Close(); bw.Close(); return(true); }