//Constructor public GrandPrixDataCollection() { MemoryStream Buffer; IffGrandPrixData GrandPrix; FGPData = new Dictionary <uint, IffGrandPrixData>(); PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "GrandPrixData.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\GrandPrixData.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { GrandPrix = new IffGrandPrixData(); GrandPrix = (IffGrandPrixData)Reader.Read(GrandPrix); FGPData.Add(GrandPrix.TypeID, GrandPrix); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
//Constructor public void Load() { MemoryStream Buffer; Desc Desc; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_jp.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Desc.iff"); //verifica se existe o arquivo if (FileZip == null) { Console.WriteLine(" data\\Desc.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new NotSupportedException("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Desc = new Desc(); Desc = (Desc)Reader.Read(new Desc()); Add(Desc); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
public void Load() { MemoryStream Buffer = null; Card Card; PangyaBinaryReader Reader = null; ListCard = new List <Card>(); using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Card.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception("data\\Card.iff is not loaded"); } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = (Reader.GetSize() - 8L) / recordCount; Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { var Count = Marshal.SizeOf(new Card()); Card = (Card)Reader.Read(new Card()); Add(Card.Base.TypeID, Card); } } catch (Exception ex) { MessageBox.Show(ex.Message); Console.ReadKey(); } finally { Reader.Dispose(); } }
//Constructor public MemorialShopRareItemCollection() { MemoryStream Buffer; IffMemorialRareItemData Rare; SpecialItemData = new List <SpecialItem>(); PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "MemorialShopRareItem.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\MemorialShopRareItem.iff is not loaded"); return; } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Rare = (IffMemorialRareItemData)Reader.Read(new IffMemorialRareItemData()); this.Add(Rare); } this.AddSPList(); } finally { Reader.Dispose(); Buffer.Dispose(); } }
public CardCollection() { MemoryStream Buffer; IffCardData Card; PangyaBinaryReader Reader = null; ListCard = new List <IffCardData>(); Cards = new ItemRandomClass(); PackData = new Dictionary <uint, CardPack>(); using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Card.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\Card.iff is not loaded"); return; } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { Card = (IffCardData)Reader.Read(new IffCardData()); Add(Card.Base.TypeID, Card); } CreateCardPack(); CreateCardItem(); } finally { Reader.Dispose(); } }
//Constructor public void Load() { MemoryStream Buffer; Character Character; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_th.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "Character.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception(" data\\Character.iff is not loaded"); } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { var Count = Marshal.SizeOf(new Character()); Character = (Character)Reader.Read(new Character()); Add(Character.Base.TypeID, Character); } } finally { Reader.Dispose(); Buffer.Dispose(); } }
public void Load() { MemoryStream Buffer; GrandPrixRankReward GP; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_jp.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "GrandPrixRankReward.iff"); //verifica se existe o arquivo if (FileZip == null) { throw new Exception(" data\\GrandPrixRankReward.iff is not loaded"); } else { Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); long recordLength = ((Reader.GetSize() - 8L) / (recordCount)); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { GP = (GrandPrixRankReward)Reader.Read(new GrandPrixRankReward()); if (this.Where(c => c.Key == GP.TypeID).Any() == false) { this.Add(GP.TypeID, GP); } } } finally { Reader.Dispose(); } }
public bool Load(MemoryStream data) { Item Item; if (data == null || data.Length == 0) { MessageBox.Show(" data\\Item.iff is not loaded", "Pangya.IFF"); return(false); } try { using (var Reader = new PangyaBinaryReader(data)) { if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); IFF_FILE_HEADER = (IFFHeader)Reader.Read(new IFFHeader()); long recordLength = (Reader.GetSize() - 8L) / IFF_FILE_HEADER.RecordCount; var datacount = Tools.IFFTools.SizeStruct(new Item()); if (datacount != recordLength) { throw new Exception($"Item.iff the structure size is incorrect, Real: {recordLength} Item.cs: {datacount} "); } for (int i = 0; i < IFF_FILE_HEADER.RecordCount; i++) { Item = (Item)Reader.Read(new Item()); this.Add(Item); } } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message + " Error Struct ", "Pangya.IFF.Model.Item"); return(false); } }
//Constructor public CadieMagicCollection() { MemoryStream Buffer; IffCadieMagicBoxData item; PangyaBinaryReader Reader = null; using (var zip = ZipFile.OpenRead("data/pangya_gb.iff")) //ler o arquivo de base { var FileZip = zip.Entries.FirstOrDefault(c => c.Name == "CadieMagicBox.iff"); //verifica se existe o arquivo if (FileZip == null) { PangyaAPI.WriteConsole.WriteLine(" data\\CadieMagicBox.iff is not loaded"); return; } Buffer = new MemoryStream(); FileZip.Open().CopyTo(Buffer); } try { Reader = new PangyaBinaryReader(Buffer); if (new string(Reader.ReadChars(2)) == "PK") { throw new Exception("The given IFF file is a ZIP file, please unpack it before attempting to parse it"); } Reader.Seek(0, 0); Reader.ReadUInt16(out ushort recordCount); Reader.ReadUInt16(out BindingID); Reader.ReadUInt32(out Version); for (int i = 0; i < recordCount; i++) { item = (IffCadieMagicBoxData)Reader.Read(new IffCadieMagicBoxData()); this.Add(item); } AddMagicBox(); } finally { Buffer.Dispose(); } }