mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 10:19:07 +00:00
deal with CreateProcess failure
This commit is contained in:
@@ -136,9 +136,10 @@ namespace QuickLook.Plugin.ImageViewer.Exiv2
|
||||
}
|
||||
|
||||
private Dictionary<string, string> Run(string arg, string regexSplit)
|
||||
{
|
||||
try
|
||||
{
|
||||
string result;
|
||||
|
||||
using (var p = new Process())
|
||||
{
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
@@ -157,6 +158,11 @@ namespace QuickLook.Plugin.ImageViewer.Exiv2
|
||||
? new Dictionary<string, string>()
|
||||
: ParseResult(result, regexSplit);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string> ParseResult(string result, string regexSplit)
|
||||
{
|
||||
|
@@ -39,6 +39,8 @@ namespace QuickLook.Plugin.VideoViewer.FFmpeg
|
||||
}
|
||||
|
||||
private bool Run(string media)
|
||||
{
|
||||
try
|
||||
{
|
||||
string result;
|
||||
|
||||
@@ -63,6 +65,11 @@ namespace QuickLook.Plugin.VideoViewer.FFmpeg
|
||||
ParseResult(result);
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseResult(string result)
|
||||
{
|
||||
@@ -71,28 +78,28 @@ namespace QuickLook.Plugin.VideoViewer.FFmpeg
|
||||
|
||||
public bool CanDecode()
|
||||
{
|
||||
var info = _infoNavigator.SelectSingleNode("/ffprobe/format[@probe_score>25]");
|
||||
var info = _infoNavigator?.SelectSingleNode("/ffprobe/format[@probe_score>25]");
|
||||
|
||||
return info != null;
|
||||
}
|
||||
|
||||
public string GetFormatName()
|
||||
{
|
||||
var format = _infoNavigator.SelectSingleNode("/ffprobe/format/@format_name")?.Value;
|
||||
var format = _infoNavigator?.SelectSingleNode("/ffprobe/format/@format_name")?.Value;
|
||||
|
||||
return format ?? string.Empty;
|
||||
}
|
||||
|
||||
public string GetFormatLongName()
|
||||
{
|
||||
var format = _infoNavigator.SelectSingleNode("/ffprobe/format/@format_long_name")?.Value;
|
||||
var format = _infoNavigator?.SelectSingleNode("/ffprobe/format/@format_long_name")?.Value;
|
||||
|
||||
return format ?? string.Empty;
|
||||
}
|
||||
|
||||
public bool HasAudio()
|
||||
{
|
||||
var duration = _infoNavigator.SelectSingleNode("/ffprobe/streams/stream[@codec_type='audio'][1]/@duration")
|
||||
var duration = _infoNavigator?.SelectSingleNode("/ffprobe/streams/stream[@codec_type='audio'][1]/@duration")
|
||||
?.Value;
|
||||
|
||||
if (duration == null)
|
||||
@@ -104,7 +111,7 @@ namespace QuickLook.Plugin.VideoViewer.FFmpeg
|
||||
|
||||
public bool HasVideo()
|
||||
{
|
||||
var fps = _infoNavigator.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@avg_frame_rate")
|
||||
var fps = _infoNavigator?.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@avg_frame_rate")
|
||||
?.Value;
|
||||
|
||||
if (fps == null)
|
||||
@@ -118,9 +125,9 @@ namespace QuickLook.Plugin.VideoViewer.FFmpeg
|
||||
if (!HasVideo())
|
||||
return Size.Empty;
|
||||
|
||||
var width = _infoNavigator.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@coded_width")
|
||||
var width = _infoNavigator?.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@coded_width")
|
||||
?.Value;
|
||||
var height = _infoNavigator.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@coded_height")
|
||||
var height = _infoNavigator?.SelectSingleNode("/ffprobe/streams/stream[@codec_type='video'][1]/@coded_height")
|
||||
?.Value;
|
||||
|
||||
if (width == null || height == null)
|
||||
|
Reference in New Issue
Block a user