本文整理汇总了C#中Duplicati类的典型用法代码示例。如果您正苦于以下问题:C# Duplicati类的具体用法?C# Duplicati怎么用?C# Duplicati使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Duplicati类属于命名空间,在下文中一共展示了Duplicati类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuItemWrapper
public MenuItemWrapper(RumpsRunner parent, string text, Duplicati.GUI.TrayIcon.MenuIcons icon, Action callback, IList<Duplicati.GUI.TrayIcon.IMenuItem> subitems)
{
m_parent = parent;
Key = Guid.NewGuid().ToString("N");
m_text = text ?? "";
Callback = callback;
m_enabled = true;
m_default = false;
if (subitems != null)
Subitems = subitems.Cast<MenuItemWrapper>().ToList();
}
示例2: GetSourceNames
private Dictionary<string, string> GetSourceNames(Duplicati.Server.Serialization.Interface.IBackup backup)
{
var systemIO = Duplicati.Library.Snapshots.SnapshotUtility.SystemIO;
return backup.Sources.Distinct().Select(x => {
var sp = SpecialFolders.TranslateToDisplayString(x);
if (sp != null)
return new KeyValuePair<string, string>(x, sp);
x = SpecialFolders.ExpandEnvironmentVariables(x);
try {
var nx = x;
if (nx.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
nx = nx.Substring(0, nx.Length - 1);
var n = systemIO.PathGetFileName(nx);
if (!string.IsNullOrWhiteSpace(n))
return new KeyValuePair<string, string>(x, n);
} catch {
}
if (x.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()) && x.Length > 1)
return new KeyValuePair<string, string>(x, x.Substring(0, x.Length - 1).Substring(x.Substring(0, x.Length - 1).LastIndexOf("/") + 1));
else
return new KeyValuePair<string, string>(x, x);
}).ToDictionary(x => x.Key, x => x.Value);
}
示例3: DynamicModule
/// <summary>
/// Constructor for webmodule interface
/// </summary>
public DynamicModule(Duplicati.Library.Interface.IWebModule module)
{
this.Key = module.Key;
this.Description = module.Description;
this.DisplayName = module.DisplayName;
if (module.SupportedCommands != null)
this.Options = module.SupportedCommands.ToArray();
}
示例4: SettingsDialog
/// <summary>
/// Edit Settings
/// </summary>
/// <remarks>
/// Here a global password may be set. If set, User may use it for backups, or not as User is want.
/// The bubbles thing is not used now.
/// </remarks>
/// <param name="aSettings">Settings to edit</param>
public SettingsDialog(Duplicati.Scheduler.Data.SchedulerDataSet.SettingsDataTable aSettings)
{
InitializeComponent();
this.Settings = aSettings;
OriginalXML = XmlFromTable(aSettings);
this.checkBox1.Checked = this.Settings.UseGlobalPassword;
this.passwordControl1.CheckMod = this.Settings.Values.CheckMod;
this.passwordControl1.Checksum = this.Settings.Values.Checksum;
this.numericUpDown1.Value = (decimal)this.Settings.Values.LogFileAgeDays;
if (this.Settings.Values.IsShowBubblesNull()) this.Settings.Values.ShowBubbles = true;
this.BubbleCheckBox.Checked = this.Settings.Values.ShowBubbles;
}
示例5: SetSummary
/// <summary>
/// Set the values
/// </summary>
/// <param name="aRow">The job row</param>
/// <param name="aDetails">Text description of the job trigger</param>
public void SetSummary(Duplicati.Scheduler.Data.SchedulerDataSet.JobsRow aRow, string aDetails)
{
this.nameTextBox.Text = aRow.Name;
this.DescriptionTextBox.Text = aDetails;
this.sourceTextBox.Text = aRow.Source;
this.destinationTextBox.Text = aRow.Destination;
this.LastModLabel.Text = (aRow.IsLastModNull() || aRow.LastMod == DateTime.MinValue) ? "Never edited" : "Last edited: " + aRow.LastMod.ToString("ddd, dd MMMM yyyy hh:mm tt");
if (aRow.FullOnly || (aRow.FullRepeatDays == 0 && aRow.FullAfterN == 0)) this.fullRepeatStrTextBox.Text = "Always do full backups";
else this.fullRepeatStrTextBox.Text = aRow.FullRepeatDays > 0 ? aRow.FullRepeatDays + " days " : aRow.FullAfterN.ToString()+" incrementals";
this.MaxFullTextBox.Text = aRow.MaxFulls > 0 ? "the last "+aRow.MaxFulls.ToString("N0") : "all" ;
this.MaxAgeTextBox.Text = aRow.MaxAgeDays > 0 ? aRow.MaxAgeDays.ToString("N0") + " days" : "<no limit>" ;
this.PassRichTextBox.Text = new string[] { "not password protected.", "protected by local password.", "protected by global password." }[aRow.GetCheckSrc()];
}
示例6: EnumerateFilesInDList
public static IEnumerable<Duplicati.Library.Main.Volumes.IFileEntry> EnumerateFilesInDList(string file, Duplicati.Library.Utility.IFilter filter, Dictionary<string, string> options)
{
var p = Library.Main.Volumes.VolumeBase.ParseFilename(file);
using(var cm = Library.DynamicLoader.CompressionLoader.GetModule(p.CompressionModule, file, options))
using(var filesetreader = new Library.Main.Volumes.FilesetVolumeReader(cm, new Duplicati.Library.Main.Options(options)))
foreach(var f in filesetreader.Files)
{
if (f.Type != Duplicati.Library.Main.FilelistEntryType.File)
continue;
bool result;
Library.Utility.IFilter evfilter;
bool match = filter.Matches(f.Path, out result, out evfilter);
if (!match || (match && result))
yield return f;
}
}
示例7: MenuItemWrapper
public MenuItemWrapper(string text, Duplicati.GUI.TrayIcon.MenuIcons icon, Action callback, IList<Duplicati.GUI.TrayIcon.IMenuItem> subitems)
{
if (text == "-")
m_item = NSMenuItem.SeparatorItem;
else
{
m_item = new NSMenuItem(text, ClickHandler);
m_callback = callback;
if (subitems != null && subitems.Count > 0)
{
m_item.Submenu = new NSMenu();
foreach(var itm in subitems)
m_item.Submenu.AddItem(((MenuItemWrapper)itm).MenuItem);
}
}
}
示例8: CreateListTask
public static IRunnerData CreateListTask(Duplicati.Server.Serialization.Interface.IBackup backup, string[] filters, bool onlyPrefix, bool allVersions, bool folderContents, DateTime time)
{
var dict = new Dictionary<string, string>();
if (onlyPrefix)
dict["list-prefix-only"] = "true";
if (allVersions)
dict["all-versions"] = "true";
if (time.Ticks > 0)
dict["time"] = Duplicati.Library.Utility.Utility.SerializeDateTime(time.ToUniversalTime());
if (folderContents)
dict["list-folder-contents"] = "true";
return CreateTask(
DuplicatiOperation.List,
backup,
dict,
filters);
}
示例9: JobDialog
/// <summary>
/// Edit a Job
/// </summary>
/// <param name="aRow">Row to edit</param>
public JobDialog(Duplicati.Scheduler.Data.SchedulerDataSet.JobsRow aRow)
{
InitializeComponent();
if (!string.IsNullOrEmpty(Properties.Settings.Default.TreeViewState))
this.folderSelectControl1.State = Properties.Settings.Default.TreeViewState;
this.Text = "Edit job " + aRow.Name + "(" + Utility.User.UserName + ")";
// Dang background colors in tab pages - can't trust them.
foreach (TabPage P in this.MainTabControl.TabPages)
P.BackColor = this.BackColor;
foreach (TabPage P in this.SourceTabControl.TabPages)
P.BackColor = this.BackColor;
this.folderSelectControl1.BackColor = this.BackColor;
// Add radio buttons for backends; put the backend in the tag
this.BackEndTableLayoutPanel.Controls.AddRange(
(from Library.Interface.IBackend qB in Duplicati.Library.DynamicLoader.BackendLoader.Backends
orderby qB.DisplayName
select BackendRadioButton(qB)).ToArray());
// Put the tooltip text at the bottom of the screen for easy user viewage
this.ExplainToolStripLabel.Text = this.MainTabControl.SelectedTab.ToolTipText;
// And use the row
SetRow(aRow);
}
示例10: FilterHandler
public FilterHandler(Snapshots.ISnapshotService snapshot, FileAttributes attributeFilter, Duplicati.Library.Utility.IFilter sourcefilter, Duplicati.Library.Utility.IFilter filter, Options.SymlinkStrategy symlinkPolicy, Options.HardlinkStrategy hardlinkPolicy, ILogWriter logWriter)
{
m_snapshot = snapshot;
m_attributeFilter = attributeFilter;
m_sourcefilter = sourcefilter;
m_emitfilter = filter;
m_symlinkPolicy = symlinkPolicy;
m_hardlinkPolicy = hardlinkPolicy;
m_logWriter = logWriter;
m_hardlinkmap = new Dictionary<string, string>();
m_mixinqueue = new Queue<string>();
bool includes;
bool excludes;
Library.Utility.FilterExpression.AnalyzeFilters(filter, out includes, out excludes);
if (includes && !excludes)
{
m_enumeratefilter = Library.Utility.FilterExpression.Combine(filter, new Duplicati.Library.Utility.FilterExpression("*" + System.IO.Path.DirectorySeparatorChar, true));
}
else
m_enumeratefilter = m_emitfilter;
}
示例11: EnumerateFilesAndFolders
/// <summary>
/// Enumerates all files and folders in the snapshot
/// </summary>
/// <param name="startpath">The path from which to retrieve files and folders</param>
/// <param name="callback">The callback to invoke with each found path</param>
public void EnumerateFilesAndFolders(string startpath, Duplicati.Library.Utility.Utility.EnumerationCallbackDelegate callback)
{
foreach (string s in m_sourcefolders)
if (s.Equals(startpath, Utility.Utility.ClientFilenameStringComparision))
{
Utility.Utility.EnumerateFileSystemEntries(s, callback, this.ListFolders, this.ListFiles, this.GetAttributes);
return;
}
throw new InvalidOperationException(string.Format(Strings.Shared.InvalidEnumPathError, startpath));
}
示例12: TestIfOptionApplies
private static bool TestIfOptionApplies(Duplicati.Server.Serialization.Interface.IBackup backup, DuplicatiOperation mode, string filter)
{
//TODO: Implement to avoid warnings
return true;
}
示例13: CreateRestoreTask
public static IRunnerData CreateRestoreTask(Duplicati.Server.Serialization.Interface.IBackup backup, string[] filters, DateTime time, string restoreTarget, bool overwrite, bool restore_permissions, bool skip_metadata)
{
var dict = new Dictionary<string, string>();
dict["time"] = Duplicati.Library.Utility.Utility.SerializeDateTime(time.ToUniversalTime());
if (!string.IsNullOrWhiteSpace(restoreTarget))
dict["restore-path"] = SpecialFolders.ExpandEnvironmentVariables(restoreTarget);
if (overwrite)
dict["overwrite"] = "true";
if (restore_permissions)
dict["restore-permissions"] = "true";
if (skip_metadata)
dict["skip-metadata"] = "true";
return CreateTask(
DuplicatiOperation.Restore,
backup,
dict,
filters);
}
示例14: BackendEvent
public void BackendEvent(Duplicati.Library.Main.BackendActionType action, Duplicati.Library.Main.BackendEventType type, string path, long size)
{
lock(m_lock)
{
m_state.m_backendAction = action;
m_state.m_backendPath = path;
if (type == Duplicati.Library.Main.BackendEventType.Started)
m_state.m_backendFileSize = size;
else if (type == Duplicati.Library.Main.BackendEventType.Progress)
m_state.m_backendFileProgress = size;
else
{
m_state.m_backendFileSize = 0;
m_state.m_backendFileProgress = 0;
m_state.m_backendSpeed = 0;
}
}
}
示例15: FilterHandler
public FilterHandler(Snapshots.ISnapshotService snapshot, FileAttributes attributeFilter, Duplicati.Library.Utility.IFilter sourcefilter, Duplicati.Library.Utility.IFilter filter, Options.SymlinkStrategy symlinkPolicy, Options.HardlinkStrategy hardlinkPolicy, ILogWriter logWriter)
{
m_snapshot = snapshot;
m_attributeFilter = attributeFilter;
m_sourcefilter = sourcefilter;
m_filter = filter;
m_symlinkPolicy = symlinkPolicy;
m_hardlinkPolicy = hardlinkPolicy;
m_logWriter = logWriter;
m_hardlinkmap = new Dictionary<string, string>();
}