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


C# IniFile.GetKeyValue方法代码示例

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


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

示例1: ReadIni

        private void ReadIni(string iniFile)
        {
            if (String.IsNullOrEmpty(iniFile))
            {
                iniFile = "fnrouter.ini";
            }

            if (!File.Exists(iniFile)) return;
            IniFile ini = new IniFile();
            ini.Load(iniFile);
            // Чтение настроек почты
            MailSrv.MailSrv = ini.GetKeyValue("Mail", "MailSrv");
            MailSrv.MailUser = ini.GetKeyValue("Mail", "MailUser");
            MailSrv.MailPass = ini.GetKeyValue("Mail", "MailPass");
            MailSrv.SetPort(ini.GetKeyValue("Mail", "MailPort"));
            MailSrv.MailFrom = ini.GetKeyValue("Mail", "MailFrom");

            MailToErrors = ini.GetKeyValue("Mail", "MailToErrors");

            // Чтение переменных
            IniFile.IniSection OptSect = ini.GetSection("Vars");

            if (OptSect == null) return;
            foreach (IniFile.IniSection.IniKey k in OptSect.Keys)
            {
                Options.Add(k.Name, k.Value);
            }

            ExpandOptions();
        }
开发者ID:partizand,项目名称:fnrouter,代码行数:30,代码来源:Params.cs

示例2: GetSingleGameStats

        /// <summary>
        /// Returns the 4 values from the ini for the game sent to this
        /// times played, last time played , average, total time
        /// </summary>
        /// <param name="systemName"></param>
        /// <param name="romName"></param>
        /// <returns></returns>
        public void GetSingleGameStats(DatabaseGame game)
        {
            IniFile ini = new IniFile();
            ini.Load(RLPath + "\\Data\\Statistics\\" + SystemName + ".ini");
            var i = ini.GetSection(RomName);
            if (i == null)
                return;

            try { TimesPlayed = Convert.ToInt32(ini.GetKeyValue(RomName, "Number_of_Times_Played")); }
            catch (Exception) { }

            try { LastTimePlayed = Convert.ToDateTime(ini.GetKeyValue(RomName, "Last_Time_Played")); }
            catch (Exception) { }

            try
            {
                var avgTime = TimeSpan.Parse(ini.GetKeyValue(RomName, "Average_Time_Played")).Days;
                AvgTimePlayed = new TimeSpan(0, 0, avgTime);
            }
            catch (Exception) { }

            try
            {
                var TotalTime = TimeSpan.Parse(ini.GetKeyValue(RomName, "Total_Time_Played")).Days;
                TotalTimePlayed = new TimeSpan(0, 0, TotalTime);
                TotalOverallTime = TotalOverallTime + TotalTimePlayed;
            }
            catch (Exception)
            {

            }
        }
开发者ID:horseyhorsey,项目名称:HyperMint,代码行数:39,代码来源:Database.cs

示例3: get_Stats

        public List<Statistics> get_Stats(string statFile)
        {
            List<Statistics> statList = new List<Statistics>();

            string sysStatIniName = Path.GetFileNameWithoutExtension(statFile);
            if (sysStatIniName == "desktop" || sysStatIniName == "Global Statistics")
                return statList;

            IniFile ini = new IniFile();
            string[] genStats = { "General", "TopTen_Time_Played", "TopTen_Times_Played", "Top_Ten_Average_Time_Played" };
            ini.Load(statFile);
            int count = ini.Sections.Count;
            string time = "";
            //ini.GetSection(filter);
            foreach (IniFile.IniSection s in ini.Sections)
            {

                string section = s.Name.ToString();
                if (genStats[0] != section)
                    if (genStats[1] != section)
                        if (genStats[2] != section)
                            if (genStats[3] != section)
                            {
                                if (section == "General")
                                {

                                }
                                else
                                {
                                    TimeSpan t = new TimeSpan();
                                    Rom = section;
                                    _systemName = sysStatIniName;
                                    try
                                    {
                                        TimesPlayed = Convert.ToInt32(ini.GetKeyValue(section, "Number_of_Times_Played"));

                                    }
                                    catch (Exception)
                                    {

                                    }

                                    try
                                    {
                                        LastTimePlayed = Convert.ToDateTime(ini.GetKeyValue(section, "Last_Time_Played"));
                                    }
                                    catch (Exception)
                                    {
                                    }
                                    try
                                    {

                                        //AvgTimePlayed = ;
                                        var avgTime = TimeSpan.Parse(ini.GetKeyValue(section, "Average_Time_Played")).Days;
                                        AvgTimePlayed = new TimeSpan(0, 0, avgTime);
                                    }
                                    catch (Exception)
                                    {
                                    }

                                    try
                                    {
                                        var TotalTime = TimeSpan.Parse(ini.GetKeyValue(section, "Total_Time_Played")).Days;

                                        TotalTimePlayed = new TimeSpan(0, 0, TotalTime);
                                        TotalOverallTime = TotalOverallTime + TotalTimePlayed;

                                    }
                                    catch (Exception)
                                    {

                                    }

                                    statList.Add(new Statistics(_systemName, Rom, TimesPlayed, LastTimePlayed, AvgTimePlayed, TotalTimePlayed));
                                }
                            }
            }
            return statList;
        }
