Model: Don't crash on obfuscated assembly or namespace strings
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection {
|
namespace Il2CppInspector.Reflection {
|
||||||
public class Assembly
|
public class Assembly
|
||||||
@@ -49,7 +50,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
|
|
||||||
// Get full assembly name
|
// Get full assembly name
|
||||||
var nameDef = AssemblyDefinition.aname;
|
var nameDef = AssemblyDefinition.aname;
|
||||||
var name = Model.Package.Strings[nameDef.nameIndex];
|
var name = Regex.Replace(Model.Package.Strings[nameDef.nameIndex], @"[^A-Za-z0-9_\-\.()]", "");
|
||||||
var culture = Model.Package.Strings[nameDef.cultureIndex];
|
var culture = Model.Package.Strings[nameDef.cultureIndex];
|
||||||
if (string.IsNullOrEmpty(culture))
|
if (string.IsNullOrEmpty(culture))
|
||||||
culture = "neutral";
|
culture = "neutral";
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection
|
namespace Il2CppInspector.Reflection
|
||||||
{
|
{
|
||||||
@@ -739,7 +740,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
|
|
||||||
Definition = pkg.TypeDefinitions[typeIndex];
|
Definition = pkg.TypeDefinitions[typeIndex];
|
||||||
Index = typeIndex;
|
Index = typeIndex;
|
||||||
Namespace = pkg.Strings[Definition.namespaceIndex];
|
Namespace = Regex.Replace(pkg.Strings[Definition.namespaceIndex], @"[^A-Za-z0-9_\-\.<>{}]", "");
|
||||||
Name = pkg.Strings[Definition.nameIndex];
|
Name = pkg.Strings[Definition.nameIndex];
|
||||||
|
|
||||||
// Nested type?
|
// Nested type?
|
||||||
|
|||||||
Reference in New Issue
Block a user