private IOReader GetIO() { try { IO.Close(); } catch { } CheckBuffer(); IO = new IOReader(new System.IO.MemoryStream(Buffer)); //IO = new IOReader(xFile.GetStream()); return(IO); }
public string GameName() { try { IO = GetIO(); IO.BaseStream.Position = (int)Offsets.TitleName; byte[] b = IO.ReadBytes(0x80); IO.Close(); Buffer = null; string ss = ""; //naw return Encoding.Unicode.GetString(b); IO = new IOReader(new System.IO.MemoryStream(b)); for (int i = 0; i < b.Length; i += 2) { char c = (char)IO.ReadUInt16(true); if (c != '\0') { ss += c; } } IO.Close(); return(ss); } catch { Close(); return(""); } }
public uint TitleID() { try { IO = GetIO(); IO.BaseStream.Position = (int)Offsets.TitleID; uint ui = IO.ReadUInt32(true); IO.Close(); return(ui); } catch { Close(); return(0); } }
public byte[] ProfileID() { try { IO = GetIO(); IO.BaseStream.Position = (int)Offsets.ProfileID; byte[] buffer = IO.ReadBytes(0x8); IO.Close(); return(buffer); } catch { Close(); return(new byte[8]); } }
public byte[] DeviceID() { try { IO = GetIO(); IO.BaseStream.Position = (int)Offsets.DeviceID; byte[] buffer = IO.ReadBytes(0x14); IO.Close(); return(buffer); } catch { Close(); return(new byte[0x14]); } }
private void CheckBuffer() { try { if (Buffer == null) { IO = new IOReader(xFile.GetStream()); Buffer = IO.ReadBytes(0x2200); //Close our IO IO.Close(); } } catch { Close(); } }
public byte[] Magic() { try { if (xFile.IsDeleted) { return(new byte[4]); } // We didn't return the null array, so let's boogie IO = xFile.Drive.GetIO(); IO.BaseStream.Position = new Misc().GetBlockOffset(xFile.StartingCluster, xFile); byte[] Header = IO.ReadBytes(0x200); byte[] buffer = new byte[] { Header[0], Header[1], Header[2], Header[3] }; IO.Close(); return(buffer); } catch { Close(); return(new byte[4]); } }
public string DisplayName() { try { IO = GetIO(); IO.BaseStream.Position = (int)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); } catch { Close(); return(""); } }
//------------------------------------------------------------------------------------- static public int Load(string filename, ShaderType shaderType, bool fCheckErrors = true) { int shaderName = 0; IOReader file = null; try { file = new IOReader(filename); string shaderText = file.ReadToEnd(); shaderName = Compile(shaderType, shaderText, fCheckErrors); } catch (IOException e) { Console.WriteLine("Shader.File IO Exception: " + e.Message); } if (file != null) { file.Close(); } return(shaderName); }