コード例 #1
0
ファイル: Menu.cs プロジェクト: hibive/nikon-firmware-tools
 static void AddElement(long addr, Struct14 element)
 {
     if (elements.ContainsKey(addr) == false)
     {
         elements.Add(addr, element);
     }
 }
コード例 #2
0
ファイル: Menu.cs プロジェクト: hibive/nikon-firmware-tools
            public void ReadElements(byte[] data)
            {
                if (field_1C != 0)
                {
                    for (int i = 0; i < field_A; i++)
                    {
                        var s14 = new Struct14(data, field_1C + (i * Struct14.size_of), addr_off);

                        menu_elements.Add(s14);
                    }
                }
            }
コード例 #3
0
        private static HardDiskInfo smethod_2(byte byte_0)
        {
            Struct10 struct2 = new Struct10();
            Struct12 struct3 = new Struct12();
            Struct14 struct4 = new Struct14();
            uint     num     = 0;
            IntPtr   ptr     = CreateFile(string.Format(@"\\.\PhysicalDrive{0}", byte_0), 0xc0000000, 3, IntPtr.Zero, 3, 0, IntPtr.Zero);

            if (ptr == IntPtr.Zero)
            {
                throw new Exception("CreateFile faild.");
            }
            if (0 == DeviceIoControl(ptr, 0x74080, IntPtr.Zero, 0, ref struct2, (uint)Marshal.SizeOf(struct2), ref num, IntPtr.Zero))
            {
                CloseHandle(ptr);
                throw new Exception(string.Format("Drive {0} may not exists.", byte_0 + 1));
            }
            if (0 == (struct2.uint_0 & 1))
            {
                CloseHandle(ptr);
                throw new Exception("Error: IDE identify command not supported.");
            }
            if (0 != (byte_0 & 1))
            {
                struct3.struct11_0.byte_5 = 0xb0;
            }
            else
            {
                struct3.struct11_0.byte_5 = 160;
            }
            if (0 != (struct2.uint_0 & (((int)0x10) >> byte_0)))
            {
                CloseHandle(ptr);
                throw new Exception(string.Format("Drive {0} is a ATAPI device, we don''t detect it.", byte_0 + 1));
            }
            struct3.struct11_0.byte_6 = 0xec;
            struct3.byte_0            = byte_0;
            struct3.struct11_0.byte_1 = 1;
            struct3.struct11_0.byte_2 = 1;
            struct3.uint_0            = 0x200;
            if (0 == DeviceIoControl_1(ptr, 0x7c088, ref struct3, (uint)Marshal.SizeOf(struct3), ref struct4, (uint)Marshal.SizeOf(struct4), ref num, IntPtr.Zero))
            {
                CloseHandle(ptr);
                throw new Exception("DeviceIoControl failed: DFP_RECEIVE_DRIVE_DATA");
            }
            CloseHandle(ptr);
            return(smethod_3(struct4.struct15_0));
        }
コード例 #4
0
        public override void Deserialize(Deserializer deserializer)
        {
            this.Unknown0 = deserializer.ReadInt16();
            this.Unknown1 = deserializer.ReadVarint();
            this.Unknown2 = deserializer.ReadByte();
            this.Unknown3 = deserializer.ReadVarint();
            byte unknown4Length = deserializer.ReadByte();

            if (unknown4Length > 81)
            {
                throw new InvalidDataException();
            }
            Unknown4 = new byte[unknown4Length];
            for (int i = 0; i < Unknown4.Length; i++)
            {
                Unknown4[i] = deserializer.ReadByte();
            }
            this.Unknown5  = deserializer.ReadVector4();
            this.Unknown6  = deserializer.ReadVarint();
            this.Unknown7  = deserializer.ReadVector4();
            this.Unknown8  = deserializer.ReadByte();
            this.Unknown9  = deserializer.ReadByte();
            this.Unknown10 = deserializer.ReadByte();
            this.Unknown11 = deserializer.ReadVector3();
            this.Unknown12 = deserializer.ReadInt16();
            this.Unknown13 = deserializer.ReadInt16();
            if (deserializer.ReadBoolean())
            {
                Struct14 struct14 = new Struct14();
                struct14.Deserialize(deserializer);
                this.Unknown18 = new Optional <Struct14>(struct14);
            }
            else
            {
                this.Unknown18 = null;
            }
        }
