예제 #1
0
        private void createFromBoardCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dlg = new ParseJoyDialog();

            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            var joy = new JoystickConfig();

            try
            {
                var parser = new DescriptionParser(joy);
                var data   = dlg.DescriptorText.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                parser.Parse(data.Select(s => uint.Parse(s, NumberStyles.HexNumber)).GetEnumerator());
            }
            catch (Exception exx)
            {
                ShowError(exx.Message, "Parsing error");
                return;
            }

            ShowJoystickDialog(joy);
        }
예제 #2
0
        private void createFromBoardCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dlg = new ParseJoyDialog();

            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            var joy = new JoystickConfig();

            try
            {
                var parser = new DescriptionParser(joy);
                var data   = SplitValues(dlg.DescriptorText);
                parser.Parse(data.Select(s => uint.Parse(s, NumberStyles.HexNumber)).GetEnumerator());
                joy.VendorID        = dlg.VendorID;
                joy.ProductID       = dlg.ProductID;
                joy.ReportStructure = dlg.DescriptorText;
            }
            catch (Exception exx)
            {
                ShowError(exx.Message, CommonResources.ParseError);
                return;
            }

            ShowJoystickDialog(joy);
        }