Ejemplo n.º 1
0
        public SelectMouseButton(Config.Data cfg, string Tag)
        {
            InitializeComponent();

            this.cfg = cfg;
            this.Tag = Tag;
        }
Ejemplo n.º 2
0
        private void btnPresOptDel_Click(object sender, EventArgs e)
        {
            var res = MessageBox.Show(
                "Are you sure you want to delete: " + GetSelectedListProfile() + "\nFile: " + GetSelectedListProfilePath(),
                "Are you sure?",
                MessageBoxButtons.OKCancel
                );

            if (res != DialogResult.OK)
            {
                return;
            }
            if (!System.IO.File.Exists(GetSelectedListProfilePath()))
            {
                MessageBox.Show("The selected profile: " + GetSelectedListProfile() +
                                " no longer exists...\nFile: " + GetSelectedListProfilePath());
                return;
            }

            if (GetSelectedListProfile().Trim() == "default.ini")
            {
                // Remake the default ini
                Config.Data d = new Config.Data();
                Config.Data.Save("profiles/default.ini", d);
            }

            if (Program.ActiveConfig.Name.Trim() == GetSelectedListProfile().Trim())
            {
                Program.SetActiveConfig("default.ini");
            }

            System.IO.File.Delete(GetSelectedListProfilePath());
            RefreshConfigList();
        }
        public Mouse_Engine_Relative(Config.Data cfg)
        {
            InitializeComponent();

            this.cfg = cfg;

            Controls_KB_MReset_KEY = cfg.Controls_KB_MReset_KEY;
            Controls_KB_MReset_MOD = cfg.Controls_KB_MReset_MOD;

            resetButtonText();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureStorageQueueSmsRelay"/> class.
        /// </summary>
        /// <param name="azureConfigOptions"> the azure configuration options </param>
        /// <param name="dataConfigOptions"> the database configuration options </param>
        /// <param name="notifyConfigOptions"> the Notify service configuration options </param>
        /// <param name="connectionStringsOptions"> the connections strings options </param>
        public AzureStorageQueueSmsRelay(
            IOptions <AzureConfiguration> azureConfigOptions,
            IOptions <DataConfiguration> dataConfigOptions,
            IOptions <NotifyConfiguration> notifyConfigOptions,
            IOptions <ConnectionStrings> connectionStringsOptions)
        {
            this.azureConfig       = azureConfigOptions.Value;
            this.dataConfig        = dataConfigOptions.Value;
            this.notifyConfig      = notifyConfigOptions.Value;
            this.connectionStrings = connectionStringsOptions.Value;

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(this.connectionStrings.StorageAccount);

            this.queueClient = storageAccount.CreateCloudQueueClient();
        }
Ejemplo n.º 5
0
        public SelectKey(Config.Data cfg, string Tag)
        {
            InitializeComponent();

            this.cfg = cfg;
            this.Tag = Tag;

            this.Text += Tag;

            foreach (Control c in Controls)
            {
                c.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SelectKey_KeyUp);
            }

            KeyUp += new System.Windows.Forms.KeyEventHandler(this.SelectKey_KeyUp);
        }
Ejemplo n.º 6
0
        public SelectKey(Config.Data cfg, string Tag)
        {
            InitializeComponent();

            this.cfg = cfg;
            this.Tag = Tag;

            this.Text += Tag;

            foreach (Control c in Controls)
            {
                c.KeyUp += this.SelectKey_KeyUp;
            }

            KeyUp += this.SelectKey_KeyUp;
        }
