A fork of Eusth's IPA
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.

58 lines
2.4KB

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