From ce9543f4b6ac63f413287081d5ee4bd1ab14f56b Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 26 Mar 2016 19:09:12 +0000 Subject: WinGui: Add a new JSON file type to the queue export functionality. This exports the standardised JSON format that can be imported into the CLI. Note, the GUI can not yet import the JSON formatted queue file. The old hbq format is still there for that. --- win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index e3dccd32c..3ad23d605 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -12,6 +12,7 @@ namespace HandBrakeWPF.ViewModels using System; using System.Collections.Generic; using System.ComponentModel; + using System.IO; using System.Linq; using System.Windows; @@ -332,14 +333,22 @@ namespace HandBrakeWPF.ViewModels { SaveFileDialog dialog = new SaveFileDialog { - Filter = "HandBrake Queue Files (*.hbq)|*.hbq", + Filter = "Legacy Queue Files (*.hbq)|*.hbq|Json for CLI (*.json)|*.json", OverwritePrompt = true, DefaultExt = ".hbq", AddExtension = true }; + if (dialog.ShowDialog() == true) { - this.queueProcessor.BackupQueue(dialog.FileName); + if (Path.GetExtension(dialog.FileName).ToLower().Trim() == ".json") + { + this.queueProcessor.ExportJson(dialog.FileName); + } + else + { + this.queueProcessor.BackupQueue(dialog.FileName); + } } } @@ -348,7 +357,7 @@ namespace HandBrakeWPF.ViewModels /// public void Import() { - OpenFileDialog dialog = new OpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true }; + OpenFileDialog dialog = new OpenFileDialog { Filter = "Legacy Queue Files (*.hbq)|*.hbq", CheckFileExists = true }; if (dialog.ShowDialog() == true) { this.queueProcessor.RestoreQueue(dialog.FileName); -- cgit v1.2.3