Ejemplo n.º 7
0
        private void loadConfig(int n)
        {
            string version;

            Config.Data[] datas;
            if (configs == null)
            {
                texturePaths   = new string[] {};
                textureList    = new List <string>();
                textureHistory = new List <string>();
                var path = File.DataPath;
                path = File.CombinePath(path, configFile);
                if (File.IsExistsFile(path))
                {
                    var text = File.ReadText(path);
                    (version, datas) = Serializer.DeserializeTextArray <Config.Data>(text);
                    if (version == default /* for version 1.0.3 or earlier */)
                    {
                        datas = new Config.Data[] { Serializer.DeserializeText <Config.Data>(text) };
                    }
                    configs = datas.ToList();
                }
                else
                {
                    var assets = Resources.Load <TextAsset>("Levels/ConfigTable");
                    (version, datas) = Serializer.DeserializeTextArray <Config.Data>(assets.text);
                    configs          = datas.ToList();
                }
            }
            var config = configs[n];

            if (File.IsExistsDirectory(config.folder))
            {
                texturePaths = getTexturePaths(config.folder);
                textureList  = texturePaths.ToList();
            }
            foreach (var historyPath in config.history)
            {
                if (File.IsExistsFile(historyPath))
                {
                    textureHistory.Add(historyPath);
                }
            }
            configs[0] = new Config.Data(config);
        }
Ejemplo n.º 8
0
        private void saveConfig(int n)
        {
            if (n >= configs.Count)
            {
                configs.Add(new Config.Data(configs[0]));
            }
            else
            {
                configs[n] = new Config.Data(configs[0]);
            }
            var path = File.DataPath;

            path = File.CombinePath(path, configFile);
            var version = UnityEngine.Application.version;
            var text    = Serializer.SerializeTextArray(version, configs.ToArray());

            File.WriteText(path, text);
        }
Ejemplo n.º 9
0
        private void file_DeletePreset_Click(object sender, EventArgs e)
        {
            if (SelectedListProfile == null)
            {
                MessageBox.Show("You must select a profile first.");
                return;
            }

            if (!File.Exists(SelectedListProfilePath))
            {
                MessageBox.Show(string.Format("The profile '{0}' no longer exists (at {1})", SelectedListProfile, SelectedListProfilePath));
                RefreshConfigList();
                return;
            }

            var message = string.Format("Are you sure you want to delete the profile '{0}'?", SelectedListProfile, SelectedListProfilePath);
            var result  = MessageBox.Show(message, "Are you sure?", MessageBoxButtons.OKCancel);

            if (result != DialogResult.OK)
            {
                return;
            }

            File.Delete(SelectedListProfilePath);

            if (SelectedListProfile == "default")
            {
                // Remake the default ini
                Config.Data d = new Config.Data();
                Config.Data.Save("default.ini", d);
            }

            if (Program.ActiveConfig.Name == SelectedListProfile)
            {
                SetActive("default.ini");
            }

            RefreshConfigList();
        }
Ejemplo n.º 10
0
        private void btnCreatePreset_Click(object sender, EventArgs e)
        {
            var filePath = "profiles/" + tbCreateName.Text + ".ini";

            if (presetNameExists())
            {
                lblCreateStatus.ForeColor = Color.Red;
                lblCreateStatus.Text      = "Preset already exists...";
                return;
            }

            // Create new config with default values
            Config.Data d = new Config.Data();
            d.Name = tbCreateName.Text;

            Config.Data.Save(tbCreateName.Text + ".ini", d);

            // Saved
            lblCreateStatus.ForeColor = Color.Orange;
            lblCreateStatus.Text      = "Saved...";

            MessageBox.Show("Created new config in file (" + tbCreateName.Text + ".ini)");
            RefreshConfigList();
        }
Ejemplo n.º 11
0
        private void settings_ChangePresetName_Click(object sender, EventArgs e)
        {
            var name = cfg.Name.Trim();

            if (cfg.Name.Trim() != preset_Name.Text.Trim())
            {
                cfg.Name = preset_Name.Text.Trim();
                File.Delete(EditingProfilePath);
            }

            // Saved
            Config.Data.Save(cfg.Name + ".ini", cfg);

            // Check if cfg is default
            if (name == "default")
            {
                // Remake the default ini
                Config.Data d = new Config.Data();
                Config.Data.Save("profiles/default.ini", d);
            }

            // Refresh listings
            RefreshConfigList();
        }
