C# 了解WMI对象路径格式
我想编写一个与.NET类具有类似功能性的类。On是一组处理对象路径格式的文章。然而,我还不明白所有的特殊情况C# 了解WMI对象路径格式,c#,.net,regex,parsing,wmi,C#,.net,Regex,Parsing,Wmi,我想编写一个与.NET类具有类似功能性的类。On是一组处理对象路径格式的文章。然而,我还不明白所有的特殊情况 处理对象路径的字符串比较始终不区分大小写。==>查询对象实例时,这是否也适用于键的值 整数的十六进制常数。==>它们会发生在哪里?仅在键的值中 具有采用布尔值的键的类的布尔常量。==>常数是什么?对/错?0/1 具有部分命名空间路径的假定本地服务器。因此,指定根和默认名称空间意味着本地服务器上的根和默认名称空间。==>这是否仅仅意味着如果我没有指定服务器,那么就使用“.”作为服务器 元
- 处理对象路径的字符串比较始终不区分大小写。==>查询对象实例时,这是否也适用于键的值
- 整数的十六进制常数。==>它们会发生在哪里?仅在键的值中
- 具有采用布尔值的键的类的布尔常量。==>常数是什么?对/错?0/1
- 具有部分命名空间路径的假定本地服务器。因此,指定根和默认名称空间意味着本地服务器上的根和默认名称空间。==>这是否仅仅意味着如果我没有指定服务器,那么就使用“.”作为服务器
- 元素内或元素之间都没有空格。==>那么,为什么原始的.NET实现允许在服务器名称中使用空格呢
- 只有十进制值被识别为键的数字部分。==>
- 此页面上的所有内容:==>
\\Server\Namespace
\Namespace
\\Server\Namespace:Class
\Namespace:Class
Class
\\Server\Namespace:Class.KeyName=KeyValue
\Namespace:Class.KeyName=KeyValue
Class.KeyName=KeyValue
\\Server\Namespace:Class=KeyValue
\Namespace:Class=KeyValue
Class=KeyValue
\\Server\Namespace:Class.FirstKey=FirstValue,SecondKey=SecondValue
\Namespace:Class.FirstKey=FirstValue,SecondKey=SecondValue
Class.FirstKey=FirstValue,SecondKey=SecondValue
\\Server\Namespace:Class=@
\Namespace:Class=@
Class=@
as well as all combinations were the \\ is replaced by a // and/or the
\ between server and namespace is replaced by /
我忘了什么吗
这是可以从MSDN中提取的内容。但是,单个代币的外观如何?这就是我所想的可能是:
KeyValue = "string" <-- string
1 <-- numeric
0x1 <-- hex
?????????? <-- about the "decimal value" thing and
"embedded quitation mark" thing.
Also, what about whitespaces?
do they have to be abreviated by %20?
KeyName / Class / Server
= string without : or / or \ inside and maybe only [a-z0-9_] ?
Namespace
= string without : or / inside and maybe only [a-z0-9_\]
(.NET implementation also buggy here. accepts forward slashes regardless of
"You cannot use forward slashes within namespace names." on MSDN)
Also, are they allowed to start with \ and end with a : ?
KeyValue=“string”您可能可以看到类的名称,从而获得有用的信息
如果要测试字符串是否与正则表达式匹配,可以使用
祝你好运。你想让我们为你阅读MSDN,为你编写代码,还是两者兼而有之?.NET ManagementPath类有什么问题?我想在没有原始类可用的环境中编写一个类似于ManagementPath的类。因此,我需要了解WMI对象路径的确切规范是什么。正如我所说,ManagementPath类在某些方面存在缺陷,并且接受的输入肯定是不正确的。另外,正如你可能注意到的,MSDN已经被阅读,重要的信息被提取到了问题中。可能不是他希望得到的详细答案,而是他自己去那里的有价值的指针,尽管我真的很感谢有详细答案的人的跟进。