Skip to content

Commit

Permalink
fix bug with Original Image Data File not being written correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
joyrider3774 committed Sep 4, 2021
1 parent 071eceb commit 569668b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OriginalImageDataFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class ImageDataFileModel

public bool LoadFromFile(string filename)
{
string ImageDataFile = Path.Combine(filename);
if (File.Exists(filename))
{
Data = Serialization.FromJsonFile<ImageDataFileModel>(filename);
Expand Down Expand Up @@ -65,8 +64,11 @@ public void SaveToFile(string filename, HtmlExporterPluginSettings SettingsUsed)
Data.ImageOptionsString = SettingsUsed.ConvertImageOptions.GetUniqueString();
Data.ExportPath = SettingsUsed.OutputFolder;
Directory.CreateDirectory(Path.GetDirectoryName(filename));
FileStream fs = File.OpenWrite(filename);
Serialization.ToJsonSteam(Data, fs, true);
var fileMode = File.Exists(filename) ? FileMode.Truncate : FileMode.CreateNew;
using (FileStream fs = File.Open(filename, fileMode, FileAccess.Write, FileShare.None))
{
Serialization.ToJsonSteam(Data, fs, true);
}
}
}
}

0 comments on commit 569668b

Please sign in to comment.