Ejemplo n.º 12
0
        // Create the preset
        private void file_CreatePreset_Button_Click(object sender, EventArgs e)
        {
            var presetString = file_CreatePreset_Text.Text;
            var filePath     = Path.Combine("profiles", presetString + ".ini");

            if (presetNameExists())
            {
                file_CreatePreset_Button.Enabled = false;
                MessageBox.Show("Preset already exists (" + presetString + ".ini)");
                return;
            }

            // Create new config with default values
            Config.Data d = new Config.Data();
            d.Name = presetString;

            Config.Data.Save(presetString + ".ini", d);

            // Saved
            file_CreatePreset_Button.FontColor = preset_Color_Created;

            MessageBox.Show(string.Format("Created preset '{0}'", presetString));
            RefreshConfigList();
        }
Ejemplo n.º 13
0
        private void btnPreOptLoad_Click(object sender, EventArgs e)
        {
            if (!System.IO.File.Exists(GetSelectedListProfilePath()))
            {
                MessageBox.Show("The selected profile: " + GetSelectedProfile() +
                                " no longer exists...\nFile: " + GetSelectedProfilePath());
                RefreshConfigList();

                return;
            }

            // Load the config
            cfg = Config.Data.Load(GetSelectedListProfile() + ".ini");

            SelectedProfile = GetSelectedListProfile();

            // Load the controls onto the labels
            LoadXboxInputButtons();

            // Load the values for the options
            optName.Text                 = cfg.Name;
            optTickRate.Value            = cfg.Mouse_TickRate;
            optXSense.Value              = (decimal)cfg.Mouse_Sensitivity_X;
            optYSense.Value              = (decimal)cfg.Mouse_Sensitivity_Y;
            optInvertX.Checked           = cfg.Mouse_Invert_X;
            optInvertY.Checked           = cfg.Mouse_Invert_Y;
            optMouseEngine.SelectedIndex = cfg.Mouse_Eng_Type;
            optMouseModifier.Value       = (decimal)cfg.Mouse_FinalMod;

            // Ensure that there is a detach key
            var k1 = (System.Windows.Input.Key)cfg.Controls_KB_Detach_MOD;
            var k2 = (System.Windows.Input.Key)cfg.Controls_KB_Detach_KEY;
            var no = System.Windows.Input.Key.None;

            if (k1 == no && k2 == no)
            {
                MessageBox.Show("You cant disable the detach key, reset to default (LeftAlt + C)!");

                cfg.Controls_KB_Detach_MOD = (int)System.Windows.Input.Key.LeftAlt;
                cfg.Controls_KB_Detach_KEY = (int)System.Windows.Input.Key.C;

                Config.Data.Save(GetSelectedProfile() + ".ini", cfg);
            }
            else
            {
                detachKeyCheckup(true);
            }

            // Load detach key
            string kbMod = ((System.Windows.Input.Key)cfg.Controls_KB_Detach_MOD).ToString();

            kbMod = (kbMod == "None" ? "" : $"{kbMod} +");

            string kbKey = ((System.Windows.Input.Key)cfg.Controls_KB_Detach_KEY).ToString();

            optDetachKey.Text = $"On/Off Key: {kbMod} {kbKey}";

            // Enable the editors
            editor_Preset.Text           = "Preset - " + GetSelectedListProfile();
            editor_Preset.Enabled        = true;
            editor_InputKeyboard.Enabled = true;
            editor_InputMouse.Enabled    = true;

            originalName = cfg.Name;

            // Check if the mouse setting is valid
            if (cfg.Mouse_Eng_Type > TranslateMouse.MaxMouseMode || cfg.Mouse_Eng_Type < 0)
            {
                MessageBox.Show("Invalid mouse engine selected -> Reset to default!");
                cfg.Mouse_Eng_Type = 0;
                Config.Data.Save(GetSelectedProfile() + ".ini", cfg);
            }

            optMouseEngine.SelectedIndex = cfg.Mouse_Eng_Type;
        }
