//General - Set the settings for this project private void setSettings(AppSettings settings) { appSettings = settings; database = new LLDatabase(appSettings.elasticip, appSettings.defaultIndex); if (database.isValid()) { bottomDBStatusText.Text = "Connected"; client = database.getClient(); if (queryBuilder == null) { queryBuilder = new LLQueryBuilder(client); } else { queryBuilder.setClient(client); } queryBuilder.setMainIndex(appSettings.defaultIndex); queryBuilder.setFileExclusions(appSettings.exclusions); enableComponents(); } else { bottomDBStatusText.Text = "No connection"; MessageBox.Show("Connection failed! Check your settings..."); logger.debug("setSettings failed! -> elastic ip: " + appSettings.elasticip + " elastic index" + appSettings.defaultIndex); } }
public IndexWindow(LLQueryBuilder builder) { InitializeComponent(); queryBuilder = builder; indexItems = queryBuilder.getAllIndexItems(); backup = indexItems.ToList(); indexItemGrid.ItemsSource = indexItems; }
// ------- SPECIAL ------- //Prepare for execution of the main local script private void prepareScript() { runScriptButton.IsEnabled = false; //Copy the files to the destination if (Directory.Exists(logStasherPath + "\\LogFiles")) { Console.WriteLine("LogStash folder exists!"); //If not empty, empty it... if (Directory.EnumerateFileSystemEntries(logStasherPath + "\\LogFiles").Any()) { Console.WriteLine("...but not empty. Emptying..."); infoLabel.Content = "Emptying LogFiles folder..."; deleteFiles(new DirectoryInfo(logStasherPath + "\\LogFiles")); } } else { Console.WriteLine("LogFile folder does not exist! Ceating one..."); Directory.CreateDirectory(logStasherPath + "\\LogFiles"); } infoLabel.Content = "Copying textfiles..."; foreach (String file in txtFiles) { Console.WriteLine("Copying: " + file); File.Copy(file, logStasherPath + "\\LogFiles\\" + file.Substring(file.LastIndexOf('\\') + 1), false); } bool indexExists = new LLQueryBuilder(new LLDatabase(elasticIp, mainIndex).getClient()).indexExists(mainIndex); MessageBoxResult result = MessageBoxResult.Cancel; if (indexExists) { result = MessageBox.Show("Index already exists in DB, do you want to continue?", "Index Exists", MessageBoxButton.YesNo, MessageBoxImage.Information); } if (result == MessageBoxResult.Yes) { infoLabel.Content = "Executing script..."; executeScript(logStasherPath, elasticIp, mainIndex); infoLabel.Content = "Done!"; } else { infoLabel.Content = "Canceled!"; } runScriptButton.IsEnabled = true; }
public ExclusionWindow(LLQueryBuilder queryBuilder, AppSettings appSettings) { InitializeComponent(); this.queryBuilder = queryBuilder; settings = appSettings; if (settings.exclusions == null) { list = new List <FileExclusion>(); } else { list = settings.exclusions; } exclusionsGrid.ItemsSource = list; updateData(); }