Skip to content

Commit e30abb1

Browse files
committed
feat(mod): add MuMod install/delete endpoints
1 parent 53f0864 commit e30abb1

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

MaiChartManager/Controllers/Mod/InstallationController.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,49 @@ public async Task InstallAquaMaiOnline(InstallAquaMaiOnlineDto req)
290290
throw new InvalidOperationException("Failed to download AquaMai from all urls", lastException);
291291
}
292292

293+
[HttpPost]
294+
public async Task InstallMuMod()
295+
{
296+
CopyFile(ModPaths.MuModDllBuiltinPath, ModPaths.MuModDllInstalledPath);
297+
298+
if (System.IO.File.Exists(ModPaths.AquaMaiDllInstalledPath))
299+
{
300+
System.IO.File.Delete(ModPaths.AquaMaiDllInstalledPath);
301+
}
302+
303+
if (!System.IO.File.Exists(ModPaths.MuModConfigPath))
304+
{
305+
System.IO.File.WriteAllText(ModPaths.MuModConfigPath, "Channel = \"slow\"\nCachePath = \"LocalAssets\\\\MuMod.cache\"\n");
306+
}
307+
308+
try
309+
{
310+
await muModService.EnsureCache(CancellationToken.None);
311+
}
312+
catch (Exception e)
313+
{
314+
logger.LogError(e, "Failed to download MuMod cache during install, but DLL was installed successfully");
315+
}
316+
}
317+
318+
[HttpPost]
319+
public void DeleteAquaMai()
320+
{
321+
if (System.IO.File.Exists(ModPaths.AquaMaiDllInstalledPath))
322+
{
323+
FileSystem.DeleteFile(ModPaths.AquaMaiDllInstalledPath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
324+
}
325+
}
326+
327+
[HttpPost]
328+
public void DeleteMuMod()
329+
{
330+
if (System.IO.File.Exists(ModPaths.MuModDllInstalledPath))
331+
{
332+
FileSystem.DeleteFile(ModPaths.MuModDllInstalledPath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
333+
}
334+
}
335+
293336
[HttpPost]
294337
public void KillGameProcess()
295338
{

0 commit comments

Comments
 (0)