Ejemplo n.º 14
0
        private void file_LoadPreset_Click(object sender, EventArgs e)
        {
            if (SelectedListProfile == null)
            {
                MessageBox.Show("You must select a profile first.");
                return;
            }

            if (!File.Exists(SelectedListProfilePath))
            {
                MessageBox.Show(string.Format("The profile '{0}' no longer exists (at {1})", SelectedListProfile, SelectedListProfilePath));
                RefreshConfigList();
                return;
            }

            // Load the config for editing
            cfg            = Config.Data.Load(SelectedListProfile + ".ini");
            EditingProfile = SelectedListProfile;

            // Load the controls onto the labels
            LoadXboxInputButtons();

            // Load the values for the options
            preset_Name.Text         = cfg.Name;
            mouseInvertAxisX.Checked = cfg.Mouse_Invert_X;
            mouseInvertAxisY.Checked = cfg.Mouse_Invert_Y;

            // Check if the mouse setting is valid
            if (cfg.Mouse_Eng_Type == MouseTranslationMode.INVALID)
            {
                MessageBox.Show("Invalid mouse engine selected -> Reset to default!");
                cfg.Mouse_Eng_Type = MouseTranslationMode.DeadZoning;
                Config.Data.Save(EditingProfile + ".ini", cfg);
            }

            mouseEngineList.SelectedIndex = (int)cfg.Mouse_Eng_Type;

            // Ensure tickrate is not 0
            if (cfg.Mouse_TickRate == 0)
            {
                cfg.Mouse_TickRate = 40;
                Config.Data.Save(EditingProfile + ".ini", cfg);
            }

            mouse_TickRate.Text = "" + cfg.Mouse_TickRate;

            // Ensure that there is a detach key
            var k1 = (Key)cfg.Controls_KB_Detach_MOD;
            var k2 = (Key)cfg.Controls_KB_Detach_KEY;

            if (k1 == Key.None && k2 == Key.None)
            {
                MessageBox.Show("You can't disable the detach key. Reset to default (LeftAlt + C)!");

                cfg.Controls_KB_Detach_MOD = (int)Key.LeftAlt;
                cfg.Controls_KB_Detach_KEY = (int)Key.C;

                Config.Data.Save(EditingProfile + ".ini", cfg);
            }
            else
            {
                detachKeyCheckup(true);
            }

            // Load detach key
            string kbMod = ((Key)cfg.Controls_KB_Detach_MOD).ToString();

            kbMod = (kbMod == "None" ? "" : $"{kbMod} +");

            string kbKey = ((Key)cfg.Controls_KB_Detach_KEY).ToString();

            settings_DetachKey.Text = $"On/Off Key: {kbMod} {kbKey}";

            // Display our current file and active files
            file_Active.Text = "Active Preset: " + Program.ActiveConfig.Name;

            editor_InputKeyboard.Enabled = true;

            originalName = cfg.Name;

            // Load our application settings
            settings_LockEscape.Checked = cfg.Application_LockEscape;
            settings_ShowCursor.Checked = cfg.Application_ShowCursor;

            // Load our mouse engine
            LoadMouseEngineSettings();

            // Setup our sticks
            comboBox1.SelectedIndex = (cfg.Mouse_Is_RightStick ? 1 : 0);

            // Enable the tabs
            tabSettings.Enabled = true;
            tabKeyboard.Enabled = true;
            tabMouse.Enabled    = true;

            // Add the tabs if not already added
            if (!TabsAdded)
            {
                TabsAdded = true;

                // Add the tabs as controls
                materialTabControl1.Controls.Add(tabSettings);
                materialTabControl1.Controls.Add(tabKeyboard);
                materialTabControl1.Controls.Add(tabMouse);
                materialTabControl1.Controls.Add(tabPage3);
            }
        }
Ejemplo n.º 15
0
 public Airlock(Config.Data config)
 {
     config_ = config;
     job_    = HandleInit;
     state_  = State.Init;
 }
