Skip to content

Commit

Permalink
Fix not restoring images of restored states
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSmugleaf committed Nov 2, 2023
1 parent 085e7ff commit da670af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SpaceWizards.RsiLib/RSI/Rsi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void SaveImagesToFolder(string rsiFolder)
var image = state.GetFullImage(Size);
var path = Path.Combine(rsiFolder, $"{state.Name}.png");

if (state.ImagePath == null)
if (state.ImagePath == null || !File.Exists(state.ImagePath))
{
image.SaveAsPng(path);
}
Expand Down
8 changes: 4 additions & 4 deletions SpaceWizards.RsiLib/RSI/RsiState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public RsiState() : this("", DirectionType.None, null, null, null)
public List<List<float>>? Delays { get; set; }

public Dictionary<string, object>? Flags { get; set; }

/// <summary>
/// The path of the image to be copied when saving this state.
/// </summary>
Expand Down Expand Up @@ -175,7 +175,7 @@ public void LoadGif(Image<Rgba32> image)
DelayLength = image.Frames.Count;
Delays = new List<List<float>> { new() };
Frames = new Image<Rgba32>[8, DelayLength];

for (var frame = 0; frame < DelayLength; frame++)
{
var frameImage = image.Frames.CloneFrame(frame);
Expand All @@ -186,7 +186,7 @@ public void LoadGif(Image<Rgba32> image)
Frames[0, frame] = frameImage;
}
}

public void LoadImage(Image<Rgba32> image, RsiSize size)
{
var currentX = 0;
Expand Down Expand Up @@ -221,4 +221,4 @@ public void Dispose()

Array.Clear(Frames, 0, Frames.Length);
}
}
}

0 comments on commit da670af

Please sign in to comment.