{"id":25560889,"url":"https://github.com/mikeclayton/Kingsland.MofParser","last_synced_at":"2026-03-04T10:30:19.396Z","repository":{"id":18793871,"uuid":"22007682","full_name":"KingslandConsulting/Kingsland.MofParser","owner":"KingslandConsulting","description":"A C# library for parsing the contents of Managed Object Format (MOF) files","archived":false,"fork":false,"pushed_at":"2024-08-07T21:57:33.000Z","size":13362,"stargazers_count":26,"open_issues_count":11,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-02T03:02:25.812Z","etag":null,"topics":["c-sharp","mof","parsing","powershell-dsc"],"latest_commit_sha":null,"homepage":"","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/KingslandConsulting.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}},"created_at":"2014-07-19T10:49:28.000Z","updated_at":"2024-11-13T07:11:22.000Z","dependencies_parsed_at":"2023-01-11T20:29:51.230Z","dependency_job_id":"bebc3891-d321-4ff1-8a34-fd1dff612962","html_url":"https://github.com/KingslandConsulting/Kingsland.MofParser","commit_stats":null,"previous_names":["mikeclayton/mofparser"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingslandConsulting%2FKingsland.MofParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingslandConsulting%2FKingsland.MofParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingslandConsulting%2FKingsland.MofParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingslandConsulting%2FKingsland.MofParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KingslandConsulting","download_url":"https://codeload.github.com/KingslandConsulting/Kingsland.MofParser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239889015,"owners_count":19713702,"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","mof","parsing","powershell-dsc"],"created_at":"2025-02-20T18:00:54.990Z","updated_at":"2026-03-04T10:30:19.200Z","avatar_url":"https://github.com/KingslandConsulting.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"Kingsland.MofParser\n===================\n\nOverview\n--------\n\nKingsland.MofParser is a C# library for parsing the contents of Managed Object Format (MOF) files.\n\nThe library was initially created with the goal of producing documentation from Managed Object Format files produced by PowerShell Desired State Configuration scripts, but now supports nearly all of the [MOF 3.0.1 specification ](https://www.dmtf.org/sites/default/files/standards/documents/DSP0221_3.0.1.pdf) including the following:\n\n+ Compiler directives (```#pragma include```)\n+ Instance declarations (```instance of xyz { ... }```)\n+ Structure declarations (```value of xyz { ... }```)\n+ Class declarations (```class xyz { ... }```)\n+ Association declarations (```association xyz { ... }```)\n+ Enumeration declarations (```enumeration xyz { ... }```)\n\nFor the full list of implemented language elements, see [Supported Syntax](wiki/supported_syntax.md).\n\n\nQuick Start\n-----------\n\nTo process a MOF file produced by PowerShell DSC, simply pass the filename to the PowerShellDscHelper.ParseMofFile method.\n\nThis will read the contents of the file and extract a list of \"instance\" declarations that are defined in the file. You can use this list to generate html documentation, or perform any other downstream processing.\n\nSee the Kingsland.MofParser.Sample project for the full source.\n\nSample Code\n-----------\n\n```c#\nconst string sourceText = @\"\ninstance of MSFT_RoleResource as $MSFT_RoleResource1ref\n{\n    ResourceID = \"\"[WindowsFeature]IIS\"\";\n    Ensure = \"\"Present\"\";\n    SourceInfo = \"\"D:\\\\dsc\\\\MyServerConfig.ps1::6::9::WindowsFeature\"\";\n    Name = \"\"Web-Server\"\";\n    ModuleName = \"\"PSDesiredStateConfiguration\"\";\n    ModuleVersion = \"\"1.0\"\";\n};\";\n\n// parse the mof file\nvar module = Parser.ParseText(sourceText);\n\n// display the instances\nforeach (var instance in module.Instances)\n{\n    Console.WriteLine($\"----------------------------------\");\n    Console.WriteLine($\"typename = {instance.TypeName}\");\n    Console.WriteLine($\"alias    = {instance.Alias}\");\n    Console.WriteLine($\"properties:\");\n    foreach (var property in instance.Properties)\n    {\n        Console.WriteLine(\"    {0} = {1}\", property.Name.PadRight(13), property.Value);\n    }\n    Console.WriteLine($\"----------------------------------\");\n}\n\n// output:\n// ----------------------------------\n// typename = MSFT_RoleResource\n// alias    = MSFT_RoleResource1ref\n// properties:\n//     ResourceID    = [WindowsFeature]IIS\n//     Ensure        = Present\n//     SourceInfo    = D:\\dsc\\MyServerConfig.ps1::6::9::WindowsFeature\n//     Name          = Web-Server\n//     ModuleName    = PSDesiredStateConfiguration\n//     ModuleVersion = 1.0\n// ----------------------------------\n```\n\n\nIssues\n------\n\nPost a bug report (and / or send a Pull Request) on the Issues page if you encounter a MOF file that doesn't get processed properly and I'll have a look.\n\n\nLicense\n-------\n\nThis project is licensed under the GNU Lesser General Public License (LGPL) v3. See LICENSE.txt for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeclayton%2FKingsland.MofParser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeclayton%2FKingsland.MofParser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeclayton%2FKingsland.MofParser/lists"}