コード例 #1
0
ファイル: SHA1Verifier.cs プロジェクト: albfernandez/dalle
 protected void CreateRecursive(string[] files, bool recursive, TextWriter writer)
 {
     foreach (string f in files){
         if (Directory.Exists (f)){
             if (recursive)
                 CreateRecursive (Directory.GetFileSystemEntries (f), recursive, writer);
         }
         else {
             SFVElement e = new SFVElement (f, "", new FileHasherSHA1());
             e.GenerateHash();
             PutSHA1 (e, writer);
         }
     }
 }
コード例 #2
0
ファイル: SFVVerifier.cs プロジェクト: albfernandez/dalle
 protected void CreateRecursive(string[] files, bool recursive, TextWriter writer)
 {
     foreach (string f in files){
         if (Directory.Exists (f)){
             if (recursive){
                 CreateRecursive (Directory.GetFileSystemEntries (f), recursive, writer);
             }
         }
         else {
             SFVElement e = new SFVElement (f, "", new FileHasherCrc32());
             e.GenerateHash();
             writer.WriteLine (f.Replace (Path.DirectorySeparatorChar, '\\') + " " + e.RealHash);
         }
     }
 }
コード例 #3
0
 protected void OnFileCheck(SFVElement e, FileCheckResult res)
 {
     string msg;
     switch (res){
         case FileCheckResult.Ok:
             msg = Catalog.GetString("Ok");
             break;
         case FileCheckResult.NotFound:
             msg = Catalog.GetString("Not Found");
             break;
         case FileCheckResult.IsDirectory:
             msg = Catalog.GetString("Is Directory");
             break;
         case FileCheckResult.Failed:
             msg = Catalog.GetString("Failed!");
             break;
         default:
             msg = Catalog.GetString("Unknown error!");
             break;
     }
     if ((verbose) || (res != FileCheckResult.Ok) )
         Console.WriteLine ("{0,-40} {1}", e.FileName + "...", msg);
 }
コード例 #4
0
ファイル: SFVVerifier.cs プロジェクト: albfernandez/dalle
 protected override ArrayList GenerateSFVFileList(string file)
 {
     ArrayList ret = new ArrayList ();
     TextReader reader = File.OpenText (file);
     string linea;
     linea = reader.ReadLine ();
     while (linea != null){
         int idx = linea.IndexOf (';');
         if (idx >=0)
             linea = linea.Substring (0, linea.IndexOf(';'));
         linea = linea.Trim();
         if (linea != string.Empty) {
             try{
                 string fname = linea.Substring (0, linea.LastIndexOf (" ")).Trim();
                 string hash = linea.Substring (linea.LastIndexOf(" ")).Trim();
                 fname = fname.Replace ('\\', Path.DirectorySeparatorChar);
                 SFVElement el = new SFVElement (fname, hash, new FileHasherCrc32());
                 ret.Add (el);
             }
             catch (System.Exception) {
             }
         }
         linea = reader.ReadLine ();
     }
     return ret;
 }
コード例 #5
0
ファイル: SHA1Verifier.cs プロジェクト: albfernandez/dalle
 protected virtual void PutSHA1(SFVElement e, TextWriter writer)
 {
     writer.WriteLine (e.RealHash + "  " + e.FileName);
 }
コード例 #6
0
 protected void OnFileCheck(SFVElement e, FileCheckResult res)
 {
     if (this.FileCheck != null){
         this.FileCheck (e, res);
     }
 }
コード例 #7
0
ファイル: FVerification.cs プロジェクト: albfernandez/dalle
 protected void OnFileEvent(SFVElement e, FileCheckResult r)
 {
     if (this.FileCheck != null)
         this.FileCheck (e, r);
 }