Exemple #1
0
        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();
        }
Exemple #2
0
        protected void ReadCharacterInfo(NoxBinaryReader rdr)
        {
            long finish = rdr.ReadInt64() + rdr.BaseStream.Position;

            rdr.ReadBytes(6);          //UNKNOWN header seems to always = 0c 00 02 00 00 00
            SavePath = rdr.ReadString(System.Type.GetType("System.Int16"));
            rdr.ReadByte();            //terminating null not included in length

            //the time this file was written
            FileTime = new DateTime(
                rdr.ReadInt16(),               //year
                rdr.ReadInt32() & 0xFFFF,      //month --skip the next 16bytes
                //rdr.ReadInt16(),//day of the week (not needed)
                rdr.ReadInt16(),               //day
                rdr.ReadInt16(),               //hour
                rdr.ReadInt16(),               //minute
                rdr.ReadInt16(),               //seconds
                rdr.ReadInt16()                //milliseconds
                );

            //these colors are RGB
            HairColor      = rdr.ReadColor();
            SkinColor      = rdr.ReadColor();
            MustacheColor  = rdr.ReadColor();
            BeardColor     = rdr.ReadColor();
            SideburnsColor = rdr.ReadColor();

            PantsColor     = rdr.ReadUserColor();
            ShirtColor     = rdr.ReadUserColor();
            ShirtTrimColor = rdr.ReadUserColor();
            ShoesColor     = rdr.ReadUserColor();
            ShoesTrimColor = rdr.ReadUserColor();

            Name  = rdr.ReadUnicodeString();
            Class = (CharacterClass)rdr.ReadByte();
            rdr.ReadBytes(2);          //UNKNOWN: always 00 0A?
            LastMapPlayed = rdr.ReadString();
            rdr.ReadByte();            //null terminator not included in string length

            System.Diagnostics.Debug.Assert(rdr.BaseStream.Position == finish, "Bad CharacterInfo length");
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 protected void ReadSPHeader(NoxBinaryReader rdr)
 {
     //long finish = rdr.ReadInt64() + rdr.BaseStream.Position;
     //TODO: skip for now
     rdr.ReadBytes((int) rdr.ReadInt64());
 }
Exemple #5
0
        protected void ReadCharacterInfo(NoxBinaryReader rdr)
        {
            long finish = rdr.ReadInt64() + rdr.BaseStream.Position;

            rdr.ReadBytes(6);//UNKNOWN header seems to always = 0c 00 02 00 00 00
            SavePath = rdr.ReadString(System.Type.GetType("System.Int16"));
            rdr.ReadByte();//terminating null not included in length

            //the time this file was written
            FileTime = new DateTime(
                rdr.ReadInt16(),//year
                rdr.ReadInt32() & 0xFFFF,//month --skip the next 16bytes
                //rdr.ReadInt16(),//day of the week (not needed)
                rdr.ReadInt16(),//day
                rdr.ReadInt16(),//hour
                rdr.ReadInt16(),//minute
                rdr.ReadInt16(),//seconds
                rdr.ReadInt16()//milliseconds
            );

            //these colors are RGB
            HairColor = rdr.ReadColor();
            SkinColor = rdr.ReadColor();
            MustacheColor = rdr.ReadColor();
            BeardColor = rdr.ReadColor();
            SideburnsColor = rdr.ReadColor();

            PantsColor = rdr.ReadUserColor();
            ShirtColor = rdr.ReadUserColor();
            ShirtTrimColor = rdr.ReadUserColor();
            ShoesColor = rdr.ReadUserColor();
            ShoesTrimColor = rdr.ReadUserColor();

            Name = rdr.ReadUnicodeString();
            Class = (CharacterClass) rdr.ReadByte();
            rdr.ReadBytes(2);//UNKNOWN: always 00 0A?
            LastMapPlayed = rdr.ReadString();
            rdr.ReadByte();//null terminator not included in string length

            System.Diagnostics.Debug.Assert(rdr.BaseStream.Position == finish, "Bad CharacterInfo length");
        }
Exemple #6
0
 protected void ReadSPHeader(NoxBinaryReader rdr)
 {
     //long finish = rdr.ReadInt64() + rdr.BaseStream.Position;
     //TODO: skip for now
     rdr.ReadBytes((int)rdr.ReadInt64());
 }