Fixed a protential race condition with warning messages and file counts (cosmetic only) when using async transfers. Spelling correction, Seperator -> Separator. Changed so a restore operation can also supply advanced options. Changed the format of timestamps in filenames to follow the Duplicity convention, which removes the need for --time-separator and --use-short-filenames. Moved the URL utility into Core, to avoid compilation errors with Monodevelop. Reorganized the runner to better support the LiveControls on all operations rather than only for backup/restore. Update issue #210 Status: Fixed I have now changed the time format to follow the Duplicity naming convention. This means that all filenames are now generated with the time set as "yyyyMMddTHHmmssZ". This format is more portable across all platforms, and easily sortable/readable. The drawback is that the Z indicates UTC time, so if one looks at the filenames, the times are not local. The motivation for this is to avoid trouble with daylight savings time offsets. There is full backwards compatibility as long as backups have not used more than one character for --time-separator (only possible via commandline). This new format means that the options --time-separator and --use-short-filenames are now deprecated and removed from the user interface. It is possible to access them from the advanced options page, along with the --use-old-filenames option. If anyone needs these options for some reason, let me know, otherwise they will be removed in a later version. git-svn-id: https://duplicati.googlecode.com/svn/trunk@523 59da171f-624f-0410-aa54-27559c288bec
172 lines
5.8 KiB
C#
172 lines
5.8 KiB
C#
#region Disclaimer / License
|
|
// Copyright (C) 2010, 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.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Threading;
|
|
using Duplicati.Datamodel;
|
|
|
|
namespace Duplicati.GUI.HelperControls
|
|
{
|
|
public partial class BackupItems : UserControl
|
|
{
|
|
public event EventHandler ListLoaded;
|
|
public event EventHandler LoadError;
|
|
public event EventHandler ItemDoubleClicked;
|
|
private Datamodel.Schedule m_schedule;
|
|
private object m_lock = new object();
|
|
private DuplicatiRunner m_runner = null;
|
|
|
|
public BackupItems()
|
|
{
|
|
InitializeComponent();
|
|
|
|
imageList.Images.Add("full", Properties.Resources.FullBackup);
|
|
imageList.Images.Add("partial", Properties.Resources.PartialBackup);
|
|
}
|
|
|
|
public void Setup(Schedule schedule)
|
|
{
|
|
m_schedule = schedule;
|
|
WaitPanel.Visible = true;
|
|
WaitPanel.Dock = DockStyle.None;
|
|
statusLabel.TextAlign = ContentAlignment.MiddleCenter;
|
|
progressBar.Visible = true;
|
|
listView.Visible = false;
|
|
|
|
backgroundWorker.RunWorkerAsync(schedule);
|
|
}
|
|
|
|
public DateTime SelectedItem
|
|
{
|
|
get
|
|
{
|
|
return listView.SelectedItems.Count != 1 ? new DateTime() : ((Library.Main.ManifestEntry)listView.SelectedItems[0].Tag).Time;
|
|
}
|
|
}
|
|
|
|
private void viewFilesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
ListBackupFiles dlg = new ListBackupFiles();
|
|
dlg.ShowList(this, m_schedule, this.SelectedItem);
|
|
}
|
|
|
|
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
lock (m_lock)
|
|
m_runner = new DuplicatiRunner();
|
|
e.Result = m_runner.ListBackupEntries(m_schedule);
|
|
}
|
|
finally
|
|
{
|
|
lock (m_lock)
|
|
m_runner = null;
|
|
}
|
|
}
|
|
|
|
public void Abort()
|
|
{
|
|
try
|
|
{
|
|
lock (m_lock)
|
|
if (m_runner != null)
|
|
m_runner.Terminate();
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
{
|
|
WaitPanel.Visible = false;
|
|
|
|
if (e.Error != null || e.Cancelled || e.Result == null)
|
|
{
|
|
Exception ex = e.Error;
|
|
if (ex == null && e.Cancelled)
|
|
ex = new Exception(Strings.BackupItems.OperationCancelled);
|
|
else if (ex == null && e.Result == null)
|
|
ex = new Exception(Strings.BackupItems.NoDataReceived);
|
|
|
|
progressBar.Visible = false;
|
|
WaitPanel.Visible = true;
|
|
WaitPanel.Dock = DockStyle.Fill;
|
|
statusLabel.Text = string.Format(Strings.BackupItems.ErrorStatusDisplay, ex.Message);
|
|
statusLabel.Visible = true;
|
|
statusLabel.TextAlign = ContentAlignment.TopLeft;
|
|
WaitPanel.Visible = true;
|
|
|
|
if (LoadError != null)
|
|
LoadError(this, null);
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
listView.Visible = true;
|
|
listView.BeginUpdate();
|
|
listView.Items.Clear();
|
|
|
|
foreach (Library.Main.ManifestEntry ef in (List<Library.Main.ManifestEntry>)e.Result)
|
|
{
|
|
ListViewItem n = new ListViewItem(ef.Time.ToLongDateString() + " " + ef.Time.ToLongTimeString(), 0);
|
|
n.Tag = ef;
|
|
n.ToolTipText = Strings.BackupItems.TooltipFullBackup;
|
|
listView.Items.Add(n);
|
|
|
|
foreach (Library.Main.ManifestEntry i in ef.Incrementals)
|
|
{
|
|
ListViewItem nn = new ListViewItem(i.Time.ToLongDateString() + " " + i.Time.ToLongTimeString(), 1);
|
|
nn.Tag = i;
|
|
nn.ToolTipText = Strings.BackupItems.TooltipPartialBackup;
|
|
listView.Items.Add(nn);
|
|
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
listView.EndUpdate();
|
|
}
|
|
|
|
if (ListLoaded != null)
|
|
ListLoaded(this, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void listView_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
if (listView.SelectedItems.Count == 1 && ItemDoubleClicked != null)
|
|
ItemDoubleClicked(sender, e);
|
|
|
|
}
|
|
|
|
}
|
|
}
|