コード例 #1
0
        private void addFactButton_Click(object sender, EventArgs e)
        {
            if (factTypeBox.SelectedIndex == 1)
            {
                if (!uint.TryParse(factEntryBox.Text, out _))
                {
                    MessageBox.Show("Hash must be a valid 32-bit unsigned integer.");
                    return;
                }
                activeSaveFile.AddFactByHash(uint.Parse(factEntryBox.Text), (uint)factValueUpDown.Value);
            }
            else
            {
                var factsList = JsonConvert.DeserializeObject <Dictionary <uint, string> >(CP2077SaveEditor.Properties.Resources.Facts);
                if (!factsList.Values.Contains(factEntryBox.Text))
                {
                    MessageBox.Show("Fact name '" + factEntryBox.Text + "' could not be found on the known facts list.");
                    return;
                }
                activeSaveFile.AddFactByName(factEntryBox.Text, (uint)factValueUpDown.Value);
            }

            callbackFunc("");
            this.Close();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: adupuis2/CyberCAT-SimpleGUI
        public void AddFactCallback(string factEntry, int factType, int factValue)
        {
            if (factType == 0)
            {
                activeSaveFile.AddFactByName(factEntry, (uint)factValue);
            }
            else
            {
                if (!uint.TryParse(factEntry, out _))
                {
                    MessageBox.Show("Hash must be a valid 32-bit unsigned integer.");
                    return;
                }

                activeSaveFile.AddFactByHash(uint.Parse(factEntry), (uint)factValue);
            }
            RefreshFacts();
        }