public void UnmaintainRelease(string modName, FactorioVersion version, bool shouldDelete) { if (shouldDelete && modsStorageService.ReleaseIsStored(modName, version)) { Console.WriteLine($"Deleting {ReleaseData.GetFileName(modName, version)}."); modsStorageService.DiscardRelease(modName, version); } }
public async Task MaintainReleaseAsync(ReleaseData release) { if (!modsStorageService.ReleaseIsStored(release)) { Console.WriteLine($"Downloading {release.GetFileName()}."); var bytes = await DownloadReleaseAsync(release); modsStorageService.StoreRelease(release, bytes); } }
public void StoreRelease(ReleaseData release, byte[] bytes) { File.WriteAllBytes(Path.Combine(modsPath, release.GetFileName()), bytes); AddToAllStoredReleases(release.Mod.Name, release.Version); }
public void DiscardRelease(string modName, FactorioVersion version) { File.Delete(Path.Combine(modsPath, ReleaseData.GetFileName(modName, version))); RemoveFromAllStoredReleases(modName, version); }
public bool ReleaseIsStored(string modName, FactorioVersion version) { return(File.Exists(Path.Combine(modsPath, ReleaseData.GetFileName(modName, version)))); }