Skip to content

Commit

Permalink
refactor: reduce nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Dec 29, 2023
1 parent bdd7385 commit f7cdc92
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,31 +1207,31 @@ private void AddMod(IDownloadTask_GetVersion info) {
}
var modPath = Path.GetFileName(this.PenumbraModPath!);
if (this.Plugin.Penumbra.AddMod(modPath)) {
if (this._reinstall) {
this.Plugin.Penumbra.ReloadMod(modPath);
}
if (!this.Plugin.Penumbra.AddMod(modPath)) {
throw new Exception("could not add mod to Penumbra");
}
// put mod in folder
if (oldPath == null && !string.IsNullOrWhiteSpace(this.Plugin.Config.PenumbraFolder)) {
var modName = this.GenerateModName(info);
this.Plugin.Penumbra.SetModPath(modPath, $"{this.Plugin.Config.PenumbraFolder}/{modName}");
} else if (oldPath != null) {
this.Plugin.Penumbra.SetModPath(modPath, oldPath);
}
if (this._reinstall) {
this.Plugin.Penumbra.ReloadMod(modPath);
}
if (this._oldModName != null) {
this.Plugin.Penumbra.CopyModSettings(this._oldModName, modPath);
}
// put mod in folder
if (oldPath == null && !string.IsNullOrWhiteSpace(this.Plugin.Config.PenumbraFolder)) {
var modName = this.GenerateModName(info);
this.Plugin.Penumbra.SetModPath(modPath, $"{this.Plugin.Config.PenumbraFolder}/{modName}");
} else if (oldPath != null) {
this.Plugin.Penumbra.SetModPath(modPath, oldPath);
}
if (this.PenumbraCollection != null) {
this.Plugin.Penumbra.TrySetMod(this.PenumbraCollection, modPath, true);
}
if (this._oldModName != null) {
this.Plugin.Penumbra.CopyModSettings(this._oldModName, modPath);
}
this.StateData += 1;
} else {
throw new Exception("could not add mod to Penumbra");
if (this.PenumbraCollection != null) {
this.Plugin.Penumbra.TrySetMod(this.PenumbraCollection, modPath, true);
}
this.StateData += 1;
});
}

Expand Down

0 comments on commit f7cdc92

Please sign in to comment.