コード例 #5
0
ファイル: Class51.cs プロジェクト: wangzhaoming/HearthBuddy
        public void imethod_0(Stream stream_0, Stream stream_1, long long_0, long long_1, Interface1 interface1_0)
        {
            this.method_3(stream_0, stream_1);
            Class50.Struct8 struct2 = new Class50.Struct8();
            struct2.method_0();
            uint  num  = 0;
            uint  num2 = 0;
            uint  num3 = 0;
            uint  num4 = 0;
            ulong num5 = 0L;
            ulong num6 = (ulong)long_1;

            if (0L < num6)
            {
                if (this.struct12_0[struct2.uint_0 << 4].method_2(this.class62_0) != 0)
                {
                    throw new Exception0();
                }
                struct2.method_1();
                byte num7 = this.class53_0.method_3(this.class62_0, 0, 0);
                this.class60_0.method_6(num7);
                num5 += (ulong)1L;
            }
            while (num5 < num6)
            {
                uint num11;
                uint num12;
                uint num8 = ((uint)num5) & this.uint_2;
                if (this.struct12_0[(struct2.uint_0 << 4) + num8].method_2(this.class62_0) == 0)
                {
                    byte num9;
                    byte num10 = this.class60_0.method_7(0);
                    if (!struct2.method_5())
                    {
                        num9 = this.class53_0.method_4(this.class62_0, (uint)num5, num10, this.class60_0.method_7(num));
                    }
                    else
                    {
                        num9 = this.class53_0.method_3(this.class62_0, (uint)num5, num10);
                    }
                    this.class60_0.method_6(num9);
                    struct2.method_1();
                    num5 += (ulong)1L;
                    continue;
                }
                if (this.struct12_1[struct2.uint_0].method_2(this.class62_0) != 1)
                {
                    goto Label_025A;
                }
                if (this.struct12_2[struct2.uint_0].method_2(this.class62_0) == 0)
                {
                    if (this.struct12_5[(struct2.uint_0 << 4) + num8].method_2(this.class62_0) != 0)
                    {
                        goto Label_0237;
                    }
                    struct2.method_4();
                    this.class60_0.method_6(this.class60_0.method_7(num));
                    num5 += (ulong)1L;
                    continue;
                }
                if (this.struct12_3[struct2.uint_0].method_2(this.class62_0) == 0)
                {
                    num12 = num2;
                }
                else
                {
                    if (this.struct12_4[struct2.uint_0].method_2(this.class62_0) == 0)
                    {
                        num12 = num3;
                    }
                    else
                    {
                        num12 = num4;
                        num4  = num3;
                    }
                    num3 = num2;
                }
                num2 = num;
                num  = num12;
Label_0237:
                num11 = this.class52_1.method_2(this.class62_0, num8) + 2;
                struct2.method_3();
                goto Label_0309;
Label_025A:
                num4  = num3;
                num3  = num2;
                num2  = num;
                num11 = 2 + this.class52_0.method_2(this.class62_0, num8);
                struct2.method_2();
                uint num13 = this.struct14_0[Class50.smethod_0(num11)].method_1(this.class62_0);
                if (num13 >= 4)
                {
                    int num14 = ((int)(num13 >> 1)) - 1;
                    num = (uint)((2 | (num13 & 1)) << (num14 & 0x1f));
                    if (num13 < 14)
                    {
                        num += Struct14.smethod_0(this.struct12_6, (num - num13) - 1, this.class62_0, num14);
                    }
                    else
                    {
                        num += this.class62_0.method_7(num14 - 4) << 4;
                        num += this.struct14_1.method_2(this.class62_0);
                    }
                }
                else
                {
                    num = num13;
                }
Label_0309:
                if ((num >= num5) || (num >= this.uint_1))
                {
                    if (num != uint.MaxValue)
                    {
                        throw new Exception0();
                    }
                    break;
                }
                this.class60_0.method_5(num, num11);
                num5 += num11;
            }
            this.class60_0.method_4();
            this.class60_0.method_3();
            this.class62_0.method_1();
        }
コード例 #6
0
 private static extern int DeviceIoControl_1(IntPtr intptr_0, uint uint_9, ref Struct12 struct12_0, uint uint_10, ref Struct14 struct14_0, uint uint_11, ref uint uint_12, [Out] IntPtr intptr_1);
コード例 #7
0
ファイル: Menu.cs プロジェクト: x86Labs/nikon-firmware-tools
            public void ReadElements(byte[] data)
            {
                if (field_1C != 0)
                {
                    for (int i = 0; i < field_A; i++)
                    {
                        var s14 = new Struct14(data, field_1C + (i * Struct14.size_of), addr_off);

                        menu_elements.Add(s14);
                    }
                }
            }
コード例 #8
0
ファイル: Menu.cs プロジェクト: x86Labs/nikon-firmware-tools
 static void AddElement(long addr, Struct14 element)
 {
     if (elements.ContainsKey(addr) == false)
     {
         elements.Add(addr, element);
     }
 }
コード例 #9
0
ファイル: P008_UnknownMessage.cs プロジェクト: puppt/GW2Emu
 public void Deserialize(Deserializer deserializer)
 {
     this.Unknown0 = deserializer.ReadInt16();
     this.Unknown1 = deserializer.ReadVarint();
     this.Unknown2 = deserializer.ReadByte();
     this.Unknown3 = deserializer.ReadVarint();
     byte unknown4Length = deserializer.ReadByte();
     if (unknown4Length > 81)
     {
         throw new InvalidDataException();
     }
     Unknown4 = new byte[unknown4Length];
     for (int i = 0; i < Unknown4.Length; i++)
     {
         Unknown4[i] = deserializer.ReadByte();
     }
     this.Unknown5 = deserializer.ReadVector4();
     this.Unknown6 = deserializer.ReadVarint();
     this.Unknown7 = deserializer.ReadVector4();
     this.Unknown8 = deserializer.ReadByte();
     this.Unknown9 = deserializer.ReadByte();
     this.Unknown10 = deserializer.ReadByte();
     this.Unknown11 = deserializer.ReadVector3();
     this.Unknown12 = deserializer.ReadInt16();
     this.Unknown13 = deserializer.ReadInt16();
     if (deserializer.ReadBoolean())
     {
         Struct14 struct14 = new Struct14();
         struct14.Deserialize(deserializer);
         this.Unknown18 = new Optional<Struct14>(struct14);
     }
     else
     {
         this.Unknown18 = null;
     }
 }
コード例 #10
0
 public static PointF smethod_1(Struct14 A_0)
 {
     return(new PointF((float)A_0.short_0, (float)A_0.short_1));
 }
コード例 #11
0
 public static Point smethod_0(Struct14 A_0)
 {
     return(new Point(A_0.short_0, A_0.short_1));
 }