弥补Reflector对中文支持的不足

Reflector是常用反编译工具,但对中文支持有问题,反编译代码中Unicode中非英文的字符显示为/u????。虽其支持Plug - in,但因要了解的东西多,写插件的想法放弃。最终用VS.NET带的宏解决了该问题。

弥补Reflector对中文支持的不足

    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 Birdshome

    
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(24), 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!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值