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


C# IniFile类代码示例

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


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

示例1: 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

示例2: LoadRules

		public override void LoadRules(IniFile.IniSection rules) {
			base.LoadRules(rules);

            WeaponType = rules.ReadEnum<WeaponType>("WeaponType", null);
			Action = rules.ReadEnum<Action>("Action", Action.MultiMissile);
			IsPowered = rules.ReadBool("IsPowered", true);
			DisableableFromShell = rules.ReadBool("DisableableFromShell");
			SidebarFlashTabFrames = rules.ReadInt("SidebarFlashTabFrames", -1);
			AIDefendAgainst = rules.ReadBool("AIDefendAgainst");
			PreClick = rules.ReadBool("PreClick");
			PostClick = rules.ReadBool("PostClick");
			ShowTimer = rules.ReadBool("ShowTimer");
			SpecialSound = Get<Sound>(rules.ReadString("SpecialSound"));
			StartSound = Get<Sound>(rules.ReadString("StartSound"));
			Range = rules.ReadFloat("Range", 0);
			LineMultiplier = rules.ReadInt("LineMultiplier", 0);
			Type = rules.ReadEnum<AbstractType>("Type", null);
			PreDependent = rules.ReadEnum<WeaponType>("PreDependent", null);
			AuxBuilding = Get<BuildingType>(rules.ReadString("AuxBuilding"));
			UseChargeDrain = rules.ReadBool("UseChargeDrain");
			ManualControl = rules.ReadBool("ManualControl");
			RechargeTime = rules.ReadFloat("RechargeTime", 5.0f);
			SidebarImage = rules.ReadString("SidebarImage", "");

		}
开发者ID:dkeetonx,项目名称:ccmaps-net,代码行数:25,代码来源:SuperWeaponType.cs

示例3: Save

        public void Save(CommandSet commandSet, string filename, bool buildComment = false)
        {
            var file = new IniFile();
            var isFirst = true;

            foreach (var setting in commandSet.Settings)
            {
                var seciontName = SectionSettingMap.GetSectionName(setting.GetType());
                if (!string.IsNullOrEmpty(setting.Id))
                {
                    seciontName = seciontName + "_" + setting.Id;
                }
                var section = file.Section(seciontName);
                if (buildComment)
                {
                    if (isFirst)
                    {
                        section.Comment = BuildFileHeaderDescription();
                        isFirst = false;
                    }

                    var cus = setting.GetType().GetCustomAttributes(typeof(DescriptionAttribute), true);
                    if (cus.Length > 0)
                    {
                        section.Comment += ((DescriptionAttribute)cus[0]).Description.Replace("\r\n", "\r\n#");
                    }
                }
                SetToSection(section, setting, buildComment);
            }

            file.Save(filename);
        }
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:32,代码来源:SettingManager.cs

示例4: btnOk_Click

 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     if (!this.tbCardPath.Text.IsEmpty())
     {
         if (this.lvMemCards.SelectedItems.Count == 0)
         {
             Tools.ShowMessage("You must select a card to assign", MessageType.Error);
         }
         else
         {
             this.pcsx2_ui.Write("Folders", "UseDefaultMemoryCards", "disabled");
             string iNIPath = UserSettings.ConfigDir + @"\" + this.g.FileSafeTitle + @"\PCSX2_ui.ini";
             MemoryCard selectedItem = (MemoryCard) this.lvMemCards.SelectedItem;
             IniFile file = new IniFile(iNIPath);
             file.Write("MemoryCards", "Slot1_Enable", "enabled");
             file.Write("MemoryCards", "Slot1_Filename", selectedItem.Name);
             file.Write("Folders", "MemoryCards", this.tbCardPath.Text.Escape());
             Tools.ShowMessage("Successfully assigned and enabled " + selectedItem.Name + " to slot 1\n for the game " + this.g.Title, MessageType.Info);
             base.Close();
         }
     }
     else
     {
         Tools.ShowMessage("The selected memory card cannot be null", MessageType.Error);
     }
 }
开发者ID:CyberFoxHax,项目名称:PCSXBonus,代码行数:26,代码来源:wndMemCard.cs

示例5: getpath

 public static string getpath()
 {
     string str;
     IniFile ini = new IniFile(Application.StartupPath + @"\人员维护.ini");
     str = ini.ReadString("config", "Path");
     return str;
 }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:7,代码来源:Form1.cs

