当前位置: 首页>>代码示例>>C#>>正文


C# IniFile.IniWriteValue方法代码示例

本文整理汇总了C#中IniFile.IniWriteValue方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.IniWriteValue方法的具体用法?C# IniFile.IniWriteValue怎么用?C# IniFile.IniWriteValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IniFile的用法示例。


在下文中一共展示了IniFile.IniWriteValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     IniFile loc = new IniFile(Directory.GetCurrentDirectory() + "/Bin/config.ini");
     loc.IniWriteValue("language", "Language", Convert.ToString(comboBox1.SelectedItem));
     loc.IniWriteValue("sound", "Notification", Convert.ToString(checkBox1.Checked));
     loc.IniWriteValue("message", "Time", Convert.ToString(numericUpDown1.Value));
     Application.Restart();
 }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:8,代码来源:Settings.cs

示例2: saveConfig

        /// <summary>
        /// Save the configuration
        /// </summary>
        public static void saveConfig()
        {
            if (File.Exists(confPath))
            {
                File.Delete(confPath);
            }

            IniFile ini = new IniFile(confPath);
            ini.IniWriteValue("main", "url", url);
            ini.IniWriteValue("main", "token", token);
        }
开发者ID:Wolfium,项目名称:gitlab-ci-runner-win,代码行数:14,代码来源:Config.cs

示例3: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            int left = Convert.ToInt32(numericUpDown_left.Value);
            int top = Convert.ToInt32(numericUpDown_top.Value);
            int width = Convert.ToInt32(numericUpDown_right.Value);
            int height = Convert.ToInt32(numericUpDown_bottom.Value);

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini");
            IniFile ini = new IniFile(path);
            ini.IniWriteValue("sel", "left", left.ToString());
            ini.IniWriteValue("sel", "top", top.ToString());
            ini.IniWriteValue("sel", "width", width.ToString());
            ini.IniWriteValue("sel", "height", height.ToString());
        }
开发者ID:momo1122momo1122,项目名称:AutoPick,代码行数:14,代码来源:Form2.cs

示例4: WelcomeWindow_Load

        private void WelcomeWindow_Load(object sender, EventArgs e)
        {

            
            // Regions
            

            if (_forConfig)
            {
                button6.Text = "Close";
                tabControl1.SelectTab(1);
                label4.Text = "Global Settings";
                button6.Click += button6_alternate;
                textBox1.Text = Config.defaultPath;
                Text = "Global / Default Configuration";
                richTextBox2.Text = "Need to change settings, mh? Configurate here the default settings for new bots.";
                string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                specificFolder = Path.Combine(folder, "LoliBot");
                string path = specificFolder;

                string test = System.IO.Path.Combine(path, "version.ini");

                IniFile ini = new IniFile(path + "\\version.ini");
                string ver = "";
                ver = ini.IniReadValue("General", "version");
                if (ver == "")
                {
                    ver = Config.clientSeason + "." + Config.clientSubVersion;
                    ini.IniWriteValue("General", "version", Config.clientSeason + "." + Config.clientSubVersion);
                }
                this.textBox1.Text = ver; 
            }
        }
开发者ID:lolibot,项目名称:LolibotGui-Code,代码行数:33,代码来源:WelcomeWindow.cs

示例5: inicreate

 public static void inicreate()
 {
     //configini = INIDatei(Application.StartupPath + "SM_config.ini");
     IniFile Ini = new IniFile(Application.StartupPath + @"\SM_config.ini");
     Ini.IniWriteValue("path", "login", "location/can/be/setup/with/options.exe");
     Ini.IniWriteValue("path", "char", "location/can/be/setup/with/options.exe");
     Ini.IniWriteValue("path", "map", "location/can/be/setup/with/options.exe");
     Ini.IniWriteValue("color", "usecolor", "true");
     Ini.IniWriteValue("color", "oldrev", "false");
     Ini.IniWriteValue("color", "color-status", "124,252,0");
     Ini.IniWriteValue("color", "color-info", "255,255,255");
     Ini.IniWriteValue("color", "color-notice", "255,255,255");
     Ini.IniWriteValue("color", "color-warning", "255,255,0");
     Ini.IniWriteValue("color", "color-error", "255,0,0");
     Ini.IniWriteValue("color", "color-sql", "208,32,144");
     Ini.IniWriteValue("color", "color-debug", "0,255,255");
     iniread();
 }
