void read_settings()
        {
            var x_doc = XDocument.Load(settings_path);
            var root  = x_doc.Element("WindowsBackup_App");

            // key_manager, file_name_reg
            key_manager   = new BasicKeyManager(root.Element("BasicKeyManager"));
            file_name_reg = new FileNameRegistration(root.Element("FileNameRegistration"));

            // cloud_backup_services
            cloud_backup_services = new List <CloudBackupService>();
            foreach (var tag in root.Element("cloud_backup_services").Elements())
            {
                if (tag.Name.LocalName.Equals("AWS_CloudBackupService"))
                {
                    cloud_backup_services.Add(new AWS_CloudBackupService(tag));
                }
                else if (tag.Name.LocalName.Equals("AzureBlob_CloudBackupService"))
                {
                    cloud_backup_services.Add(new AzureBlob_CloudBackupService(tag));
                }
                else if (tag.Name.LocalName.Equals("GCP_CloudBackupService"))
                {
                    cloud_backup_services.Add(new GCP_CloudBackupService(tag));
                }
            }
            cloud_backup_services.Sort(compare_two_cloud_backups);

            // backup_manager, restore_manager
            backup_manager = new BackupManager(root.Element("BackupManager"),
                                               file_name_reg, cloud_backup_services, key_manager, handle_event);
            restore_manager = new RestoreManager(root.Element("RestoreManager"),
                                                 cloud_backup_services, key_manager, handle_event);
        }
示例#2
0
        internal Key_Page(BasicKeyManager key_manager)
        {
            InitializeComponent();

            this.key_manager = key_manager;
            update_gui();
        }
示例#3
0
        internal AddBackup_Page(BackupManager backup_manager,
                                List <CloudBackupService> cloud_backups,
                                BasicKeyManager key_manager, AddBackup_Callback add_backup)
        {
            this.backup_manager = backup_manager;
            this.cloud_backups  = cloud_backups;
            this.key_manager    = key_manager;
            this.add_backup     = add_backup;

            InitializeComponent();
        }
        void create_default_file()
        {
            // Create a directory if needed.
            var dir_name = Path.GetDirectoryName(settings_path);

            if (Directory.Exists(dir_name) == false)
            {
                Directory.CreateDirectory(dir_name);
            }

            key_manager           = new BasicKeyManager();
            file_name_reg         = new FileNameRegistration(fnr_path);
            cloud_backup_services = new List <CloudBackupService>();
            backup_manager        = new BackupManager();
            restore_manager       = new RestoreManager();

            save_settings();
        }