From 262097f63114fc167f545e32ac230f39b64bdaf7 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 20 Sep 2017 19:25:37 +0100 Subject: [PATCH] WinGui: Tidy up some warnings that you get when you import WinGui presets into the CLI. #906 --- .../Interop/HandBrakePresetService.cs | 2 +- .../Services/Presets/Factories/JsonPresetFactory.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs index adc9bcbd6..ae3387006 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs @@ -91,7 +91,7 @@ namespace HandBrake.ApplicationServices.Interop /// public static void ExportPreset(string filename, PresetTransportContainer container) { - string preset = JsonConvert.SerializeObject(container, Formatting.Indented); + string preset = JsonConvert.SerializeObject(container, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); using (StreamWriter writer = new StreamWriter(filename)) { writer.Write(preset); diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index b3d138efd..4acbc4c63 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -657,7 +657,7 @@ namespace HandBrakeWPF.Services.Presets.Factories // Video preset.VideoEncoder = EnumHelper.GetShortName(export.Task.VideoEncoder); - preset.VideoFramerate = export.Task.Framerate.ToString(); + preset.VideoFramerate = export.Task.Framerate.HasValue ? export.Task.Framerate.ToString() : null; preset.VideoFramerateMode = EnumHelper.GetShortName(export.Task.FramerateMode); preset.VideoGrayScale = export.Task.Grayscale; preset.VideoLevel = export.Task.VideoLevel != null ? export.Task.VideoLevel.ShortName : null; -- 2.40.0