开发者ID:Jefte-Netyul,项目名称:rAthena-Server-Monitor,代码行数:18,代码来源:Handler.cs

示例6: CheckAndFixSettings

        private void CheckAndFixSettings()
        {
            IniFile settingsIni = new IniFile(FileNames.SettingsIni);
            if (!int.TryParse(settingsIni.IniReadValue("Profiles", "Active"), out activeProfile))
            {
                new FormProfileCreate().ShowDialog();
                activeProfile = int.Parse(settingsIni.IniReadValue("Profiles", "Active"));
            }

            // if Options doesn't exist, create default
            if (string.IsNullOrEmpty(settingsIni.IniReadValue("Options", "Fullscreen")) ||
                string.IsNullOrEmpty(settingsIni.IniReadValue("Options", "UseGamePad")) ||
                string.IsNullOrEmpty(settingsIni.IniReadValue("Options", "MSAA")))
            {
                settingsIni.IniWriteValue("Options", "Fullscreen", "True");
                settingsIni.IniWriteValue("Options", "MSAA", "4");
                settingsIni.IniWriteValue("Options", "UseGamePad", "False");
            }
        }
开发者ID:rossmas,项目名称:zomination,代码行数:19,代码来源:FormMain.cs

示例7: btn_ok_Click

 private void btn_ok_Click(object sender, EventArgs e)
 {
     frm_main frm = (frm_main)this.Owner;
     IniFile settings = new IniFile(Directory.GetCurrentDirectory() + "\\Settings\\" + frm.current_pos + ".ini");
     settings.IniWriteValue("NFComments", "CheckPrefix1", tb_prefix1.Text);
     settings.IniWriteValue("NFComments", "CheckPrefix2", tb_prefix2.Text);
     settings.IniWriteValue("NFComments", "CheckPrefix3", tb_prefix3.Text);
     settings.IniWriteValue("NFComments", "CheckPrefix4", tb_prefix4.Text);
     settings.IniWriteValue("NFComments", "CheckPrefix5", tb_prefix5.Text);
     settings.IniWriteValue("NFComments", "CheckPrefix6", tb_prefix6.Text);
     settings.IniWriteValue("NFComments", "CheckPostfix1", tb_postfix1.Text);
     settings.IniWriteValue("NFComments", "CheckPostfix2", tb_postfix2.Text);
     this.Close();
 }
开发者ID:sylion,项目名称:SMarketSettings,代码行数:14,代码来源:frm_check_comment.cs

示例8: createver

        public void createver()
        {
            string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            specificFolder = Path.Combine(folder, "LoliBot");
            string path = specificFolder;

            string test = System.IO.Path.Combine(path, "version.ini");

            IniFile ini = new IniFile(path + "\\version.ini");
            if (!System.IO.File.Exists(test))
            {
                ini.IniWriteValue("General", "version", Config.clientSeason+"."+Config.clientSubVersion);
            }
        }
开发者ID:lolibot,项目名称:LolibotGui-Code,代码行数:14,代码来源:VoliBot.cs

示例9: btn_apply_Click

        private void btn_apply_Click(object sender, EventArgs e)
        {
            System.Reflection.Assembly exe = System.Reflection.Assembly.GetEntryAssembly();
            string exePath = System.IO.Path.GetDirectoryName(exe.Location);
            IniFile ini = new IniFile(exePath + "\\settings.ini");

            if (checkBox_autosnap.Checked) ini.IniWriteValue("basic", "AutoSnap", "1");
            else ini.IniWriteValue("basic", "AutoSnap", "0");
            if (checkBox_startmin.Checked) ini.IniWriteValue("basic", "StartMinimized", "1");
            else ini.IniWriteValue("basic", "StartMinimized", "0");
            ini.IniWriteValue("basic", "SnapInterval", numericUpDown_snapint.Value.ToString());
            ini.IniWriteValue("basic", "SavePath", textBox_savepath.Text);
            ini.IniWriteValue("basic", "FileFormat", comboBox_saveformat.SelectedItem.ToString());
            ini.IniWriteValue("basic", "JPGCompress", numericUpDown_jpgcomp.Value.ToString());

            load_settings();
        }
开发者ID:soruly,项目名称:TimeSnap,代码行数:17,代码来源:MainForm.cs

