解决在反编译中出现中文字符都表示成16进制Unicode的形式



在vs.net 2003中打开[Tools]-[macros]-[macros explorer]
然后将下面的代码copy-paste 进去
代开你要转换的cs文件,在mymacros form中单击dubug就可以了

 1 None.gif Imports  EnvDTE
 2 None.gif Imports  System.Globalization
 3 None.gif Imports  System.Text.RegularExpressions
 4 None.gif Imports  System.Diagnostics
 5 ExpandedBlockStart.gifContractedBlock.gif Public   Module Birdshome Module Birdshome
 6ExpandedSubBlockStart.gifContractedSubBlock.gif    Sub Unicode2Character()Sub Unicode2Character()
 7InBlock.gif        Dim doc As Document = DTE.ActiveDocument
 8InBlock.gif        Dim docText As TextDocument = doc.Object
 9InBlock.gif        Dim selText As TextSelection = docText.Selection()
10InBlock.gif        selText.SelectAll()
11InBlock.gif        Dim text As String = selText.Text
12InBlock.gif        Dim iLength As Integer
13InBlock.gif        Do
14InBlock.gif            iLength = text.Length
15InBlock.gif            Dim m As Match
16InBlock.gif            Dim strPattern As String = "(?\\u[A-F0-9]{4})"
17InBlock.gif            m = Regex.Match(text, strPattern, RegexOptions.IgnoreCase)
18InBlock.gif            If m.Success Then
19InBlock.gif                Dim strValue As String
20InBlock.gif                strValue = m.Groups("code").Value
21InBlock.gif                text = text.Replace(strValue, "")
22InBlock.gif                Dim int As Integer
23InBlock.gif                int = System.Int32.Parse(strValue.Substring(24), NumberStyles.HexNumber)
24InBlock.gif                Dim ch As Char = ChrW(int)
25InBlock.gif                docText.ReplacePattern(strValue, ch)
26InBlock.gif            Else
27InBlock.gif                Exit Do
28InBlock.gif            End If
29InBlock.gif            If Not text.Length < iLength Then
30InBlock.gif                Exit Do
31InBlock.gif            End If
32InBlock.gif        Loop
33InBlock.gif        selText.StartOfDocument()
34ExpandedSubBlockEnd.gif    End Sub

35ExpandedBlockEnd.gifEnd Module

36 None.gif


一切就都搞定了

希望能给大家提供一些帮助

你可能感兴趣的:(解决在反编译中出现中文字符都表示成16进制Unicode的形式)