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


C# IniFile.Read方法代码示例

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


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

示例1: Load

        public static void Load()
        {
            if (!new FileInfo(Path).Exists){
                New();
            }

            ConfigurationFile = new IniFile(Path);

            ActivationKey = (Keys)Enum.Parse(typeof(Keys), ConfigurationFile.Read("Activation", "Controls"));
            DeactivationKey = (Keys)Enum.Parse(typeof(Keys), ConfigurationFile.Read("Deactivation", "Controls"));
            RadiusIncreaseKey = (Keys)Enum.Parse(typeof(Keys), ConfigurationFile.Read("RadiusIncrease", "Controls"));
            RadiusDecreaseKey = (Keys)Enum.Parse(typeof(Keys), ConfigurationFile.Read("RadiusDecrease", "Controls"));
        }
开发者ID:zydevs,项目名称:Infection,代码行数:13,代码来源:INiSettings.cs

示例2: Selector

        public Selector()
        {
            IniFile MyIni = new IniFile("Settings.ini");
            string lang = MyIni.Read("Lang");
            if (lang == "en" || lang == "de" || lang == "be" || lang == "cs" || lang == "fa-IR" || lang == "fr" || lang == "hu" || lang == "pt-PT" || lang == "ru" || lang == "uk" || lang == "zh-Hans")
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo(MyIni.Read("Lang"));
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(MyIni.Read("Lang"));
            }
            

            InitializeComponent();
            
        }
开发者ID:lomtest,项目名称:Download-1,代码行数:14,代码来源:Selector.cs

示例3: ReadFallout4PrefIni

        public bool ReadFallout4PrefIni(string s = "none")
        {
            string iniFolfder = GetIniFolder();

            if (File.Exists(iniFolfder + "Fallout4Prefs.ini"))
            {
                if (s == "none")
                {

                    IniFile fallout4Custom = new IniFile(iniFolfder + "Fallout4Prefs.ini");
                    IniFile fallout4ini = new IniFile(iniFolfder + "Fallout4.ini");
                   // ReadCustomValues();
                    for (int i = 0; i < AllFalloutSettings.Count; i++)
                    {
                        if (AllFalloutSettings[i].pref)
                        {
                            if (fallout4Custom.KeyExists(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section))
                            {
                                AllFalloutSettings[i].ChangeValue(fallout4Custom.Read(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section));
                                MainWindow.Console.WriteToConsole("AntiAliasing value " + GlobalVar.sAntiAliasing.VarValue);

                            }
                        }
                        else
                        {
                            if (fallout4ini.KeyExists(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section))
                            {
                                AllFalloutSettings[i].ChangeValue(fallout4ini.Read(AllFalloutSettings[i].VarName, AllFalloutSettings[i].Section));
                                MainWindow.Console.WriteToConsole("AntiAliasing value " + GlobalVar.sAntiAliasing.VarValue);

                            }
                        }
                    }
                }
                else
                {
                    //   GenerateXMLAttributes
                    XmlReader xl = XmlReader.Create(s);

                    XmlSerializer file = new XmlSerializer(typeof(List<AppSettingFormat>), "test");
                    List<AppSettingFormat> FileFalloutSettings = new List<AppSettingFormat>();
                    FileFalloutSettings = (List<AppSettingFormat>)file.Deserialize(xl);
                    for (int i = 0; i < AllFalloutSettings.Count; i++)
                    {
                        AllFalloutSettings[i].ChangeValue(FileFalloutSettings[i].VarValue);
                    }
                    xl.Dispose();
                }

                ReadApplicationIni();
                return true;
            }
            ReadApplicationIni();
            return false;
        }
开发者ID:DelGruth,项目名称:FO4AlternativeLauncher,代码行数:55,代码来源:GlobalVar.cs

