public BackendManager(string backendurl, Options options, IBackendWriter statwriter, LocalDatabase database) { m_options = options; m_backendurl = backendurl; m_statwriter = statwriter; m_taskControl = statwriter as BasicResults; m_db = new DatabaseCollector(database, statwriter); m_backend = DynamicLoader.BackendLoader.GetBackend(m_backendurl, m_options.RawOptions); if (m_backend == null) throw new Exception(string.Format("Backend not supported: {0}", m_backendurl)); if (!m_options.NoEncryption) { m_encryption = DynamicLoader.EncryptionLoader.GetModule(m_options.EncryptionModule, m_options.Passphrase, m_options.RawOptions); if (m_encryption == null) throw new Exception(string.Format("Encryption method not supported: ", m_options.EncryptionModule)); } if (m_taskControl != null) m_taskControl.StateChangedEvent += (state) => { if (state == TaskControlState.Abort) m_thread.Abort(); }; m_queue = new BlockingQueue<FileEntryItem>(options.SynchronousUpload ? 1 : (options.AsynchronousUploadLimit == 0 ? int.MaxValue : options.AsynchronousUploadLimit)); m_thread = new System.Threading.Thread(this.ThreadRun); m_thread.Name = "Backend Async Worker"; m_thread.IsBackground = true; m_thread.Start(); }
public void Encrypt(Library.Interface.IEncryption encryption, IBackendWriter stat) { if (encryption != null && !this.Encrypted) { var tempfile = new Library.Utility.TempFile(); encryption.Encrypt(this.LocalFilename, tempfile); this.DeleteLocalFile(stat); this.LocalTempfile = tempfile; this.Hash = null; this.Size = 0; this.Encrypted = true; } }
private void EncryptionModule_SelectedIndexChanged(object sender, EventArgs e) { if (m_wrapper != null) { //Since the encryption mode is autodetected, there is no warning for changing the encryption module //m_settingsChanged = true; EncryptionControlContainer.Controls.Clear(); if (EncryptionModule.SelectedItem as ComboBoxItemPair <Library.Interface.IEncryption> != null) { m_encryptionModule = (EncryptionModule.SelectedItem as ComboBoxItemPair <Library.Interface.IEncryption>).Value; if (m_encryptionModule is Library.Interface.IEncryptionGUI && m_encryptionModule is Library.Interface.IGUIMiniControl) { Control c = (m_encryptionModule as Library.Interface.IEncryptionGUI).GetControl(m_wrapper.ApplicationSettings, m_wrapper.EncryptionSettings); c.Dock = DockStyle.Fill; EncryptionControlContainer.Controls.Add(c); } } else { m_encryptionModule = null; } } }
private void EncryptionModule_SelectedIndexChanged(object sender, EventArgs e) { if (m_wrapper != null) { //Since the encryption mode is autodetected, there is no warning for changing the encryption module //m_settingsChanged = true; EncryptionControlContainer.Controls.Clear(); if (EncryptionModule.SelectedItem as ComboBoxItemPair<Library.Interface.IEncryption> != null) { m_encryptionModule = (EncryptionModule.SelectedItem as ComboBoxItemPair<Library.Interface.IEncryption>).Value; if (m_encryptionModule is Library.Interface.IEncryptionGUI && m_encryptionModule is Library.Interface.IGUIMiniControl) { Control c = (m_encryptionModule as Library.Interface.IEncryptionGUI).GetControl(m_wrapper.ApplicationSettings, m_wrapper.EncryptionSettings); c.Dock = DockStyle.Fill; EncryptionControlContainer.Controls.Add(c); } } else m_encryptionModule = null; } }