示例6: ItShouldBePosssibleToAddValueWithBuildSpectificationToExistingSection

        public void ItShouldBePosssibleToAddValueWithBuildSpectificationToExistingSection()
        {
            var iniFile = new IniFile(null,null,true);
            var datas = new Dictionary<string, object>
                {
                    {"A","AVAL"},
                    {"B","BVAL{build}"},
                    {"C","CVAL"}
                };
            iniFile.SetValues(datas);
            iniFile.SetValue("E","EVAL",null);
            Assert.AreEqual("AVAL", iniFile.GetValueString("A"));
            Assert.AreEqual("EVAL", iniFile.GetValueString("E"));
            #if DEBUG
            Assert.AreEqual("BVALDebug", iniFile.GetValueString("B", "roOt"));
            #else
            Assert.AreEqual("BVALRelease", iniFile.GetValueString("B", "roOt"));
            #endif
            Assert.AreEqual("CVAL", iniFile.GetValueString("C"));

            iniFile.SetValue("D", "DVAL{build}", "rooT");
            #if DEBUG
            Assert.AreEqual("DVALDebug", iniFile.GetValueString("D", "roOt"));
            #else
            Assert.AreEqual("DVALRelease", iniFile.GetValueString("D", "roOt"));
            #endif
        }
开发者ID:kendarorg,项目名称:ZakFramework,代码行数:27,代码来源:IniFileTest.cs

示例7: ReadSettings

 private void ReadSettings()
 {
     try
     {
         IniFile ini = new IniFile(TargetFile);
         Volume = double.Parse(ini.IniReadValue("config", "Volume"));
         HadithNoLastOpen = int.Parse(ini.IniReadValue("config", "HadithNoLastOpen"));
         ChapterLastOpen = int.Parse(ini.IniReadValue("config", "ChapterLastOpen"));
         PageLastOpen = int.Parse(ini.IniReadValue("config", "PageLastOpen"));
         LanguageLastOpen = int.Parse(ini.IniReadValue("config", "LanguageLastOpen"));
         HadithLastOpen = int.Parse(ini.IniReadValue("config", "HadithLastOpen"));
         UrlRecitation = ini.IniReadValue("config", "UrlRecitation");
         
         isAutoSpeech = bool.Parse(ini.IniReadValue("config", "isAutoSpeech"));
         VerseSize = int.Parse(ini.IniReadValue("config", "VerseSize"));
         //ClickMode = int.Parse(ini.IniReadValue("config", "ClickMode"));
         //PlayMode = int.Parse(ini.IniReadValue("config", "PlayMode"));
         isVoiceEnable = bool.Parse(ini.IniReadValue("config", "isVoiceEnable"));
         isGestureEnable = bool.Parse(ini.IniReadValue("config", "isGestureEnable"));
         isAutoShutdownEnable = bool.Parse(ini.IniReadValue("config", "isAutoShutdownEnable"));
          ShutdownTime = int.Parse(ini.IniReadValue("config", "ShutdownTime"));
         
        
     }
     catch
     {
         throw;
     }
 }
开发者ID:Gravicode,项目名称:Al-Hadith,代码行数:29,代码来源:Konfigurasi.cs

示例8: getpassword

 public static string getpassword()
 {
     string str;
     IniFile ini = new IniFile(Application.StartupPath + @"\模具维修记录配置文件.ini");
     str = ini.ReadString("config", "Password");
     return str;
 }
开发者ID:yangpeiren,项目名称:hello-world,代码行数:7,代码来源:Form2.cs

示例9: Write

 public static void Write(IniFile iniFile, string filename)
 {
     using (StreamWriter streamWriter = new StreamWriter(filename))
     {
         Write(iniFile, streamWriter);
     }
 }
开发者ID:retlaf,项目名称:IniIO,代码行数:7,代码来源:IniWriter.cs

示例10: ScreenshotFormatChange

 public ScreenshotFormatChange(string acRoot, string value) {
     _cfgFile = Path.Combine(FileUtils.GetSystemCfgDirectory(acRoot), "assetto_corsa.ini");
     var iniFile = new IniFile(_cfgFile);
     _originalFormat = iniFile["SCREENSHOT"].GetPossiblyEmpty("FORMAT");
     iniFile["SCREENSHOT"].Set("FORMAT", value);
     iniFile.Save();
 }
开发者ID:gro-ove,项目名称:actools,代码行数:7,代码来源:TemporaryChange.cs

示例11: Core

        static Core()
        {
            string sphereDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                "Sphere Studio");
            string iniPath = Path.Combine(sphereDir, "Settings", "Sphere Studio.ini");
            MainIniFile = new IniFile(iniPath);
            Settings = new CoreSettings(Core.MainIniFile);

            // load plugin modules (user-installed plugins first)
            Plugins = new Dictionary<string, PluginShim>();
            var programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            string[] paths =
            {
                Path.Combine(sphereDir, "Plugins"),
                Path.Combine(programDataPath, "Sphere Studio", "Plugins"),
                Path.Combine(Application.StartupPath, "Plugins"),
            };
            foreach (string path in from path in paths
                where Directory.Exists(path)
                select path)
            {
                DirectoryInfo dir = new DirectoryInfo(path);
                foreach (FileInfo file in dir.GetFiles("*.dll"))
                {
                    string handle = Path.GetFileNameWithoutExtension(file.Name);
                    if (!Plugins.Keys.Contains(handle))  // only the first by that name is used
                        try { Plugins[handle] = new PluginShim(file.FullName, handle); }
                        catch { /* TODO: Log plugin load failure */ }
                }
            }
        }
