/// <summary> /// method of starting all processes /// </summary> public void Comparisone() { try { if (!Directory.Exists(this.import.Root)) { Console.WriteLine("Error open directory"); return; } ComparisonFile.TestFile(this.import, this.export); ComparisonFile.DeleteFile(this.export.Files); OperatinDirectory.TestDirectory(this.import, this.export); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(e.Message); Console.ResetColor(); Console.ReadKey(true); this.export.ClearError(); } finally { this.Reset(); } }
/// <summary> /// method of starting recursive traversal /// </summary> /// <param name="s">root of the bypass folder</param> /// <param name="obj">serialization object</param> public void Open(Sinhronizer obj) { if (!Directory.Exists(this.Root)) { OperatinDirectory.CrieteDirectory(this.Root); } base.WalkRir(new DirectoryInfo(this.Root), files, dir, obj, (int)Nums.Zero, dir.Count == (int)Nums.Zero); }
/// <summary> /// method for cleaning a folder in case of an error /// </summary> public void ClearError() { ComparisonFile.DeleteFile(this.newFile); OperatinDirectory.DeleteDir(this.newDir); foreach (var key in this.moveFile.Keys) { ComparisonFile.MoveFile(key, this.moveFile[key]); } }
/// <summary> /// method for create folders /// </summary> public void CreateDir() { foreach (var dir in this.import.Dir) { var buf = string.Format("{0}\\{1}", this.export.Root, dir.Remove((int)Nums.Zero, this.import.Root.Length)); if (!Directory.Exists(buf)) { this.export.AddNewDir(buf); OperatinDirectory.CrieteDirectory(buf); } } }