예제 #1
0
파일: DataMap.cs 프로젝트: TrutzX/9Nations
        public IniData Config()
        {
            IniDataParser i = new IniDataParser();

            //intern?
            if (Intern())
            {
                TextAsset t = UnityEngine.Resources.Load <TextAsset>(folder.Substring(1) + "/map");
                return(i.Parse(t.text));
            }

            return(i.Parse(File.ReadAllText(folder)));
        }
예제 #2
0
파일: ConfigData.cs 프로젝트: huangjk/Ash
        public ConfigData(string customConfigs)
        {
            var parser = new IniDataParser();

            _iniData = parser.Parse(DefaultConfigs);

            if (!string.IsNullOrEmpty(customConfigs))
            {
                if (customConfigs.Trim() != "")
                {
                    var userIniData = parser.Parse(customConfigs);
                    _iniData.Merge(userIniData);
                }
            }
        }
        public void CollectionToAbstractConfigurationNodeIniSerializer_Test()
        {
            var configuration =
                new ConfigurationCollection <ExampleConfigurationCollection>(new ConfigurationValueCollection());

            var    fs   = new PhysicalFileSystem();
            var    temp = Path.GetTempPath();
            var    pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            string test = Path.GetRandomFileName();
            var    dir  = new FS.Directory(test, pfs, pfs.GetDirectoryEntry("/"));

            dir.OpenDirectory("program")
            .OpenFile("RMGE01.wbfs").OpenStream().Close();
            configuration.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1152X648;
            var context = new ConfigurationTraversalContext(("game", dir));

            var list = context.TraverseCollection(configuration);
            IAbstractConfigurationNode dolphinList = list["#dolphin"];

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Visit(dolphinList);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }
예제 #4
0
        public static void Configure()
        {
            var configFilename = Path.Combine(
                Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)), "res", "logger.config");

            if (!File.Exists(configFilename))
            {
                return;
            }

            var parser           = new IniDataParser();
            var iniData          = parser.Parse(File.ReadAllText(configFilename));
            var udpLoggerSection = iniData["UdpLogger"];

            ushort port = 0;

            IsRunning = udpLoggerSection.ContainsKey("Port") && ushort.TryParse(udpLoggerSection["Port"], out port);
            if (!IsRunning)
            {
                return;
            }

            if (_loggerService != null)
            {
                return;
            }

            _loggerService = new UdpLoggerService();
            _ = _loggerService.StartLogger(port, UdpLogger.LogFormat);

            Configure(iniData, CreateLogger);
        }
