Update Resources.cs

This commit is contained in:
pointfeev 2023-01-29 20:38:34 -05:00
parent 36570420a4
commit 720a28ead5

View file

@ -439,16 +439,17 @@ internal static class Resources
internal static void WriteManifestResource(this string resourceIdentifier, string filePath) internal static void WriteManifestResource(this string resourceIdentifier, string filePath)
{ {
using Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("CreamInstaller.Resources." + resourceIdentifier);
while (!Program.Canceled) while (!Program.Canceled)
try try
{ {
using Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream("CreamInstaller.Resources." + resourceIdentifier);
using FileStream file = new(filePath, FileMode.Create, FileAccess.Write); using FileStream file = new(filePath, FileMode.Create, FileAccess.Write);
resource?.CopyTo(file); resource?.CopyTo(file);
break;
} }
catch catch
{ {
if (filePath.IOWarn("Failed to write a crucial manifest resource") is not DialogResult.OK) if (filePath.IOWarn("Failed to write a crucial manifest resource (" + resourceIdentifier + ")") is not DialogResult.OK)
break; break;
} }
} }
@ -460,6 +461,7 @@ internal static class Resources
{ {
using FileStream fileStream = new(filePath, FileMode.Create, FileAccess.Write); using FileStream fileStream = new(filePath, FileMode.Create, FileAccess.Write);
fileStream.Write(resource); fileStream.Write(resource);
break;
} }
catch catch
{ {