Final commit in the refactor sequence.

git-svn-id: https://duplicati.googlecode.com/svn/trunk@59 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2009-01-14 17:31:19 +00:00
parent 3f0e519879
commit 8879df0309
4 changed files with 69 additions and 47 deletions
+21 -9
View File
@@ -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
@@ -39,29 +39,37 @@
<Compile Include="UnitTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Backend\File\Duplicati.Backend.File.csproj">
<ProjectReference Include="..\Library\Backend\File\Duplicati.Library.Backend.File.csproj">
<Project>{FC9B7611-836F-4127-8B44-A7C31F506807}</Project>
<Name>Duplicati.Backend.File</Name>
<Name>Duplicati.Library.Backend.File</Name>
</ProjectReference>
<ProjectReference Include="..\Compression\Duplicati.Compression.csproj">
<ProjectReference Include="..\Library\Backend\FTP\Duplicati.Library.Backend.FTP.csproj">
<Project>{F61679A9-E5DE-468A-B5A4-05F92D0143D2}</Project>
<Name>Duplicati.Library.Backend.FTP</Name>
</ProjectReference>
<ProjectReference Include="..\Library\Backend\SSH\Duplicati.Library.Backend.SSH.csproj">
<Project>{6BA21DCB-1701-4936-B177-3B6D4DE3474E}</Project>
<Name>Duplicati.Library.Backend.SSH</Name>
</ProjectReference>
<ProjectReference Include="..\Library\Compression\Duplicati.Library.Compression.csproj">
<Project>{19ECCE09-B5EB-406C-8C57-BAC66997D469}</Project>
<Name>Duplicati.Compression</Name>
<Name>Duplicati.Library.Compression</Name>
</ProjectReference>
<ProjectReference Include="..\Core\Duplicati.Core.csproj">
<ProjectReference Include="..\Library\Core\Duplicati.Library.Core.csproj">
<Project>{DE3E5D4C-51AB-4E5E-BEE8-E636CEBFBA65}</Project>
<Name>Duplicati.Core</Name>
<Name>Duplicati.Library.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Logging\Duplicati.Logging.csproj">
<ProjectReference Include="..\Library\Logging\Duplicati.Library.Logging.csproj">
<Project>{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}</Project>
<Name>Duplicati.Logging</Name>
<Name>Duplicati.Library.Logging</Name>
</ProjectReference>
<ProjectReference Include="..\Main\Duplicati.Main.csproj">
<ProjectReference Include="..\Library\Main\Duplicati.Library.Main.csproj">
<Project>{10D2D1B7-C664-41D8-9B3A-00040C3D421B}</Project>
<Name>Duplicati.Main</Name>
<Name>Duplicati.Library.Main</Name>
</ProjectReference>
<ProjectReference Include="..\SharpRSync\Duplicati.SharpRSync.csproj">
<ProjectReference Include="..\Library\SharpRSync\Duplicati.Library.SharpRSync.csproj">
<Project>{47FE73E1-0832-44F7-96B9-2580273206C3}</Project>
<Name>Duplicati.SharpRSync</Name>
<Name>Duplicati.Library.SharpRSync</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+4 -4
View File
@@ -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<string, string> 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);
}
}
+24 -22
View File
@@ -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
/// <param name="folders">The folders to backup. Folder at index 0 is the base, all others are incrementals</param>
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<string, string> options = new Dictionary<string, string>();
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<Main.BackupEntry> entries = Duplicati.Main.Interface.ParseFileList("file://" + tf, options);
List<Duplicati.Library.Main.BackupEntry> 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<Main.BackupEntry> t = new List<Duplicati.Main.BackupEntry>();
List<Duplicati.Library.Main.BackupEntry> t = new List<Duplicati.Library.Main.BackupEntry>();
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<string, string> opts = new Dictionary<string, string>();
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;
}
/// <summary>
@@ -104,11 +106,11 @@ namespace Duplicati.CommandLine
/// <param name="f2">Another folder</param>
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<string> folders1 = Core.Utility.EnumerateFolders(f1);
List<string> folders2 = Core.Utility.EnumerateFolders(f2);
List<string> folders1 = Utility.EnumerateFolders(f1);
List<string> 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<string> files1 = Core.Utility.EnumerateFiles(f1);
List<string> files2 = Core.Utility.EnumerateFiles(f2);
List<string> files1 = Utility.EnumerateFiles(f1);
List<string> files2 = Utility.EnumerateFiles(f2);
foreach (string s in files1)
{
string relpath = s.Substring(f1.Length);