Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm authored and dgrunwald committed Jun 29, 2014
1 parent c1fb133 commit db1d106
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ILSpy.BamlDecompiler/CecilTypeResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ string MakeShort(string name)

public IType GetTypeByAssemblyQualifiedName(string name)
{
int comma = name.IndexOf(',');
int bracket = name.LastIndexOf(']');
int comma = bracket > -1 ? name.IndexOf(',', bracket) : name.IndexOf(',');

if (comma == -1)
throw new ArgumentException("invalid name");
string fullName = name.Substring(0, comma);

string fullName = bracket > -1 ? name.Substring(0, name.IndexOf('[')) : name.Substring(0, comma);
string assemblyName = name.Substring(comma + 1).Trim();

var type = thisAssembly.MainModule.GetType(fullName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public ResolverTypeDeclaration(ITypeResolver resolver, string assemblyQualifiedN

void ParseName(string assemblyQualifiedName, out string name, out string @namespace, out string assembly)
{
int commaSeparator = assemblyQualifiedName.IndexOf(", ");
int bracket = assemblyQualifiedName.LastIndexOf(']');
int commaSeparator = bracket > -1 ? assemblyQualifiedName.IndexOf(", ", bracket) : assemblyQualifiedName.IndexOf(", ");
assembly = "";
if (commaSeparator >= 0) {
assembly = assemblyQualifiedName.Substring(commaSeparator + 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ void ReadContentProperty()
{
reader.ReadInt16();

// Non serve aprire niente, è il default
// Non serve aprire niente, ?il default
}

static void ReadConstructorParametersStart()
Expand Down Expand Up @@ -1588,7 +1588,8 @@ void ReadTypeInfo()
string fullName = reader.ReadString();
assemblyId = (short)(assemblyId & 0xfff);
TypeDeclaration declaration;
int length = fullName.LastIndexOf('.');
int bracket = fullName.IndexOf('[');
int length = bracket > -1 ? fullName.LastIndexOf('.', bracket) : fullName.LastIndexOf('.');
if (length != -1)
{
string name = fullName.Substring(length + 1);
Expand Down

0 comments on commit db1d106

Please sign in to comment.