Exemplo n.º 1
0
        public static void Save()
        {
            INI_Reader Inisettings = new INI_Reader("Data/settings.ini");

            if (Initialized)
            {
                Inisettings.DeleteKey("Location", "Settings");
                Inisettings.Write("Location", Location, "Settings");

                Inisettings.DeleteKey("TempunitF", "Settings");
                Inisettings.Write("TempunitF", Temp_Unit_F.ToString(), "Settings");

                Inisettings.DeleteKey("RefreshInterval", "Settings");
                Inisettings.Write("RefreshInterval", RefreshInterval.ToString(), "Settings");

                if (NameSet)
                {
                    Inisettings.DeleteKey("Name", "Settings");
                    Inisettings.Write("Name", Name, "Settings");
                }
            }
            else
            {
                Console.WriteLine("Error");
            }
        }
Exemplo n.º 2
0
        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);
                }
            }
        }