public bool Equals(FileToken objFileToken) { if (objFileToken == null) { return(false); } return((RelativePath == objFileToken.RelativePath) && (Hash == objFileToken.Hash)); }
public override bool Equals(object objValue) { if (objValue == null) { return(false); } FileToken objFileToken = objValue as FileToken; return(Equals(objFileToken)); }
public static FileToken Load(string strFilePath, string strRelativePath) { if (strFilePath == null) { throw new ArgumentNullException("strFilePath", "A valid non-null string is required."); } if (FileManager.Exists(strFilePath) == false) { throw new FileNotFoundException("Unable to generate FileToken because the file does not exist.", strFilePath); } FileToken objFileToken = null; if (FileManager.Exists(strFilePath) == true) { string strHash = string.Empty; FileInfo objFileInfo = new FileInfo(strFilePath); try { using (Stream objFileSteam = objFileInfo.OpenRead()) { HashBase.Default.ComputeHash(objFileSteam, out strHash); } FileVersionInfo objFileVersionInfo = FileVersionInfo.GetVersionInfo(strFilePath); VersionToken objVersionToken = new VersionToken(objFileVersionInfo.FileBuildPart, objFileVersionInfo.FileMajorPart, objFileVersionInfo.FileMinorPart, 0); string strRelativeFileName = Path.Combine(strRelativePath, objFileInfo.Name); objFileToken = new FileToken(strFilePath, strRelativeFileName, strHash, objFileInfo.Length, objVersionToken); } catch {} } return(objFileToken); }
public static FileToken Load(string strFilePath) { return(FileToken.Load(strFilePath, string.Empty)); }