• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IniParser.FileIniDataParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FileConfigurationStore

        public FileConfigurationStore(IList<string> filePaths)
        {
            if (filePaths == null ||
                filePaths.Count == 0 ||
                !filePaths.All(c => !String.IsNullOrWhiteSpace(c)))
                throw new ArgumentNullException("filePaths", "The parameter filePaths cannot be empty or contains empty string");

            this.fileIniDataParser = new FileIniDataParser();
            this.fileIniDataParser.Parser.Configuration.CommentString = "#";
            this.filePaths = filePaths;
        }
开发者ID:vihongphuc,项目名称:NLogging_Rollbar,代码行数:11,代码来源:FileConfigurationStore.cs


示例2: GetConnectionString

        public static String GetConnectionString(String AppID)
        {
            FileIniDataParser i = new FileIniDataParser();

            i.Parser.Configuration.CommentString = "#";

            IniData data = i.ReadFile(Settings.Preferences.GetConfig());

            bool decrypt = false;

            if (Convert.ToBoolean(data["HOST"]["Encrypt"]))
            {
                decrypt = true;
            }

            String myConnectionString = "";

            if (decrypt)
            {
                myConnectionString = String.Format("server={0};uid={1}; pwd={2}; port={3}; database={4};",
                    data["HOST"]["IP"], data["HOST"]["User"], MySQLSet.Decrypt(data["HOST"]["Pass"]), data["HOST"]["Port"], data["DS"][AppID]);
            }
            else
            {
                myConnectionString = String.Format("server={0};uid={1}; pwd={2}; port={3}; database={4};",
                    data["HOST"]["IP"], data["HOST"]["User"], data["HOST"]["Pass"], data["HOST"]["Port"], data["DS"][AppID]);
            }

            return myConnectionString;
        }
开发者ID:NiDragon,项目名称:IllTechLibrary,代码行数:30,代码来源:IllSQL.cs


示例3: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            if (!File.Exists("DefaultService.ini") || !File.Exists("service.ini")
                || !File.Exists("version.dat") || !File.Exists("bin/BlackDesert32.exe")
                || !File.Exists("bin64/BlackDesert64.exe")
                )
            {
                MessageBox.Show(@"Invalid Launcher location.", @"Error!");
                Application.Exit();
                return;
            }

            var parser = new FileIniDataParser();
            var data = parser.ReadFile("DefaultService.ini");
            var serverIp1 = data["KR_REAL"]["AUTH_DOMAIN"];

            var data2 = parser.ReadFile("service.ini");
            var serverIp2 = data2["KR"]["AUTHENTIC_DOMAIN"];

            serverIP.Text = serverIp1;
            authip.Text = serverIp2;

            serverIP.ForeColor = serverIp1 == "auth.black.game.daum.net" ? Color.Green : Color.Red;
            authip.ForeColor = serverIp2 == "blackauth.black.game.daum.net" ? Color.Green : Color.Red;
        }
开发者ID:arkanoid1,项目名称:BlackDesert,代码行数:25,代码来源:Form1.cs


示例4: programLoad

        public void programLoad()
        {
            { //load from config file
                FileIniDataParser parser = new FileIniDataParser();
                IniData data = parser.ReadFile("resource/installer.ini");
                {// set logo image
                    var logoPath = data["GLOBAL"]["logo"];
                    string logoClean = String.Format("resource/{0}", logoPath);
                    Console.WriteLine("ini file claims logo image is {0}", logoClean);

                    FileInfo fi = new FileInfo(logoClean);
                    long logoSize = (fi.Length / 1024);
                    Console.WriteLine("Loaded logo ({0}KB)", logoSize);
                    this.logo.ImageLocation = logoClean;
                    fi = null; //destroy FileInfo
                }
                {//figure out what to install
                    var toInstall = data["GLOBAL"]["file"];
                    var where = data["GLOBAL"]["destination"];
                    Console.WriteLine("ini file claims {0} is going to be installed to {1}", toInstall, where);
                }
                {//set readme docs
                    this.readmedocs = new Uri(data["GLOBAL"]["readme"], UriKind.Absolute);
                    Console.WriteLine("ini file claims readme docs are located {0}", this.readmedocs);
                }
                {//set start page text
                    this.startText = data["GLOBAL"]["startpage"].Replace("{break}",Environment.NewLine);
                    Console.WriteLine("loaded start text from ini file");
                }
            }
        }
开发者ID:teh-random-name,项目名称:SCInstaller,代码行数:31,代码来源:bacpro.cs


