Ejemplo n.º 1
0
        private void DifficultyChanged(object sender, EventArgs e)
        {
            var currentDifficulty = DataCache.Difficulty;

            if (NormalDifficultyRadioButton.Checked)
            {
                DataCache.Difficulty = "normal";
            }
            else if (ExpensiveDifficultyRadioButton.Checked)
            {
                DataCache.Difficulty = "expensive";
            }

            if (currentDifficulty == DataCache.Difficulty)
            {
                return;
            }

            Properties.Settings.Default.FactorioDifficulty = DataCache.Difficulty;
            Properties.Settings.Default.Save();

            JObject savedGraph = JObject.Parse(JsonConvert.SerializeObject(GraphViewer));

            ReloadFactorioData();
            GraphViewer.LoadFromJson(savedGraph);
            UpdateControlValues();
        }
Ejemplo n.º 2
0
        private void EnableDisableButton_Click(object sender, EventArgs e)
        {
            EnableDisableItemsForm form = new EnableDisableItemsForm();

            form.ShowDialog();
            SaveEnabledObjects();

            if (form.ModsChanged)
            {
                GraphViewer.LoadFromJson(JObject.Parse(JsonConvert.SerializeObject(GraphViewer)));
                UpdateControlValues();
            }
        }
Ejemplo n.º 3
0
        private void ModDirectoryButton_Click(object sender, EventArgs e)
        {
            using (DirectoryChooserForm form = new DirectoryChooserForm(Properties.Settings.Default.FactorioModPath))
            {
                form.Text = "Locate the mods directory";
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Properties.Settings.Default["FactorioModPath"] = form.SelectedPath;
                    Properties.Settings.Default.Save();

                    JObject savedGraph = JObject.Parse(JsonConvert.SerializeObject(GraphViewer));
                    ReloadFactorioData();
                    GraphViewer.LoadFromJson(savedGraph);
                    UpdateControlValues();
                }
            }
        }
Ejemplo n.º 4
0
        private void loadGraphButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter          = "JSON Files (*.json)|*.json|All files (*.*)|*.*";
            dialog.CheckFileExists = true;
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                GraphViewer.LoadFromJson(JObject.Parse(File.ReadAllText(dialog.FileName)));
            }
            catch (Exception exception)
            {
                MessageBox.Show("Could not load this file. See log for more details");
                ErrorLogging.LogLine(String.Format("Error loading file '{0}'. Error: '{1}'", dialog.FileName, exception.Message));
            }

            UpdateControlValues();
            GraphViewer.Invalidate();
        }
Ejemplo n.º 5
0
 private void ReloadButton_Click(object sender, EventArgs e)
 {
     GraphViewer.LoadFromJson(JObject.Parse(JsonConvert.SerializeObject(GraphViewer)));
     UpdateControlValues();
 }