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 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(); } }
static void Main(string[] args) { VICE vice = new VICE(); using (IOReader reader = new IOReader(File.OpenRead("test.nuc"))) { byte[] temp = new byte[reader.BaseStream.Length]; int bytesLeft = (int)reader.BaseStream.Length; while (bytesLeft >= 8) { byte[] tmp = new byte[8]; byte[] buffer = reader.ReadBytes(8); vice.Decrypt("SDhfi878", ref buffer, ref tmp); bytesLeft -= 8; Array.Copy(tmp, temp, 8); } File.WriteAllBytes("out.nut", temp); } }
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 bool UnSerialize(IOReader reader) { try { if (reader.ReadUInt() != m_dwSignature) return false; this.m_wDiskNumber = reader.ReadUShort(); this.m_wDiskNumberCDir = reader.ReadUShort(); this.m_wNumCDirEntries = reader.ReadUShort(); this.m_wTotalCDirEntries = reader.ReadUShort(); this.m_dwSizeOfCDir = reader.ReadUInt(); this.m_dwStartOfCDir = reader.ReadUInt(); this.m_wCommentLen = reader.ReadUShort(); this.m_Comment = Encoding.ASCII.GetString(reader.ReadBytes(this.m_wCommentLen)); return true; } catch { return false; } }
public bool UnSerialize(IOReader reader) { try { if (reader.ReadUInt() != m_dwSignature) return false; this.m_wVersionMadeBy = reader.ReadUShort(); this.m_wVersionMadeBy = reader.ReadUShort(); this.m_wGeneralBitFlag = reader.ReadUShort(); this.m_wCompressionMethod = reader.ReadUShort(); this.m_wLastModTime = reader.ReadUShort(); this.m_wLastModDate = reader.ReadUShort(); this.m_dwCRC32 = reader.ReadUInt(); this.m_dwCompressedSize = reader.ReadUInt(); this.m_dwUnCompressedSize = reader.ReadUInt(); this.m_wFilenameLen = reader.ReadUShort(); this.m_wExtraFieldLen = reader.ReadUShort(); this.m_wCommentLen = reader.ReadUShort(); this.m_wDiskNumber = reader.ReadUShort(); this.m_wInternalArrtib = reader.ReadUShort(); this.m_wExternalArrtib = reader.ReadUInt(); this.m_dwOffsetLocalFile = reader.ReadUInt(); this.m_sFileName = ASCIIEncoding.ASCII.GetString(reader.ReadBytes(this.m_wFilenameLen)); return true; } catch { return false; } }
public void UnSerialize(IOReader reader) { // Make sure we are reading big endian reader.ByteOrder = Endian.Big; this.Flags = (VTFFlags)reader.ReadInt(); this.Width = reader.ReadUShort(); this.Height = reader.ReadUShort(); this.Depth = reader.ReadUShort(); this.NumFrames = reader.ReadUShort(); this.PreloadSize = reader.ReadUShort(); this.MipSkipCount = reader.ReadByte(); this.NumResources = reader.ReadByte(); this.Reflectivity.UnSerialize(reader); this.BumpScale = reader.ReadFloat(); this.ImageFormat = (VTFImageFormat)reader.ReadInt(); this.LowResImgSmple = reader.ReadBytes(4); this.CompressedSize = reader.ReadUInt(); }