示例5: Train

        public static void Train()
        {
            FileIniDataParser parser = new FileIniDataParser();
            IniData data = parser.ReadFile("config.ini");
            for (int i = 1; i <= 4; i++)
            {
                string stringPosition = data["barracks"]["barrack" + i];
                Point pointPosition = new Point(Convert.ToInt32(stringPosition.Split(';')[0]), Convert.ToInt32(stringPosition.Split(';')[1]));
                string stringTroop = data["troops"]["barrack" + i];
                int intTroop = Convert.ToInt32(stringTroop);
                if(pointPosition.X != -1 || pointPosition.Y != -1)
                {
                    Home.bsProcess.mouse.SendClick(WButton.Left, pointPosition, false);
                    Thread.Sleep(1000);
                    if (ColorDif.isCorrect(Home.bsProcess.image.GetPixelColor(Buttons.GetPos("5_5", Settings.xDif, Settings.yDif)), Color.FromArgb(112, 140, 176)))
                        Home.bsProcess.mouse.SendClick(WButton.Left, Buttons.GetPos("5_5", Settings.xDif, Settings.yDif), false);
                    else if(ColorDif.isCorrect(Home.bsProcess.image.GetPixelColor(Buttons.GetPos("3_3", Settings.xDif, Settings.yDif)), Color.FromArgb(161, 184, 207)))
                        Home.bsProcess.mouse.SendClick(WButton.Left, Buttons.GetPos("3_3", Settings.xDif, Settings.yDif), false);
                    else
                        Home.bsProcess.mouse.SendClick(WButton.Left, Buttons.GetPos("4_4", Settings.xDif, Settings.yDif), false);

                    Thread.Sleep(1000);
                    while (!SameRGB(Home.bsProcess.image.GetPixelColor(CocFunctions.Buttons.GetPos("troop" + intTroop, Settings.xDif, Settings.yDif))))
                    {
                        Home.bsProcess.mouse.SendClick(WButton.Left, CocFunctions.Buttons.GetPos("troop" + intTroop, Settings.xDif, Settings.yDif), false);
                        Thread.Sleep(100);
                    }
                    Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0,0), false);
                    Thread.Sleep(500);
                }
            }
            Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0, 0), false);
        }
开发者ID:Jeremymav,项目名称:ClashofBots,代码行数:33,代码来源:TrainTroops.cs


示例6: Main

        public static void Main()
        {
            //Create an instance of a ini file parser
            FileIniDataParser fileIniData = new FileIniDataParser();

            if (File.Exists("NewTestIniFile.ini"))
                File.Delete("NewTestIniFile.ini");

            //Parse the ini file
            IniData parsedData = fileIniData.LoadFile("TestIniFile.ini");

            //Write down the contents of the ini file to the console
            Console.WriteLine("---- Printing contents of the INI file ----\n");
            Console.WriteLine(parsedData.ToString());

            //Get concrete data from the ini file
            Console.WriteLine("---- Printing contents concrete data from the INI file ----");
            Console.WriteLine("setMaxErrors = " + parsedData["GeneralConfiguration"]["setMaxErrors"]);
            Console.WriteLine();

            //Modify the INI contents and save
            Console.WriteLine();
            //Write down the contents of the modified ini file to the console
            Console.WriteLine("---- Printing contents of the new INI file ----\n");
            IniData modifiedParsedData = ModifyINIData(parsedData);
            Console.WriteLine(modifiedParsedData.ToString());

            //Save to a file
            fileIniData.SaveFile("NewTestIniFile.ini", modifiedParsedData);
        }
开发者ID:kzgs,项目名称:ini-parser,代码行数:30,代码来源:Program.cs


示例7: Load

        public static void Load()
        {
            List.Clear();

            foreach (var item in Directory.GetFiles(Global.Folder.Profile, "*.ifp"))
            {
                var parser = new FileIniDataParser();
                IniData data = parser.ReadFile(item);

                var p = new Profile();

                p.File = item;
                p.Info.Format = data["info"]["format"];
                p.Info.Platform = data["info"]["platform"];
                p.Info.Name = data["info"]["name"];
                p.Info.Author = data["info"]["author"];
                p.Info.Web = data["info"]["web"];
                p.Picture.Resolution = data["picture"]["resolution"];
                p.Picture.FrameRate = data["picture"]["framerate"];
                p.Picture.BitDepth = Convert.ToInt32(data["picture"]["bitdepth"]);
                p.Picture.Chroma = Convert.ToInt32(data["picture"]["chroma"]);
                p.Video.Preset = data["video"]["preset"];
                p.Video.Tune = data["video"]["tune"];
                p.Video.Type = Convert.ToInt32(data["video"]["type"]);
                p.Video.Value = data["video"]["value"];
                p.Video.Command = data["video"]["cmd"];
                p.Audio.Encoder = data["audio"]["encoder"];
                p.Audio.BitRate = data["audio"]["bitrate"];
                p.Audio.Freq = data["audio"]["frequency"];
                p.Audio.Chan = data["audio"]["channel"];
                p.Audio.Args = data["audio"]["cmd"];

                List.Add(p);
            }
        }
