您的位置:首页 > 其它

reflector的中文支持方法

2007-02-12 16:14 459 查看
本来想找个插件,但发现了这个

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!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: