Cardlife mod patcher
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.

PatchContext.cs 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Text;
  7. namespace IPA
  8. {
  9. public class PatchContext
  10. {
  11. /// <summary>
  12. /// Gets the filename of the executable.
  13. /// </summary>
  14. public string Executable { get; private set; }
  15. /// <summary>
  16. /// Gets the path to the launcher executable (in the IPA folder)
  17. /// </summary>
  18. public string LauncherPathSrc { get; private set; }
  19. public string DataPathSrc { get; private set; }
  20. public string PluginsFolder { get; private set; }
  21. public string ProjectName { get; private set; }
  22. public string DataPathDst { get; private set; }
  23. public string ManagedPath { get; private set; }
  24. public string EngineFile { get; private set; }
  25. public string AssemblyFile { get; private set; }
  26. public string[] Args { get; private set; }
  27. public string ProjectRoot { get; private set; }
  28. public string IPARoot { get; private set; }
  29. public string ShortcutPath { get; private set; }
  30. public string IPA { get; private set; }
  31. private PatchContext() { }
  32. public static PatchContext Create(String[] args)
  33. {
  34. var context = new PatchContext();
  35. context.Args = args;
  36. context.Executable = args[0];
  37. context.ProjectRoot = Path.GetDirectoryName(context.Executable);
  38. context.IPARoot = Path.Combine(context.ProjectRoot, "IPA");
  39. context.IPA = Assembly.GetExecutingAssembly().Location ?? Path.Combine(context.ProjectRoot, "IPA.exe");
  40. context.LauncherPathSrc = Path.Combine(context.IPARoot, "Launcher.exe");
  41. context.DataPathSrc = Path.Combine(context.IPARoot, "Data");
  42. context.PluginsFolder = Path.Combine(context.ProjectRoot, "Plugins");
  43. context.ProjectName = Path.GetFileNameWithoutExtension(context.Executable);
  44. context.DataPathDst = Path.Combine(context.ProjectRoot, context.ProjectName + "_Data");
  45. context.ManagedPath = Path.Combine(context.DataPathDst, "Managed");
  46. context.EngineFile = Path.Combine(context.ManagedPath, "UnityEngine.dll");
  47. context.AssemblyFile = Path.Combine(context.ManagedPath, "Assembly-Csharp.dll");
  48. string shortcutName = string.Format("{0} (Patch & Launch)", context.ProjectName);
  49. context.ShortcutPath = Path.Combine(context.ProjectRoot, shortcutName) + ".lnk";
  50. return context;
  51. }
  52. }
  53. }