private void button_ApplySettings_Click(object sender, EventArgs e) { if (textBox_ShareFolder.Text.Length == 0) { MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("The share file folder name can't be empty.", "share file folder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBox_DRFolder.Text.Length == 0) { MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("The DR folder name can't be empty.", "share file folder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } GlobalConfig.ProtectFolder = textBox_ProtectFolder.Text; GlobalConfig.ProtectFolderWhiteList = textBox_ProtectFolderWhiteList.Text; GlobalConfig.ProtectFolderBlackList = textBox_ProtectFolderBlackList.Text; GlobalConfig.ShareFolder = textBox_ShareFolder.Text; GlobalConfig.ShareFolderWhiteList = textBox_ShareFolderWhiteList.Text; GlobalConfig.ShareFolderBlackList = textBox_ShareFolderBlackList.Text; if (radioButton_Local.Checked) { GlobalConfig.StoreSharedFileMetaDataInServer = false; } else { GlobalConfig.StoreSharedFileMetaDataInServer = true; if (GlobalConfig.AccountName.Trim().Length == 0) { string accountName = "testaccount." + Environment.MachineName + "." + Guid.NewGuid().ToString(); GlobalConfig.AccountName = accountName; } } GlobalConfig.DRInfoFolder = textBox_DRFolder.Text; if (!Directory.Exists(GlobalConfig.ShareFolder)) { Directory.CreateDirectory(GlobalConfig.ShareFolder); } if (!Directory.Exists(GlobalConfig.ProtectFolder)) { Directory.CreateDirectory(GlobalConfig.ProtectFolder); } if (!Directory.Exists(GlobalConfig.DRInfoFolder)) { Directory.CreateDirectory(GlobalConfig.DRInfoFolder); } FilterWorker.ApplySettingsToFilterDriver(); this.Close(); }
public ConsoleForm() { GlobalConfig.filterType = FilterAPI.FilterType.FILE_SYSTEM_MONITOR | FilterAPI.FilterType.FILE_SYSTEM_CONTROL | FilterAPI.FilterType.FILE_SYSTEM_ENCRYPTION | FilterAPI.FilterType.FILE_SYSTEM_PROCESS | FilterAPI.FilterType.FILE_SYSTEM_REGISTRY; InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; filterMessage = new FilterMessage(listView_Info); filterWorker = new FilterWorker(listView_Info); DisplayVersion(); }