{"id":18518098,"url":"https://github.com/cyotek/cyotek.data.ini","last_synced_at":"2025-04-22T21:20:56.317Z","repository":{"id":41534720,"uuid":"508033717","full_name":"cyotek/Cyotek.Data.Ini","owner":"cyotek","description":"A simple library for reading and writing .ini files in .NET applications","archived":false,"fork":false,"pushed_at":"2022-07-10T11:29:15.000Z","size":123,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T18:51:15.514Z","etag":null,"topics":["csharp","csharp-library","ini-parser"],"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/cyotek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-27T19:16:08.000Z","updated_at":"2024-09-23T01:30:03.000Z","dependencies_parsed_at":"2022-07-08T05:44:00.019Z","dependency_job_id":null,"html_url":"https://github.com/cyotek/Cyotek.Data.Ini","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyotek%2FCyotek.Data.Ini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyotek%2FCyotek.Data.Ini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyotek%2FCyotek.Data.Ini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyotek%2FCyotek.Data.Ini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyotek","download_url":"https://codeload.github.com/cyotek/Cyotek.Data.Ini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250324953,"owners_count":21411983,"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":["csharp","csharp-library","ini-parser"],"created_at":"2024-11-06T17:11:41.888Z","updated_at":"2025-04-22T21:20:56.255Z","avatar_url":"https://github.com/cyotek.png","language":"C#","funding_links":["https://www.paypal.me/cyotek","https://www.buymeacoffee.com/cyotek"],"categories":[],"sub_categories":[],"readme":"# Cyotek Ini Reading / Writing Library\n\n[![NuGet][nugetbadge]][nuget]\n\nThe **Cyotek.Data.Ini** library contains a number of classes to\nwork with ini files.\n\n## Did you say ini files\n\nYes, I said ini files. Traditionally, I would use the registry,\nbut that isn't such a great idea if you're making portable\nsoftware. So I could use XML, JSON, YAML, TOML etc. I have\nnothing against any of these formats - with the exception of\nTOML (which I have yet to use), I use the other 3 extensively.\nBut for my configuration files I still prefer something that\npeople can more easily edit, and which is more tolerant of\nerrors.\n\nThe bulk of these classes were wrote in 2014 and were part of my\nmain code library. As this isn't open source (yet), and I didn't\nlike the 3rd party ini helper library I was using with another\nof my open source projects, I decided to extract this one and\nmake it available. I filled in some test coverage and fixed a\nbug or two. With that said, despite its age it is still somewhat\nunderused, and so likely still has bugs lurking around and the\nfeature set and object model could definitely be improved.\n\n## Getting the library\n\nThe easiest way of obtaining the library is via [NuGet][nuget].\n\n\u003e `Install-Package Cyotek.Data.Ini`\n\nIf you don't use NuGet, pre-compiled binaries can be obtained\nfrom the [GitHub Releases page][ghrel].\n\nOf course, you can always grab [the source][ghsrc] and build it\nyourself!\n\n## Quick Start\n\nNo documentation, so a few pointers to get started.\n\n```csharp\nusing Cyotek.Data.Ini;\n\nstring fileName;\nIniDocument document;\n\nfileName = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), \"settings.ini\");\n\n// you can set the filename as part of the constructor\n// the document is not loaded until you try to access a token\ndocument = new IniDocument(fileName);\n\n// or, you can load text directly with the LoadIni method\ndocument.LoadIni(\"[Settings]\\r\\nalpha=beta\");\n\n// or, you can load text from a file (this is direct, unlike the constructor)\n// overloads exist for loading from a Stream or TextWriter\ndocument.Load(fileName);\n\n// use GetValue to read a value from a section\nConsole.WriteLine(document.GetValue(\"Settings\", \"stringTest\"));\n\n// you can also specify a default for when the requested value doesn't exist\nConsole.WriteLine(document.GetValue(\"Settings\", \"newSettings\", \"fallback\"));\n\n// or if you're reading multiple values, it is more efficient to get the section first\nIniSectionToken section;\n\nsection = (IniSectionToken)document.CreateSection(\"Settings\"); // this will return the existing section if found, or create a new one if not\nConsole.WriteLine(section.GetValue(\"longTest\"));\nConsole.WriteLine(section.GetValue(\"shortTest\"));\nConsole.WriteLine(section.GetValue(\"stringTest\"));\n\nsection = (IniSectionToken)document.GetSection(\"Settings\"); // this version returns null if the section doesn't exist\n\n// to get a list of defined names, you can call GetNames\nforeach (string name in section.GetNames())\n{\n  Console.WriteLine(name);\n}\n\n// or enumerate tokens directly\nforeach (IniToken token in document.ChildTokens)\n{\n  Console.WriteLine(token.Type.ToString());\n}\n\n// you can get the representation of a token with InnerText (or ToString(), they are equivalent)\nforeach (IniToken token in document.ChildTokens)\n{\n  Console.WriteLine(token.InnerText);\n}\n\n// the document is a token too, so you can get the full ini configuration the same way\nConsole.WriteLine(document.InnerText);\n\n// use SetValue on either IniDocument or IniSectionToken to set a value\nsection.SetValue(\"alpha\", \"beta\");\ndocument.SetValue(\"Settings\", \"gamma\", \"delta\");\n\n// save the file\n// overloads exist for saving to a Stream or TextWriter\ndocument.Save(fileName);\n\n// for quick operations there are a couple of static methods, but these\n// will cause the entire document to be loaded and saved with each call\n// so should be used sparingly\nConsole.WriteLine(IniDocument.GetValue(fileName,\"Settings\",\"colorTest\",\"Black\"));\nIniDocument.SetValue(fileName, \"Settings\", \"newField\", \"Epsilon\");\n```\n\n## Requirements\n\n.NET Framework 3.5 or later.\n\nPre-built binaries are available via a signed [NuGet\npackage][nuget] containing the following targets.\n\n* .NET 3.5\n* .NET 4.0\n* .NET 4.5.2\n* .NET 4.6.2\n* .NET 4.7.2\n* .NET 4.8\n* .NET 6.0\n* .NET Core 3.1\n* .NET Standard 2.1\n\n## Contributing to this code\n\nContributions accepted!\n\n* Found a problem? [Raise an issue][ghissue]\n* Want to improve the code? [Make a pull request][ghpull]\n\nAlternatively, if you make use of this software and it saves you\nsome time, [donations are welcome][donate].\n\n[![PayPal Donation][paypalimg]][paypal]\n\n[![By Me a Coffee Donation][bmacimg]][bmac]\n\n## Known Issues\n\n* No documentation\n* API is a bit rough and ready\n\n## Acknowledgements\n\n* The wrench icon used in the package logo is the [Options,\n  preferences, settings icon][IconRef] by iconify\n\n[IconRef]: https://www.iconfinder.com/icons/510859/options_preferences_settings_tools_icon\n\n[nuget]: https://www.nuget.org/packages/Cyotek.Data.Ini/\n[nugetbadge]: https://img.shields.io/nuget/vpre/Cyotek.Data.Ini\n\n[ghissue]: https://github.com/cyotek/Cyotek.Data.Ini/issues\n[ghpull]: https://github.com/cyotek/Cyotek.Data.Ini/pulls\n[ghrel]: https://github.com/cyotek/Cyotek.Data.Ini/releases\n[ghsrc]: https://github.com/cyotek/Cyotek.Data.Ini\n\n[donate]: https://www.cyotek.com/contribute\n[paypal]: https://www.paypal.me/cyotek\n[paypalimg]: https://static.cyotek.com/assets/images/donate.gif\n[bmac]: https://www.buymeacoffee.com/cyotek\n[bmacimg]: https://static.cyotek.com/assets/images/bmac.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyotek%2Fcyotek.data.ini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyotek%2Fcyotek.data.ini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyotek%2Fcyotek.data.ini/lists"}