/// <param name="titleIndex">\r
/// The title index to scan (1-based, 0 for all titles).\r
/// </param>\r
+ /// <param name="clEnabled">\r
+ /// OpenCL enabled. \r
+ /// </param>\r
public void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex, bool clEnabled = false)\r
{\r
this.previewCount = previewCount;\r
}\r
}\r
\r
- /// <summary>\r
- /// Checks the status of the ongoing encode.\r
- /// </summary>\r
/// <summary>\r
/// Checks the status of the ongoing encode.\r
/// </summary>\r
/// <summary>\r
/// Contains utilities for converting language codes.\r
/// </summary>\r
- public static class Languages\r
+ public static class HandBrakeLanguagesHelper\r
{\r
/// <summary>\r
/// The list of all languages.\r
// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="MetaData.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// <copyright file="Metadata.cs" company="HandBrake Project (http://handbrake.fr)">\r
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
// </copyright>\r
// <summary>\r
/// <summary>\r
/// Gets or sets a value indicating whether save log with video.\r
/// </summary>\r
- public bool SaveLogWithVideo{ get; set; }\r
+ public bool SaveLogWithVideo { get; set; }\r
\r
/// <summary>\r
/// Gets or sets the save log copy directory.\r
// Make this class Thread Safe.
private static ILog loggerInstance;
private readonly object lockObject = new object();
- private readonly object FileWriterLock = new object();
+ private readonly object fileWriterLock = new object();
private readonly StringBuilder logBuilder = new StringBuilder();
private LogLevel currentLogLevel = LogLevel.Error;
this.isDiskLoggingEnabled = true;
this.deleteLogFirst = deleteCurrentLogFirst;
- lock (this.FileWriterLock)
+ lock (this.fileWriterLock)
{
this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
}
if (this.fileWriter != null)
{
- lock (this.FileWriterLock)
+ lock (this.fileWriterLock)
{
this.fileWriter.Flush();
this.fileWriter.Close();
try
{
- lock (this.FileWriterLock)
+ lock (this.fileWriterLock)
{
if (this.fileWriter != null)
{
try
{
- lock (this.FileWriterLock)
+ lock (this.fileWriterLock)
{
if (this.fileWriter != null && this.fileWriter.BaseStream.CanWrite)
{
{
try
{
- lock (this.FileWriterLock)
+ lock (this.fileWriterLock)
{
if (this.fileWriter != null)
{
/// </param>\r
protected override void OnStartup(StartupEventArgs e)\r
{\r
- OperatingSystem OS = Environment.OSVersion;\r
- if ((OS.Platform == PlatformID.Win32NT) && (OS.Version.Major == 5 && OS.Version.Minor <= 1))\r
+ OperatingSystem os = Environment.OSVersion;\r
+ if ((os.Platform == PlatformID.Win32NT) && (os.Version.Major == 5 && os.Version.Minor <= 1))\r
{\r
MessageBox.Show("Windows XP and earlier are no longer supported. Version 0.9.9 was the last version to support these versions. ", "Notice", MessageBoxButton.OK, MessageBoxImage.Warning);\r
Application.Current.Shutdown();\r
\r
namespace HandBrakeWPF.AttachedProperties\r
{\r
- using System;\r
using System.Collections.Generic;\r
using System.Windows;\r
using System.Windows.Controls;\r
"GroupName", \r
typeof(string), \r
typeof(MenuItemExtensions), \r
- new PropertyMetadata(String.Empty, OnGroupNameChanged));\r
+ new PropertyMetadata(string.Empty, OnGroupNameChanged));\r
\r
/// <summary>\r
/// The element to group names.\r
/// </summary>\r
- public static Dictionary<MenuItem, String> ElementToGroupNames = new Dictionary<MenuItem, String>();\r
+ public static Dictionary<MenuItem, string> ElementToGroupNames = new Dictionary<MenuItem, string>();\r
\r
#endregion\r
\r
}\r
\r
// Scan a Folder (Ctrl+Shift+O)\r
- if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.O)\r
+ if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.O)\r
{\r
mainViewModel.FolderScan();\r
}\r
\r
namespace HandBrakeWPF.Controls\r
{\r
- using System.Windows.Threading;\r
using System;\r
using System.Windows;\r
using System.Windows.Controls;\r
+ using System.Windows.Threading;\r
\r
/// <summary>\r
/// Interaction logic for Loading.xaml\r
throw new ArgumentNullException("e");\r
}\r
\r
- if (Key.Down == e.Key || Key.Up == e.Key)\r
+ if (e.Key == Key.Down || e.Key == Key.Up)\r
{\r
this.Dispatcher.BeginInvoke((Action)this.OpenButtonMenu);\r
}\r
\r
this.contextMenu.HorizontalOffset = desiredOffset.X - currentOffset.X;\r
this.contextMenu.VerticalOffset = desiredOffset.Y - currentOffset.Y;\r
- if (FlowDirection.RightToLeft == this.FlowDirection)\r
+ if (this.FlowDirection == FlowDirection.RightToLeft)\r
{\r
this.contextMenu.HorizontalOffset *= -1;\r
}\r
}\r
\r
/// <summary>\r
- /// \r
+ /// Gets a value indicating whether is action 2 button visible.\r
/// </summary>\r
public bool IsActionButton2Visibile\r
{\r
get\r
{\r
- return true; //SecondaryAction != null;\r
+ return true; // SecondaryAction != null;\r
}\r
}\r
\r
string name = value as string;\r
if (!string.IsNullOrEmpty(name))\r
{\r
- return new object[] { EnumHelper<AudioEncoder>.GetValue(name)};\r
+ return new object[] { EnumHelper<AudioEncoder>.GetValue(name) };\r
}\r
\r
return null;\r
namespace HandBrakeWPF.Converters.Audio
{
+ using System;
using System.Globalization;
using System.Windows.Data;
- using System;
-
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
namespace HandBrakeWPF.Converters.Audio
{
- using System.Globalization;
- using System.Windows.Data;
using System;
using System.ComponentModel;
-
+ using System.Globalization;
+ using System.Windows.Data;
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
using HandBrakeWPF.Services.Encode.Model.Models;
using HandBrakeWPF.Utilities;
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Globalization;\r
using System.Windows.Data;\r
- using System;\r
\r
/// <summary>\r
/// Boolean to Visibility Converter\r
// Paramater is a boolean which inverts the output.\r
var param = System.Convert.ToBoolean(parameter, CultureInfo.InvariantCulture);\r
\r
- if (value is Boolean)\r
+ if (value is bool)\r
{\r
return param ? !(bool)value : value;\r
}\r
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Globalization;\r
using System.Windows;\r
using System.Windows.Data;\r
- using System;\r
\r
/// <summary>\r
/// Boolean to Visibility Converter (Hidden, not Collasped)\r
return Visibility.Hidden;\r
}\r
\r
- if (value is Boolean)\r
+ if (value is bool)\r
{\r
if (param)\r
{\r
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Globalization;\r
using System.Windows;\r
using System.Windows.Data;\r
- using System;\r
\r
/// <summary>\r
/// Boolean to Visibility Converter\r
return Visibility.Collapsed;\r
}\r
\r
- if (value is Boolean)\r
+ if (value is bool)\r
{\r
if (param)\r
{\r
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Collections.Generic;\r
using System.Globalization;\r
using System.Windows.Data;\r
- using System;\r
-\r
- using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
-\r
+ using HandBrake.ApplicationServices.Model;\r
using HandBrakeWPF.Services.Queue.Model;\r
using HandBrakeWPF.Utilities;\r
-\r
using OutputFormat = HandBrakeWPF.Services.Encode.Model.Models.OutputFormat;\r
using PresetPictureSettingsMode = HandBrakeWPF.Model.Picture.PresetPictureSettingsMode;\r
\r
{
if (groupedMenu.ContainsKey(item.Category))
{
- MenuItem newMeuItem = new MenuItem { Header = item.Name, Tag = item, Command = new PresetMenuSelectCommand(item)};
+ MenuItem newMeuItem = new MenuItem { Header = item.Name, Tag = item, Command = new PresetMenuSelectCommand(item) };
if (item.IsDefault)
{
newMeuItem.FontStyle = FontStyles.Italic;
namespace HandBrakeWPF.Converters.Queue
{
+ using System;
using System.Globalization;
using System.Windows.Data;
- using System;
-
using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
using HandBrakeWPF.Services.Encode.Model;
/// <summary>
using System.Windows.Data;\r
\r
using HandBrake.ApplicationServices.Interop;\r
- using HandBrake.ApplicationServices.Utilities;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
\r
using HandBrakeWPF.Utilities;\r
string name = value as string;\r
if (!string.IsNullOrEmpty(name))\r
{\r
- return new object[] { EnumHelper<VideoEncoder>.GetValue(name)};\r
+ return new object[] { EnumHelper<VideoEncoder>.GetValue(name) };\r
}\r
\r
return null;\r
using System.Globalization;\r
using System.Windows.Data;\r
\r
- using HandBrake.ApplicationServices.Utilities;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
\r
using HandBrakeWPF.Utilities;\r
{\r
// Get the Source Name and remove any invalid characters\r
string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));\r
- // string sanitisedPresetName = presetName != null ? Path.GetInvalidFileNameChars().Aggregate(presetName.Name, (current, character) => current.Replace(character.ToString(), string.Empty)) : string.Empty;\r
+ // string sanitisedPresetName = presetName != null ? Path.GetInvalidFileNameChars().Aggregate(presetName.Name, (current, character) => current.Replace(character.ToString(), string.Empty)) : string.Empty;\r
\r
// Remove Underscores\r
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))\r
.Replace(Constants.Chapters, combinedChapterTag)\r
.Replace(Constants.Date, DateTime.Now.Date.ToShortDateString().Replace('/', '-'))\r
.Replace(Constants.Time, DateTime.Now.ToString("HH:mm"));\r
- // .Replace(Constants.Preset, sanitisedPresetName);\r
+ // .Replace(Constants.Preset, sanitisedPresetName);\r
\r
if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)\r
{\r
}\r
else\r
{\r
- destinationFilename = destinationFilename.Replace(Constants.Bitrate, task.VideoBitrate.ToString());\r
+ destinationFilename = destinationFilename.Replace(\r
+ Constants.Bitrate,\r
+ task.VideoBitrate.ToString());\r
destinationFilename = destinationFilename.Replace(Constants.Quality, string.Empty);\r
}\r
}\r
else\r
+ {\r
destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;\r
+ }\r
\r
/*\r
* File Extension\r
}\r
}\r
else if (task.OutputFormat == OutputFormat.Mkv)\r
+ {\r
destinationFilename += ".mkv";\r
+ }\r
\r
/*\r
* File Destination Path\r
{\r
autoNamePath = Path.Combine(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath), destinationFilename);\r
}\r
- else // ...otherwise, output to the source directory\r
+ else \r
+ {\r
+ // ...otherwise, output to the source directory\r
autoNamePath = null;\r
+ }\r
}\r
- else // Otherwise, use the path that is already there.\r
+ else\r
{\r
+ // Otherwise, use the path that is already there.\r
// Use the path and change the file extension to match the previous destination\r
autoNamePath = Path.Combine(Path.GetDirectoryName(task.Destination), destinationFilename);\r
}\r
maxHeight = job.MaxHeight,\r
mode = (int)job.AnamorphicMode,\r
modulus = job.Modulus.HasValue ? job.Modulus.Value : 16,\r
- geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t { den = title.ParH, num = title.ParW } : new hb_rational_t { den = job.ParH, num = job.ParW }}\r
+ geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t { den = title.ParH, num = title.ParW } : new hb_rational_t { den = job.ParH, num = job.ParW } }\r
};\r
\r
hb_geometry_s sourceGeometry = new hb_geometry_s\r
namespace HandBrakeWPF.Helpers
{
- using System.Globalization;
using System;
+ using System.Globalization;
/// <summary>
/// Helper functions for handling <see cref="TimeSpan"/> structures
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
+ using Newtonsoft.Json;
using Services.Encode.Model.Models;
using Utilities;
- using Newtonsoft.Json;
-
/// <summary>
/// Model of a HandBrake Audio Track and it's associated behaviours.
/// </summary>
{\r
using System;\r
using System.Windows;\r
- using Interfaces;\r
using Caliburn.Micro;\r
+ using Interfaces;\r
using ViewModels.Interfaces;\r
\r
/// <summary>\r
? "decomb"\r
: export.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif ? "yadif" : "off";\r
\r
-\r
preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb\r
? EnumHelper<Decomb>.GetShortName(export.Task.Decomb)\r
: export.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif ? EnumHelper<Deinterlace>.GetShortName(export.Task.Deinterlace) : string.Empty;\r
preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);\r
preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);\r
preset.PictureDetelecineCustom = export.Task.CustomDetelecine;\r
- \r
\r
// Video\r
preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);\r
preset.VideoLevel = export.Task.VideoLevel != null ? export.Task.VideoLevel.ShortName : null;\r
preset.VideoOptionExtra = export.Task.ExtraAdvancedArguments;\r
preset.VideoPreset = export.Task.VideoPreset != null ? export.Task.VideoPreset.ShortName : null;\r
- preset.VideoProfile = export.Task.VideoProfile != null ? export.Task.VideoProfile.ShortName : null;\r
+ preset.VideoProfile = export.Task.VideoProfile != null ? export.Task.VideoProfile.ShortName : null;\r
preset.VideoQSVAsyncDepth = 4; // Defaulted to 4 for now.\r
preset.VideoQSVDecode = !config.DisableQuickSyncDecoding;\r
preset.VideoQualitySlider = export.Task.Quality.HasValue ? export.Task.Quality.Value : 0;\r
/// https://github.com/Caliburn-Micro/Caliburn.Micro/issues/89\r
/// https://github.com/Caliburn-Micro/Caliburn.Micro/issues/96\r
/// </remarks>\r
- public class Preset : PropertyChangedBase // Delibery not \r
+ public class Preset : PropertyChangedBase // Delibery not \r
{\r
#region Constants and Fields\r
\r
{\r
foreach (QueueTask job in this.queue)\r
{\r
- if (String.Equals(\r
+ if (string.Equals(\r
job.Task.Destination,\r
destination.Replace("\\\\", "\\"),\r
StringComparison.OrdinalIgnoreCase)\r
using System.Net;\r
using System.Reflection;\r
using System.Security.Cryptography;\r
- using System.Text;\r
using System.Threading;\r
-\r
- using HandBrake.ApplicationServices.Utilities;\r
using HandBrake.ApplicationServices.Interop;\r
-\r
+ using HandBrake.ApplicationServices.Utilities;\r
using HandBrakeWPF.Model;\r
using HandBrakeWPF.Services.Interfaces;\r
-\r
using AppcastReader = HandBrakeWPF.Utilities.AppcastReader;\r
\r
/// <summary>\r
var currentBuild = HandBrakeUtils.Build;\r
\r
// Fetch the Appcast from our server.\r
- HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);\r
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);\r
request.AllowAutoRedirect = false; // We will never do this.\r
WebResponse response = request.GetResponse();\r
\r
while ((bytesSize = responceStream.Read(downBuffer, 0, downBuffer.Length)) > 0)\r
{\r
localStream.Write(downBuffer, 0, bytesSize);\r
- progress(new DownloadStatus { BytesRead = localStream.Length, TotalBytes = fileSize});\r
+ progress(new DownloadStatus { BytesRead = localStream.Length, TotalBytes = fileSize });\r
}\r
\r
responceStream.Close();\r
if (!Directory.Exists(dirPath))
{
MessageBoxResult result = errorService.ShowMessageBox(string.Format(Resources.DirectoryUtils_CreateFolderMsg, dirPath), Resources.DirectoryUtils_CreateFolder, MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (MessageBoxResult.Yes == result)
+ if (result == MessageBoxResult.Yes)
{
Directory.CreateDirectory(dirPath);
}
memberExpression = (MemberExpression)unaryExpression.Operand;
}
else
+ {
memberExpression = (MemberExpression)lambda.Body;
+ }
return memberExpression.Member;
}
gpuBuilder.Append("GPU Information is unavailable");
}
- logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion()));
- logHeader.AppendLine(String.Format("OS: {0} - {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "64bit" : "32bit"));
- logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
- logHeader.AppendLine(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
- logHeader.AppendLine(String.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd()));
- logHeader.AppendLine(String.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
- logHeader.AppendLine(String.Format("Temp Dir: {0}", Path.GetTempPath()));
- logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath));
- logHeader.AppendLine(String.Format("Data Dir: {0}\n", Application.UserAppDataPath));
+ logHeader.AppendLine(string.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion()));
+ logHeader.AppendLine(string.Format("OS: {0} - {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "64bit" : "32bit"));
+ logHeader.AppendLine(string.Format("CPU: {0}", SystemInfo.GetCpuCount));
+ logHeader.AppendLine(string.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
+ logHeader.AppendLine(string.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd()));
+ logHeader.AppendLine(string.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
+ logHeader.AppendLine(string.Format("Temp Dir: {0}", Path.GetTempPath()));
+ logHeader.AppendLine(string.Format("Install Dir: {0}", Application.StartupPath));
+ logHeader.AppendLine(string.Format("Data Dir: {0}\n", Application.UserAppDataPath));
logHeader.AppendLine("-------------------------------------------");
{
using System;
using System.Collections.Generic;
- using System.Linq;
using System.IO;
-
+ using System.Linq;
using HandBrakeWPF.Helpers;
/// <summary>
namespace HandBrakeWPF.Utilities
{
- using System.Collections.Generic;
using System;
+ using System.Collections.Generic;
using System.IO;
/// <summary>
{
string gpu = string.Empty, version = string.Empty;
- foreach (PropertyData PC in share.Properties)
+ foreach (PropertyData pc in share.Properties)
{
- if (!string.IsNullOrEmpty(PC.Name) && PC.Value != null)
+ if (!string.IsNullOrEmpty(pc.Name) && pc.Value != null)
{
- if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString();
- if (PC.Name.Equals("Name")) gpu = PC.Value.ToString();
+ if (pc.Name.Equals("DriverVersion")) version = pc.Value.ToString();
+ if (pc.Name.Equals("Name")) gpu = pc.Value.ToString();
}
}
this.errorService = errorService;\r
this.windowManager = windowManager;\r
this.Title = "Add Preset";\r
- this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName};\r
+ this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName };\r
this.PictureSettingsModes = EnumHelper<PresetPictureSettingsMode>.GetEnumList();\r
}\r
\r
using System;\r
using System.Collections.Generic;\r
using System.Collections.ObjectModel;\r
- using System.ComponentModel.DataAnnotations;\r
using System.IO;\r
- using System.Text;\r
using System.Linq;\r
using System.Windows;\r
using System.Windows.Forms;\r
using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;\r
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;\r
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;\r
- using MessageBox = System.Windows.Forms.MessageBox;\r
\r
/// <summary>\r
/// The Chapters View Model\r
#endregion\r
\r
#region Public Properties\r
+\r
/// <summary>\r
/// Gets or sets Task.\r
/// </summary>\r
if (!this.ValidateImportedChapters(importedChapters, out validationErrorMessage))\r
{\r
if (!string.IsNullOrEmpty(validationErrorMessage))\r
+ {\r
throw new GeneralApplicationException(\r
Resources.ChaptersViewModel_ValidationFailedWarning,\r
validationErrorMessage);\r
+ }\r
\r
// The user has cancelled the import, so exit\r
return;\r
}\r
}\r
\r
- /// <summary>\r
- /// Validates any imported chapter information against the currently detected chapter information in the \r
- /// source media. If validation fails then an error message is returned via the out parameter <see cref="validationErrorMessage"/>\r
- /// </summary>\r
- /// <param name="importedChapters">The list of imported chapter information</param>\r
- /// <param name="validationErrorMessage">In case of a validation error this variable will hold \r
- /// a detailed message that can be presented to the user</param>\r
- /// <returns>True if there are no errors with imported chapters, false otherwise</returns>\r
- private bool ValidateImportedChapters(Dictionary<int, Tuple<string, TimeSpan>> importedChapters, out string validationErrorMessage)\r
- {\r
- validationErrorMessage = null;\r
-\r
- // If the number of chapters don't match, prompt for confirmation\r
- if (importedChapters.Count != this.Task.ChapterNames.Count)\r
- {\r
- if (MessageBoxResult.Yes !=\r
- this.errorService.ShowMessageBox(\r
- string.Format(Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchMsg, this.Task.ChapterNames.Count, importedChapters.Count),\r
- Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchWarning,\r
- MessageBoxButton.YesNo,\r
- MessageBoxImage.Question))\r
- {\r
- return false;\r
- }\r
- }\r
-\r
- // If the average discrepancy in timings between chapters is either:\r
- // a) more than 15 sec for more than 2 chapters\r
- // (I chose 15sec based on empirical evidence from testing a few DVDs and comparing to chapter-marker files I downloaded)\r
- // => This check will not be performed for the first and last chapter as they're very likely to differ significantly due to language and region\r
- // differences (e.g. longer title sequences and different distributor credits)\r
- var diffs = importedChapters.Zip(this.Task.ChapterNames, (import, source) => source.Duration - import.Value.Item2);\r
- if (diffs.Count(diff => Math.Abs(diff.TotalSeconds) > 15) > 2)\r
- {\r
- if (MessageBoxResult.Yes !=\r
- this.errorService.ShowMessageBox(\r
- Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg,\r
- Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchWarning,\r
- MessageBoxButton.YesNo,\r
- MessageBoxImage.Question))\r
- {\r
- return false;\r
- }\r
- }\r
-\r
- // All is well, we should import chapters\r
- return true;\r
- }\r
-\r
/// <summary>\r
/// Setup this window for a new source\r
/// </summary>\r
}\r
\r
#endregion\r
+\r
+ #region Private Methods\r
+\r
+ /// <summary>\r
+ /// Validates any imported chapter information against the currently detected chapter information in the \r
+ /// source media. If validation fails then an error message is returned via the out parameter <see cref="validationErrorMessage"/>\r
+ /// </summary>\r
+ /// <param name="importedChapters">The list of imported chapter information</param>\r
+ /// <param name="validationErrorMessage">In case of a validation error this variable will hold \r
+ /// a detailed message that can be presented to the user</param>\r
+ /// <returns>True if there are no errors with imported chapters, false otherwise</returns>\r
+ private bool ValidateImportedChapters(Dictionary<int, Tuple<string, TimeSpan>> importedChapters, out string validationErrorMessage)\r
+ {\r
+ validationErrorMessage = null;\r
+\r
+ // If the number of chapters don't match, prompt for confirmation\r
+ if (importedChapters.Count != this.Task.ChapterNames.Count)\r
+ {\r
+ if (this.errorService.ShowMessageBox(\r
+ string.Format(Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchMsg, this.Task.ChapterNames.Count, importedChapters.Count),\r
+ Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchWarning,\r
+ MessageBoxButton.YesNo,\r
+ MessageBoxImage.Question) !=\r
+ MessageBoxResult.Yes)\r
+ {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ // If the average discrepancy in timings between chapters is either:\r
+ // a) more than 15 sec for more than 2 chapters\r
+ // (I chose 15sec based on empirical evidence from testing a few DVDs and comparing to chapter-marker files I downloaded)\r
+ // => This check will not be performed for the first and last chapter as they're very likely to differ significantly due to language and region\r
+ // differences (e.g. longer title sequences and different distributor credits)\r
+ var diffs = importedChapters.Zip(this.Task.ChapterNames, (import, source) => source.Duration - import.Value.Item2);\r
+ if (diffs.Count(diff => Math.Abs(diff.TotalSeconds) > 15) > 2)\r
+ {\r
+ if (this.errorService.ShowMessageBox(\r
+ Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg,\r
+ Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchWarning,\r
+ MessageBoxButton.YesNo,\r
+ MessageBoxImage.Question) !=\r
+ MessageBoxResult.Yes)\r
+ {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ // All is well, we should import chapters\r
+ return true;\r
+ }\r
+\r
+ #endregion\r
}\r
}
\ No newline at end of file
Resources.DirectoryUtils_CreateFolder,\r
MessageBoxButton.YesNo,\r
MessageBoxImage.Question);\r
- if (MessageBoxResult.Yes == result)\r
+ if (result == MessageBoxResult.Yes)\r
{\r
Directory.CreateDirectory(directory);\r
Process.Start(directory);\r
/// <param name="e">\r
/// The e.\r
/// </param>\r
- void QueueProcessorJobProcessingStarted(object sender, QueueProgressEventArgs e)\r
+ private void QueueProcessorJobProcessingStarted(object sender, QueueProgressEventArgs e)\r
{\r
Execute.OnUIThread(\r
() =>\r
this.QueueViewModel.WhenDone(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction), false);\r
break;\r
}\r
-\r
}\r
\r
/// <summary>\r
this.errorService = errorService;
this.windowManager = windowManager;
this.Title = "Manage Preset";
- this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName};
+ this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName };
}
/// <summary>
#endregion\r
\r
#region Preview\r
+\r
/// <summary>\r
/// Gets or sets VLCPath.\r
/// </summary>\r
this.NotifyOfPropertyChange("VLCPath");\r
}\r
}\r
+\r
#endregion\r
\r
#region System and Logging\r
\r
// Use dvdnav\r
this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);\r
-\r
}\r
\r
/// <summary>\r
this.WhenDone = userSettingService.GetUserSetting<string>("WhenCompleteAction");\r
}\r
\r
+ /// <summary>\r
+ /// The goto tab.\r
+ /// </summary>\r
+ /// <param name="tab">\r
+ /// The tab.\r
+ /// </param>\r
+ public void GotoTab(OptionsTab tab)\r
+ {\r
+ this.SelectedTab = tab;\r
+ }\r
+\r
/// <summary>\r
/// Save the settings selected\r
/// </summary>\r
}\r
}\r
\r
- /// <summary>\r
- /// The goto tab.\r
- /// </summary>\r
- /// <param name="tab">\r
- /// The tab.\r
- /// </param>\r
- public void GotoTab(OptionsTab tab)\r
- {\r
- this.SelectedTab = tab;\r
- }\r
-\r
/// <summary>\r
/// Validate the Autoname Fileformat string\r
/// </summary>\r
this.Task.Height = this.GetModulusValue(this.sourceResolution.Height - this.CropTop - this.CropBottom);\r
this.MaintainAspectRatio = preset.Task.KeepDisplayAspect;\r
}\r
- else // Custom\r
+ else \r
{\r
+ // Custom\r
// Set the Width, and Maintain Aspect ratio. That should calc the Height for us.\r
this.Task.Width = this.GetModulusValue(this.MaxWidth - this.CropLeft - this.CropRight);\r
\r
/// <summary>\r
/// The changed picture field.\r
/// </summary>\r
- enum ChangedPictureField\r
+ public enum ChangedPictureField\r
{\r
Width,\r
Height,\r
this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;\r
this.queueProcessor.QueueChanged += this.QueueManager_QueueChanged;\r
this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;\r
-\r
}\r
\r
public void Deactivate()\r
// Attempt to find VLC if it doesn't exist in the default set location.\r
string vlcPath;\r
\r
- if (IntPtr.Size == 8 || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))\r
+ if (IntPtr.Size == 8 || (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))\r
vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");\r
else\r
vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");\r
/// <summary>\r
/// The add first for selected languages.\r
/// </summary>\r
- private void AddFirstForSelectedLanguages()\r
+ public void AddFirstForSelectedLanguages()\r
{\r
foreach (Subtitle sourceTrack in this.GetSelectedLanguagesTracks())\r
{\r
case SubtitleBurnInBehaviourModes.FirstTrack: \r
foreach (var track in this.Task.SubtitleTracks)\r
{\r
- if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch) // Foreign Audio Search is always first in the list.\r
+ // Foreign Audio Search is always first in the list.\r
+ if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch) \r
{\r
track.Forced = true;\r
continue;\r
case VideoEncoder.X265_10:\r
case VideoEncoder.X265_12:\r
double cqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);\r
- double rfValue = 51.0 - value * cqStep;\r
+ double rfValue = 51.0 - (value * cqStep);\r
rfValue = Math.Round(rfValue, 2);\r
this.Task.Quality = rfValue;\r
break; \r
if (encoder != null)\r
{\r
string preset = value >= 0 ? encoder.Presets[value] : null;\r
- this.VideoPreset = preset != null ?new VideoPreset(preset, preset) : this.VideoPresets.FirstOrDefault();\r
+ this.VideoPreset = preset != null ? new VideoPreset(preset, preset) : this.VideoPresets.FirstOrDefault();\r
}\r
\r
this.NotifyOfPropertyChange(() => this.VideoPresetValue);\r
}\r
}\r
\r
-\r
/// <summary>\r
/// The get actualx 264 query.\r
/// </summary>\r