internal bool xLoadDetails() { try { xRef.xIO.Position = Offset; DJsIO xbuff = new DJsIO(xRef.xIO.ReadBytes(Size), true); xbuff.Position = 0; while (xbuff.Position < xbuff.Length) { try { xpairs.Add(new SyncPair(xbuff.ReadInt64(), xbuff.ReadInt64())); } catch { } } return true; } catch { return false; } }
void read(DJsIO xIO, STFSPackage xPackage, PackageMagic MagicType) { xMagic = MagicType; xIO.Position = 0x22C; if (xPackage != null) xPackage.AddToLog("Reading Liscenses"); xLisc = new List<STFSLicense>(); for (int i = 0; i < 0x10; i++) xLisc.Add(new STFSLicense(xIO.ReadInt64(), xIO.ReadInt32(), xIO.ReadInt32(), i == 0)); if (xPackage != null) xPackage.AddToLog("Reading Package locks"); xIO.Position = 0x344; if (xPackage != null) xPackage.AddToLog("Reading Header Values"); xThisType = (PackageType)xIO.ReadUInt32(); ; MetaDataVersion = xIO.ReadUInt32(); xContentSize = xIO.ReadInt64(); MediaID = xIO.ReadUInt32(); Version_ = xIO.ReadUInt32(); Version_Base = xIO.ReadUInt32(); TitleID = xIO.ReadUInt32(); Platform = xIO.ReadByte(); ExecutableType = xIO.ReadByte(); DiscNumber = xIO.ReadByte(); DiscInSet = xIO.ReadByte(); SaveGameID = xIO.ReadUInt32(); SaveConsoleID = (long)xIO.ReadUInt40(); ProfileID = xIO.ReadInt64(); xIO.Position = 0x39D; DataFileCount = xIO.ReadUInt32(); DataFileSize = xIO.ReadInt64(); Reserved = xIO.ReadInt64(); xSeriesID = xIO.ReadBytes(0x10); xSeasonID = xIO.ReadBytes(0x10); SeasonNumber = xIO.ReadUInt16(); EpidsodeNumber = xIO.ReadUInt16(); xIO.Position += 0x28; xDeviceID = xIO.ReadBytes(0x14); for (int i = 0; i < 9; i++) xTitles[i] = xIO.ReadString(StringForm.Unicode, 0x80).Replace("\0", ""); for (int i = 0; i < 9; i++) xDescriptions[i] = xIO.ReadString(StringForm.Unicode, 0x80).Replace("\0", ""); xPublisher = xIO.ReadString(StringForm.Unicode, 0x40).Replace("\0", ""); xTitle = xIO.ReadString(StringForm.Unicode, 0x40).Replace("\0", ""); IDTransferByte = xIO.ReadByte(); // Package Image int xSize = xIO.ReadInt32(); xIO.Position = 0x171A; if (xSize < 0x4000) xPackageImage = xIO.ReadBytes(xSize); else xPackageImage = xIO.ReadBytes(0x4000); // Content Image xIO.Position = 0x1716; xSize = xIO.ReadInt32(); xIO.Position = 0x571A; if (xSize < 0x4000) xContentImage = xIO.ReadBytes(xSize); else xContentImage = xIO.ReadBytes(0x4000); xLoaded = true; }
///<summary>Extracts a WSG from a CON (Xbox 360 Container File).</summary> public MemoryStream WSGExtract(Stream InputX360File) { BinaryReader br = new BinaryReader(InputX360File); byte[] fileInMemory = br.ReadBytes((int)InputX360File.Length); if (fileInMemory.Count() != InputX360File.Length) throw new EndOfStreamException(); try { STFSPackage CON = new STFSPackage(new DJsIO(fileInMemory, true), new X360.Other.LogRecord()); //DJsIO Extract = new DJsIO(true); //CON.FileDirectory[0].Extract(Extract); ProfileID = CON.Header.ProfileID; DeviceID = CON.Header.DeviceID; //DJsIO Save = new DJsIO("C:\\temp.sav", DJFileMode.Create, true); //Save.Write(Extract.ReadStream()); //Save.Close(); //byte[] nom = CON.GetFile("SaveGame.sav").GetEntryData(); return new MemoryStream(CON.GetFile("SaveGame.sav").GetTempIO(true).ReadStream(), false); } catch { try { DJsIO Manual = new DJsIO(fileInMemory, true); Manual.ReadBytes(881); ProfileID = Manual.ReadInt64(); Manual.ReadBytes(132); DeviceID = Manual.ReadBytes(20); Manual.ReadBytes(48163); int size = Manual.ReadInt32(); Manual.ReadBytes(4040); return new MemoryStream(Manual.ReadBytes(size), false); } catch { return null; } } }