|
12 | 12 | using MethodAttributes = dnlib.DotNet.MethodAttributes;
|
13 | 13 | using MethodImplAttributes = dnlib.DotNet.MethodImplAttributes;
|
14 | 14 | using TypeAttributes = dnlib.DotNet.TypeAttributes;
|
| 15 | +using InformationalAttribute = System.Reflection.AssemblyInformationalVersionAttribute; |
| 16 | +using ProductAttribute = System.Reflection.AssemblyProductAttribute; |
| 17 | +using CopyrightAttribute = System.Reflection.AssemblyCopyrightAttribute; |
15 | 18 |
|
16 | 19 | namespace Confuser.Core {
|
17 | 20 | /// <summary>
|
18 | 21 | /// The processing engine of Confuser.
|
19 | 22 | /// </summary>
|
20 | 23 | public static class ConfuserEngine {
|
| 24 | + public static readonly string Version; |
| 25 | + static readonly string Copyright; |
| 26 | + static ConfuserEngine() |
| 27 | + { |
| 28 | + var assembly = typeof(ConfuserEngine).Assembly; |
| 29 | + var nameAttr = (ProductAttribute)assembly.GetCustomAttributes(typeof(ProductAttribute), false)[0]; |
| 30 | + var verAttr = (InformationalAttribute)assembly.GetCustomAttributes(typeof(InformationalAttribute), false)[0]; |
| 31 | + var cpAttr = (CopyrightAttribute)assembly.GetCustomAttributes(typeof(CopyrightAttribute), false)[0]; |
| 32 | + Version = string.Format("{0} {1}", nameAttr.Product, verAttr.InformationalVersion); |
| 33 | + Copyright = cpAttr.Copyright; |
| 34 | + } |
| 35 | + |
21 | 36 | /// <summary>
|
22 | 37 | /// Runs the engine with the specified parameters.
|
23 | 38 | /// </summary>
|
@@ -268,7 +283,7 @@ private static void Inspection(ConfuserContext context) {
|
268 | 283 | marker.Mark(ctor);
|
269 | 284 |
|
270 | 285 | var attr = new CustomAttribute(ctor);
|
271 |
| - attr.ConstructorArguments.Add(new CAArgument(module.CorLibTypes.String, "ConfuserEx 0.1")); |
| 286 | + attr.ConstructorArguments.Add(new CAArgument(module.CorLibTypes.String, Version)); |
272 | 287 |
|
273 | 288 | module.CustomAttributes.Add(attr);
|
274 | 289 | }
|
@@ -348,7 +363,7 @@ private static void PrintInfo(ConfuserContext context) {
|
348 | 363 | context.Logger.Info("Protecting packer stub...");
|
349 | 364 | }
|
350 | 365 | else {
|
351 |
| - context.Logger.Info("ConfuserEx v0.1 Copyright (C) Ki 2014"); |
| 366 | + context.Logger.InfoFormat("{0} {1}", Version, Copyright); |
352 | 367 |
|
353 | 368 | Type mono = Type.GetType("Mono.Runtime");
|
354 | 369 | context.Logger.InfoFormat("Running on {0}, {1}, {2} bits",
|
|
0 commit comments