Fixed VideoInfo ToString when no File is specified

Former-commit-id: b007e9105a
This commit is contained in:
Максим Багрянцев 2020-05-02 13:07:34 +03:00
parent 50eb92efcb
commit ed1284fc31

View file

@ -8,6 +8,7 @@ namespace FFMpegCore
{ {
public class VideoInfo public class VideoInfo
{ {
private const string NoVideoPlaceholder = "NULL";
private FileInfo _file; private FileInfo _file;
internal VideoInfo() internal VideoInfo()
@ -148,10 +149,10 @@ public static VideoInfo FromStream(System.IO.Stream stream)
/// <returns></returns> /// <returns></returns>
public override string ToString() public override string ToString()
{ {
return "Video Path : " + FullName + Environment.NewLine + return "Video Path : " + (_file != null ? FullName : NoVideoPlaceholder) + Environment.NewLine +
"Video Root : " + Directory.FullName + Environment.NewLine + "Video Root : " + (_file != null ? Directory.FullName : NoVideoPlaceholder) + Environment.NewLine +
"Video Name: " + Name + Environment.NewLine + "Video Name: " + (_file != null ? Name : NoVideoPlaceholder) + Environment.NewLine +
"Video Extension : " + Extension + Environment.NewLine + "Video Extension : " + (_file != null ? Extension : NoVideoPlaceholder) + Environment.NewLine +
"Video Duration : " + Duration + Environment.NewLine + "Video Duration : " + Duration + Environment.NewLine +
"Audio Format : " + AudioFormat + Environment.NewLine + "Audio Format : " + AudioFormat + Environment.NewLine +
"Video Format : " + VideoFormat + Environment.NewLine + "Video Format : " + VideoFormat + Environment.NewLine +