예제 #1
0
        public static async Task AutoUpdateFromNetToLocalConfig()
        {
            if (!PublicData.isAutoSyncConfig)
            {
                return;
            }
            var    today          = DateTime.Today;
            string month          = today.Month < 10 ? $"0{today.Month}" : $"{today.Month}";
            string day            = today.Day < 10 ? $"0{today.Day}" : $"{today.Day}";
            string datestring     = $"{today.Year}{month}{day}";
            int    todayDateValue = 0;

            try
            {
                todayDateValue = int.Parse(datestring);
            }
            catch { return; }
            var sets      = new SavingManager();
            int dateSaved = Setting.dateConfigUpdate.Get(sets).ValueInt;

            if (isUseCustomRootPath)
            {
                if (todayDateValue > dateSaved)
                {
                    if (Form1.CountSuccess > 9)
                    {
                        await UpdateFromNetToLocalConfig();

                        sets.Key(Setting.dateConfigUpdate).ValueInt = todayDateValue;
                        sets.Save();
                    }
                }
            }
        }
예제 #2
0
 public void buyEmojiCrush()
 {
     SavingManager.PersistantData.Coins           -= 10;
     SavingManager.PersistantData.EmojiCrushOwned += 1;
     checkPrices();
     SavingManager.Save();
 }
예제 #3
0
        private void Save()
        {
            if (numericUpDown1.Text != "")
            {
                int size = Convert.ToInt32(numericUpDown1.Text);
                mainForm.changeFontListView(size);

                var set = new SavingManager();
                set.Key(Setting.FontListView).ValueInt = size;
                set.Key(Setting.FileEndProg).Value     = "." + textBoxFileEnd.Text.Trim(' ', '.', '"');
                set.Save();
            }

            IniFile ini = new IniFile(PublicData.configFile);

            if (txtConfigPath.Text.Length == 0)
            {
                ini.RemoveSection(PublicData.configSection);
                PublicData.CustomRootPath = null;
            }
            string oldPath = PublicData.ReadFromFileRootPath();

            if (oldPath == null)
            {
                oldPath = "";
            }
            if (ini.ForceRenameKey(PublicData.configSection, oldPath, txtConfigPath.Text))
            {
                PublicData.CustomRootPath = txtConfigPath.Text;
            }
            ini.SaveShowMessage();
        }
예제 #4
0
        private void btnCreateWBFile_Click(object sender, EventArgs e)
        {
            string fileEnd  = new SavingManager().Key(Setting.FileEndOptions).Value;
            string fileName = "WBSettings" + fileEnd;
            string fullPath = Path.Combine(PublicData.FolderConfigPath, fileName);

            try
            {
                File.CreateText(fullPath).Close();
            }
            catch (Exception ex)
            {
                PublicData.ShowMessage(ex, "Ошибка. Не удалось создать файл.");
                return;
            }
            try
            {
                var set = new SavingManager(Where.custom, fullPath, "WBSettings");
                set.Key(Setting.CoolX);
                set.Key(Setting.CoolY);
                set.Key(Setting.StandartX);
                set.Key(Setting.StandartY);
                set.Key(Setting.WarmX);
                set.Key(Setting.WarmY);
                set.Key(Setting.ToleranceXY);
                set.Key(Setting.Average);
                set.Key(Setting.Green128Below);
                set.Save();
                Process.Start(fullPath);
            }
            catch (Exception ex)
            {
                PublicData.ShowMessage(ex, "Ошибка. Не удалось открыть файл.");
            }
        }
예제 #5
0
 public void buyAutoCorrect()
 {
     SavingManager.PersistantData.Coins             -= 100;
     SavingManager.PersistantData.AutoCorrectsOwned += 1;
     checkPrices();
     SavingManager.Save();
 }
