/// <summary> /// Perform "methods" verb. /// </summary> /// <param name="options">Options</param> static void DoMethods(MonoOptions options) { ILogger logger = GetLogger(options); EazModule module; if (!TryLoadModule(options.AssemblyPath, logger, out module)) { return; } Devirtualizer devirtualizer = new Devirtualizer(module, options.MethodFixers, logger); var results = devirtualizer.Devirtualize((attempt) => { PrintAttempt(options, module, attempt); }); if (results.Empty) { Console.WriteLine("No virtualized methods found"); return; } Console.WriteLine("{0}/{1} method stubs devirtualizable", results.DevirtualizedCount, results.MethodCount); }
/// <summary> /// Perform "devirtualize" verb. /// </summary> /// <param name="options">Options</param> static void DoDevirtualize(MonoOptions options) { ILogger logger = GetLogger(options); EazModule module; if (!TryLoadModule(options.AssemblyPath, logger, out module)) { return; } // Setup devirtualize options var opts = DevirtualizeOptions.Nothing; if (options.InjectAttributes) { opts |= DevirtualizeOptions.InjectAttributes; } Devirtualizer devirtualizer = new Devirtualizer(module, opts, options.MethodFixers, logger); var results = devirtualizer.Devirtualize((attempt) => { if (attempt.Successful) { PrintAttempt(options, module, attempt); } }); if (results.Empty) { Console.WriteLine("No virtualized methods found"); return; } else if (!options.Verbose) { Console.WriteLine(); } Console.WriteLine("Devirtualized {0}/{1} methods", results.DevirtualizedCount, results.MethodCount); // Only save if at least one method devirtualized if (results.DevirtualizedCount > 0) { String outputPath = options.OutputPath ?? GetDevirtualizedModulePath(options.AssemblyPath); Console.WriteLine("Saving {0}", outputPath); module.Write(outputPath, options.NoThrow); } }
/// <summary> /// Perform "methods" verb. /// </summary> /// <param name="options">Options</param> static void DoMethods(MonoOptions options) { ILogger logger = GetLogger(options); EazModule module; if (!TryLoadModule(options.AssemblyPath, logger, out module)) return; Devirtualizer devirtualizer = new Devirtualizer(module, options.MethodFixers, logger); var results = devirtualizer.Devirtualize((attempt) => { PrintAttempt(options, module, attempt); }); if (results.Empty) { Console.WriteLine("No virtualized methods found"); return; } Console.WriteLine("{0}/{1} method stubs devirtualizable", results.DevirtualizedCount, results.MethodCount); }
/// <summary> /// Perform "devirtualize" verb. /// </summary> /// <param name="options">Options</param> static void DoDevirtualize(MonoOptions options) { ILogger logger = GetLogger(options); EazModule module; if (!TryLoadModule(options.AssemblyPath, logger, out module)) return; // Setup devirtualize options var opts = DevirtualizeOptions.Nothing; if (options.InjectAttributes) opts |= DevirtualizeOptions.InjectAttributes; Devirtualizer devirtualizer = new Devirtualizer(module, opts, options.MethodFixers, logger); var results = devirtualizer.Devirtualize((attempt) => { if (attempt.Successful) PrintAttempt(options, module, attempt); }); if (results.Empty) { Console.WriteLine("No virtualized methods found"); return; } else if (!options.Verbose) Console.WriteLine(); Console.WriteLine("Devirtualized {0}/{1} methods", results.DevirtualizedCount, results.MethodCount); // Only save if at least one method devirtualized if (results.DevirtualizedCount > 0) { String outputPath = options.OutputPath ?? GetDevirtualizedModulePath(options.AssemblyPath); Console.WriteLine("Saving {0}", outputPath); module.Write(outputPath, options.NoThrow); } }