Browse Source

fix conflict in Escape/UnescapeTypeName

newNRILSpyDebugger
Siegfried Pammer 12 years ago
parent
commit
a53f674b3b
  1. 7
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs

7
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -144,8 +145,7 @@ namespace ICSharpCode.ILSpyAddIn
{ {
if (typeName == null) if (typeName == null)
throw new ArgumentNullException("typeName"); throw new ArgumentNullException("typeName");
typeName = typeName.Replace("_", "__"); foreach (var ch in new[] { '_' }.Concat(Path.GetInvalidFileNameChars())) {
foreach (var ch in Path.GetInvalidFileNameChars()) {
typeName = typeName.Replace(ch.ToString(), string.Format("_{0:X4}", (int)ch)); typeName = typeName.Replace(ch.ToString(), string.Format("_{0:X4}", (int)ch));
} }
return typeName; return typeName;
@ -157,10 +157,9 @@ namespace ICSharpCode.ILSpyAddIn
{ {
if (typeName == null) if (typeName == null)
throw new ArgumentNullException("typeName"); throw new ArgumentNullException("typeName");
foreach (var ch in Path.GetInvalidFileNameChars()) { foreach (var ch in Path.GetInvalidFileNameChars().Concat(new[] { '_' })) {
typeName = unescapeRegex.Replace(typeName, m => ((char)int.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber)).ToString()); typeName = unescapeRegex.Replace(typeName, m => ((char)int.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber)).ToString());
} }
typeName = typeName.Replace("__", "_");
return typeName; return typeName;
} }

Loading…
Cancel
Save