Пример #1
0
        internal DsPacket(Byte[] Native)
        {
            Byte[] Local = new Byte[6];

            Array.Copy(Native, (Int32)DsOffset.Address, Local, 0, Local.Length);

            m_Detail = new DsDetail(
                (DsPadId)Native[(Int32)DsOffset.Pad],
                (DsState)Native[(Int32)DsOffset.State],
                (DsModel)Native[(Int32)DsOffset.Model],
                Local,
                (DsConnection)Native[(Int32)DsOffset.Connection],
                (DsBattery)Native[(Int32)DsOffset.Battery]
                );

            m_Packet = (Int32)(Native[4] << 0 | Native[5] << 8 | Native[6] << 16 | Native[7] << 24);
            m_Native = Native;

            switch (m_Detail.Model)
            {
            case DsModel.DS3: m_Ds3Button = (Ds3Button)((Native[10] << 0) | (Native[11] << 8) | (Native[12] << 16) | (Native[13] << 24)); break;

            case DsModel.DS4: m_Ds4Button = (Ds4Button)((Native[13] << 0) | (Native[14] << 8) | ((Native[15] & 0x03) << 16)); break;
            }
        }
Пример #2
0
        public virtual DsDetail Detail(DsPadId Pad)
        {
            DsDetail Detail = null;

            try
            {
                Byte[] Buffer = { (Byte)Pad, 0x0A };

                if (m_Server.Send(Buffer, Buffer.Length, m_ServerEp) == Buffer.Length)
                {
                    IPEndPoint ReferenceEp = new IPEndPoint(IPAddress.Loopback, 0);

                    Buffer = m_Server.Receive(ref ReferenceEp);

                    if (Buffer.Length > 0)
                    {
                        Byte[] Local = new Byte[6]; Array.Copy(Buffer, 5, Local, 0, Local.Length);

                        Detail = new DsDetail((DsPadId)Buffer[0], (DsState)Buffer[1], (DsModel)Buffer[2], Local, (DsConnection)Buffer[3], (DsBattery)Buffer[4]);
                    }
                }
            }
            catch { }

            return(Detail);
        }
Пример #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var Profile = new Profile("<New Profile>");

            m_Detail = scpProxy.Detail((DsPadId)m_SelectedPad);
            m_PropForm = new ProfileProperties(Profile, m_Detail.Pad, m_Detail.Local, true);

            m_PropForm.FormClosed += Props_Close;
            m_PropForm.VisibleChanged += Props_Visible;

            m_PropForm.Show(this);
        }
Пример #4
0
        public void Request()
        {
            m_SelectedProfile = m_Active = scpProxy.ActiveProfile;

            cbProfile.Items.Clear();
            cbProfile.Items.AddRange(scpProxy.Mapper.Profiles);
            cbProfile.SelectedItem = m_SelectedProfile;

            cbPad.SelectedIndex = m_SelectedPad = 0;
            m_Detail = scpProxy.Detail((DsPadId)m_SelectedPad);

            ResetControls();

            m_Editing = false;
            m_CanSave = true;
        }
Пример #5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            m_Detail = scpProxy.Detail((DsPadId)m_SelectedPad);
            m_PropForm = new ProfileProperties(scpProxy.Mapper.Map[m_SelectedProfile], m_Detail.Pad, m_Detail.Local,
                true);

            m_PropForm.FormClosed += Props_Close;
            m_PropForm.VisibleChanged += Props_Visible;

            m_PropForm.Show(this);
        }
Пример #6
0
        private void Pad_Selected(object sender, EventArgs e)
        {
            lock (this)
            {
                m_SelectedPad = cbPad.SelectedIndex;
                m_Detail = scpProxy.Detail((DsPadId)m_SelectedPad);

                ResetControls();
            }
        }