开发者ID:Radnen,项目名称:spherestudio,代码行数:31,代码来源:Core.cs

示例12: AutoExtractor

        public AutoExtractor(string configPath)
        {
            var iniFile = new IniFile(configPath);

            var configMonitor = new FileSystemWatcher(Path.GetDirectoryName(configPath),Path.GetFileName(configPath));

            var readConfig = FunctionTools.Recreate(() => new
                                                  	{
                                                  		Folders = iniFile["Folders"],
                                                        WinRar = iniFile["WinRar"].First(),
                                                        Extentions = iniFile["Extentions"].FirstOrDefault().With(x => x.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)),
                                                        AutoDelete = iniFile["Options"]["AutoDelete"].With(FunctionTools.ToBoolean)
                                                    });

            configMonitor.Changed += delegate
            {
                Stop();
                iniFile = new IniFile(configPath);
                var newConfig = readConfig();
                Init(newConfig.Folders, newConfig.WinRar, newConfig.Extentions,newConfig.AutoDelete);
                Start();
            };
            var config = readConfig();
            Init(config.Folders, config.WinRar, config.Extentions, config.AutoDelete);
            configMonitor.EnableRaisingEvents = true;
        }
开发者ID:JmAbuDabi,项目名称:auto-extractor-net,代码行数:26,代码来源:AutoExtractor.cs

示例13: InstallModule

        private static bool InstallModule() {
            try {
                var ini = new IniFile(Path.Combine(FileUtils.GetDocumentsCfgDirectory(), "launcher.ini"));
                var theme = ini["WINDOW"].GetNonEmpty("theme");
                var directory = Path.Combine(AcRootDirectory.Instance.RequireValue, @"launcher", @"themes", theme ?? @"default", @"modules", ModuleId);

                var installed = false;
                if (!Directory.Exists(directory)) {
                    Directory.CreateDirectory(directory);

                    using (var stream = new MemoryStream(BinaryResources.ModuleCmHelper))
                    using (var archive = new ZipArchive(stream)) {
                        archive.ExtractToDirectory(directory);
                    }

                    installed = true;
                }

                var active = ini["MODULES"].GetStrings("ACTIVE");
                if (!active.Contains(ModuleId)) {
                    ini["MODULES"].Set("ACTIVE", active.Append(@"CmHelper").Distinct());
                    ini.Save();
                    installed = true;
                }

                return installed;
            } catch (Exception e) {
                throw new InformativeException("Can’t install UI module", e);
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:30,代码来源:ModuleStarter.cs

示例14: Initialize

 protected override void Initialize()
 {
     config = new IniFile("Content\\Config\\config.ini");
     config.parse();
     constants = new IniFile("Content\\Config\\constants.ini");
     constants.parse();
     audioList = new IniFile("Content\\Config\\audiolist.ini");
     audioList.parse();
     lighting = new IniFile("Content\\Config\\lighting.ini");
     lighting.parse();
     this.IsMouseVisible = bool.Parse(config.getValue("General", "ShowMouse"));
     audioManager = new AudioManager(Content, this);
     displayModes = new LinkedList<DisplayMode>();
     foreach (DisplayMode dm in this.GraphicsDevice.Adapter.SupportedDisplayModes)
     {
         if (dm.Format == SurfaceFormat.Color && dm.AspectRatio > 1.7f && dm.AspectRatio < 2f)
         {
             displayModes.AddLast(dm);
         }
     }
     Resolution.Init(ref graphics);
     Resolution.SetVirtualResolution(Constants.RESOLUTION_VIRTUAL_WIDTH, Constants.RESOLUTION_VIRTUAL_HEIGHT);
     Resolution.SetResolution(
         int.Parse(config.getValue("Video", "Width")),
         int.Parse(config.getValue("Video", "Height")),
         bool.Parse(config.getValue("Video", "Fullscreen"))
         );
     base.Initialize();
 }
开发者ID:rodstrom,项目名称:soul,代码行数:29,代码来源:Soul.cs

示例15: Create

        private static void Create()
        {
            // Create new file with a default formatting.
            IniFile file = new IniFile(new IniOptions());

            // Add new content.
            IniSection section = new IniSection(file, IniSection.GlobalSectionName);
            IniKey key = new IniKey(file, "Key 1", "Value 1");
            file.Sections.Add(section);
            section.Keys.Add(key);

            // Add new content.
            file.Sections.Add("Section 2").Keys.Add("Key 2", "Value 2");
            
            // Add new content.
            file.Sections.Add(
                new IniSection(file, "Section 3",
                    new IniKey(file, "Key 3.1", "Value 3.1"),
                    new IniKey(file, "Key 3.2", "Value 3.2")));

            // Add new content.
            file.Sections.Add(
                new IniSection(file, "Section 4",
                    new Dictionary<string, string>()
                    {
                        {"Key 4.1", "Value 4.1"},
                        {"Key 4.2", "Value 4.2"}
                    }));
        }
开发者ID:javadib,项目名称:MadMilkman.Ini,代码行数:29,代码来源:IniSamples.cs


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