Skip to content

Commit

Permalink
fix: get embedded resources correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Mar 21, 2024
1 parent 3f1d05a commit 6f228f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,18 +1458,18 @@ internal static bool IsDone(this State state) {
};
}

internal static string IconFileName(this State state) {
internal static Stream GetIconStream(this State state) {
return state switch {
State.NotStarted => "clock",
State.DownloadingPackageInfo => "magnifying-glass",
State.CheckingExistingFiles => "hard-drives",
State.DownloadingFiles => "cloud-arrow-down",
State.ConstructingModPack => "package",
State.AddingMod => "file-plus",
State.RemovingOldFiles => "trash-simple",
State.Finished => "check",
State.Errored => "warning",
State.Cancelled => "prohibit-inset",
State.NotStarted => Resourcer.Resource.AsStream("Heliosphere.Resources.clock.png"),
State.DownloadingPackageInfo => Resourcer.Resource.AsStream("Heliosphere.Resources.magnifying-glass.png"),
State.CheckingExistingFiles => Resourcer.Resource.AsStream("Heliosphere.Resources.hard-drives.png"),
State.DownloadingFiles => Resourcer.Resource.AsStream("Heliosphere.Resources.cloud-arrow-down.png"),
State.ConstructingModPack => Resourcer.Resource.AsStream("Heliosphere.Resources.package.png"),
State.AddingMod => Resourcer.Resource.AsStream("Heliosphere.Resources.file-plus.png"),
State.RemovingOldFiles => Resourcer.Resource.AsStream("Heliosphere.Resources.trash-simple.png"),
State.Finished => Resourcer.Resource.AsStream("Heliosphere.Resources.check.png"),
State.Errored => Resourcer.Resource.AsStream("Heliosphere.Resources.warning.png"),
State.Cancelled => Resourcer.Resource.AsStream("Heliosphere.Resources.prohibit-inset.png"),
_ => throw new ArgumentOutOfRangeException(nameof(state), state, null),
};
}
Expand Down
2 changes: 1 addition & 1 deletion Ui/NotificationProgressManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal NotificationProgressManager(Plugin plugin) {

foreach (var state in Enum.GetValues<State>()) {
try {
using var stream = Resourcer.Resource.AsStream($"{state.IconFileName()}.png");
using var stream = state.GetIconStream();
using var memory = new MemoryStream();
stream.CopyTo(memory);
var img = this.Plugin.Interface.UiBuilder.LoadImage(memory.ToArray());
Expand Down

0 comments on commit 6f228f7

Please sign in to comment.