开发者ID:horseyhorsey,项目名称:HyperMint,代码行数:79,代码来源:IHyperspinGame.cs

示例4: mainForm_Load

        private void mainForm_Load(object sender, EventArgs e)
        {
            this.Text = "PawnoSharp";

            //Create the ToolTip component not available in the designer.
            ToolTip toolTip1 = new ToolTip();
            toolTip1.AutoPopDelay = 5000;
            toolTip1.InitialDelay = 1000;
            toolTip1.ReshowDelay = 500;
            toolTip1.ShowAlways = true;
            //Create the tooltips for the bar buttons.
            toolTip1.SetToolTip(this.newFileButton, "New File...");
            toolTip1.SetToolTip(this.openFileButton, "Open File...");
            toolTip1.SetToolTip(this.saveFileButton, "Save File");
            toolTip1.SetToolTip(this.compileFileButton, "Compile");

            //Set the scintilla1 RichTextBox margin width to 50 to allow for large line numbers
            //to show properly. (Up to 100,000?)
            scintilla1.Margins[0].Width = 50;

            //Load the application settings!
            IniFile fsINI = new IniFile();

            Uri uri = new Uri(settingsFile);
            fsINI.Load(uri.LocalPath + "\\Settings.ini");

            string fontName = fsINI.GetKeyValue("User", "FontName");
            string fontSize = fsINI.GetKeyValue("User", "FontSize");
            float fontSizeF = 0F;

            string FormW = fsINI.GetKeyValue("Application", "FormW");
            string FormH = fsINI.GetKeyValue("Application", "FormH");
            int FormWI = Convert.ToInt32(FormW);
            int FormHI = Convert.ToInt32(FormH);

            string FormX = fsINI.GetKeyValue("Application", "FormX");
            string FormY = fsINI.GetKeyValue("Application", "FormY");
            int FormXI = Convert.ToInt32(FormX);
            int FormYI = Convert.ToInt32(FormY);

            string FormMaximized = fsINI.GetKeyValue("Application", "Maximized");
            int FormMaximizedI = Convert.ToInt16(FormMaximized);

            string FormFileTitle = fsINI.GetKeyValue("User", "FileInTitle");
            int FormFileTitleI = Convert.ToInt16(FormFileTitle);

            float.TryParse(fontSize, out fontSizeF);

            Point FormPos = new Point();
            FormPos.X = FormXI;
            FormPos.Y = FormYI;

            Size FormSize = new Size();
            FormSize.Width = FormWI;
            FormSize.Height = FormHI;

            //Apply the application settings!
            Font font = new Font(fontName, fontSizeF);
            SetFont(font);
            fontDialog1.Font = font;

            this.Location = FormPos;
            this.Size = FormSize;

            if (FormMaximizedI == 1)
            {
                this.WindowState = FormWindowState.Maximized;
            }
        }
开发者ID:ENGINEERwtf,项目名称:PawnoSharp,代码行数:69,代码来源:Form1.cs

示例5: getSingleGameStats

        /// <summary>
        /// Returns the 4 values from the ini for the game sent to this
        /// times played, last time played , average, total time
        /// </summary>
        /// <param name="systemName"></param>
        /// <param name="romName"></param>
        /// <returns></returns>
        public static List<string> getSingleGameStats(string systemName, string romName)
        {
            IniFile ini = new IniFile();
            ini.Load(StatsPath + "\\" + systemName + ".ini");

            var i = ini.GetSection(romName);
            if (i == null)
                return new List<string>();
            //            List<string> gameStatsList = new List<string>();

            gameStatsList.Add(ini.GetKeyValue(romName, "Number_of_Times_Played"));
            gameStatsList.Add(ini.GetKeyValue(romName, "Last_Time_Played"));
            gameStatsList.Add(ini.GetKeyValue(romName, "Average_Time_Played"));
            gameStatsList.Add(ini.GetKeyValue(romName, "Total_Time_Played"));

            return gameStatsList;
        }
开发者ID:horseyhorsey,项目名称:HyperMint,代码行数:24,代码来源:IHyperspinGame.cs


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