Пример #1
0
 private void fileLengthWrite(DataSet1.fileNamesRow row)
 {
     FileInfo file = new FileInfo(row.file_path);
     row.file_length = file.Length;
 }
Пример #2
0
 private string hashCodeWrite(DataSet1.fileNamesRow row)
 {
     FileInfo file = new FileInfo(row.file_path);
     HashAlgorithm fileHash = HashAlgorithm.Create();
     FileStream fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);
     return row.file_hashCode = ByteArrayToString(fileHash.ComputeHash(fs));
 }
Пример #3
0
 private bool fileCheck(DataSet1.fileNamesRow frow)
 {
     bool fileChanged = false;
     if (File.Exists(frow.file_path))
     {
         FileInfo file = new FileInfo(frow.file_path);
         if (frow.file_length != file.Length)
         {
             fileChanged = true;
             fileLengthWrite(frow);
             frow.file_hashCode = hashCodeWrite(frow);
         }
         else if (frow.file_hashCode != hashCodeWrite(frow))
         {
             fileChanged = true;
             frow.file_hashCode = hashCodeWrite(frow);
         }
     }
     return fileChanged;
 }