예제 #6
0
    public void EmojiCrushActivate(GameObject g)
    {
        Match m = new Match();

        m.objectJoinedTogether.Add(g.GetComponent <TileController>().location);
        DeleteTiles(new List <Match>()
        {
            m
        });
        GameUI.EmojiCrushActivated = false;
        SavingManager.Save();
    }
 private void SetHeadline()
 {
     Ex.Log("MainWindow.SetHeadline()");
     try
     {
         var local = new SavingManager(Where.local);
         label1.Content = local.Key(Setting.HeadlineLauncherText).Value;
         local.Save();
     }
     catch (Exception ex)
     {
         ex.Log("Error at SetHeadline()");
     }
 }
예제 #8
0
        void SaveSettings()
        {
            var setting = new SavingManager();

            setting.Key(Setting.Split1).ValueInt = splitContainer1.SplitterDistance;
            setting.Key(Setting.Split3).ValueInt = splitContainer3.SplitterDistance;
            setting.Key(Setting.Split4).ValueInt = splitContainer4.SplitterDistance;

            setting.Key(Setting.FormSizeX).ValueInt     = this.Size.Width;
            setting.Key(Setting.FormSizeY).ValueInt     = this.Size.Height;
            setting.Key(Setting.FormLocationX).ValueInt = this.Location.X;
            setting.Key(Setting.FormLocationY).ValueInt = this.Location.Y;

            setting.Save();
        }
예제 #9
0
파일: OkayButton.cs 프로젝트: AlliHax/QMH
 void OnMouseDown()
 {
     soundEffectSource.clip = buttonPushedSound;
     soundEffectSource.Play();
     managerControllerScript.showOverview = false;
     managerControllerScript.groundedWindow.SetActive(false);
     managerControllerScript.groundedTitleText.SetActive(false);
     managerControllerScript.groundedDescriptionText.SetActive(false);
     managerControllerScript.grounded        = false;
     managerControllerScript.showPlayerStats = true;
     Camera.main.transform.position          = cameraLocation.position;
     managerControllerScript.showMainHud     = true;
     managerControllerScript.earnedAllowance = 0;
     managerControllerScript.choresCompleted = 0;
     savingManagerScript.Save();
 }
예제 #10
0
        private void LaunchPorgram()
        {
            IniFile ini     = new IniFile(pathconfig.GetFilePath(listView1.FocusedItem.Text));
            var     section = ini.GetSection("exe");

            if (section != null)
            {
                foreach (IniFile.IniSection.IniKey fileName in section.Keys)
                {
                    try
                    {
                        System.Diagnostics.Process.Start(fileName.Name);
                    }
                    catch (Exception ex1)
                    {
                        var local = Path.Combine(Environment.CurrentDirectory, fileName.Name);
                        try
                        {
                            System.Diagnostics.Process.Start(local);
                        }
                        catch (Exception ex2)
                        {
                            Ex.Show($"{ex1.Message}:\n{fileName.Name}\n\n{ex2.Message}:\n{local}");
                        }
                    }
                    break;
                }
                this.Close();
                return;
            }

            PublicData.operation        = listView1.FocusedItem.Text;
            PublicData.fileOperation    = pathconfig.GetFilePath(listView1.FocusedItem.Text);
            PublicData.cancelLaunch     = false;
            PublicData.DisplayModel     = pathconfig.displayPathParts;
            PublicData.model            = (PublicData.DisplayModel.Length > 0) ? PublicData.DisplayModel[0] : PublicData.operation;
            PublicData.FolderConfigPath = pathconfig.FullPath;

            var set = new SavingManager();

            set.Key(Setting.LastTVSelection).Value = String.Join("©", pathconfig.displayPathParts) + "©" + PublicData.operation;
            set.Save();

            this.Close();
        }
예제 #11
0
 public void PowerUp1()
 {
     Shop.SetActive(false);
     Power_Up1.SetActive(false);
     PauseMenu.SetActive(false);
     Power_Up2.SetActive(false);
     SavingManager.PersistantData.AutoCorrectsOwned -= 1;
     powerUp1Ammount.text = SavingManager.PersistantData.AutoCorrectsOwned.ToString();
     if (SavingManager.PersistantData.AutoCorrectsOwned == 0)
     {
         Power_Up1.GetComponent <Button>().interactable = false;
     }
     else
     {
         Power_Up1.GetComponent <Button>().interactable = true;
     }
     SavingManager.Save();
     Back();
 }
