\r
return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);\r
}\r
+\r
+ /// <summary>\r
+ /// The equals.\r
+ /// </summary>\r
+ /// <param name="other">\r
+ /// The other.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The System.Boolean.\r
+ /// </returns>\r
+ public bool Equals(Audio other)\r
+ {\r
+ if (ReferenceEquals(null, other))\r
+ {\r
+ return false;\r
+ }\r
+ if (ReferenceEquals(this, other))\r
+ {\r
+ return true;\r
+ }\r
+ return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.Format, this.Format);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.\r
+ /// </summary>\r
+ /// <returns>\r
+ /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.\r
+ /// </returns>\r
+ /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>\r
+ public override bool Equals(object obj)\r
+ {\r
+ if (ReferenceEquals(null, obj))\r
+ {\r
+ return false;\r
+ }\r
+ if (ReferenceEquals(this, obj))\r
+ {\r
+ return true;\r
+ }\r
+ if (obj.GetType() != typeof(Audio))\r
+ {\r
+ return false;\r
+ }\r
+ return Equals((Audio)obj);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Serves as a hash function for a particular type. \r
+ /// </summary>\r
+ /// <returns>\r
+ /// A hash code for the current <see cref="T:System.Object"/>.\r
+ /// </returns>\r
+ /// <filterpriority>2</filterpriority>\r
+ public override int GetHashCode()\r
+ {\r
+ unchecked\r
+ {\r
+ int result = this.TrackNumber;\r
+ result = (result * 397) ^ (this.Language != null ? this.Language.GetHashCode() : 0);\r
+ result = (result * 397) ^ (this.LanguageCode != null ? this.LanguageCode.GetHashCode() : 0);\r
+ result = (result * 397) ^ (this.Format != null ? this.Format.GetHashCode() : 0);\r
+ return result;\r
+ }\r
+ }\r
}\r
}
\ No newline at end of file
{\r
return this.SubtitleType == SubtitleType.ForeignAudioSearch ? "Foreign Audio Scan" : string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.TypeString);\r
}\r
+\r
+ /// <summary>\r
+ /// The equals.\r
+ /// </summary>\r
+ /// <param name="other">\r
+ /// The other.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The System.Boolean.\r
+ /// </returns>\r
+ public bool Equals(Subtitle other)\r
+ {\r
+ if (ReferenceEquals(null, other))\r
+ {\r
+ return false;\r
+ }\r
+ if (ReferenceEquals(this, other))\r
+ {\r
+ return true;\r
+ }\r
+ return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.SubtitleType, this.SubtitleType);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.\r
+ /// </summary>\r
+ /// <returns>\r
+ /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.\r
+ /// </returns>\r
+ /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>\r
+ public override bool Equals(object obj)\r
+ {\r
+ if (ReferenceEquals(null, obj))\r
+ {\r
+ return false;\r
+ }\r
+ if (ReferenceEquals(this, obj))\r
+ {\r
+ return true;\r
+ }\r
+ if (obj.GetType() != typeof(Subtitle))\r
+ {\r
+ return false;\r
+ }\r
+ return Equals((Subtitle)obj);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Serves as a hash function for a particular type. \r
+ /// </summary>\r
+ /// <returns>\r
+ /// A hash code for the current <see cref="T:System.Object"/>.\r
+ /// </returns>\r
+ /// <filterpriority>2</filterpriority>\r
+ public override int GetHashCode()\r
+ {\r
+ unchecked\r
+ {\r
+ int result = this.TrackNumber;\r
+ result = (result * 397) ^ (this.Language != null ? this.Language.GetHashCode() : 0);\r
+ result = (result * 397) ^ (this.LanguageCode != null ? this.LanguageCode.GetHashCode() : 0);\r
+ result = (result * 397) ^ this.SubtitleType.GetHashCode();\r
+ return result;\r
+ }\r
+ }\r
}\r
}
\ No newline at end of file
{\r
using System;\r
using System.Management;\r
+ using System.Threading;\r
\r
using HandBrakeWPF.Services.Interfaces;\r
\r
/// </param>\r
public void StartDetection(Action action)\r
{\r
- this.detectionAction = action;\r
+ ThreadPool.QueueUserWorkItem(\r
+ delegate\r
+ {\r
+ this.detectionAction = action;\r
\r
- var options = new ConnectionOptions { EnablePrivileges = true };\r
- var scope = new ManagementScope(@"root\CIMV2", options);\r
+ var options = new ConnectionOptions { EnablePrivileges = true };\r
+ var scope = new ManagementScope(@"root\CIMV2", options);\r
\r
- try\r
- {\r
- var query = new WqlEventQuery\r
- {\r
- EventClassName = "__InstanceModificationEvent",\r
- WithinInterval = TimeSpan.FromSeconds(1),\r
- Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM\r
- };\r
+ try\r
+ {\r
+ var query = new WqlEventQuery\r
+ {\r
+ EventClassName = "__InstanceModificationEvent",\r
+ WithinInterval = TimeSpan.FromSeconds(1),\r
+ Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM\r
+ };\r
\r
- this.watcher = new ManagementEventWatcher(scope, query);\r
- this.watcher.EventArrived += this.WatcherEventArrived;\r
- this.watcher.Start();\r
- }\r
- catch (Exception e)\r
- {\r
- Console.WriteLine(e.Message);\r
- }\r
+ this.watcher = new ManagementEventWatcher(scope, query);\r
+ this.watcher.EventArrived += this.WatcherEventArrived;\r
+ this.watcher.Start();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Console.WriteLine(e.Message);\r
+ }\r
+ });\r
}\r
\r
/// <summary>\r
/// </summary>\r
public void Close()\r
{\r
- this.watcher.Stop();\r
+ if (watcher != null)\r
+ {\r
+ this.watcher.Stop();\r
+ }\r
}\r
\r
/// <summary>\r
MessageBoxImage.Information);\r
}\r
\r
+ /// <summary>\r
+ /// The debug scan log.\r
+ /// </summary>\r
+ public void DebugScanLog()\r
+ {\r
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog();\r
+ \r
+ dialog.ShowDialog();\r
+\r
+ if (File.Exists(dialog.FileName))\r
+ {\r
+ this.scanService.DebugScanLog(dialog.FileName);\r
+ } \r
+ }\r
+\r
#endregion\r
\r
#region Main Window Public Methods\r
{\r
this.Task = task;\r
this.NotifyOfPropertyChange(() => this.Task.SubtitleTracks);\r
+ this.NotifyOfPropertyChange(() => this.Task);\r
}\r
\r
/// <summary>\r
\r
<Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">\r
<Setter Property="ToolTipService.ShowDuration" Value="20000" />\r
+ <Setter Property="Margin" Value="0,2,0,2" />\r
</Style>\r
\r
<Style x:Key="LongToolTip" TargetType="TextBlock">\r
<Setter Property="Width" Value="400" />\r
<Setter Property="TextWrapping" Value="Wrap" />\r
</Style>\r
- </UserControl.Resources>\r
+\r
+ </UserControl.Resources>\r
<Grid>\r
<Grid.RowDefinitions>\r
<RowDefinition Height="Auto" />\r
<ColumnDefinition Width="*" MinWidth="100" />\r
</Grid.ColumnDefinitions>\r
\r
- <Label Grid.Row="0"\r
- Grid.Column="0"\r
- Content="Adaptive B-Frames:"\r
+ <Label Content="Adaptive B-Frames:"\r
Style="{StaticResource AdvancedLabel}"\r
Visibility="{Binding BFramesOptionsVisible,\r
- Converter={StaticResource VisibilityConverter}}"\r
- />\r
+ Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />\r
<ComboBox Grid.Row="0"\r
Grid.Column="1"\r
Width="120"\r
\r
<MenuItem Header="Debug" Foreground="Transparent" >\r
<MenuItem Header="Show CLI Equiv" Micro:Message.Attach="[Event Click] = [Action ShowCliQuery]" />\r
+ <MenuItem Header="Debug Scan Log" Micro:Message.Attach="[Event Click] = [Action DebugScanLog]" />\r
</MenuItem>\r
</Menu>\r
\r
SnapsToDevicePixels="True"\r
UseLayoutRounding="True"\r
WindowStartupLocation="CenterScreen"\r
+ TextOptions.TextFormattingMode="Display"\r
>\r
<Window.Resources>\r
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
</Setter>\r
</Style>\r
\r
+ <Style TargetType="{x:Type ComboBox}">\r
+ <Setter Property="Height" Value="22"/>\r
+ <Setter Property="Margin" Value="0,2,0,2" />\r
+ </Style>\r
+\r
+ <Style TargetType="{x:Type TextBlock}">\r
+ <Setter Property="VerticalAlignment" Value="Center"/>\r
+ </Style>\r
+\r
+ <Style TargetType="{x:Type Button}">\r
+ <Setter Property="Height" Value="22"/>\r
+ </Style>\r
+\r
+ <Style TargetType="{x:Type RadioButton}">\r
+ <Setter Property="Margin" Value="0,0,0,8" />\r
+ </Style>\r
+\r
<SolidColorBrush x:Key="GlyphBrush" Color="#444"/>\r
\r
</ResourceDictionary>
\ No newline at end of file
</StackPanel>\r
\r
<StackPanel Orientation="Horizontal">\r
- <TextBlock Text="Framerate (FPS):" Width="100"/>\r
+ <TextBlock Text="Framerate (FPS):" VerticalAlignment="Top" Margin="0,5,0,0" Width="100"/>\r
<StackPanel Orientation="Vertical">\r
<ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}" />\r
<RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" Margin="0,10,0,0" />\r