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 void ForceSTFSInfo() { if (Size >= 0xA000 && !Name.ToLower().Contains(".xex") && !Name.ToLower().Contains(".xbe")) { STFS.STFSInfo stfsloader = new STFS.STFSInfo(this); byte[] CON = Encoding.ASCII.GetBytes("CON "); byte[] LIVE = Encoding.ASCII.GetBytes("LIVE"); byte[] PIRS = Encoding.ASCII.GetBytes("PIRS"); byte[] Magic = stfsloader.Magic(); if (ArrayComparer(Magic, CON) | ArrayComparer(Magic, LIVE) | ArrayComparer(Magic, PIRS)) { STFSInformation = stfsloader.GetInfo(); IsSTFSPackage = true; } } }