示例#1
0
 public Config(Main m, Overlay o)
 {
     mainForm = m;
     overlayForm = o;
     AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "Silky Shark.config");
 }
示例#2
0
        public Settings(Main mF, Config cG, Overlay oF)
        {
            InitializeComponent();
            panel_cursorPanel.Paint += new PaintEventHandler(CursorPreviewPaint);
            mainForm = mF;
            config = cG;
            overlayForm = oF;

            // Overlay tab setup
            if (config.disableOverlay) checkBox_disableOverlay.Checked = true;
            if (config.allScreens) checkBox_allScreens.Checked = true;
            if (config.manualOverlayOverride)
            {
                checkBox_manualOverlayOverride.Checked = true;
            }
            else
            {
                textBox_overlayPositionX.Enabled = false;
                textBox_overlayPositionY.Enabled = false;
                textBox_overlaySizeX.Enabled = false;
                textBox_overlaySizeY.Enabled = false;
            }
            Rectangle ob = config.overrideBounds;
            textBox_overlayPositionX.Text = ob.Location.X.ToString();
            textBox_overlayPositionY.Text = ob.Location.Y.ToString();
            textBox_overlaySizeX.Text = ob.Width.ToString();
            textBox_overlaySizeY.Text = ob.Height.ToString();

            // Cursor tab
            if (config.disableCatchUp) checkBox_disableCatchUp.Checked = true;
            if (config.snapToCursor) checkBox_snapToCursor.Checked = true;
            switch (overlayForm.cursorType)
            {
                case Overlay.CursorType.Bullseye:
                    radioButton_bullseye.Checked = true;
                    break;
                case Overlay.CursorType.Circle:
                    radioButton_circle.Checked = true;
                    break;
                case Overlay.CursorType.Crosshair:
                    radioButton_crosshair.Checked = true;
                    break;
                case Overlay.CursorType.Cursor:
                    radioButton_cursor.Checked = true;
                    break;
                case Overlay.CursorType.TinyCursor:
                    radioButton_tinyCursor.Checked = true;
                    break;
                case Overlay.CursorType.Pen:
                    radioButton_pen.Checked = true;
                    break;
            }
            button_mainColor.BackColor = overlayForm.cursorColor;
            button_fillColor.BackColor = overlayForm.cursorFillColor;

            // Tablet tab
            if (config.disableAutoDetection) checkBox_disableAutoDetection.Checked = true;
            if (mainForm.smoothingOn)
            {
                checkBox_disableAutoDetection.Enabled = false;
            }
            int t = config.tolerance;
            textBox_tolerance.Text = t.ToString();
            if (config.tabletOffsetOverride)
            {
                checkBox_tabletOffsetOverride.Checked = true;
            }
            else
            {
                textBox_tabletOffsetX.Enabled = false;
                textBox_tabletOffsetY.Enabled = false;
            }
            Point co = config.tabletOffset;
            textBox_tabletOffsetX.Text = co.X.ToString();
            textBox_tabletOffsetY.Text = co.Y.ToString();

            // Hotkey tab
            KeysConverter c = new KeysConverter();
            string mod;
            string[] ms;
            Keys k;
            Hotkey.KeyModifiers m;
            k = (Keys)c.ConvertFromString(config.hotkeys[0]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeySmoothOnOff.Text = mod + k;
            }
            k = (Keys)c.ConvertFromString(config.hotkeys[1]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeyOverlayOnOff.Text = mod + k;
            }
            k = (Keys)c.ConvertFromString(config.hotkeys[2]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeyToggleDisplay.Text = mod + k;
            }
            k = (Keys)c.ConvertFromString(config.hotkeys[3]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeyTabletMode.Text = mod + k;
            }
            k = (Keys)c.ConvertFromString(config.hotkeys[4]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeyStrengthUp.Text = mod + k;
            }
            k = (Keys)c.ConvertFromString(config.hotkeys[5]);
            if (k.ToString() != "None")
            {
                m = Hotkey.GetModifiers(k, out k);
                mod = "";
                ms = m.ToString().Split(new[] { ", " }, StringSplitOptions.None);
                foreach (string mm in ms)
                {
                    mod += mm + "+";
                }
                textBox_hotkeyStrengthDown.Text = mod + k;
            }
        }