C#.NET 导入注册表配置单元并解析其内容

发布于 2024-07-10 07:53:13 字数 167 浏览 3 评论 0原文

我从注册表中获得了一个 .Hive 文件,我必须解析该文件并将其内容用作 html 报告的一部分(由此我假设我必须以某种方式转换为文本)。 整个事情必须在程序内完成,所以我不能只转换配置单元文件,然后通过我的程序运行它。 我目前不知道如何开始,所以对此的任何帮助都会很棒。

任何想法都会很棒!

I have been given a .Hive file from a registry which i have to parse and use the contents as part of a html report(from this i assume i have to convert to text somehow). The whole thing must be done within the program so i cant just convert the hive file and then run it through my program. I currently have no idea how to even start this so any help on this would be great.

Any ideas would be fantastic!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

謸气贵蔟 2024-07-17 07:53:13

如果没有看到输入,就很难判断什么是最好的方法。 您可能需要使用 RegExp 类来解析您的键和值。 如果您可以获得足够干净的值路径,您也许可以使用 string.Split() 将路径拆分为键数组并使用这些值遍历注册表。

输入集是否包含值的类型,或者您是否可以假设这些值已存在于注册表中?

有关输入集的更多信息会很有用。 一个例子,可能吗?

Without seeing the input, it is hard to tell what the best approach is. You are probably going to need to use the RegExp class to parse out your keys and values. If you can get clean enough paths to the values, you might be able to get away with string.Split() to split the path into arrays of keys and walk the registry using those values.

Does the input set include the type of values, or can you assume that the values already exist in the registry?

A little more information on the input set would be useful. An example, possibly?

泛泛之交 2024-07-17 07:53:13

快速 Google 一下“.HIVE 文件格式”,发现该格式为二进制 。 我首先看看您是否可以找到您正在解析的文件格式的规范。 如果您需要解析的文件格式是上面链接的文件格式,那么您需要使用 System.IO.BinaryReader 来浏览该文件。 在 C# 中设置一些表示文件格式结构的类或结构并在解析文件时填充它们也可能会有所帮助。 然后,您可以根据已填充的这些对象进行 HTML 报告。

A quick Google of ".HIVE file format" points to the format being binary. I would start by seeing if you can find a specification for the file format you are parsing. If the file format you need to parse is the one linked to above, then you'll need to use a System.IO.BinaryReader to go through the file. It might also be helpful to set up some classes or structures in C# that represent the file format structures and populate those as you parse the file. You can then do your HTML reporting off of these objects you've populated.

你如我软肋 2024-07-17 07:53:13

感谢您的回答,我现在已经弄清楚了。 这不是解析,而是导入我遇到问题的数据。 我创建了一个 hive.out 文件,然后以普通文本方式导入它。

Thanks for your answer, ive managed to figure it out now. It wasnt the parsing it was importing the data i was having problems with. I created a hive.out file and then imported it in the normal text way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文