开发者ID:zeruel11,项目名称:IFME,代码行数:35,代码来源:Profile.cs


示例8: WriteConfig

		/// <summary>
		/// Writes the config data to disk. This method is thread-blocking, and all write operations 
		/// are synchronized via lock(WriteLock).
		/// </summary>
		/// <param name="Parser">The parser dealing with the current data.</param>
		/// <param name="Data">The data which should be written to file.</param>
		private void WriteConfig(FileIniDataParser Parser, IniData Data)
		{
			lock (WriteLock)
			{
				Parser.WriteFile (GetConfigPath (), Data);
			}
		}
开发者ID:furesoft,项目名称:Launchpad,代码行数:13,代码来源:ConfigHandler.cs


示例9: CreateDefault

        public static void CreateDefault()
        {
            //Create ini file
            FileIniDataParser parser = new FileIniDataParser();
            IniData data = new IniData();

            //Add global section
            data.Sections.AddSection("game");

            //Add global settings
            data["game"]["hidemode"] = "1";

            //Add collectors section
            data.Sections.AddSection("collectors");

            //Add collectors locations
            for (int i = 1; i <= 17; i++)
            {
                data["collectors"]["collector" + i] = "-1:-1";
            }

            //Add troops section
            data.Sections.AddSection("troops");

            //Add troops settings
            for (int i = 1; i <= 4; i++)
            {
                data["troops"]["barrack" + i] = "0";
            }

            //Add search section
            data.Sections.AddSection("search");

            //Add search settings
            data["search"]["gold"] = "50000";
            data["search"]["elixir"] = "50000";
            data["search"]["dark"] = "0";
            data["search"]["trophy"] = "0";
            data["search"]["bgold"] = "1";
            data["search"]["belixir"] = "1";
            data["search"]["bdark"] = "0";
            data["search"]["btrophy"] = "0";
            data["search"]["alert"] = "0";

            //Add attack section
            data.Sections.AddSection("attack");

            //Add attack settings
            data["attack"]["topleft"] = "True";
            data["attack"]["topright"] = "True";
            data["attack"]["bottomleft"] = "True";
            data["attack"]["bottomright"] = "True";
            data["attack"]["mode"] = "0";
            data["attack"]["maxtrophy"] = "1000";
            data["attack"]["bmaxtrophy"] = "False";
            data["attack"]["deploytime"] = "75";

            //Save the file
            parser.WriteFile(AppSettings.Cfg.FilePath, data);
        }
开发者ID:Madraka,项目名称:ClashofBots,代码行数:60,代码来源:ConfigFileHelper.cs


示例10: Main

        static void Main(string[] args)
        {
            string server_ini_file = @"Ini\servers.ini";

            C("HTTP Server Starting");

            if (File.Exists(server_ini_file))
            {
                C("Using File {0} for configuration", server_ini_file);

                FileIniDataParser parser = new FileIniDataParser();
                var servers = parser.LoadFile(server_ini_file);

                servers.Sections
                       .ToList()
                       .ForEach(server_config =>
                       {
                           NSServer server = new NSServer(server_config.Keys["listenon"], Int32.Parse(server_config.Keys["port"]), "/");
                           server.CreateHttpServer();
                           C("Starting Server {0} : listening on http://{1}:{2}/", server_config.SectionName, server_config.Keys["listenon"], server_config.Keys["port"]);
                       });
                C("Servers have been started.");
            }

            Console.WriteLine("Waiting...");
            Console.Read();
        }
开发者ID:rexwhitten,项目名称:netspace,代码行数:27,代码来源:Program.cs


