Extractor_Serializer.Extractor.GetRecordData C# (CSharp) Method

GetRecordData() public method

The get record data.
///
public GetRecordData ( Extractor RecordType, int RecordInstance, bool decode = false ) : byte[]
RecordType Extractor /// The record type. ///
RecordInstance int /// The record instance. ///
decode bool /// The decode. ///
return byte[]
        public byte[] GetRecordData(Extractor.RecordType RecordType, int RecordInstance, bool decode = false)
        {
            ulong position = this.Records[(int)RecordType][RecordInstance];
            byte[] buffer = this.SegRead(34u, position);
            bStream bStream = new bStream(buffer);
            int num = bStream.ReadInt32_At(10u);
            if ((int)RecordType != num)
            {
                throw new InvalidDataException("Invalid Record Type");
            }

            int num2 = bStream.ReadInt32();
            if (RecordInstance != num2)
            {
                throw new InvalidDataException("Invalid Record Instance");
            }

            uint count = bStream.ReadUInt32() - 12u;
            byte[] array = this.SegRead(count, 4294967295u);
            if (decode)
            {
                ulong num3 = (ulong)RecordInstance;
                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;
        }

Usage Example

Example #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)
                {
                }
            }
        }
All Usage Examples Of Extractor_Serializer.Extractor::GetRecordData