Ejemplo n.º 1
0
        public FDOperationQueue(FDDataStore store, FDUserSettings userset, FDOperationLog oplog)
        {
            stopQueue = false;
            DataStore = store;
            settings = userset;
            log = oplog;
            UploadRunning = DownloadRunning = false;

            uploadQueue = new ConcurrentQueue<FDQueueItem>();
            downloadQueue = new ConcurrentQueue<FDQueueItem>();
            current = new ConcurrentStack<FDQueueItem>();
            finished = new ConcurrentStack<FDQueueItem>();

            ignoreGuid = new HashSet<Guid>();
        }
Ejemplo n.º 2
0
        public FDGlacier(FDUserSettings settings, FDOperationLog oplog, string optype)
        {
            this.vaultName = settings.AWSGlacierVaultName;
            log = oplog;

            switch (settings.AWSRegion) {
            case FDUserSettings.AWSRegionIndex.USWest1:
                region = RegionEndpoint.USWest1;
                break;
            case FDUserSettings.AWSRegionIndex.USWest2:
                region = RegionEndpoint.USWest2;
                break;
            case FDUserSettings.AWSRegionIndex.USEast1:
                region = RegionEndpoint.USEast1;
                break;
            case FDUserSettings.AWSRegionIndex.EUWest1:
                region = RegionEndpoint.EUWest1;
                break;
            case FDUserSettings.AWSRegionIndex.APNortheast1:
                region = RegionEndpoint.APNortheast1;
                break;
            default:
                region = RegionEndpoint.USEast1;
                break;
            }

            //Instantiate the glacier config with our settins (for future move to AmazonGlacierClient)
            glacierConfig = new AmazonGlacierConfig();
            glacierConfig.RegionEndpoint = region;

            //Instantiate AWS Credentials
            awsCredentials = new BasicAWSCredentials(settings.AWSAccessKey, settings.AWSSecretKey);

            //Instantiate the transfer manager with our settings
            //TODO: Switch to glacier client so we can abort this damn thing
            //glacierClient = new AmazonGlacierClient(appConfig["AWSAccessKey"], appConfig["AWSSecretKey"], region);
            transferManager = new ArchiveTransferManager(awsCredentials, region);

            upOptions = new UploadOptions();
            downOptions = new DownloadOptions();
            progress = 0;
            upOptions.StreamTransferProgress = downOptions.StreamTransferProgress = this.onProgress;

            OperationType = optype;
        }
Ejemplo n.º 3
0
        public FDPreferences(Gtk.Window win, Gtk.DialogFlags f, FDUserSettings userset, bool firstRun = false)
            : base("Preferences", win, f)
        {
            this.Build ();
            settings = userset;
            isFirstRun = firstRun;
            allowExit = false;

            //fill the settings fields
            entryAWSAccessKey.Text = settings.AWSAccessKey;
            entryAWSSecretKey.Text = settings.AWSSecretKey;
            entryAWSGlacierVaultName.Text = settings.AWSGlacierVaultName;
            comboboxAWSRegion.Active = settings.AWSRegion;
            this.DeleteEvent += OnDeleteEvent;

            //you can't cancel if this is firstrun
            if(firstRun) buttonCancel.Sensitive = false;
        }
Ejemplo n.º 4
0
    public FDQueueView()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        UserSettings = new FDUserSettings();
        DataStore = new FDDataStore(UserSettings.CurrentDataStore, FDLogVerbosity.Warning);
        log = new FDOperationLog(DataStore, FDLogVerbosity.Warning, true);
        operationQueue = new FDOperationQueue(DataStore, UserSettings, log);
        treeview1.Selection.Changed += RemoveSensitive;

        //Create the item list
        items = new List<ListItem>();
        this.uploadQueue = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(Guid), typeof(FDItemStatus));

        //Create the tree view columns and misc
        TreeViewColumn icon = new TreeViewColumn();
        TreeViewColumn filename = new TreeViewColumn();
        TreeViewColumn progress = new TreeViewColumn();
        icon.Title = "";
        filename.Title = "Filename";
        progress.Title = "Progress";
        Gtk.CellRendererPixbuf iconCell = new Gtk.CellRendererPixbuf();
        Gtk.CellRendererText filenameCell = new Gtk.CellRendererText();
        Gtk.CellRendererText progressCell = new Gtk.CellRendererText();
        icon.PackStart(iconCell, true);
        filename.PackStart(filenameCell, true);
        progress.PackStart(progressCell, false);
        icon.AddAttribute(iconCell, "pixbuf", 0);
        filename.AddAttribute(filenameCell, "text", 1);
        progress.AddAttribute(progressCell, "text", 2);
        treeview1.AppendColumn(icon);
        treeview1.AppendColumn(filename);
        treeview1.AppendColumn(progress);
        treeview1.Model = this.uploadQueue;
        Gtk.TreeSelection selection = treeview1.Selection;
        selection.Mode = Gtk.SelectionMode.Multiple;

        //Verify our settings. If they aren't present, we need to show the settings dialog
        if(String.IsNullOrWhiteSpace(UserSettings.AWSAccessKey) ||
           String.IsNullOrWhiteSpace(UserSettings.AWSSecretKey) ||
           String.IsNullOrWhiteSpace(UserSettings.AWSGlacierVaultName))
        {
            FDPreferences preferences = new FDPreferences(this, DialogFlags.Modal, UserSettings, true);
            preferences.Run();
            preferences.Destroy();
        }

        //Create the uploader thread
        uploadQueueWorker = new BackgroundWorker();
        uploadQueueWorker.DoWork += new DoWorkEventHandler(_uploadQueueWork);
        uploadQueueWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_uploadQueueDone);
        if(!uploadQueueWorker.IsBusy)
        {
            uploadQueueWorker.RunWorkerAsync();
        }

        //Create the downloader thred
        downloadQueueWorker = new BackgroundWorker();
        downloadQueueWorker.DoWork += new DoWorkEventHandler(_downloadQueueWork);
        downloadQueueWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_downloadQueueDone);
        if(!downloadQueueWorker.IsBusy)
        {
            downloadQueueWorker.RunWorkerAsync();
        }

        //Now create the UI update thread that watches the uploader
        updateUIWorker = new BackgroundWorker();
        updateUIWorker.DoWork += new DoWorkEventHandler(_updateUIWork);
        updateUIWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_updateUIDone);
        if(!updateUIWorker.IsBusy)
        {
            updateUIWorker.RunWorkerAsync();
        }

        //Housekeeping functions for window
        this.DeleteEvent += OnDeleteEvent;

        //System.Console.WriteLine (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
        //System.Console.WriteLine (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
    }