PowerToys/Wox.UpdateFeedGenerator/FileInfoEx.cs

40 lines
901 B
C#
Raw Normal View History

2015-01-22 22:57:54 +08:00
using System.Diagnostics;
using System.IO;
2016-01-07 05:34:42 +08:00
using NAppUpdate.Framework.Utils;
2015-01-22 22:57:54 +08:00
namespace Wox.UpdateFeedGenerator
{
public class FileInfoEx
{
private readonly FileInfo myFileInfo;
private readonly string myFileVersion;
private readonly string myHash;
public FileInfo FileInfo
{
get { return myFileInfo; }
}
public string FileVersion
{
get { return myFileVersion; }
}
public string Hash
{
get { return myHash; }
}
public string RelativeName { get; private set; }
public FileInfoEx(string fileName,int rootDirectoryLength)
{
myFileInfo = new FileInfo(fileName);
myFileVersion = FileVersionInfo.GetVersionInfo(fileName).FileVersion;
if (myFileVersion != null) myFileVersion = myFileVersion.Replace(", ", ".");
2016-01-07 05:34:42 +08:00
myHash = FileChecksum.GetSHA256Checksum(fileName);
2015-01-22 22:57:54 +08:00
RelativeName = fileName.Substring(rootDirectoryLength + 1);
}
}
}