Пример #1
0
        /// <summary>
        /// The GetData.
        /// </summary>
        /// <param name="path">
        /// The path.
        /// </param>
        /// <param name="recordtype">
        /// The recordtype.
        /// </param>
        public static void GetData(string path, Extractor.RecordType recordtype)
        {
            int[] items = extractor.GetRecordInstances(recordtype);
            int   cou   = 0;

            foreach (int item in items)
            {
                try
                {
                    using (
                        var fileStream = new FileStream(Path.Combine(
                                                            path, item.ToString(CultureInfo.InvariantCulture)),
                                                        FileMode.Create,
                                                        FileAccess.Write))
                    {
                        byte[] data = extractor.GetRecordData(recordtype, item);

                        fileStream.Write(data, 0, data.Length);
                    }
                    if (cou % 10 == 0)
                    {
                        Console.WriteLine(item);
                    }

                    cou++;
                }
                catch (Exception)
                {
                }
            }
        }
Пример #2
0
        /// <summary>
        /// The get record data.
        /// </summary>
        /// <param name="RecordType">
        /// The record type.
        /// </param>
        /// <param name="RecordInstance">
        /// The record instance.
        /// </param>
        /// <param name="decode">
        /// The decode.
        /// </param>
        /// <returns>
        /// The <see cref="byte[]"/>.
        /// </returns>
        /// <exception cref="InvalidDataException">
        /// </exception>
        public byte[] GetRecordData(Extractor.RecordType recordType, int recinstance, bool decode = false)
        {
            int  rectype  = (int)recordType;
            uint position = this.Records[rectype][recinstance];

            byte[]  buffer  = this.SegRead(34u, position);
            bStream bStream = new bStream(buffer);
            int     num     = bStream.ReadInt32_At(10u);

            if (rectype != num)
            {
                throw new InvalidDataException("Invalid Record Type");
            }

            int num2 = bStream.ReadInt32();

            if (recinstance != num2)
            {
                throw new InvalidDataException("Invalid Record Instance");
            }

            uint count = bStream.ReadUInt32() - 12u;

            byte[] array = this.SegRead(count, 4294967295u);
            if (decode)
            {
                ulong num3 = (ulong)recinstance;
                int   i    = 0;
                while (i < array.Length)
                {
                    num3 *= 16850947uL;
                    num3 %= 21023087759uL;
                    byte[] arg_B0_0 = array;
                    int    expr_AB  = i++;
                    arg_B0_0[expr_AB] ^= (byte)num3;
                }
            }

            return(array);
        }
Пример #3
0
        /// <summary>
        /// The parse item.
        /// </summary>
        /// <param name="rectype">
        /// The rectype.
        /// </param>
        /// <param name="recnum">
        /// The recnum.
        /// </param>
        /// <param name="data">
        /// The data.
        /// </param>
        /// <param name="itemNamesSqlList">
        /// </param>
        /// <returns>
        /// The <see cref="AOItem"/>.
        /// </returns>
        public ItemTemplate ParseItem(Extractor.RecordType recordType, int recnum, byte[] data, List <string> itemNamesSqlList)
        {
            int rectype = (int)recordType;

            this.br = new BufferedReader(rectype, recnum, data);
            ItemTemplate aoi = new ItemTemplate();

            aoi.ID = recnum;
            this.br.Skip(16);

            int num   = this.br.Read3F1();
            int argc0 = 0;

            int num2 = num - 1;
            int num3 = argc0;

            while (true)
            {
                int arg1c2 = num3;
                int num4   = num2;
                if (arg1c2 > num4)
                {
                    break;
                }

                int attrkey = this.br.ReadInt32();
                int attrval = this.br.ReadInt32();
                if (attrkey == 54)
                {
                    aoi.Quality = attrval;
                }
                else
                {
                    aoi.Stats.Add(attrkey, attrval);
                }

                num3++;
            }

            this.br.Skip(8);

            short  num5     = this.br.ReadInt16();
            short  num6     = this.br.ReadInt16();
            string itemname = string.Empty;

            if (num5 > 0)
            {
                itemname = this.br.ReadString(num5);
            }

            if (itemNamesSqlList != null)
            {
                itemNamesSqlList.Add(string.Format("( {0} , '{1}' , '{2}', '{3}' ) ",
                                                   recnum,
                                                   itemname.Replace("'", "''"),
                                                   Enum.GetName(typeof(Extractor.RecordType), recordType),
                                                   aoi.getItemAttribute(79)));
            }

            if (num6 > 0)
            {
                this.br.ReadString(num6); // Read and discard Description
            }

            bool flag4 = true;

            checked
            {
                while (this.br.Ptr < this.br.Buffer.Length - 8 && flag4)
                {
                    switch (this.br.ReadInt32()) // what are these ints ?
                    {
                    case 2:
                        this.ParseFunctionSet(aoi.Events);
                        break;

                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 13:
                    case 15:
                    case 16:
                    case 17:
                    case 18:
                    case 19:
                    case 21:
                        goto IL_4BF;

                    case 4:
                        this.ParseAtkDefSet(aoi.Attack, aoi.Defend);
                        break;

                    case 6:
                    {
                        this.br.Skip(4);
                        int count = this.br.Read3F1() * 8;
                        this.br.Skip(count);
                        break;
                    }

                    case 14:
                        this.ParseAnimSoundSet(1, aoi);
                        break;

                    case 20:
                        this.ParseAnimSoundSet(2, aoi);
                        break;

                    case 22:
                        this.ParseActionSet(aoi.Actions);
                        break;

                    case 23:
                        this.ParseShopHash(aoi.Events);
                        break;

                    default:
                        goto IL_4BF;
                    }

                    continue;
IL_4BF:
                    flag4 = false;
                }
            }

            return(aoi);
        }
Пример #4
0
 /// <summary>
 /// The is valid type.
 /// </summary>
 /// <param name="recordType">
 /// The record type.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public bool IsValidType(Extractor.RecordType recordType)
 {
     return(this.Records.ContainsKey((int)recordType));
 }
Пример #5
0
 /// <summary>
 /// The is valid instance.
 /// </summary>
 /// <param name="recordType">
 /// The record type.
 /// </param>
 /// <param name="recordInstance">
 /// The record instance.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public bool IsValidInstance(Extractor.RecordType recordType, int recordInstance)
 {
     return(this.Records.ContainsKey((int)recordType) && this.Records[(int)recordType].ContainsKey(recordInstance));
 }
Пример #6
0
 /// <summary>
 /// The get record instances.
 /// </summary>
 /// <param name="recordType">
 /// The record type.
 /// </param>
 /// <returns>
 /// The <see cref="int[]"/>.
 /// </returns>
 public int[] GetRecordInstances(Extractor.RecordType recordType)
 {
     return(this.Records[(int)recordType].Keys.ToArray());
 }