{"id":22031050,"url":"https://github.com/nmyvision/templatewriter","last_synced_at":"2026-05-18T02:33:19.218Z","repository":{"id":34886999,"uuid":"183452661","full_name":"NMyVision/TemplateWriter","owner":"NMyVision","description":"Take a string with placeholders and replace with values or by an object.","archived":false,"fork":false,"pushed_at":"2022-12-28T08:07:31.000Z","size":44,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-01T03:58:52.262Z","etag":null,"topics":[],"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/NMyVision.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}},"created_at":"2019-04-25T14:37:36.000Z","updated_at":"2022-01-04T06:55:04.000Z","dependencies_parsed_at":"2023-01-15T09:56:52.613Z","dependency_job_id":null,"html_url":"https://github.com/NMyVision/TemplateWriter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/NMyVision/TemplateWriter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMyVision%2FTemplateWriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMyVision%2FTemplateWriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMyVision%2FTemplateWriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMyVision%2FTemplateWriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NMyVision","download_url":"https://codeload.github.com/NMyVision/TemplateWriter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMyVision%2FTemplateWriter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269687961,"owners_count":24459395,"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-08-10T02:00:08.965Z","response_time":71,"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":[],"created_at":"2024-11-30T08:13:37.146Z","updated_at":"2026-05-18T02:33:19.192Z","avatar_url":"https://github.com/NMyVision.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# TemplateWriter\n\nTake a string with placeholders and replace with values or by an object.\n\n![NuGet](https://img.shields.io/nuget/v/NMyVision.TemplateWriter.svg?style=flat-square\u0026logo=nuget)\n\n``` cs\nInstall-Package  NMyVision.TemplateWriter\n```\n\n## Example\n\n``` cs\nvar tw = CreateTemplateWriter();\ntw.Add(\"GroupKey\", 1221);\ntw.Add(\"CompanyKey\", 101);\n\nvar tmp = \"{GroupKey}_{CompanyKey}_{missing}\";\n\ntw.Transform(tmp); // outputs: 1221_101_{missing}\n```\n\n\n``` cs\nvar o = new\n{\n  GroupKey = 1221,\n  CompanyKey = 100\n};\n\nvar x = TemplateWriter.Transform(tmp, o);\n\nconsole.log(x); // outputs: 1221_101_{missing}\n```\n\n## Built In variables\n\n\n``` cs\nvar dt = new DateTime(1980, 4, 6, 6, 30, 33);\nvar tw = new TemplateWriter(dt);\n\ntw.Transform(\"{Current}\"); // 4/6/1980 6:30:33 AM\ntw.Transform(\"{Current_Date}\"); // 19800406\ntw.Transform(\"{Current_DateTime}\"); // 19800406063033 (note: 24hr format)\ntw.Transform(\"{Current_Time}\"); // 063033\n```\n\n| Name               | Format            | Ouput                 |\n|--------------------|-------------------| --------------------- |\n|Current             | N/A               | 4/6/1980 6:30:33 AM   |\n|Current_Date        | yyyyMMdd          | 19800406              |\n|Current_DateTime    | yyyyMMddHHmmss    | 19800406063033        |\n|Current_Time        | HHmmss|063033     |                       |\n|Current_UniqueDate  | yyyyMMddHHmmssfff | 19800406063033000     |\n|Index *             | N/A               | 0 ... N+1             | \n|UUID *              | GUID / UUID       |                       | \n\nNote:\n  - **Index** default starts at 0 and increments by 1, this can be altered\n  - **UUID** changes per transform call (v2.1)\n\n## Create from FileInfo to add predifined variables\n\n```\nvar tw = TemplateWriter.Create(new FileInfo(\"C:\\temp\\Sample.txt\"));\n```\n| Name      | Ouput                   |\n|-----------|-------------------------|\n| Name      | Sample                  |\n| Filename  | Sample.txt              |\n| Extension | .txt                    |\n| Fullname  | C:\\temp\\Sample.txt      |\n| Directory | C:\\temp                 |\n| Created   | 4/25/2020 12:01:33 PM   |\n| Modified  | 4/25/2020 3:02:59 PM    |\n\n\n# Examples\n\nLook in the test folder for more examples.\n\n# Release Log\n2.1.2\n- Allow for spaces in placeholder names\n\n2.1.1\n- Clear method resets the `Index` variable\n- Add CurrentIndex property to expose `Index` variable\n\n2.1.0\n- Increment variable renamed to IncrementValue (variable is still Index)   \n- Add Increment method to manually increment the `{Index}`\n- Add AutoIncrement variable to turn off/of increment functionality\n- Add new `UUID` variable\n\n2.0.2\n- Add clear method\n\n2.0.1\n- Fix load to override an existing value if exists\n\n2.0.0\n- `null` can not be passed in the constructor anymore use TemplateWriter.Empty\n- Removed Add(object) now use Load(object)\n- Load(object) can accept an class object, Anonymous type, IDictionary or KeyValuePair \n\n1.2.0 \n- Add Index variable for use when used in loops\n- Suppress internal object Extension\n- Expose GlobalFileVariables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmyvision%2Ftemplatewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmyvision%2Ftemplatewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmyvision%2Ftemplatewriter/lists"}