예제 #5
0
        public static void LoadFromIniString(Configuration receivedConfig, string inputString)
        {
            try
            {
                var parser = new IniDataParser();
                var ini    = parser.Parse(inputString);

                foreach (var property in propertyCache)
                {
                    if (ini.Sections.ContainsSection(property.Name))
                    {
                        var result = property.PropertyType.GetMethod("LoadIni", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
                                     ?.Invoke(null, new object[] { ini, property.Name });
                        if (result == null)
                        {
                            throw new Exception($"LoadIni method not found on Type {property.PropertyType.Name}");
                        }

                        property.SetValue(receivedConfig, result, null);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.LogError($"Error {e.Message} occured while parsing synced config");

                Logger.LogError($"while parsing {Environment.NewLine}{inputString}");
            }
        }
예제 #6
0
        public bool LoadINI(string language)
        {
            var translationFile = ResourceUtils.GetEmbeddedResource("Resources.Localization.translations.ini", null);

            if (translationFile == null)
            {
                ZLog.Log("Failed to load the translation file!");
                return(false);
            }

            var     translationFileContents = System.Text.Encoding.UTF8.GetString(translationFile, 0, translationFile.Length);
            var     parser  = new IniDataParser();
            IniData iniData = parser.Parse(translationFileContents);

            if (!iniData.Sections.ContainsSection(language))
            {
                ZLog.Log("Failed to find language: " + language);
                return(false);
            }

            SectionData sectionData = iniData.Sections.GetSectionData(language);

            foreach (KeyData key in sectionData.Keys)
            {
                AddWord(key.KeyName, key.Value);
            }
            return(true);
        }
        public bool TryLoadConfig()
        {
            try
            {
                if (!File.Exists(INI_PATH))
                {
                    return(false);
                }

                string ini = File.ReadAllText(INI_PATH);

                var data = _parser.Parse(ini);

                foreach (var config in data.Sections["Config"])
                {
                    if (ConfigManager.InternalConfigs.TryGetValue(config.KeyName, out IConfigElement configElement))
                    {
                        configElement.BoxedValue = StringToConfigValue(config.Value, configElement.ElementType);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                ExplorerCore.LogWarning("Error loading internal data: " + ex.ToString());
                return(false);
            }
        }
예제 #8
0
        public static void CopyFwProjectTo(string projectCode, string destDir)
        {
            var dataDir = Path.Combine(FindGitRepoRoot(), "data");

            DirectoryHelper.Copy(Path.Combine(dataDir, projectCode), Path.Combine(destDir, projectCode));

            // Adjust hgrc file
            var hgrc = Path.Combine(destDir, projectCode, ".hg/hgrc");

            if (File.Exists(hgrc))
            {
                var parser  = new IniDataParser();
                var iniData = parser.Parse(File.ReadAllText(hgrc));

                iniData["ui"]["username"] = Environment.UserName;

                var outputDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                iniData["merge-tools"]["chorusmerge.executable"] =
                    Path.Combine(outputDirectory, "chorusmerge");

                iniData["extensions"]["fixutf8"] = Path.Combine(FindGitRepoRoot(),
                                                                "MercurialExtensions/fixutf8/fixutf8.py");

                var contents = iniData.ToString();
                File.WriteAllText(hgrc, contents);
            }

            Console.WriteLine("Copied {0} to {1}", projectCode, destDir);
        }
        public bool TryLoadConfig()
        {
            try
            {
                if (!File.Exists(INI_PATH))
                {
                    return(false);
                }

                string ini = File.ReadAllText(INI_PATH);

                var data = _parser.Parse(ini);

                foreach (var config in data.Sections["Config"])
                {
                    if (ConfigManager.ConfigElements.TryGetValue(config.KeyName, out IConfigElement configElement))
                    {
                        configElement.BoxedValue = StringToConfigValue(config.Value, configElement.ElementType);
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #10
0
        public void parse_ini_string_with_custom_configuration()
        {
            var parser = new IniDataParser();

            IniParser.Model.Configuration.IniParserConfiguration config = parser.Configuration;

            config.CommentString    = "#";
            config.SectionStartChar = '<';
            config.SectionEndChar   = '>';

            IniData data = parser.Parse(iniFileStrCustom);

            Assert.That(data, Is.Not.Null);
            Assert.That(data.Sections.Count, Is.EqualTo(2));
            var section1 = data.Sections.GetSectionData("section1");

            Assert.That(section1, Is.Not.Null);
            Assert.That(section1.SectionName, Is.EqualTo("section1"));
            Assert.That(section1.Comments, Is.Not.Empty);
            Assert.That(section1.Comments.Count, Is.EqualTo(1));

            Assert.That(section1.Keys, Is.Not.Null);
            Assert.That(section1.Keys.Count, Is.EqualTo(2));
            Assert.That(section1.Keys.GetKeyData("key1"), Is.Not.Null);
            Assert.That(section1.Keys["key1"], Is.EqualTo("value1"));
            Assert.That(section1.Keys.GetKeyData("key2"), Is.Not.Null);
            Assert.That(section1.Keys["key2"], Is.EqualTo("value5"));
        }
예제 #11
0
        public Configuration ParseConfiguration(string configuration)
        {
            var parser = new IniDataParser();
            var data   = parser.Parse(configuration);

            var config = new Configuration();

            foreach (var section in data.Sections)
            {
                var innerConfig = new Configuration();

                foreach (var key in section.Keys)
                {
                    innerConfig[RemoveWhiteSpace(key.KeyName)] = key.Value;
                }

                config[RemoveWhiteSpace(section.SectionName)] = innerConfig;
            }

            foreach (var key in data.Global)
            {
                config[RemoveWhiteSpace(key.KeyName)] = key.Value;
            }

            return(config);
        }
예제 #12
0
        public override object Load(string path, VFS.IFileSystem fs)
        {
            var obj      = fs.ReadLines($"{path}.{FileExtension}");
            var fileData = obj.Aggregate("", (a, b) => a + b + "\r\n");

            return(new ConfigTable(Parser.Parse(fileData)));
        }
예제 #13
0
        public static void ParseSmbConfShareList(SharesList dstList, string smbConfContent)
        {
            // note: some smb.conffeatures are not handled. Like special variables and includes.
            // TODO special case for [homes] share

            var parser = new IniDataParser();

            parser.Configuration.CommentRegex = new System.Text.RegularExpressions.Regex(@"^[#;](.*)");
            var iniData = parser.Parse(smbConfContent);

            foreach (var shareIniSection in iniData.Sections)
            {
                string shareName = shareIniSection.SectionName;
                if (shareName == "global")
                {
                    continue;
                }

                if (!shareIniSection.Keys.ContainsKey("path"))
                {
                    throw new Exception(String.Format("share {0} doesn't have local path specified", shareName));
                }

                string shareLocalPath = shareIniSection.Keys["path"];

                dstList.AddOrReplace(new Share(shareName, new TokenizedLocalPath(shareLocalPath, '/')));
            }
        }
예제 #14
0
        public static void InitializeHgRepo(string projectFolderPath)
        {
            Directory.CreateDirectory(projectFolderPath);
            RunHgCommand(projectFolderPath, "init .");

            // We have to copy the ini file, otherwise Mercurial won't accept branches that
            // consists only of digits.
            var hgini = Path.Combine(TestEnvironment.FindGitRepoRoot(), "Mercurial", "mercurial.ini");
            var hgrc  = Path.Combine(projectFolderPath, ".hg", "hgrc");

            File.Copy(hgini, hgrc);

            // Adjust hgrc file
            var parser = new IniDataParser {
                Configuration = { CommentString = "#" }
            };
            var iniData = parser.Parse(File.ReadAllText(hgrc));

            iniData["extensions"].AddKey("fixutf8", Path.Combine(TestEnvironment.FindGitRepoRoot(),
                                                                 "MercurialExtensions/fixutf8/fixutf8.py"));

            var contents = iniData.ToString();

            File.WriteAllText(hgrc, contents);
        }
예제 #15
0
        public void InputTemplateToAbstractConfigurationNodeIniSerializer_Test()
        {
            var testmappings = new StoneProvider().Controllers["XBOX_CONTROLLER"];
            var realmapping  =
                JsonConvert.DeserializeObject <ControllerLayout>(
                    TestUtilities.GetStringResource("InputMappings.xinput_device.json"));
            var           mapcol   = ControllerElementMappings.GetDefaultMappings(realmapping, testmappings);
            string        _mapping = TestUtilities.GetStringResource("InputMappings.DirectInput.XINPUT_DEVICE.json");
            IInputMapping mapping  = JsonConvert.DeserializeObject <InputMapping>(_mapping);
            var           input    =
                new InputTemplate <IRetroArchInput>(mapcol).Template;


            var fs   = new PhysicalFileSystem();
            var temp = Path.GetTempPath();
            var pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            var dir  = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/"));

            var context = new ConfigurationTraversalContext();

            var list = context.TraverseInputTemplate(input, mapping, 0);

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Transform(list);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }
        public void InputTemplateToAbstractConfigurationNodeIniSerializer_Test()
        {
            var mapcol = new ControllerElementMappingProfile("Keyboard",
                                                             "TEST_CONTROLLER",
                                                             InputDriver.Keyboard,
                                                             IDeviceEnumerator.VirtualVendorID,
                                                             new XInputDeviceInstance(0).DefaultLayout);
            IDeviceInputMapping mapping = new TestInputMapping();
            var input =
                new InputTemplate <IRetroArchInput>(mapcol).Template;


            var fs   = new PhysicalFileSystem();
            var temp = Path.GetTempPath();
            var pfs  = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(temp));
            var dir  = new FS.Directory("test", pfs, pfs.GetDirectoryEntry("/"));

            var context = new ConfigurationTraversalContext();

            var list = context.TraverseInputTemplate(input, mapping, 0);

            var    iniSerializer = new SimpleIniConfigurationSerializer();
            string outputIni     = iniSerializer.Transform(list);
            var    parser        = new IniDataParser();
            var    data          = parser.Parse(outputIni);

            Assert.NotEmpty(data.Sections);
        }
예제 #17
0
        public void provides_error_data()
        {
            string iniDataString = @";begin

                            ;value
                            value1 = test
                                = test2
                            value1 = test3
                            ";

            var parser = new IniDataParser();

            parser.Configuration.ThrowExceptionsOnError = true;

            try
            {
                parser.Parse(iniDataString);
            }
            catch (ParsingException ex)
            {
                Assert.That(ex.LineNumber, Is.EqualTo(5));
                Assert.That(parser.HasError, Is.True);
                Assert.That(parser.Errors, Has.Count.EqualTo(1));
            }
        }
예제 #18
0
        internal static void Main(string[] args)
        {
            var parser           = new IniDataParser();
            var data             = parser.Parse(File.ReadAllText("onewaymirror.ini"));
            var tfsCollection    = new Uri(data["tfs"]["collectionUri"]);
            var tfsWorkspacePath = data["tfs"]["workspacePath"];
            var tfsTargetPath    = data["tfs"]["targetPath"];
            var tfsUserInfoMappingFileRelativePath = data["tfs"]["tfsUserInfoMappingFileRelativePath"];
            var gitRepositoryPath = data["git"]["repositoryPath"];
            var gitRepositoryUri  = new Uri(data["git"]["repositoryUri"]);
            var gitRemoteName     = data["git"]["remote"];
            var gitBranchName     = data["git"]["branch"];
            var alertEmailAddress = data["general"]["alertEmailAddress"];

            var tfsUserInfoMappingFilePath = Path.Combine(tfsWorkspacePath, tfsUserInfoMappingFileRelativePath);

            OneWayMirrorUtil.Run(
                new ReportingConsoleHost(verbose: true, reportEmailAddress: alertEmailAddress, gitRemoteName: gitRemoteName, gitBranchName: gitBranchName),
                tfsCollection,
                tfsWorkspacePath,
                tfsTargetPath,
                tfsUserInfoMappingFilePath,
                gitRepositoryPath,
                gitRepositoryUri,
                gitRemoteName,
                gitBranchName,
                confirmBeforeCheckin: false,
                lockWorkspacePath: true);
        }
예제 #19
0
파일: BuyGui.cs 프로젝트: mapic91/JxqyHD
        public void BeginBuy(string listFileName, Character target, bool canSellSelfGoods)
        {
            _fileName        = listFileName;
            _target          = target;
            CanSellSelfGoods = canSellSelfGoods;
            BuyPercent       = 100;
            RecyclePercent   = 100;
            try
            {
                _goods.Clear();
                IniData data;
                if (_target != null && !string.IsNullOrEmpty(_target.BuyIniString))
                {
                    var str    = Utils.Base64Decode(_target.BuyIniString);
                    var parser = new IniDataParser();
                    data = parser.Parse(str);
                }
                else
                {
                    var path = @"save\game\" + listFileName;
                    if (!File.Exists(path))
                    {
                        path = @"ini\buy\" + listFileName;
                    }

                    var parser = new FileIniDataParser();
                    data = parser.ReadFile(path, Globals.LocalEncoding);
                }

                _goodTypeCountAtStart = _goodTypeCount = int.Parse(data["Header"]["Count"]);
                _numberValid          = (_target != null && !string.IsNullOrEmpty(_target.BuyIniString)) || (!string.IsNullOrEmpty(data["Header"]["NumberValid"]) && int.Parse(data["Header"]["NumberValid"]) != 0);
                if (!string.IsNullOrEmpty(data["Header"]["BuyPercent"]))
                {
                    BuyPercent = int.Parse(data["Header"]["BuyPercent"]);
                }
                if (!string.IsNullOrEmpty(data["Header"]["RecyclePercent"]))
                {
                    RecyclePercent = int.Parse(data["Header"]["RecyclePercent"]);
                }

                for (var i = 1; i <= _goodTypeCountAtStart; i++)
                {
                    var count = 0;
                    if (_numberValid)
                    {
                        var number = data[i.ToString()]["Number"];
                        count = string.IsNullOrEmpty(number) ? 0 : int.Parse(number);
                    }
                    _goods[i] = new GoodsListManager.GoodsItemInfo(data[i.ToString()]["IniFile"], count);
                }
                _listView.ScrollToRow(0);
                UpdateItems();
                IsShow = true;
            }
            catch (Exception exception)
            {
                Log.LogFileLoadError("BuySell", listFileName, exception);
            }
        }
예제 #20
0
        public static string GetUsernameFromHgrc(string repoPath)
        {
            var hgrc    = Path.Combine(repoPath, ".hg", "hgrc");
            var parser  = new IniDataParser();
            var iniData = parser.Parse(File.ReadAllText(hgrc));

            return(iniData["ui"]["username"]);
        }
예제 #21
0
        public void allow_asteriks_in_section_names()
        {
            var parser = new IniDataParser();

            var iniData = parser.Parse(iniDataString);

            Assert.That(iniData.Sections.ContainsSection("2Way-Keyword-*##13559710880"));
        }
예제 #22
0
        private static void Process(ZipArchiveEntry entry)
        {
            try {
                var entries = entry.Archive.Entries;
                var files   = entries.Where(x => Match(x, entry)).ToList();

                var rules   = files.Find(x => x.Name.ToLower() == "rules.txt")?.GetString();
                var sources = files.Where(x => x.Name.ToLower().Contains("source.txt")).ToList();

                if (string.IsNullOrEmpty(rules))
                {
                    return;
                }

                var parser = new IniDataParser
                {
                    Configuration =
                    {
                        SkipInvalidLines       = true,
                        AllowDuplicateKeys     = true,
                        AllowDuplicateSections = true
                    }
                };
                var data = parser.Parse(rules);

                if (data["Definition"]?["titleIds"] == null || data["Definition"]?["name"] == null)
                {
                    return;
                }

                var value = data["Definition"]?["titleIds"]?.ToUpper();
                if (string.IsNullOrEmpty(value))
                {
                    return;
                }

                var titleIds = value.Split(',');
                var name     = data["Definition"]?["name"].Replace("\"", "").Trim();

                var pack = new GraphicPack {
                    Name = name, Rules = rules
                };
                pack.TitleIds.AddRange(titleIds);
                foreach (var source in sources)
                {
                    var graphicPackSource = new GraphicPackSource {
                        FileName = source.Name, Data = source.GetBytes()
                    };
                    pack.Sources.Add(graphicPackSource);
                }

                NewGraphicPack?.Invoke(null, pack);
            }
            catch (Exception e) {
                TextLog.MesgLog.WriteLog($"{e.Message}\n{e.StackTrace}");
                //MessageBox.Show($@"{e.Message}\n{e.StackTrace}");
            }
        }
예제 #23
0
        public KnyttSave(KnyttWorld world, string ini_data, int slot)
        {
            this.World = world;
            this.Slot  = slot;
            var parser = new IniDataParser();

            this.data = parser.Parse(ini_data);
            this.setWorldDirectory(World.WorldDirectoryName);
        }
예제 #24
0
        public async Task <IList <CloudProvider> > DetectAsync()
        {
            try
            {
                var infoPath   = @"Mega Limited\MEGAsync\MEGAsync.cfg";
                var configPath = Path.Combine(UserDataPaths.GetDefault().LocalAppData, infoPath);
                var configFile = await StorageFile.GetFileFromPathAsync(configPath);

                var    parser        = new IniDataParser();
                var    data          = parser.Parse(await FileIO.ReadTextAsync(configFile));
                byte[] fixedSeed     = Encoding.UTF8.GetBytes("$JY/X?o=h·&%v/M(");
                byte[] localKey      = GetLocalStorageKey();
                byte[] xLocalKey     = XOR(fixedSeed, localKey);
                var    sh            = SHA1.Create();
                byte[] encryptionKey = sh.ComputeHash(xLocalKey);

                var    mainSection  = data.Sections.First(s => s.SectionName == "General");
                string currentGroup = "";

                var currentAccountKey       = Hash("currentAccount", currentGroup, encryptionKey);
                var currentAccountStr       = mainSection.Keys.First(s => s.KeyName == currentAccountKey);
                var currentAccountDecrypted = Decrypt(currentAccountKey, currentAccountStr.Value.Replace("\"", ""), currentGroup);

                var currentAccountSectionKey = Hash(currentAccountDecrypted, "", encryptionKey);
                var currentAccountSection    = data.Sections.First(s => s.SectionName == currentAccountSectionKey);

                var syncKey    = Hash("Syncs", currentAccountSectionKey, encryptionKey);
                var syncGroups = currentAccountSection.Keys.Where(s => s.KeyName.StartsWith(syncKey)).Select(x => x.KeyName.Split('\\')[1]).Distinct();
                var results    = new List <CloudProvider>();

                foreach (var sync in syncGroups)
                {
                    currentGroup = string.Join("/", currentAccountSectionKey, syncKey, sync);
                    var syncNameKey          = Hash("syncName", currentGroup, encryptionKey);
                    var syncNameStr          = currentAccountSection.Keys.First(s => s.KeyName == string.Join("\\", syncKey, sync, syncNameKey));
                    var syncNameDecrypted    = Decrypt(syncNameKey, syncNameStr.Value.Replace("\"", ""), currentGroup);
                    var localFolderKey       = Hash("localFolder", currentGroup, encryptionKey);
                    var localFolderStr       = currentAccountSection.Keys.First(s => s.KeyName == string.Join("\\", syncKey, sync, localFolderKey));
                    var localFolderDecrypted = Decrypt(localFolderKey, localFolderStr.Value.Replace("\"", ""), currentGroup);

                    results.Add(new CloudProvider()
                    {
                        ID         = CloudProviders.Mega,
                        Name       = $"MEGA ({syncNameDecrypted})",
                        SyncFolder = localFolderDecrypted
                    });
                }

                return(results);
            }
            catch
            {
                // Not detected
                return(Array.Empty <CloudProvider>());
            }
        }
예제 #25
0
        public static void Init()
        {
            IniDataParser parser = new IniDataParser();
            IniData       data   = parser.Parse(FileHelper.ReadText("Resource/Config.ini"));

            LISTENER_IP   = data.Sections["Network"].GetKeyData("LISTENER_IP").Value;
            LISTENER_PORT = int.Parse(data.Sections["Network"].GetKeyData("LISTENER_PORT").Value);
            SERVER_IP     = data.Sections["Network"].GetKeyData("SERVER_IP").Value;
            SERVER_PORT   = int.Parse(data.Sections["Network"].GetKeyData("SERVER_PORT").Value);
        }
예제 #26
0
        public void alway_returns_a_valid_section()
        {
            var parser = new IniDataParser();

            parser.Configuration.AllowCreateSectionsOnFly = true;

            var iniData = parser.Parse("");

            Assert.IsNotNull(iniData["noname"]);
        }
예제 #27
0
        public void commentchar_property_works()
        {
            var parser = new IniDataParser();

            parser.Configuration.CommentChar = '#';

            var result = parser.Parse(initest);

            Assert.That(result.Sections.GetSectionData("seccion1").Comments.Count > 0);
        }
예제 #28
0
        public void escape_comment_regex_special_characters()
        {
            var iniStr = @"[Section]
                \Backslash Bcomment
                Key=Value";

            var parser = new IniDataParser();

            parser.Configuration.CommentString = @"\";

            parser.Parse(iniStr);
        }
예제 #29
0
        public void allow_duplicated_keys_in_section()
        {
            var parser = new IniDataParser();

            parser.Configuration.AllowDuplicateKeys = true;

            IniData data = parser.Parse(ini_duplicated_keys);

            Assert.That(data, Is.Not.Null);
            Assert.That(data.Sections.GetSectionData("seccion1").Keys.Count, Is.EqualTo(1));
            Assert.That(data.Sections.GetSectionData("seccion1").Keys["value1"], Is.EqualTo("10.6"));
        }
예제 #30
0
        public void allow_tilde_in_sections()
        {
            string data =
                @"[section~subsection]
key=value";
            IniDataParser parser = new IniDataParser();

            IniData parsedData = parser.Parse(data);

            Assert.That(parsedData.Sections.ContainsSection("section~subsection"));
            Assert.That(parsedData.Sections["section~subsection"]["key"], Is.EqualTo("value"));
        }