From 8879df0309d02b35e8bd51be3bcccc4e81c81397 Mon Sep 17 00:00:00 2001 From: "kenneth.skovhede@gmail.com" Date: Wed, 14 Jan 2009 17:31:19 +0000 Subject: [PATCH] Final commit in the refactor sequence. git-svn-id: https://duplicati.googlecode.com/svn/trunk@59 59da171f-624f-0410-aa54-27559c288bec --- Duplicati Console.sln | 30 ++++++++---- .../CommandLine/Duplicati.CommandLine.csproj | 32 ++++++++----- Duplicati/CommandLine/Program.cs | 8 ++-- Duplicati/CommandLine/UnitTest.cs | 46 ++++++++++--------- 4 files changed, 69 insertions(+), 47 deletions(-) diff --git a/Duplicati Console.sln b/Duplicati Console.sln index 49b2af1a3..26fbea3db 100644 --- a/Duplicati Console.sln +++ b/Duplicati Console.sln @@ -1,25 +1,29 @@  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Main", "Duplicati\Main\Duplicati.Main.csproj", "{10D2D1B7-C664-41D8-9B3A-00040C3D421B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Main", "Duplicati\Library\Main\Duplicati.Library.Main.csproj", "{10D2D1B7-C664-41D8-9B3A-00040C3D421B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.CommandLine", "Duplicati\CommandLine\Duplicati.CommandLine.csproj", "{81765A64-3661-4E3E-B850-2F6F87A51F74}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Backend.BackendInterface", "Duplicati\Backend\BackendInterface\Duplicati.Backend.BackendInterface.csproj", "{994F3D0A-E91E-4EEE-80EE-064485E09909}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.BackendInterface", "Duplicati\Library\Backend\BackendInterface\Duplicati.Library.Backend.BackendInterface.csproj", "{994F3D0A-E91E-4EEE-80EE-064485E09909}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Backend.BackendLoader", "Duplicati\Backend\BackendLoader\Duplicati.Backend.BackendLoader.csproj", "{0CA86ECF-5BEC-4909-B4F6-110A03B30B92}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.BackendLoader", "Duplicati\Library\Backend\BackendLoader\Duplicati.Library.Backend.BackendLoader.csproj", "{0CA86ECF-5BEC-4909-B4F6-110A03B30B92}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Backend.File", "Duplicati\Backend\File\Duplicati.Backend.File.csproj", "{FC9B7611-836F-4127-8B44-A7C31F506807}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.File", "Duplicati\Library\Backend\File\Duplicati.Library.Backend.File.csproj", "{FC9B7611-836F-4127-8B44-A7C31F506807}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Core", "Duplicati\Core\Duplicati.Core.csproj", "{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Core", "Duplicati\Library\Core\Duplicati.Library.Core.csproj", "{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Compression", "Duplicati\Compression\Duplicati.Compression.csproj", "{19ECCE09-B5EB-406C-8C57-BAC66997D469}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Compression", "Duplicati\Library\Compression\Duplicati.Library.Compression.csproj", "{19ECCE09-B5EB-406C-8C57-BAC66997D469}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.SharpRSync", "Duplicati\SharpRSync\Duplicati.SharpRSync.csproj", "{47FE73E1-0832-44F7-96B9-2580273206C3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.SharpRSync", "Duplicati\Library\SharpRSync\Duplicati.Library.SharpRSync.csproj", "{47FE73E1-0832-44F7-96B9-2580273206C3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Logging", "Duplicati\Logging\Duplicati.Logging.csproj", "{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Logging", "Duplicati\Library\Logging\Duplicati.Library.Logging.csproj", "{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Encryption", "Duplicati\Encryption\Duplicati.Encryption.csproj", "{94484FDB-2EFA-4CF0-9BE6-A561157B4F87}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Encryption", "Duplicati\Library\Encryption\Duplicati.Library.Encryption.csproj", "{94484FDB-2EFA-4CF0-9BE6-A561157B4F87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.FTP", "Duplicati\Library\Backend\FTP\Duplicati.Library.Backend.FTP.csproj", "{F61679A9-E5DE-468A-B5A4-05F92D0143D2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicati.Library.Backend.SSH", "Duplicati\Library\Backend\SSH\Duplicati.Library.Backend.SSH.csproj", "{6BA21DCB-1701-4936-B177-3B6D4DE3474E}" EndProject Global GlobalSection(SubversionScc) = preSolution @@ -71,6 +75,14 @@ Global {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Debug|Any CPU.Build.0 = Debug|Any CPU {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Release|Any CPU.ActiveCfg = Release|Any CPU {94484FDB-2EFA-4CF0-9BE6-A561157B4F87}.Release|Any CPU.Build.0 = Release|Any CPU + {F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F61679A9-E5DE-468A-B5A4-05F92D0143D2}.Release|Any CPU.Build.0 = Release|Any CPU + {6BA21DCB-1701-4936-B177-3B6D4DE3474E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6BA21DCB-1701-4936-B177-3B6D4DE3474E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6BA21DCB-1701-4936-B177-3B6D4DE3474E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6BA21DCB-1701-4936-B177-3B6D4DE3474E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Duplicati/CommandLine/Duplicati.CommandLine.csproj b/Duplicati/CommandLine/Duplicati.CommandLine.csproj index d58210e88..2ec1c4363 100644 --- a/Duplicati/CommandLine/Duplicati.CommandLine.csproj +++ b/Duplicati/CommandLine/Duplicati.CommandLine.csproj @@ -39,29 +39,37 @@ - + {FC9B7611-836F-4127-8B44-A7C31F506807} - Duplicati.Backend.File + Duplicati.Library.Backend.File - + + {F61679A9-E5DE-468A-B5A4-05F92D0143D2} + Duplicati.Library.Backend.FTP + + + {6BA21DCB-1701-4936-B177-3B6D4DE3474E} + Duplicati.Library.Backend.SSH + + {19ECCE09-B5EB-406C-8C57-BAC66997D469} - Duplicati.Compression + Duplicati.Library.Compression - + {DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65} - Duplicati.Core + Duplicati.Library.Core - + {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798} - Duplicati.Logging + Duplicati.Library.Logging - + {10D2D1B7-C664-41D8-9B3A-00040C3D421B} - Duplicati.Main + Duplicati.Library.Main - + {47FE73E1-0832-44F7-96B9-2580273206C3} - Duplicati.SharpRSync + Duplicati.Library.SharpRSync diff --git a/Duplicati/CommandLine/Program.cs b/Duplicati/CommandLine/Program.cs index 1583dc794..79421062a 100644 --- a/Duplicati/CommandLine/Program.cs +++ b/Duplicati/CommandLine/Program.cs @@ -36,7 +36,7 @@ namespace Duplicati.CommandLine return; } #endif - cargs.Add(Core.FilenameFilter.EncodeAsFilter(Core.FilenameFilter.ParseCommandLine(cargs, true))); + cargs.Add(Duplicati.Library.Core.FilenameFilter.EncodeAsFilter(Duplicati.Library.Core.FilenameFilter.ParseCommandLine(cargs, true))); Dictionary options = CommandLineParser.ExtractOptions(cargs); //TODO: Print usage window @@ -58,7 +58,7 @@ namespace Duplicati.CommandLine options["passphrase"] = System.Environment.GetEnvironmentVariable("PASSPHRASE"); if (source.Trim().ToLower() == "list") - Console.WriteLine(string.Join("\r\n", Duplicati.Main.Interface.List(target, options))); + Console.WriteLine(string.Join("\r\n", Duplicati.Library.Main.Interface.List(target, options))); else if (source.IndexOf("://") > 0 || options.ContainsKey("restore")) { if (!options.ContainsKey("passphrase") && !options.ContainsKey("no-encryption")) @@ -70,7 +70,7 @@ namespace Duplicati.CommandLine options["passphrase"] = pwd; } - Duplicati.Main.Interface.Restore(source, target, options); + Duplicati.Library.Main.Interface.Restore(source, target, options); } else { @@ -83,7 +83,7 @@ namespace Duplicati.CommandLine options["passphrase"] = pwd; } - Duplicati.Main.Interface.Backup(source, target, options); + Duplicati.Library.Main.Interface.Backup(source, target, options); } } diff --git a/Duplicati/CommandLine/UnitTest.cs b/Duplicati/CommandLine/UnitTest.cs index bb0a0199f..bbdd640d7 100644 --- a/Duplicati/CommandLine/UnitTest.cs +++ b/Duplicati/CommandLine/UnitTest.cs @@ -23,6 +23,8 @@ using System; using System.Collections.Generic; using System.Text; +using Duplicati.Library.Logging; +using Duplicati.Library.Core; namespace Duplicati.CommandLine { @@ -38,62 +40,62 @@ namespace Duplicati.CommandLine /// The folders to backup. Folder at index 0 is the base, all others are incrementals public static void RunTest(string[] folders) { - Logging.Log.CurrentLog = new Logging.StreamLog("unittest.log"); - Logging.Log.LogLevel = Duplicati.Logging.LogMessageType.Profiling; + Log.CurrentLog = new StreamLog("unittest.log"); + Log.LogLevel = Duplicati.Library.Logging.LogMessageType.Profiling; - using(new Logging.Timer("Total unittest")) - using (Core.TempFolder tf = new Duplicati.Core.TempFolder()) + using(new Timer("Total unittest")) + using (TempFolder tf = new TempFolder()) { Dictionary options = new Dictionary(); options["time-separator"] = "'"; options["passphrase"] = "secret password!"; Console.WriteLine("Backing up the full copy: " + folders[0]); - using (new Logging.Timer("Full backup of " + folders[0])) - Duplicati.Main.Interface.Backup(folders[0], "file://" + tf, options); + using (new Timer("Full backup of " + folders[0])) + Duplicati.Library.Main.Interface.Backup(folders[0], "file://" + tf, options); for (int i = 1; i < folders.Length; i++) { //If the backups are too close, we can't pick the right one :( System.Threading.Thread.Sleep(1000 * 5); Console.WriteLine("Backing up the incremental copy: " + folders[i]); - using (new Logging.Timer("Incremental backup of " + folders[i])) - Duplicati.Main.Interface.Backup(folders[i], "file://" + tf, options); + using (new Timer("Incremental backup of " + folders[i])) + Duplicati.Library.Main.Interface.Backup(folders[i], "file://" + tf, options); } - List entries = Duplicati.Main.Interface.ParseFileList("file://" + tf, options); + List entries = Duplicati.Library.Main.Interface.ParseFileList("file://" + tf, options); if (entries.Count != 1 || entries[0].Incrementals.Count != folders.Length - 1) throw new Exception("Filename parsing problem, or corrupt storage"); - List t = new List(); + List t = new List(); t.Add(entries[0]); t.AddRange(entries[0].Incrementals); entries = t; for (int i = 0; i < entries.Count; i++) { - using (Core.TempFolder ttf = new Duplicati.Core.TempFolder()) + using (TempFolder ttf = new TempFolder()) { Console.WriteLine("Restoring the copy: " + folders[i]); Dictionary opts = new Dictionary(); opts["restore-time"] = entries[i].Time.ToString(); opts["time-separator"] = "'"; - using (new Logging.Timer("Restore of " + folders[i])) - Duplicati.Main.Interface.Restore("file://" + tf, ttf, opts); + using (new Timer("Restore of " + folders[i])) + Duplicati.Library.Main.Interface.Restore("file://" + tf, ttf, opts); Console.WriteLine("Verifying the copy: " + folders[i]); - using (new Logging.Timer("Verification of " + folders[i])) + using (new Timer("Verification of " + folders[i])) VerifyDir(System.IO.Path.GetFullPath(folders[i]), ttf); } } } - (Logging.Log.CurrentLog as Logging.StreamLog).Dispose(); - Logging.Log.CurrentLog = null; + (Log.CurrentLog as StreamLog).Dispose(); + Log.CurrentLog = null; } /// @@ -104,11 +106,11 @@ namespace Duplicati.CommandLine /// Another folder private static void VerifyDir(string f1, string f2) { - f1 = Core.Utility.AppendDirSeperator(f1); - f2 = Core.Utility.AppendDirSeperator(f2); + f1 = Utility.AppendDirSeperator(f1); + f2 = Utility.AppendDirSeperator(f2); - List folders1 = Core.Utility.EnumerateFolders(f1); - List folders2 = Core.Utility.EnumerateFolders(f2); + List folders1 = Utility.EnumerateFolders(f1); + List folders2 = Utility.EnumerateFolders(f2); foreach (string s in folders1) { @@ -123,8 +125,8 @@ namespace Duplicati.CommandLine foreach(string s in folders2) Console.WriteLine("Extra folder: " + s.Substring(f2.Length)); - List files1 = Core.Utility.EnumerateFiles(f1); - List files2 = Core.Utility.EnumerateFiles(f2); + List files1 = Utility.EnumerateFiles(f1); + List files2 = Utility.EnumerateFiles(f2); foreach (string s in files1) { string relpath = s.Substring(f1.Length);