private void addstatementbtn_Click(object sender, EventArgs e) { string inputtext = inputtxt.Text.ToLower(); string outputtext = outputtxt.Text; if (commandtypecombo.SelectedIndex == 1) { var MyIni = new INI_Reader("Data/humor.ini"); if (!MyIni.KeyExists(inputtext, "Humor")) { MyIni.Write(inputtext + " ", " " + outputtext, "Humor"); MyIni.Write(outputtext + " ", " " + inputtext, "Humor2"); File.AppendAllText("Data/dictionary.txt", Environment.NewLine + inputtext); } } else if (commandtypecombo.SelectedIndex == 0) { var MyIni = new INI_Reader("Data/commands.ini"); if (!MyIni.KeyExists(inputtext, "Commands")) { MyIni.Write(inputtext + " ", " " + outputtext, "Commands"); MyIni.Write(outputtext + " ", " " + inputtext, "Commands2"); File.AppendAllText("Data/dictionary.txt", Environment.NewLine + inputtext); } } }
public bool GetCmdExists(string input) { var MyIni = new INI_Reader("Data/commands.ini"); var answer = MyIni.KeyExists(input, "Commands"); return(answer); }
public static void Initialise() { var Inisettings = new INI_Reader("Data/settings.ini"); if (Inisettings.KeyExists("Name", "Settings")) { NameSet = true; Name = Inisettings.Read("Name", "Settings"); } Location = Inisettings.Read("Location", "Settings"); Temp_Unit_F = Functions.ToBoolean(Inisettings.Read("TempunitF", "Settings")); RefreshInterval = Convert.ToInt32(Inisettings.Read("RefreshInterval", "Settings")); Initialized = true; }