protected override void ForceJsonFileUpdate() { base.ForceJsonFileUpdate(); McMod mcMod = SessionContext.SelectedMod; CodeGenerationService.RegenerateInitScript(SourceCodeLocator.SoundEvents(mcMod.ModInfo.Name, mcMod.Organization).ClassName, mcMod, Explorer.Folders.Files); }
public void RegenerateSourceCode(McMod mcMod) { foreach (ScriptCodeGenerator generator in ReflectionHelper.EnumerateSubclasses <ScriptCodeGenerator>(false, mcMod)) { generator.RegenerateScript(); } }
public ScriptCodeGenerator(McMod mcMod) { McMod = mcMod; Modname = mcMod.ModInfo.Name; ModnameLower = Modname.ToLower(); Organization = mcMod.Organization; SourceRootPackageName = $"com.{Organization}.{ModnameLower}"; }
public void CreateCustomScript <T>(McMod mcMod, T element) { CustomScriptGenerator <T> generator = ReflectionHelper.EnumerateSubclasses <CustomScriptGenerator <T> >(false, mcMod, element).FirstOrDefault(); if (generator != null) { generator.RegenerateScript(); } }
protected void CreateCommand(object sender, ItemEditedEventArgs <Command> e) { if (e.Result) { McMod mod = SessionContext.SelectedMod; CodeGenerationService.CreateCustomScript(mod, e.ActualItem); } new FileInfo(tempFilePath).Delete(); }
public void Compile(McMod mcMod) { string modPath = ModPaths.ModRootFolder(mcMod.ModInfo.Name); ProcessStartInfo psi = new ProcessStartInfo { FileName = "CMD.EXE", Arguments = $"/K cd \"{modPath}\" & gradlew build" }; Process.Start(psi); }
public void RegenerateInitScript <T>(string className, McMod mcMod, IEnumerable <T> repository) { foreach (ScriptCodeGenerator generator in ReflectionHelper.EnumerateSubclasses <InitVariablesCodeGenerator <T> >(false, mcMod, repository)) { if (string.Compare(generator.ScriptLocator.ClassName, className) == 0) { generator.RegenerateScript(); break; } } }
public void RegenerateScript(string className, McMod mcMod) { foreach (ScriptCodeGenerator generator in ReflectionHelper.EnumerateSubclasses <ScriptCodeGenerator>(false, mcMod)) { if (string.Compare(generator.ScriptLocator.ClassName, className) == 0) { generator.RegenerateScript(); break; } } }
private void ToggleLaunchSelection(McMod mcMod) { bool isSelected = SessionContext.SelectedMods.Contains(mcMod); if (isSelected) { SessionContext.SelectedMods.Remove(mcMod); mcMod.PropertyChanged -= Mod_PropertyChanged; } else { SessionContext.SelectedMods.Add(mcMod); mcMod.PropertyChanged += Mod_PropertyChanged; } }
/// <summary> Run mod depends on mod.LanuchSetup </summary> public void Run(McMod mcMod) { switch (mcMod.LaunchSetup) { case LaunchSetup.Client: RunClient(mcMod); break; case LaunchSetup.Server: RunServer(mcMod); break; default: RunClient(mcMod); break; } }
/// <summary> Ignore LanuchSetup and run server for this mod </summary> public void RunServer(McMod mcMod) { string modPath = ModPaths.ModRootFolder(mcMod.ModInfo.Name); string eulaPath = Path.Combine(modPath, "run", "eula.txt"); FileInfo eulaFile = new FileInfo(eulaPath); if (!eulaFile.Exists) { eulaFile.Directory.Create(); string eulaMessage = $@"#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula). #{DateTime.UtcNow} eula = true"; File.WriteAllText(eulaPath, eulaMessage); } ProcessStartInfo psi = new ProcessStartInfo { FileName = "CMD.EXE", Arguments = $"/K cd \"{modPath}\" & gradlew runServer" }; Process.Start(psi); }
protected void RegenerateRecipes() { McMod mod = SessionContext.SelectedMod; CodeGenerationService.RegenerateInitScript(SourceCodeLocator.Recipes(mod.ModInfo.Name, mod.Organization).ClassName, mod, Explorer.Folders.Files[0].Files); }
public ItemBasesCodeGenerator(McMod mcMod) : base(mcMod) =>
private void RunSelectedMod(McMod mcMod) => modBuilder.Run(mcMod);
public ModelCodeGenerator(McMod mcMod) : base(mcMod) =>
public CustomCommandCodeGenerator(McMod mcMod, Command command) : base(mcMod, command) => ScriptLocator = SourceCodeLocator.CustomCommand(mcMod.ModInfo.Name, mcMod.Organization, command.ClassName);
// Writes to FmgModInfo file public static void ExportMod(ISerializer <McMod> serializer, McMod mcMod) => File.WriteAllText(ModPaths.FmgModInfoFile(mcMod.ModInfo.Name), serializer.Serialize(mcMod));
public CustomScriptGenerator(McMod mcMod, T element) : base(mcMod) => Element = element;
public CommandCodeGenerator(McMod mcMod) : this(mcMod, Enumerable.Empty <Command>()) { }
public BlockCodeGenerator(McMod mcMod, IEnumerable <Block> elements) : base(mcMod, elements) => ScriptLocator = SourceCodeLocator.Blocks(Modname, Organization);
public BlockCodeGenerator(McMod mcMod) : this(mcMod, Enumerable.Empty <Block>()) { }
public ModHookCodeGenerator(McMod mcMod) : base(mcMod) => ScriptLocator = SourceCodeLocator.Hook(mcMod.ModInfo.Name, mcMod.Organization);
protected override bool TryGetModFromPath(string path, out McMod mcMod) { mcMod = ModHelper.ImportMod(modSerializer, path); return(mcMod != null); }
public ProxyCodeGenerator(McMod mcMod) : base(mcMod) =>
public CommandCodeGenerator(McMod mcMod, IEnumerable <Command> elements) : base(mcMod, elements) => ScriptLocator = SourceCodeLocator.Commands(Modname, Organization);
public SoundCodeGenerator(McMod mcMod) : this(mcMod, Enumerable.Empty <SoundEvent>()) { }
public InitVariablesCodeGenerator(McMod mcMod, IEnumerable <T> elements = null) : base(mcMod) => Elements = elements;
public SoundCodeGenerator(McMod mcMod, IEnumerable <SoundEvent> elements) : base(mcMod, elements) => ScriptLocator = SourceCodeLocator.SoundEvents(Modname, Organization);
public ManagerCodeGenerator(McMod mcMod) : base(mcMod) => ScriptLocator = SourceCodeLocator.Manager(Modname, Organization);
public void RegenerateScript <TScriptGenerator>(McMod mcMod) where TScriptGenerator : IScriptCodeGenerator => ReflectionHelper.CreateInstance <TScriptGenerator>(mcMod).RegenerateScript();