{"id":24721948,"url":"https://github.com/saklis/property-manager","last_synced_at":"2025-10-09T18:30:40.246Z","repository":{"id":143187244,"uuid":"183426818","full_name":"saklis/property-manager","owner":"saklis","description":"Configuration tool, which automatically finds and sets any fields or properties based on provided data.","archived":false,"fork":false,"pushed_at":"2020-05-27T06:54:23.000Z","size":61,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-27T18:49:24.849Z","etag":null,"topics":["c-sharp","c-sharp-library","csharp","csharp-library","properties","property-management","reflection"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saklis.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-25T12:09:32.000Z","updated_at":"2025-07-19T23:51:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9e15770-8d5e-42be-a763-bc4daa7f7e2b","html_url":"https://github.com/saklis/property-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saklis/property-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saklis%2Fproperty-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saklis%2Fproperty-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saklis%2Fproperty-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saklis%2Fproperty-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saklis","download_url":"https://codeload.github.com/saklis/property-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saklis%2Fproperty-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001947,"owners_count":26083226,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","c-sharp-library","csharp","csharp-library","properties","property-management","reflection"],"created_at":"2025-01-27T12:15:34.541Z","updated_at":"2025-10-09T18:30:40.239Z","avatar_url":"https://github.com/saklis.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Property Manager\nA configuration tool, which automatically finds and sets any fields or properties based on provided data. It comes bundled with providers to read and write ini files as well as pair of simple interfaces to let you easily write your own.\n\n## Features\n* Can set values of fields and properties using Reflection.\n* Supported types: bool, int, float, string\n* Supports static variables.\n* Option to save changes through editable data provider.\n\n## Compatibility\n* C# 7.0 and greater\n\n## Installation\nWith Visual Studio NuGet Package Manager: `PM\u003e Install-Package PropertyManager`\n\nor download library from https://www.nuget.org/packages/PropertyManager/\n\n## Getting started with Property Manager\nMost common way of using Property Manager is by invoking static API of `PropertyManager` class. This is used for batch application of all values.\n\n### Applying values through static call\nWhen you get used to it, applying values through static call is quite easy:\n```c#\nPropertyManager.Apply(this, new PropertyProvider.FilePropertyProvider(\"fileWithValues.ini\"));\n```\n\nThis one line is a bit deceptive, though, as it does have quite a bit of things happening. Two main topics are Context and providers.\n\n### Providers\nProviders are classes implementing `IPropertyProvider` or `IEditablePropertyProvider` interface. The job of a provider is to supply Property Manager with List of `PropertyEntry` objects through implementation of `GetPropertyEntries()` method. Aditionally, `IEditablePropertyProvider` provides `Save()` method, which should be used to saving changes done through Property Manager.\n\nPropery Manager by default contains two providers - `FilePropertyProvider` and `FileEditablePropertyProvider` which implement simple support \\*.ini files with line-long comments.\n\nAn example of `fileWithValues.ini` file:\n```ini\nprivate field id = 42\nName = \"Adams\"\n\n# Is Adams user of our system?\nIsUser = true\n```\n\nYou may notice that there are two qualificators before `id` variable. Each variable is, by default, treated as public property, so if you're trying to set a private property or a field you need to add proper qualifier.\n\nYou can create and configure both providers using an initializer. Here's an example based on `FilePropertyProvider` class:\n```c#\nvar provider = new FilePropertyProvider(\"fileWithValues.ini\") {\n  CommentSign = \"#\",\n  Encoding = System.Text.Encoding.UTF8,\n  Culture = CultureInfo.InvariantCulture,\n  AllValuesAsString = false\n};\n```\n\nMethods `GetPropertyEntries()` and `Save()` in the providers are for internal use for Property Manager and don't need to be called manualy.\n\n### Context\nContext is a starting point for Property Manager from which the system will look for fields and propertis.\n\nCheck out this example that expands on static call line from above:\n```c#\nclass User {\n  private int id;\n  public string Name { get; set; }\n  public bool IsUser { get; set; }\n    \n  public User() { }\n}\n\ninternal class Program {\n  private static void Main(string[] args) {\n    User userObject = new User();\n    \n    PropertyManager.Apply(userObject, new PropertyProvider.FilePropertyProvider(\"fileWithValues.ini\"));\n  }\n}\n```\n\nThe context of the call is userObject object, which means that all lines from the files will be applied to this userObject object. In this example after the calls of `Apply()` method values stored in userObject object will be 42, \"Adams\" and true for id, Name and IsUser respectively.\n\nThis approach, while quick and convinient, is a read-only approach. To make full use out of editable providers you'll need...\n\n### Instance of Property Manager\nCreating an editable instance of Property Manager is as strightforward as any other class.\n\n```c#\nvar manager = new PropertyManager(new PropertyProvider.FileEditablePropertyProvider(\"fileWithValues.ini\"));\n```\n\nA Property Manager instance give you access to `Apply()` method that can be used exactly the same way as the static version. Aside of that, you can also use `GetValue()` method or indexer to retrive value from particular key.\n```c#\nstring name = manager.GetValue\u003cstring\u003e(\"Name\");\nstring sameName = manager[\"Name\"];\n```\n\n### Editable values\nTo change value under key you can use `SetValue` method.\n```c#\nmanager.SetValue\u003cstring\u003e(\"Name\", \"Duglas\");\n```\n\nAnd to update source file just call `Save()` method that's provided by the instance.\n```c#\nmanager.Save();\n```\n\n## Concurrency\nProperty Manager is thread-safe in non-editable mode. It's no when editable provider is used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaklis%2Fproperty-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaklis%2Fproperty-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaklis%2Fproperty-manager/lists"}