summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-02-24 14:53:29 +0000
committersr55 <[email protected]>2013-02-24 14:53:29 +0000
commitc8d8a0798c645c4ddf8b4318a8310ee96883dd18 (patch)
treeb369d55d4b58f1120e4a161b999bd7fff599376d /win
parent2b9da3e96aaf259c166b5f7ead3b0ea4b96565ac (diff)
WinGui: Show "Scan failed: Unrecognized file type." when a scan fails for this reason. Patch by Roman Starkov.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5265 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/EventArgs/ScanCompletedEventArgs.cs15
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs7
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs10
4 files changed, 24 insertions, 10 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanCompletedEventArgs.cs b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanCompletedEventArgs.cs
index 88a8d9ed2..6ab67d3ec 100644
--- a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanCompletedEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanCompletedEventArgs.cs
@@ -21,8 +21,8 @@ namespace HandBrake.ApplicationServices.EventArgs
/// <summary>
/// Initializes a new instance of the <see cref="ScanCompletedEventArgs"/> class.
/// </summary>
- /// <param name="sucessful">
- /// The sucessful.
+ /// <param name="cancelled">
+ /// Whether the scan was cancelled.
/// </param>
/// <param name="exception">
/// The exception.
@@ -30,9 +30,10 @@ namespace HandBrake.ApplicationServices.EventArgs
/// <param name="errorInformation">
/// The error information.
/// </param>
- public ScanCompletedEventArgs(bool sucessful, Exception exception, string errorInformation)
+ public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation)
{
- this.Successful = sucessful;
+ this.Successful = !cancelled && exception == null && string.IsNullOrEmpty(errorInformation);
+ this.Cancelled = cancelled;
this.Exception = exception;
this.ErrorInformation = errorInformation;
}
@@ -44,6 +45,12 @@ namespace HandBrake.ApplicationServices.EventArgs
public bool Successful { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether Cancelled.
+ /// </summary>
+ [DataMember]
+ public bool Cancelled { get; set; }
+
+ /// <summary>
/// Gets or sets Exception.
/// </summary>
[DataMember]
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 8dfb5ca12..850c3b860 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -262,7 +262,7 @@ namespace HandBrake.ApplicationServices.Services
IsScanning = false;
if (this.ScanCompleted != null)
- this.ScanCompleted(this, new ScanCompletedEventArgs(true, null, string.Empty));
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty));
}
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index e7c7a2852..cc99b916b 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -191,7 +191,7 @@ namespace HandBrake.ApplicationServices.Services
if (this.ScanCompleted != null)
{
- this.ScanCompleted(this, new ScanCompletedEventArgs(true, null, string.Empty));
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, string.Empty));
}
}
catch (Exception e)
@@ -335,7 +335,10 @@ namespace HandBrake.ApplicationServices.Services
{
if (this.ScanCompleted != null)
{
- this.ScanCompleted(this, new ScanCompletedEventArgs(!this.cancelScan, null, string.Empty));
+ if (logBuffer.ToString().Contains("scan: unrecognized file type"))
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, null, "Unrecognized file type."));
+ else
+ this.ScanCompleted(this, new ScanCompletedEventArgs(this.cancelScan, null, string.Empty));
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 2ba64e37d..3ae4f9d58 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1735,15 +1735,19 @@ namespace HandBrakeWPF.ViewModels
this.SourceLabel = this.SourceName;
this.StatusLabel = "Scan Completed";
}
- else if (!e.Successful && e.Exception == null)
+ else if (e.Cancelled)
{
this.SourceLabel = "Scan Cancelled.";
this.StatusLabel = "Scan Cancelled.";
}
+ else if (e.Exception == null && e.ErrorInformation != null)
+ {
+ this.SourceLabel = "Scan failed: " + e.ErrorInformation;
+ this.StatusLabel = "Scan failed: " + e.ErrorInformation;
+ }
else
{
- this.SourceLabel = "Scan Failed... See Activity Log for details.";
- this.StatusLabel = "Scan Failed... See Activity Log for details.";
+ this.SourceLabel = "Scan Failed... See Activity Log for details."; this.StatusLabel = "Scan Failed... See Activity Log for details.";
}
});
}