示例11: getReports

 List<Report> getReports()
 {
     if (reports == null)
     {
         reports = new List<Report>();
         var dir = new DirectoryInfo(GraphPkgInfo.ReportsDir);
         foreach (var reportDir in dir.GetDirectories())
         {
             // parse the ini and create the report object
             var parser = new FileIniDataParser();
             var infoTxtPath = Path.Combine(reportDir.FullName, "info.txt");
             if (File.Exists(infoTxtPath) == false)
                 continue;
             var infoData = parser.LoadFile(infoTxtPath, relaxedIniRead: true);
             var report = new Report
                 {
                     Key = reportDir.Name,
                     Name = getInfoData(infoData, "Name"),
                     Description = getInfoData(infoData, "Description"),
                     ReportDir = reportDir.FullName
                 };
             report.ThemeFile = getInfoData(infoData, "Theme", report.ThemeFile);
             report.TemplateFile = getInfoData(infoData, "Template", report.TemplateFile);
             report.ScriptFile = getInfoData(infoData, "Script", report.ScriptFile);
             report.TemplateLayoutFile = getInfoData(infoData, "TemplateLayout", report.TemplateLayoutFile);
             reports.Add(report);
         }
     }
     return reports;
 }
开发者ID:jhorback,项目名称:ReportGenerationTest,代码行数:30,代码来源:ReportRepository.cs


示例12: IsTroopsReady

 public static bool IsTroopsReady()
 {
     FileIniDataParser parser = new FileIniDataParser();
     IniData data = parser.ReadFile("config.ini");
     string stringPosition = data["barracks"]["barrack1"];
     Point pointPosition = new Point(Convert.ToInt32(stringPosition.Split(';')[0]), Convert.ToInt32(stringPosition.Split(';')[1]));
     if (pointPosition.X != -1 || pointPosition.Y != -1)
     {
         Home.bsProcess.mouse.SendClick(WButton.Left, pointPosition, false);
         Thread.Sleep(500);
         if (ColorDif.isCorrect(Home.bsProcess.image.GetPixelColor(Buttons.GetPos("5_5", Settings.xDif, Settings.yDif)), Color.FromArgb(112, 140, 176)))
             Home.bsProcess.mouse.SendClick(WButton.Left, Buttons.GetPos("5_5", Settings.xDif, Settings.yDif), false);
         else
             Home.bsProcess.mouse.SendClick(WButton.Left, Buttons.GetPos("4_4", Settings.xDif, Settings.yDif), false);
         Thread.Sleep(500);
         if (ColorDif.isCorrect(Home.bsProcess.image.GetPixelColor(Buttons.GetPos("troop_ready", Settings.xDif, Settings.yDif)), Color.FromArgb(216, 72, 81)))
         {
             Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0, 0), false);
             Thread.Sleep(500);
             Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0, 0), false);
             return true;
         }
     }
     Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0, 0), false);
     Thread.Sleep(500);
     Home.bsProcess.mouse.SendClick(WButton.Left, new Point(0, 0), false);
     return false;
 }
开发者ID:Jeremymav,项目名称:ClashofBots,代码行数:28,代码来源:TrainTroops.cs


示例13: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Reading Generation Info File \n");
            FileIniDataParser parser = new FileIniDataParser();
            IniData genData = parser.LoadFile("generation.ini");

            Console.WriteLine("Generation Info File Read \n");
            foreach (SectionData genSection in genData.Sections)
            {
                Console.WriteLine(String.Format("Analyzing {0} \n", genSection.SectionName));
                Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
                GenerationInfo info = new GenerationInfo();
                info.CompanyName = genSection.Keys["companyname"].Replace(";", "");
                info.DataNameSpace = genSection.Keys["datanamespace"].Replace(";", "");
                info.FolderPath = genSection.Keys["path"].Replace(";", "");
                info.ServerName = genSection.Keys["server"].Replace(";", "");
                info.DataBase = genSection.Keys["database"].Replace(";", "");
                MGenerator.Tools.Generator.GenerateFromDatabase(info);
                Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
                Console.WriteLine(String.Format("done  \n", genSection.SectionName));
                Console.WriteLine(String.Format("=============================================== \n", genSection.SectionName));
            }

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
开发者ID:rexwhitten,项目名称:MGenerator,代码行数:26,代码来源:Program.cs


示例14: Issue11_Tests

        public void Issue11_Tests()
        {
            FileIniDataParser parser = new FileIniDataParser();

            IniData parsedData = parser.LoadFile("Issue11_example.ini",true);

            Assert.That(parsedData.Global[".reg (Win)"], Is.EqualTo("notepad.exe"));
        }
开发者ID:vanan08,项目名称:ini-parser,代码行数:8,代码来源:Issues_Tests.cs


