Browse Source

Add support for 'windowsruntime' IL keyword.

pull/320/merge
Daniel Grunwald 14 years ago
parent
commit
92400e0f1a
  1. 11
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  2. 2
      ILSpy/Languages/Language.cs
  3. 2
      ILSpy/LoadedAssembly.cs
  4. 2
      ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
  5. 1
      Mono.Cecil/Mono.Cecil/AssemblyFlags.cs
  6. 5
      Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs
  7. 1
      Mono.Cecil/Mono.Cecil/TypeAttributes.cs
  8. 5
      Mono.Cecil/Mono.Cecil/TypeDefinition.cs

11
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -809,6 +809,7 @@ namespace ICSharpCode.Decompiler.Disassembler
{ TypeAttributes.SpecialName, "specialname" },
{ TypeAttributes.Import, "import" },
{ TypeAttributes.Serializable, "serializable" },
{ TypeAttributes.WindowsRuntime, "windowsruntime" },
{ TypeAttributes.BeforeFieldInit, "beforefieldinit" },
{ TypeAttributes.HasSecurity, null },
};
@ -1075,7 +1076,10 @@ namespace ICSharpCode.Decompiler.Disassembler
public void WriteAssemblyHeader(AssemblyDefinition asm)
{
output.Write(".assembly " + DisassemblerHelpers.Escape(asm.Name.Name));
output.Write(".assembly ");
if (asm.Name.IsWindowsRuntime)
output.Write("windowsruntime ");
output.Write(DisassemblerHelpers.Escape(asm.Name.Name));
OpenBlock(false);
WriteAttributes(asm.CustomAttributes);
WriteSecurityDeclarations(asm);
@ -1103,7 +1107,10 @@ namespace ICSharpCode.Decompiler.Disassembler
output.WriteLine(".module extern {0}", DisassemblerHelpers.Escape(mref.Name));
}
foreach (var aref in module.AssemblyReferences) {
output.Write(".assembly extern {0}", DisassemblerHelpers.Escape(aref.Name));
output.Write(".assembly extern ");
if (aref.IsWindowsRuntime)
output.Write("windowsruntime ");
output.Write(DisassemblerHelpers.Escape(aref.Name));
OpenBlock(false);
if (aref.PublicKeyToken != null) {
output.Write(".publickeytoken = ");

2
ILSpy/Languages/Language.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.ILSpy
{
WriteCommentLine(output, assembly.FileName);
var name = assembly.AssemblyDefinition.Name;
if ((name.Attributes & (AssemblyAttributes)0x0200) != 0) {
if (name.IsWindowsRuntime) {
WriteCommentLine(output, name.Name + " [WinRT]");
} else {
WriteCommentLine(output, name.FullName);

2
ILSpy/LoadedAssembly.cs

@ -181,7 +181,7 @@ namespace ICSharpCode.ILSpy
{
if (name == null)
throw new ArgumentNullException("name");
if ((name.Attributes & (AssemblyAttributes)0x0200) != 0) {
if (name.IsWindowsRuntime) {
return assemblyList.winRTMetadataLookupCache.GetOrAdd(name.Name, LookupWinRTMetadata);
} else {
return assemblyList.assemblyLookupCache.GetOrAdd(name.FullName, LookupReferencedAssemblyInternal);

2
ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs

@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
if ((r.Attributes & (AssemblyAttributes)0x0200) != 0) {
if (r.IsWindowsRuntime) {
language.WriteCommentLine(output, r.Name + " [WinRT]");
} else {
language.WriteCommentLine(output, r.FullName);

1
Mono.Cecil/Mono.Cecil/AssemblyFlags.cs

@ -35,6 +35,7 @@ namespace Mono.Cecil {
PublicKey = 0x0001,
SideBySideCompatible = 0x0000,
Retargetable = 0x0100,
WindowsRuntime = 0x0200,
DisableJITCompileOptimizer = 0x4000,
EnableJITCompileTracking = 0x8000,
}

5
Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs

@ -92,6 +92,11 @@ namespace Mono.Cecil {
set { attributes = attributes.SetAttributes ((uint) AssemblyAttributes.Retargetable, value); }
}
public bool IsWindowsRuntime {
get { return attributes.GetAttributes ((uint) AssemblyAttributes.WindowsRuntime); }
set { attributes = attributes.SetAttributes ((uint) AssemblyAttributes.WindowsRuntime, value); }
}
public byte [] PublicKey {
get { return public_key; }
set {

1
Mono.Cecil/Mono.Cecil/TypeAttributes.cs

@ -62,6 +62,7 @@ namespace Mono.Cecil {
// Implementation attributes
Import = 0x00001000, // Class/Interface is imported
Serializable = 0x00002000, // Class is serializable
WindowsRuntime = 0x00004000, // Windows Runtime type
// String formatting attributes
StringFormatMask = 0x00030000, // Use this mask to retrieve string information for native interop

5
Mono.Cecil/Mono.Cecil/TypeDefinition.cs

@ -389,6 +389,11 @@ namespace Mono.Cecil {
set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Serializable, value); }
}
public bool IsWindowsRuntime {
get { return attributes.GetAttributes ((uint) TypeAttributes.WindowsRuntime); }
set { attributes = attributes.SetAttributes ((uint) TypeAttributes.WindowsRuntime, value); }
}
public bool IsAnsiClass {
get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass); }
set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass, value); }

Loading…
Cancel
Save