Welcome to mirror list, hosted at ThFree Co, Russian Federation.

asmref.cs « tools - github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 909e6f4da962ccaacfe608a1714586a3008ac9a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.IO;
using System.Reflection;
using System.Text;

class asmref
{
  static void Main(string[] args)
  {
    foreach(string s in args)
    {
      AssemblyName asm;
      if(File.Exists(s))
      {
        asm = Assembly.LoadFile(new FileInfo(s).FullName).GetName();
      }
      else
      {
        asm = Assembly.LoadWithPartialName(s).GetName();
      }

      Console.WriteLine(".assembly extern {0}", asm.Name);
      Console.WriteLine("{");
      if(asm.GetPublicKeyToken() != null)
      {
        StringBuilder sb = new StringBuilder();
        foreach(byte b in asm.GetPublicKeyToken())
        {
          sb.AppendFormat("{0:X2} ", b);
        }
        Console.WriteLine("  .publickeytoken = ({0})", sb.ToString());
      }
      Version v = asm.Version;
      Console.WriteLine("  .ver {0}:{1}:{2}:{3}", v.Major, v.Minor, v.Build, v.Revision);
      Console.WriteLine("}");
    }
  }
}