public void ValidateConfigurationAndAnalyse() { Configuration config = ConfigurationProvider.Load(); if (!ValidateConfiguration(config)) { return; } OutputWindowPane outputPane = CreatePane("Dexter"); outputPane.Clear(); outputPane.Activate(); System.Threading.Tasks.Task.Run(() => { dexter = new DexterLegacyAnalyzer(config); DataReceivedEventHandler writeToOutputPane = (s, e1) => outputPane.OutputString(e1.Data + Environment.NewLine); dexter.OutputDataReceived += writeToOutputPane; dexter.ErrorDataReceived += writeToOutputPane; OnAnalysisStarted(EventArgs.Empty); try { Result result = dexter.Analyse(); ReportResult(result); } catch (Exception ex) { outputPane.OutputString("Error during analysis: " + ex.Message); } finally { OnAnalysisFinished(EventArgs.Empty); } }); }
public void Init() { var config = new Configuration() { dexterHome = AppDomain.CurrentDomain.BaseDirectory + "../../TestData/Dexter", projectName = "TestData", type = "PROJECT", sourceDir = { AppDomain.CurrentDomain.BaseDirectory + "../../TestData/SampleCppProject/" }, headerDir = { AppDomain.CurrentDomain.BaseDirectory + "../../TestData/SampleCppProject/" }, projectFullPath = AppDomain.CurrentDomain.BaseDirectory + "../../TestData/SampleCppProject/", userName = "******", userPassword = "******", dexterServerIp = "0.0.0.0", dexterServerPort = "0" }; // If there are no Dexter binaries in TestData, we need to download them. It may take some time. if (!config.IsDexterFound) { var dexterDownloadUrl = "https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-cli_0.10.6_32.zip"; var dexterZipPath = AppDomain.CurrentDomain.BaseDirectory + "../../TestData/Dexter.zip"; if (!File.Exists(dexterZipPath)) { using (var client = new WebClient()) { client.DownloadFile(dexterDownloadUrl, dexterZipPath); } } ZipFile.ExtractToDirectory(dexterZipPath, config.dexterHome); } dexter = new DexterLegacyAnalyzer(config); dexter.OutputDataReceived += (s, e) => { Console.WriteLine(e.Data); }; dexter.ErrorDataReceived += (s, e) => { Console.Error.WriteLine(e.Data); }; }