mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-06 17:15:42 -08:00
Catch errors in writing image
This commit is contained in:
@@ -339,8 +339,12 @@ public class Setup {
|
||||
g.DrawImageUnscaledAndClipped(img, new Rectangle(Point.Empty, img.Size));
|
||||
}
|
||||
try {
|
||||
bmp.Save(newName, ImageFormat.Bmp);
|
||||
} catch {
|
||||
var ms = new MemoryStream();
|
||||
bmp.Save(ms, ImageFormat.Bmp);
|
||||
var bytes = ms.ToArray();
|
||||
File.WriteAllBytes(newName, bytes);
|
||||
} catch (Exception e) {
|
||||
Log($"InstallImageFile failed: {e.ToString()}");
|
||||
throw new SetupException($"Failed to install image {name} to {newName}.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user