Ejemplo n.º 16
0
        private void file_LoadPreset_Click(object sender, EventArgs e)
        {
            if (!System.IO.File.Exists(GetSelectedListProfilePath()))
            {
                MessageBox.Show("The selected profile: " + GetSelectedProfile() +
                                " no longer exists...\nFile: " + GetSelectedProfilePath());
                RefreshConfigList();

                return;
            }

            // Load the config
            cfg = Config.Data.Load(GetSelectedListProfile() + ".ini");

            SelectedProfile = GetSelectedListProfile();

            // Load the controls onto the labels
            LoadXboxInputButtons();

            // Load the values for the options
            preset_Name.Text         = cfg.Name;
            mouseInvertAxisX.Checked = cfg.Mouse_Invert_X;
            mouseInvertAxisY.Checked = cfg.Mouse_Invert_Y;

            // Check if the mouse setting is valid
            if (cfg.Mouse_Eng_Type > TranslateMouse.MaxMouseMode || cfg.Mouse_Eng_Type < 0)
            {
                MessageBox.Show("Invalid mouse engine selected -> Reset to default!");
                cfg.Mouse_Eng_Type = 0;
                Config.Data.Save(GetSelectedProfile() + ".ini", cfg);
            }

            mouseEngineList.SelectedIndex = cfg.Mouse_Eng_Type;

            // Ensure tickrate is not 0
            if (cfg.Mouse_TickRate == 0)
            {
                cfg.Mouse_TickRate = 40;
                Config.Data.Save(GetSelectedProfile() + ".ini", cfg);
            }

            mouse_TickRate.Text = "" + cfg.Mouse_TickRate;

            // Ensure that there is a detach key
            var k1 = (System.Windows.Input.Key)cfg.Controls_KB_Detach_MOD;
            var k2 = (System.Windows.Input.Key)cfg.Controls_KB_Detach_KEY;
            var no = System.Windows.Input.Key.None;

            if (k1 == no && k2 == no)
            {
                MessageBox.Show("You cant disable the detach key, reset to default (LeftAlt + C)!");

                cfg.Controls_KB_Detach_MOD = (int)System.Windows.Input.Key.LeftAlt;
                cfg.Controls_KB_Detach_KEY = (int)System.Windows.Input.Key.C;

                Config.Data.Save(GetSelectedProfile() + ".ini", cfg);
            }
            else
            {
                detachKeyCheckup(true);
            }

            // Load detach key
            string kbMod = ((System.Windows.Input.Key)cfg.Controls_KB_Detach_MOD).ToString();

            kbMod = (kbMod == "None" ? "" : $"{kbMod} +");

            string kbKey = ((System.Windows.Input.Key)cfg.Controls_KB_Detach_KEY).ToString();

            settings_DetachKey.Text = $"On/Off Key: {kbMod} {kbKey}";

            // Display our current file and active files
            file_Editing.Text = "Editing: " + GetSelectedProfile();
            file_Active.Text  = "Active Preset: " + Program.ActiveConfig.Name;

            editor_InputKeyboard.Enabled = true;

            originalName = cfg.Name;

            // Load our application settings
            settings_LockEscape.Checked = cfg.Application_LockEscape;
            settings_ShowCursor.Checked = cfg.Application_ShowCursor;

            // Load our mouse engine
            LoadMouseEngineSettings();

            // Setup our sticks
            comboBox1.SelectedIndex = (cfg.Mouse_Is_RightStick ? 1 : 0);

            // Enable the tabs
            tabSettings.Enabled = true;
            tabKeyboard.Enabled = true;
            tabMouse.Enabled    = true;

            // Add the tabs if not already added
            if (!TabsAdded)
            {
                TabsAdded = true;

                // Add the tabs as controls
                materialTabControl1.Controls.Add(tabSettings);
                materialTabControl1.Controls.Add(tabKeyboard);
                materialTabControl1.Controls.Add(tabMouse);
                materialTabControl1.Controls.Add(tabPage3);
            }
        }