本来想找个插件,但发现了这个
Reflector是我目前用的最多的反编译工具,他可能不时最好的,但以它的更新速度,我相信他会成为最好的哦
~~
国外的软件,对中文支持还是有问题,虽然我们都Unicode了,可是老外还是不一定认账。Reflector反编译代码,Unicode中非英文的字符都显示为了/u????,这本来还是对的,可是我们看起来就太郁闷了
。Reflector支持Plug-in,曾经想写个插件,结果要了解的东西太多,就放弃了。不过问题也解决了,用VS.NET带的宏,haha
转换前的代码,谁能看懂写的啥呀@_@?

不要担心,转换后的代码就成了:

VS.NET 宏代码,名称:Unicode2Character
Imports EnvDTE
Imports System.Globalization
Imports System.Text.RegularExpressions
Imports System.Diagnostics

Public Module BirdshomeModule Birdshome

Sub Unicode2Character()Sub Unicode2Character()
Dim doc As Document = DTE.ActiveDocument
Dim docText As TextDocument = doc.Object
Dim selText As TextSelection = docText.Selection()
selText.SelectAll()
Dim text As String = selText.Text
Dim iLength As Integer
Do
iLength = text.Length
Dim m As Match
Dim strPattern As String = "(?<code>//u[A-F0-9]{4})"
m = Regex.Match(text, strPattern, RegexOptions.IgnoreCase)
If m.Success Then
Dim strValue As String
strValue = m.Groups("code").Value
text = text.Replace(strValue, "")
Dim int As Integer
int = System.Int32.Parse(strValue.Substring(2, 4), NumberStyles.HexNumber)
Dim ch As Char = ChrW(int)
docText.ReplacePattern(strValue, ch)
Else
Exit Do
End If
If Not text.Length < iLength Then
Exit Do
End If
Loop
selText.StartOfDocument()
End Sub
End Module
enjoy it!
本文介绍了一种使用Visual Studio.NET宏解决Reflector反编译工具处理Unicode字符串时遇到的问题的方法。通过提供的宏代码,可以将代码中的Unicode转义序列转换为实际的字符,改善了阅读体验。
529

被折叠的 条评论
为什么被折叠?