示例4: ReadApplicationIni

 public static void ReadApplicationIni()
 {
     IniFile settingFile = new IniFile(AppSettingPath);
     if (settingFile.KeyExists(OpenConsole.VarName, "Main"))
     {
         OpenConsole.VarValue = settingFile.Read(OpenConsole.VarName, OpenConsole.Section);
     }
     if (settingFile.KeyExists("EXEPath", "Main"))
     {
         EXEPath.ChangeValue(settingFile.Read("EXEPath", "Main"));
     }
     else if (MainWindow.exeIndex != -1)
     {
         EXEPath.ChangeValue(MainWindow.PossibleFallout4Paths[MainWindow.exeIndex]);
     }
     else
     {
         try
         {
             EXEPath.ChangeValue(Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\bethesda softworks\Fallout4\").GetValue("Installed Path").ToString() + "Fallout4.exe");
             return;
         }
         catch
         {
             MessageBox.Show("Could not determine path to Fallout4.exe,please set it manually at the launcher tab");
         }
     }
     MainWindow.Console.WriteToConsole("OpenConsoleValue is: " + OpenConsole.VarValue.ToString());
 }
开发者ID:DelGruth,项目名称:FO4AlternativeLauncher,代码行数:29,代码来源:GlobalVar.cs

示例5: LoadIniFile

        public static void LoadIniFile()
        {
            var appIniFile = new IniFile();

            #region Dir Path
            AppInfoStrc.DirOfApplication = Environment.CurrentDirectory;

            AppInfoStrc.DirOfSchedule = appIniFile.Read("DirOfSchedule", "PATH");
            if (AppInfoStrc.DirOfSchedule == "")
            {
                appIniFile.Write("DirOfSchedule", InitValue.InitDirOfSchedule, "PATH");
                AppInfoStrc.DirOfSchedule = InitValue.InitDirOfSchedule;
            }

            AppInfoStrc.DirOfLog = appIniFile.Read("DirOfLog", "PATH");
            if (AppInfoStrc.DirOfLog == "")
            {
                appIniFile.Write("DirOfLog", InitValue.InitDirOfLog, "PATH");
                AppInfoStrc.DirOfLog = InitValue.InitDirOfLog;
            }

            AppInfoStrc.DirOfContents = appIniFile.Read("DirOfContents", "PATH");
            if (AppInfoStrc.DirOfContents == "")
            {
                appIniFile.Write("DirOfContents", InitValue.DirOfContents, "PATH");
                AppInfoStrc.DirOfContents = InitValue.DirOfContents;
            }
            #endregion

            #region Server connectoion Info
            AppInfoStrc.UrlOfServer = appIniFile.Read("UrlOfServer", "SERVER");
            if (AppInfoStrc.UrlOfServer == "")
            {
                appIniFile.Write("UrlOfServer", InitValue.InitUrlOfServer, "SERVER");
                AppInfoStrc.UrlOfServer = InitValue.InitUrlOfServer;
            }

            AppInfoStrc.ExtentionOfServer = appIniFile.Read("ExtentionOfServer", "SERVER");
            if (AppInfoStrc.ExtentionOfServer == "")
            {
                appIniFile.Write("ExtentionOfServer", InitValue.InitExtensionOfServer, "SERVER");
                AppInfoStrc.ExtentionOfServer = InitValue.InitExtensionOfServer;
            }

            AppInfoStrc.PortOfServer = appIniFile.Read("PortOfServer", "SERVER");
            if (AppInfoStrc.PortOfServer == "")
            {
                appIniFile.Write("PortOfServer", InitValue.InitPortOfServer, "SERVER");
                AppInfoStrc.PortOfServer = InitValue.InitPortOfServer;
            }
            #endregion

            #region Player Info
            AppInfoStrc.PlayerId = appIniFile.Read("PlayerID", "PLAYER");
            if (AppInfoStrc.PlayerId == "")
            {
                appIniFile.Write("PlayerID", "", "PLAYER");
            }
            #endregion
        }
开发者ID:Onemann,项目名称:NDS20_WinPlayer,代码行数:60,代码来源:commonFunctions.cs


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