示例15: Display

 public static void Display()
 {
     foreach (var item in Directory.GetFiles(Global.Folder.Language, "*.ini"))
     {
         var data = new FileIniDataParser().ReadFile(item, Encoding.UTF8);
         Lists.Add(new Language() { Code = data["info"]["Code"], Name = data["info"]["Name"] });
     }
 }
开发者ID:kyborek,项目名称:IFME,代码行数:8,代码来源:Language.cs


示例16: allow_duplicated_sections

        public void allow_duplicated_sections()
        {
            FileIniDataParser parser = new FileIniDataParser();

            IniData parsedData = parser.LoadFile("Issue11_example.ini");

            Assert.That(parsedData.Global[".reg (Win)"], Is.EqualTo("notepad.exe"));
        }
开发者ID:rickyah,项目名称:ini-parser,代码行数:8,代码来源:FileIniDataParserTests.cs


示例17: Config

 private Config(string path)
 {
     FilePath = path;
     FileHandler = new FileIniDataParser();
     ConfigHandler = FileHandler.LoadFile(path);
     //Fill Dictionary
     ReplacingData.Add("$(root)",Global.AppDir);
 }
开发者ID:andrusender,项目名称:YesPos,代码行数:8,代码来源:Ini.cs


示例18: main

        public main()
        {
            IniParser.FileIniDataParser parser = new FileIniDataParser();
            IniData parsedData = parser.LoadFile("setting/ui-setting.ini");
            rubyPath = parsedData["PATH"]["ruby"];
            compassPath = parsedData["PATH"]["compass"];
            dirListPath = parsedData["PATH"]["dirlist"];
            frameworkPath = parsedData["PATH"]["framework"];
            ///

            components = new System.ComponentModel.Container();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.menuItem0 = new System.Windows.Forms.MenuItem();
            this.menuItem1 = new System.Windows.Forms.MenuItem();

            // Initialize contextMenu1
            this.contextMenu1.MenuItems.AddRange(
                        new System.Windows.Forms.MenuItem[] { this.menuItem0,this.menuItem1 });

            // Initialize menuItem1
            this.menuItem1.Index = 1;
            this.menuItem1.Text = "E&xit";
            this.menuItem1.Click += new System.EventHandler(this.exitWindowHander);

            this.menuItem0.Index = 0;
            this.menuItem0.Text = "H&ide";
            this.menuItem0.Click += new System.EventHandler(this.showWindowHander);
            // Set up how the form should be displayed.
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Text = "Compass Bundle UI";

            // Create the NotifyIcon.
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.

            notifyIcon1.Icon = new Icon(Directory.GetCurrentDirectory()+"/icon/compass_icon.ico");

            // The ContextMenu property sets the menu that will
            // appear when the systray icon is right clicked.
            notifyIcon1.ContextMenu = this.contextMenu1;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon1.Text = "Compass Bundle UI";
            notifyIcon1.Visible = true;

            // Handle the DoubleClick event to activate the form.
            notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
            //MessageBox.Show(compassBatPath);
            InitializeComponent();
            this.loadList();
            this.add2CLI("load the default folder list.");
            this.write2Xml();
            this.initCreateList();
            this.Show();
        }
开发者ID:cokeetang,项目名称:compass-bundle,代码行数:58,代码来源:Form1.cs


示例19: WakaTimeConfigFile

 /// <summary>
 /// Initializes a new instance of the <see cref="MonoDevelop.WakaTime.WakaTimeConfigFile"/> class.
 /// </summary>
 static WakaTimeConfigFile()
 {
     _configParser = new FileIniDataParser();
     _configFilepath = GetConfigFilePath();
     _configData = (File.Exists(_configFilepath))
         ? _configParser.ReadFile(_configFilepath, new UTF8Encoding(false))
         : new IniData();
     Read();
 }
开发者ID:solrevdev,项目名称:monodevelop-wakatime,代码行数:12,代码来源:WakaTimeConfigFile.cs


示例20: check_parse_unicode_chinese_characters

        public void check_parse_unicode_chinese_characters()
        {
            var parser = new FileIniDataParser();
            parser.Parser.Configuration.ThrowExceptionsOnError = true;

            var iniFileData = parser.ReadFile("unicode_chinese.ini");

            // If you want to write the file you must specify the encoding
            //parser.WriteFile("unicode_chinese_copy.ini", iniFileData, Encoding.UTF8);
        }
开发者ID:rickyah,项目名称:ini-parser,代码行数:10,代码来源:FileIniDataParserTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Authentication.AccountInfo类代码示例发布时间:2022-05-26
下一篇:
C# Common.RelayCommand类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap