Fix PNGToPNG writing in a bad way

Fixes #125
This commit is contained in:
jvyden 2022-01-22 21:11:31 -05:00
parent 31ad1ccfcd
commit 22382efe52
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 4 additions and 3 deletions

View file

@ -76,6 +76,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DDS/@EntryIndexedValue">DDS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DLC/@EntryIndexedValue">DLC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JPG/@EntryIndexedValue">JPG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LBP/@EntryIndexedValue">LBP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MM/@EntryIndexedValue">MM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NAT/@EntryIndexedValue">NAT</s:String>

View file

@ -28,7 +28,7 @@ public static class ImageHelper
return type switch
{
LbpFileType.Texture => TextureToPNG(hash, reader),
LbpFileType.Png => PNGToPNG(hash),
LbpFileType.Png => PNGToPNG(hash, data),
LbpFileType.Jpeg => JPGToPNG(hash, data),
_ => false,
};
@ -114,9 +114,9 @@ public static class ImageHelper
// it sounds dumb i know but hear me out:
// you're completely correct
private static bool PNGToPNG(string hash)
private static bool PNGToPNG(string hash, byte[] data)
{
File.Copy(FileHelper.GetResourcePath(hash), $"png/{hash}.png");
File.WriteAllBytes($"png/{hash}.png", data);
return true;
}
}