示例10: CreateSettingFile

        private static void CreateSettingFile()
        {
            //Create the settings.ini file, generally used on first-run.
            //This method will run only when specific arguments has been passed to the program.
            IniFile ini = new IniFile(AppDomain.CurrentDomain.BaseDirectory + "settings.ini");

            //Write default values.
            ini.IniWriteValue("Settings", "CheckVersionURL", "http://commondatastorage.googleapis.com/chromium-browser-continuous/Win/LAST_CHANGE");
            ini.IniWriteValue("Settings", "ChromiumDirURL", "http://commondatastorage.googleapis.com/chromium-browser-continuous/Win/");
            ini.IniWriteValue("Settings", "ChromiumZipFileName", "chrome-win32.zip");
            ini.IniWriteValue("Settings", "PathToFileArchiver", @"C:\Program Files\7-Zip\7z.exe");
            ini.IniWriteValue("Settings", "ExtractCommand", @"x chrome-win32.zip");
            ini.IniWriteValue("Chromium", "Version", "0");
            ini.IniWriteValue("Chromium", "Path", @"C:\Program Files (x86)\chrome-win32");
        }
开发者ID:konome,项目名称:UpdateChromium,代码行数:15,代码来源:UpdateChromium.cs

示例11: make_INI

    public static void make_INI(string path)
    {
        if (!File.Exists(path))
        {
            m_path = path;

            //File.Create(path);

            //IniFile ini = new IniFile(path);

            StreamWriter sw = new StreamWriter(path);
            //Client Loading
            sw.WriteLine("[Load]");
            sw.WriteLine("; Handles ");
            sw.WriteLine("Auto_Del=False");
            sw.WriteLine("Auto_kill=False");

            //Client Caching
            sw.WriteLine("");
            sw.WriteLine("[Cache]");
            sw.WriteLine("; Handles Auto saving of product files");
            sw.WriteLine("Auto_Cache=False");

            //Auto Cleaning
            sw.WriteLine("");
            sw.WriteLine("[Auto]");
            sw.WriteLine("; Handles Auto Cleanerto do it or not");
            sw.WriteLine("Auto_Clean=True");
            sw.WriteLine("; Handles Auto Cleaner Stored in days");
            sw.WriteLine("Auto_Clean_Timeout=3");
            sw.WriteLine("Version=1.0");

            //Last Update
            sw.WriteLine("");
            sw.WriteLine("[Update]");
            sw.WriteLine("; Handles last checked update");
            sw.WriteLine("Last_Update=" + DateTime.Now.ToString());

            //Close INI
            sw.Close();
            /*ini.IniWriteValue("[Load]", "Auto_Del", "false");
            ini.IniWriteValue("[Load]", "Auto_Kill", "false");*/
        }
        else
        {
            m_path = path;

            string text = System.IO.File.ReadAllText(path);

            string[] lines =  System.IO.File.ReadAllLines(path);

            ArrayList file = new ArrayList();
            //string file = string.Empty;

            IniFile ini = new IniFile(path);

            if (!text.Contains("[Cache]"))
            {
                StreamWriter sw = new StreamWriter(path);
                foreach(string line in lines)
                    sw.WriteLine(line);
                //Client Caching
                sw.WriteLine("");
                sw.WriteLine("[Cache]");
                sw.WriteLine("; Handles Auto saving of product files");
                sw.WriteLine("Auto_Cache=false");
                sw.Close();
            }

            if (ini.IniReadValue("Auto", "Version") == string.Empty)
            {
                ini.IniWriteValue("Auto", "Version", "1.0");
            }
        }
    }
开发者ID:ToyzStore,项目名称:-ACID-Cache-Cleaner,代码行数:75,代码来源:IniFile.cs

示例12: comboBox1_SelectedIndexChanged

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int lastIndex = checkedListBox1.Items.Count - 1;
            for (int i = lastIndex; i >= 0; i--)
            {
                checkedListBox1.Items.RemoveAt(i);
            }

            if (comboBox1.SelectedItem.ToString() != nw)
            {
                if (File.Exists("Projects//" + comboBox1.SelectedItem + ".fat"))
                {
                    StreamReader SR = new StreamReader("Projects//" + comboBox1.SelectedItem + ".fat");
                    while (SR.EndOfStream == false)
                    {
                        checkedListBox1.Items.Add(SR.ReadLine());
                    }
                    SR.Close();
                }
            }

            label1.Text = "Project: " + Convert.ToString(comboBox1.SelectedItem);

            IniFile loc = new IniFile(Directory.GetCurrentDirectory() + "/Bin/config.ini");
            loc.IniWriteValue("Others", "last", Convert.ToString(comboBox1.SelectedItem));
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:26,代码来源:Main.cs

