public void ReadFile() { NoxBinaryReader rdr = new NoxBinaryReader(File.Open(filename, FileMode.Open), CryptApi.NoxCryptFormat.PLR); //find out what kind of file we got FileType = (PlrFileType)rdr.ReadInt64(); //switch for different formats switch (FileType) { case PlrFileType.SOLO: System.Windows.Forms.MessageBox.Show("Sorry, solo/quest player files are not yet supported.", "Error"); ReadSPHeader(rdr); //ReadSpellset(rdr); rdr.BaseStream.Seek(0, SeekOrigin.End); break; case PlrFileType.MULTI: ReadSpellset(rdr); rdr.ReadInt32(); //TODO: dunno what this int is doing hangin out here, always 0x00000001? rdr.SkipToNextBoundary(); ReadCharacterInfo(rdr); rdr.ReadBytes(4); //(TODO) 0c 00 00 00 -- this occupies unaccounted-for space and is post-padded rdr.SkipToNextBoundary(); rdr.ReadBytes((int)rdr.ReadInt64()); //skip the next section (the 3byte one) rdr.SkipToNextBoundary(); break; default: throw new IOException("Unknown player file format"); } System.Diagnostics.Debug.Assert(rdr.BaseStream.Position == rdr.BaseStream.Length, "Wrong number of total bytes read."); rdr.Close(); }
public void ReadFile() { NoxBinaryReader rdr = new NoxBinaryReader(File.Open(filename, FileMode.Open), CryptApi.NoxCryptFormat.PLR); //find out what kind of file we got FileType = (PlrFileType) rdr.ReadInt64(); //switch for different formats switch (FileType) { case PlrFileType.SOLO: System.Windows.Forms.MessageBox.Show("Sorry, solo/quest player files are not yet supported.", "Error"); ReadSPHeader(rdr); //ReadSpellset(rdr); rdr.BaseStream.Seek(0, SeekOrigin.End); break; case PlrFileType.MULTI: ReadSpellset(rdr); rdr.ReadInt32();//TODO: dunno what this int is doing hangin out here, always 0x00000001? rdr.SkipToNextBoundary(); ReadCharacterInfo(rdr); rdr.ReadBytes(4);//(TODO) 0c 00 00 00 -- this occupies unaccounted-for space and is post-padded rdr.SkipToNextBoundary(); rdr.ReadBytes((int) rdr.ReadInt64());//skip the next section (the 3byte one) rdr.SkipToNextBoundary(); break; default: throw new IOException("Unknown player file format"); } System.Diagnostics.Debug.Assert(rdr.BaseStream.Position == rdr.BaseStream.Length, "Wrong number of total bytes read."); rdr.Close(); }