예제 #12
0
        private static void WarningSwipe()
        {
            Ex.Log("SystemManager.WarningSwipe()");
            StringBuilder msg = new StringBuilder("ВНИМАНИЕ! Не отключены свайпы границ экрана в Windows, что нарушает безопасность.\n\n");

            msg.AppendLine("Воспользуйтесь TuningGameStand.exe от имени администратора для отключения свайпов.\n");
            msg.AppendLine("Для отключения этого сообщения (не рекомендуется) в файле settings.ini выставьте параметр DisableSwipeWarning=1.\n");
            OnSwipesEnabledWarning += () => Ex.Show(msg.ToString());

            RegPath.ReadSwipeEdgeMachine();
            var  set            = new SavingManager(Where.local);
            bool isForceDisable = set.Key(Setting.DisableSwipeWarning).ValueBool;

            set.Save();
            if (RegPath.isDisabledSwipes == false && isForceDisable == false)
            {
                Ex.Log("SystemManager.OnSwipesEnabledWarning()");
                OnSwipesEnabledWarning();
            }
        }
예제 #13
0
        private void CloseAndSave()
        {
            buttonOk.Enabled = false;

            #region old
            //SetPorts(comboBox2.Text, comboBox2.Text, comboBox3.Text, comboBox4.Text);
            PublicData.isPort1     = portBox1.Checked;
            PublicData.isPort2     = portBox2.Checked;
            PublicData.FixOpenPort = checkBoxFixOpen.Checked;
            PublicData.isAutoStart = checkBoxAutoStart.Checked;
            PublicData.port1_rate  = comboBoxBaudrate1.Text;
            PublicData.port2_rate  = comboBoxBaudrate2.Text;
            PublicData.port1Name   = comboBoxPort1.Text;
            PublicData.port2Name   = comboBoxPort2.Text;
            PublicData.placeNumber = textBoxPlaceNumber.Text;

            mainForm.SetPorts(comboBoxPort1.Text, comboBoxPort2.Text,
                              comboBoxBaudrate1.Text, comboBoxBaudrate2.Text);

            string on1, on2, fixon, auto, minolta;
            on1     = PublicData.isPort1 ? "1" : "0";
            on2     = PublicData.isPort2 ? "1" : "0";
            fixon   = PublicData.FixOpenPort ? "1" : "0";
            auto    = PublicData.isAutoStart ? "1" : "0";
            minolta = PublicData.isConnectedMinolta ? "1" : "0";

            IniFile ini = new IniFile("com_settings.ini");
            ini.SetKeyValue("ports", "port1_name", comboBoxPort1.Text);
            ini.SetKeyValue("ports", "port2_name", comboBoxPort2.Text);
            ini.SetKeyValue("ports", "port1_enable", on1);
            ini.SetKeyValue("ports", "port2_enable", on2);
            ini.SetKeyValue("ports", "port1_rate", comboBoxBaudrate1.Text);
            ini.SetKeyValue("ports", "port2_rate", comboBoxBaudrate2.Text);
            ini.SetKeyValue("ports", "FixOpenPort", fixon);
            ini.SetKeyValue("ports", "AutoStart", auto);
            ini.SetKeyValue("ports", "PlaceNumber", textBoxPlaceNumber.Text);
            ini.SaveShowMessage("com_settings.ini");

            ini = new IniFile(PublicData.configFile);
            ini.ForceRenameKey("brak", FormScaner.GetPathRejectFromFile(), txtRejectPath.Text);
            if (txtRejectPath.Text.Length == 0)
            {
                ini.RemoveSection("brak");
            }
            if (txtConfigPath.Text.Length == 0)
            {
                ini.RemoveSection(PublicData.configSection);
                PublicData.CustomRootPath = null;
            }
            string oldPath = PublicData.ReadFromFileRootPath();
            if (oldPath == null)
            {
                oldPath = "";
            }
            if (ini.ForceRenameKey(PublicData.configSection, oldPath, txtConfigPath.Text))
            {
                PublicData.CustomRootPath = txtConfigPath.Text;
            }
            ini.SaveShowMessage();
            #endregion

            var set = new SavingManager();
            set.Key(Setting.FileEndOptions).Value = "." + textBoxFileEnd.Text.Trim(' ', '.', '"');
            set.Save();

            var local = new SavingManager(Where.local);
            PublicData.LogsCheckPassPath = txtCheckpassLogsPath.Text;
            PublicData.LogsWBPath        = txtWBLogsPath.Text;
            local.Key(Setting.LogsCheckPassPath).Value = PublicData.LogsCheckPassPath;
            local.Key(Setting.LogsWBPath).Value        = PublicData.LogsWBPath;
            Ex.isAutonomMode = checkBoxAutonomMode.Checked;
            local.Key(Setting.isAutonomMode).ValueBool       = Ex.isAutonomMode;
            PublicData.isUseCustomRootPath                   = checkBoxRootPath.Checked;
            local.Key(Setting.isUseCustomRootPath).ValueBool = PublicData.isUseCustomRootPath;
            PublicData.isAutoSyncConfig = checkBoxAutoSync.Checked;
            local.Key(Setting.isAutoSyncConfig).ValueBool = PublicData.isAutoSyncConfig;
            local.Save();


            var appdata = new SavingManager(Where.user, PublicData.UniqOperationPath);
            appdata.Key(Setting.isAutoStart).ValueBool     = checkBoxAutoStart.Checked;
            appdata.Key(Setting.isAutoFirstTest).ValueBool = radioButtonAutoFirstTest.Checked;
            appdata.Key(Setting.timeAfterAutostart).Value  = numericUpDownTimeAfterAutostart.Value.ToString();
            appdata.Save();

            Code.InitializePort1();
            Code.InitializePortGenr();

            PublicData.isAutoStart        = appdata.Key(Setting.isAutoStart).ValueBool;
            PublicData.isAutoFirstTest    = appdata.Key(Setting.isAutoFirstTest).ValueBool;
            PublicData.timeAfterAutostart = appdata.Key(Setting.timeAfterAutostart).ValueInt;


            if (PublicData.FixOpenPort)
            {
                Code.OpenPorts();
            }
            else
            {
                Code.ClosePorts();
            }

            mainForm.stats();
            logger.Debug($"autostart = {PublicData.isAutoStart}");
            if (PublicData.isAutoStart)
            {
                mainForm.AutoStartLauncher().RunParallel();
            }
            this.Close();
        }
 public void Save()
 {
     savingManager.Save();
 }
예제 #15
0
 public void ReturnToMainMenu()
 {
     Time.timeScale = 1;
     SavingManager.Save();
     SceneManager.LoadScene("MainMenu");
 }
예제 #16
0
 /// <summary>
 /// User decides to goback to mainmenu
 /// </summary>
 public void endLevelWithMainMenu()
 {
     SavingManager.Save();
     SceneManager.LoadScene("MainMenu");
 }
예제 #17
0
 /// <summary>
 /// Users decides to replay the level
 /// </summary>
 public void endLevelWithRetry()
 {
     SavingManager.Save();
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
예제 #18
0
 /// <summary>
 /// User decides to continue to the next level
 /// </summary>
 public void endLevelWithNextLevel()
 {
     SavingManager.Save();
     LoadLoadingInfo.currentLevel = LoadLoadingInfo.currentLevel.nextLevel;
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
예제 #19
0
 protected void SaveData()
 {
     SavingManager.Save(_fileName, _data);
 }
예제 #20
0
파일: PlayButton.cs 프로젝트: AlliHax/QMH
 // Update is called once per frame
 void OnMouseDown()
 {
     savingManagerScript.Save();
     managerControllerScript.showStartMenu = false;
     managerControllerScript.BeginGamePlay();
 }