Files
duplicati/Duplicati/GUI/Datamodel/Backends/File.cs
T
kenneth.skovhede@gmail.com daaef5f092 Fixed issue #39.
Fixed issue #41.
Fixed issue #11.
Refactored the way settings are stored, this means that you cannot go back to a previous version if you have used this one.
A backup of the old database will be created, if you need to use a previous version.
Fixed a bug in the S3 backend where the filenames would be prefixed with a slash.
Moved the file time seperator char out of the file backend, and into common settings.


git-svn-id: https://duplicati.googlecode.com/svn/trunk@134 59da171f-624f-0410-aa54-27559c288bec
2009-03-29 18:06:02 +00:00

83 lines
2.8 KiB
C#

#region Disclaimer / License
// Copyright (C) 2009, Kenneth Skovhede
// http://www.hexad.dk, opensource@hexad.dk
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
namespace Duplicati.Datamodel.Backends
{
public class File : IBackend
{
private const string DESTINATION_FOLDER = "Destination";
private const string USERNAME = "Username";
private const string PASSWORD = "Password";
private Task m_owner;
public File(Task owner)
{
m_owner = owner;
if (m_owner.Extensions.FileTimeSeperator == null)
m_owner.Extensions.FileTimeSeperator = "'";
}
public string DestinationFolder
{
get { return m_owner.BackendSettingsLookup[DESTINATION_FOLDER]; }
set { m_owner.BackendSettingsLookup[DESTINATION_FOLDER] = value; }
}
public string Username
{
get { return m_owner.BackendSettingsLookup[USERNAME]; }
set { m_owner.BackendSettingsLookup[USERNAME] = value; }
}
public string Password
{
get { return m_owner.BackendSettingsLookup[PASSWORD]; }
set { m_owner.BackendSettingsLookup[PASSWORD] = value; }
}
#region IBackend Members
public string GetDestinationPath()
{
if (!string.IsNullOrEmpty(this.Username))
return "file://" + this.Username + "@" + this.DestinationFolder;
else
return "file://" + this.DestinationFolder;
}
public void GetOptions(Dictionary<string, string> options)
{
if (!string.IsNullOrEmpty(this.Password))
options["ftp-password"] = this.Password;
}
public string FriendlyName { get { return "External drive or folder"; } }
public string SystemName { get { return "file"; } }
public void SetService() { m_owner.Service = this.SystemName; }
#endregion
}
}