{"id":14960879,"url":"https://github.com/rickyah/ini-parser","last_synced_at":"2025-05-14T13:06:05.328Z","repository":{"id":5421676,"uuid":"6613196","full_name":"rickyah/ini-parser","owner":"rickyah","description":"Read/Write an INI file the easy way!","archived":false,"fork":false,"pushed_at":"2023-07-02T18:59:51.000Z","size":1728,"stargazers_count":990,"open_issues_count":56,"forks_count":239,"subscribers_count":41,"default_branch":"development","last_synced_at":"2025-04-14T01:49:09.580Z","etag":null,"topics":["c-sharp","cli","config","config-management","configuration","configuration-file","configuration-management","dotnet","ini","ini-parser","iniparser","mono","monodevelop","nuget","unity-scripts","unity3d","unity3d-games"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rickyah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2012-11-09T12:32:48.000Z","updated_at":"2025-04-09T12:32:58.000Z","dependencies_parsed_at":"2024-01-13T17:47:48.642Z","dependency_job_id":"a30d1d84-8118-4b10-8d96-eb08517aa4a1","html_url":"https://github.com/rickyah/ini-parser","commit_stats":{"total_commits":320,"total_committers":21,"mean_commits":"15.238095238095237","dds":"0.31562500000000004","last_synced_commit":"d300241a75bec4dcabc0751c8690f3b12b3eaf43"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2Fini-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2Fini-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2Fini-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2Fini-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickyah","download_url":"https://codeload.github.com/rickyah/ini-parser/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149948,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","cli","config","config-management","configuration","configuration-file","configuration-management","dotnet","ini","ini-parser","iniparser","mono","monodevelop","nuget","unity-scripts","unity3d","unity3d-games"],"created_at":"2024-09-24T13:23:20.494Z","updated_at":"2025-05-14T13:06:05.297Z","avatar_url":"https://github.com/rickyah.png","language":"C#","readme":"# INI File Parser\n\nA .NET, Mono and Unity3d compatible(*) library for reading/writing INI data from IO streams, file streams, and strings written in C#.\n\nAlso implements merging operations, both for complete ini files, sections, or even just a subset of the keys contained by the files.\n\n\n(*) This library is 100% .NET code and does not have any dependencies on Windows API calls in order to be portable.\n\n[![Build Status](https://travis-ci.org/rickyah/ini-parser.png?branch=master)](https://travis-ci.org/rickyah/ini-parser)\n\n\nGet the latest version: https://github.com/rickyah/ini-parser/releases/latest\nInstall it with NuGet: https://www.nuget.org/packages/ini-parser/\n\n## Version 2.0\nSince the INI format isn't really a \"standard\", version 2 introduces a simpler way to customize INI parsing:\n\n * Pass a configuration object to an `IniParser`, specifying the behaviour of the parser. A default implementation is used if none is provided.\n \n * Derive from `IniDataParser` and override the fine-grained parsing methods.\n\n\n## Installation\n\nThe library is published to [NuGet](https://www.nuget.org/packages/ini-parser/) and can be installed on the command-line from the directory containing your solution.\n\n```bat\n\u003e nuget install ini-parser\n```\n\nOr, from the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console) in Visual Studio\n\n```powershell\nPM\u003e Install-Package ini-parser\n```\n\nIf you are using Visual Studio, you can download the [NuGet Package Manager](http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c) extension that will allow adding the NuGet dependency for your project.\n\nIf you use MonoDevelop / Xamarin Studio, you can install the [MonoDevelop NuGet AddIn](https://github.com/mrward/monodevelop-nuget-addin) to also be able to add this library as dependency from the IDE.\n\n## Getting Started\n\nAll code examples expect the following using clauses:\n\n```csharp\nusing IniParser;\nusing IniParser.Model;\n```\n\nINI data is stored in nested dictionaries, so accessing the value associated to a key in a section is straightforward. Load the data using one of the provided methods.\n\n```csharp\nvar parser = new FileIniDataParser();\nIniData data = parser.ReadFile(\"Configuration.ini\");\n```\n\nRetrieve the value for a key inside of a named section. Values are always retrieved as `string`s.\n\n```csharp\nstring useFullScreenStr = data[\"UI\"][\"fullscreen\"];\n// useFullScreenStr contains \"true\"\nbool useFullScreen = bool.Parse(useFullScreenStr);\n```\n\nModify the value in the dictionary, not the value retrieved, and save to a new file or overwrite.\n\n```csharp\ndata[\"UI\"][\"fullscreen\"] = \"true\";\nparser.WriteFile(\"Configuration.ini\", data);\n```\n\nHead to the [wiki](https://github.com/rickyah/ini-parser/wiki) for more usage examples, or [check out the code of the example project](https://github.com/rickyah/ini-parser/blob/development/src/IniFileParser.Example/Program.cs)\n\n\n## Merging ini files\nMerging ini files is a one-method operation:\n\n```csharp\n\n   var parser = new IniParser.Parser.IniDataParser();\n\n   IniData config = parser.Parse(File.ReadAllText(\"global_config.ini\"));\n   IniData user_config = parser.Parse(File.ReadAllText(\"user_config.ini\"));\n   config.Merge(user_config);\n\n   // config now contains that data from both ini files, and the values of\n   // the keys and sections are overwritten with the values of the keys and\n   // sections that also existed in the user config file\n```\n\nKeep in mind that you can merge individual sections if you like:\n\n```csharp\nconfig[\"user_settings\"].Merge(user_config[\"user_settings\"]);\n```\n\n## Comments\n\nThe library allows modifying the comments from an ini file. \nHowever note than writing the file back to disk, the comments will be rearranged so \ncomments are written before the element they refer to.\n\nTo query, add or remove comments, access the property `Comments` available both in `SectionData` and `KeyData` models.\n\n```csharp\nvar listOfCommentsForSection = config.[\"user_settings\"].Comments;\nvar listOfCommentsForKey = config[\"user_settings\"].GetKeyData(\"resolution\").Comments;\n```\n\n## Unity3D\nYou can easily use this library in your Unity3D projects. Just drop either the code or the DLL inside your project's Assets folder and you're ready to go!\n\nini-parser is actually being used in [ProjectPrefs](http://u3d.as/content/garrafote/project-prefs/5so) a free add-on available in the Unity Assets Store that allows you to set custom preferences for your project. I'm not affiliated with this project: Kudos to Garrafote for making this add-on.\n\n## Contributing\nDo you have an idea to improve this library, or did you happen to run into a bug? Please share your idea or the bug you found in the [issues page](https://github.com/rickyah/ini-parser/issues), or even better: feel free to fork and [contribute](https://github.com/rickyah/ini-parser/wiki/Contributing) to this project with a Pull Request.\n","funding_links":[],"categories":["C\\#","DSL"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyah%2Fini-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickyah%2Fini-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyah%2Fini-parser/lists"}