Example #1
0
        public bool Handshake()
        {
            if (!SimpleSend(OpCodes.Connect, "00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00") ||
                !SimpleSend(OpCodes.Connect, "00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00"))
            {
                return(false);
            }

            using (Packet request = new Packet(OpCodes.SettingsList))
            {
                request.WriteHexString("00 00 00 00 00 00 00 00 C8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00");
                using (Packet response = Packet.Reader(SendCommand(request.GetBuffer())))
                {
                    if (response.ReadByte() != 1 || response.ReadByte() != 0x20)
                    {
                        return(false);
                    }

                    AvailableMainSettingIds.Clear();
                    AvailableSubSettingIds.Clear();

                    response.Index = 30;
                    ushort unk = response.ReadUInt16();//200?

                    int mainSettingsCount = response.ReadInt32();
                    for (int i = 0; i < mainSettingsCount; i++)
                    {
                        AvailableMainSettingIds.Add(response.ReadUInt16());
                    }

                    int subSettingsCount = response.ReadInt32();
                    for (int i = 0; i < subSettingsCount; i++)
                    {
                        AvailableSubSettingIds.Add(response.ReadUInt16());
                    }
                }
            }


            if (!SimpleSend(OpCodes.Connect, "00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00"))
            {
                return(false);
            }

            if (!Update(false))
            {
                return(false);
            }

            return(true);
        }