A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
861B

  1. using System.Text.RegularExpressions;
  2. using Mono.Cecil;
  3. Console.WriteLine("Starting assembly editing...");
  4. var fileRegex =
  5. new Regex(".*(Techblox|Gamecraft|RobocraftX|FullGame|RobocraftECS|DataLoader|RCX|GameState|Svelto\\.ECS)[^/]*(\\.dll)");
  6. foreach (var file in Directory.EnumerateFiles(@"../../../../../ref/Techblox_Data/Managed"))
  7. {
  8. if (!fileRegex.IsMatch(file)) continue;
  9. Console.WriteLine(file);
  10. ProcessAssembly(file);
  11. }
  12. void ProcessAssembly(string path)
  13. {
  14. using var mod = ModuleDefinition.ReadModule(path, new(ReadingMode.Immediate) { ReadWrite = true });
  15. foreach (var typeDefinition in mod.Types)
  16. {
  17. typeDefinition.IsPublic = true;
  18. foreach (var method in typeDefinition.Methods) method.IsPublic = true;
  19. foreach (var field in typeDefinition.Fields) field.IsPublic = true;
  20. }
  21. mod.Write();
  22. }