示例13: createStandardProfile

        public async static Task<Boolean> createStandardProfile(string profileName)
        {
            //Kill OBS so that it does not override our settings again
            OBSUtils.kill();

            //Check for existing profile
            if (File.Exists(getConfigPath() + @"\profiles\" + profileName + ".ini"))
            {
                //Ask to overwrite profile
                var overwrite = await DialogManager.ShowMessageAsync(Hearthstone_Deck_Tracker.API.Core.MainWindow, "Profile does exist", "A profile with the same name does already exist. Overwrite?", MessageDialogStyle.AffirmativeAndNegative);
                if (overwrite == MessageDialogResult.Negative) 
                {
                    return false;
                }
            }
            FileStream fs = File.Create(getConfigPath() + @"\profiles\" + profileName + ".ini");
            StreamWriter sw = new StreamWriter(fs);

            string result = readFromResourceStream("HDT_GameRecorder.Resources.StandardProfile.txt");

            sw.Write(result);

            sw.Close();

            
            IniFile ini = new IniFile(getConfigPath() + @"\profiles\" + profileName + ".ini");

            ini.IniWriteValue("Video", "BaseHeight", Screen.PrimaryScreen.Bounds.Height.ToString());
            ini.IniWriteValue("Video", "BaseWidth", Screen.PrimaryScreen.Bounds.Width.ToString());
            ini.IniWriteValue("Publish", "SavePath", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+ @"\Videos\Recorded\$T.mp4");

            
            ini = new IniFile(getConfigPath() + @"\global.ini");
            ini.IniWriteValue("General", "Profile", profileName);
            await DialogManager.ShowMessageAsync(Hearthstone_Deck_Tracker.API.Core.MainWindow, "Created profile", "Profile creation sucessfull!", MessageDialogStyle.Affirmative);

            return true;
        }
开发者ID:becelot,项目名称:HDT_VideoRecorder,代码行数:38,代码来源:OBSUtils.cs

示例14: ReadSettings

        private void ReadSettings()
        {
            string inifile = Environment.CurrentDirectory + "\\" + iniFile;
            IniFile ini = new IniFile(inifile);
            if (File.Exists(inifile))
            {
                mySqlServer = ini.IniReadValue(iniConnection, "mySqlServer");
                mySqlUser = ini.IniReadValue(iniConnection, "mySqlUser");
                mySqlPassword = ini.IniReadValue(iniConnection, "mySqlPassword");
                mySqlDatabase = ini.IniReadValue(iniConnection, "mySqlDatabase");

                ArchivePath = ini.IniReadValue(iniLifeGame, "ArchivePath");
                WorkingPath = ini.IniReadValue(iniLifeGame, "WorkingPath");
                ResultFilename = ini.IniReadValue(iniLifeGame, "ResultFilename");
                OutputFilename = ini.IniReadValue(iniLifeGame, "OutputFilename");
                try { timeoutInterval = int.Parse(ini.IniReadValue(iniLifeGame, "timeoutInterval")); }
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                MatlabStartPath = ini.IniReadValue(iniLifeGame, "MatlabStartPath");
                MatlabArguments = ini.IniReadValue(iniLifeGame, "MatlabArguments");
                verificationScriptName = ini.IniReadValue(iniLifeGame, "verificationScriptName");
                verificationScriptsZip = ini.IniReadValue(iniLifeGame, "verificationScriptsZip");

                try { taskIDs = Array.ConvertAll(ini.IniReadValue(iniHWServer, "taskIDs").Split(new char[]{','}), s => int.Parse(s.Trim())); }
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { StateNewSubmission = int.Parse(ini.IniReadValue(iniHWServer, "StateNewSubmission"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { StateUnderAutoProcessing = int.Parse(ini.IniReadValue(iniHWServer, "StateUnderAutoProcessing"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { StateProcessingFinished = int.Parse(ini.IniReadValue(iniHWServer, "StateProcessingFinished"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { StateProcessingAborted = int.Parse(ini.IniReadValue(iniHWServer, "StateProcessingAborted"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                SambaFileSharePath = ini.IniReadValue(iniHWServer, "SambaFileSharePath");
                try { checkInterval = int.Parse(ini.IniReadValue(iniHWServer, "checkInterval"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }

                try { verboseLevel = int.Parse(ini.IniReadValue(iniMaintenance, "verboseLevel"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { fileVerboseLevel = int.Parse(ini.IniReadValue(iniMaintenance, "fileVerboseLevel")); }
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                try { debugModeEnabled = bool.Parse(ini.IniReadValue(iniMaintenance, "debugModeEnabled"));}
                catch (Exception ex) { AddLine("Error parsing INI file: " + ex.Message + "\r\n" + ex.StackTrace); }
                LogFilename = ini.IniReadValue(iniMaintenance, "LogFilename");
            }
            else
            {
                ini.IniWriteValue(iniConnection, "mySqlServer",mySqlServer);
                ini.IniWriteValue(iniConnection, "mySqlUser",mySqlUser);
                ini.IniWriteValue(iniConnection, "mySqlPassword",mySqlPassword);
                ini.IniWriteValue(iniConnection, "mySqlDatabase",mySqlDatabase);

                ini.IniWriteValue(iniLifeGame, "ArchivePath",ArchivePath);
                ini.IniWriteValue(iniLifeGame, "WorkingPath",WorkingPath);
                ini.IniWriteValue(iniLifeGame, "ResultFilename",ResultFilename);
                ini.IniWriteValue(iniLifeGame, "OutputFilename",OutputFilename);
                ini.IniWriteValue(iniLifeGame, "timeoutInterval",timeoutInterval.ToString());
                ini.IniWriteValue(iniLifeGame, "MatlabStartPath", MatlabStartPath);
                ini.IniWriteValue(iniLifeGame, "MatlabArguments", MatlabArguments);
                ini.IniWriteValue(iniLifeGame, "verificationScriptName", verificationScriptName);
                ini.IniWriteValue(iniLifeGame, "verificationScriptsZip", verificationScriptsZip);

                ini.IniWriteValue(iniHWServer, "taskIDs",taskIDs.Skip(1).Aggregate(taskIDs[0].ToString(), (s, i) => s + "," + i.ToString()));
                ini.IniWriteValue(iniHWServer, "StateNewSubmission",StateNewSubmission.ToString());
                ini.IniWriteValue(iniHWServer, "StateUnderAutoProcessing",StateUnderAutoProcessing.ToString());
                ini.IniWriteValue(iniHWServer, "StateProcessingFinished",StateProcessingFinished.ToString());
                ini.IniWriteValue(iniHWServer, "StateProcessingAborted",StateProcessingAborted.ToString());
                ini.IniWriteValue(iniHWServer, "SambaFileSharePath",SambaFileSharePath);
                ini.IniWriteValue(iniHWServer, "checkInterval",checkInterval.ToString());

                ini.IniWriteValue(iniMaintenance, "verboseLevel",verboseLevel.ToString());
                ini.IniWriteValue(iniMaintenance, "fileVerboseLevel", fileVerboseLevel.ToString());
                ini.IniWriteValue(iniMaintenance, "debugModeEnabled",debugModeEnabled.ToString());
                ini.IniWriteValue(iniMaintenance, "LogFilename",LogFilename);
            }
        }
开发者ID:hunsteve,项目名称:LifeGameManager,代码行数:75,代码来源:LifeGameManagerForm.cs

示例15: FMainClosed

 //*************************************
 //保存服务参数到配置文件Sysconfig.ini
 //*************************************
 private void FMainClosed(object sender, EventArgs e)
 {
     //保存各项参数到配置文件Sysconfig.ini
     var path = Directory.GetCurrentDirectory();
     path = path + "\\Sysconfig.ini";
     var ini = new IniFile(path);
     ini.IniWriteValue("ServerConfig", "serv_ip", ServIp);
     ini.IniWriteValue("ServerConfig", "connect_time", ConnectTime.ToString(CultureInfo.InvariantCulture));
     ini.IniWriteValue("ServerConfig", "refresh_time", RefreshTime.ToString(CultureInfo.InvariantCulture));
     ini.IniWriteValue("ServerConfig", "serv_port", ServPort.ToString(CultureInfo.InvariantCulture));
     ini.IniWriteValue("ServerConfig", "serv_type", ServType.ToString(CultureInfo.InvariantCulture));
     ini.IniWriteValue("ServerConfig", "serv_mode", ServMode.ToString(CultureInfo.InvariantCulture));
 }
开发者ID:ericzhc,项目名称:gprs-system-tiger,代码行数:16,代码来源:FMain.cs


注:本文中的IniFile.IniWriteValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。