2020-08-05 14:06:42 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Diagnostics;
|
2020-11-02 18:33:43 +01:00
|
|
|
|
using System.IO.Abstractions;
|
2020-07-17 22:32:21 -07:00
|
|
|
|
|
|
|
|
|
|
namespace Wox.Infrastructure.FileSystemHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
public class FileVersionInfoWrapper : IFileVersionInfoWrapper
|
|
|
|
|
|
{
|
2020-11-02 18:33:43 +01:00
|
|
|
|
private readonly IFile _file;
|
|
|
|
|
|
|
2020-08-11 13:40:26 -07:00
|
|
|
|
public FileVersionInfoWrapper()
|
2020-11-02 18:33:43 +01:00
|
|
|
|
: this(new FileSystem().File)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public FileVersionInfoWrapper(IFile file)
|
2020-08-11 13:40:26 -07:00
|
|
|
|
{
|
2020-11-02 18:33:43 +01:00
|
|
|
|
_file = file;
|
2020-08-11 13:40:26 -07:00
|
|
|
|
}
|
2020-08-06 11:28:13 -07:00
|
|
|
|
|
2020-07-17 22:32:21 -07:00
|
|
|
|
public FileVersionInfo GetVersionInfo(string path)
|
|
|
|
|
|
{
|
2020-11-02 18:33:43 +01:00
|
|
|
|
if (_file.Exists(path))
|
2020-07-17 22:32:21 -07:00
|
|
|
|
{
|
|
|
|
|
|
return FileVersionInfo.GetVersionInfo(path);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string FileDescription { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|