public FlightgearModel(string trainCsv, string detectCsv, string xmlPath, string dllPath, TelnetClient telnetClient) { this.telnetClient = telnetClient; this.trainCsv = trainCsv; this.detectCsv = detectCsv; this.xmlPath = xmlPath; trainHandler = new DataHandler(); detectHandler = new DataHandler(); correlations = new Dictionary <int, int>(); anomalyUtil = new AnomalyUtil(); FeaturesList = DataHandler.getFeaturesFromXml(xmlPath); DataHandler.createTxtFileFromTwoFiles(trainCsv, detectCsv, FeaturesList); trainHandler.csvParser(trainCsv); detectHandler.csvParser(detectCsv); trainHandler.setFeaturesList(FeaturesList); detectHandler.setFeaturesList(FeaturesList); CurrentLineNumber = 0; threatStarted = false; stop = false; Speed = 1; new Thread(delegate() { var assembly = Assembly.LoadFile(dllPath); var type = assembly.GetType("regression_line_dll.anomaly_detector"); var obj = Activator.CreateInstance(type); var method = type.GetMethod("detector"); method.Invoke(obj, null); anomalyDict = DataHandler.getOutputTxt("output.txt"); AnomalyListBox = DataHandler.getAnomalyListBox("output.txt"); detectionAlgorithm = DataHandler.detectionAlgorithm; }).Start(); setCorrelatedFeaturesFromTrainCsv(this.correlations); }
public MainWindow(string learnCsv, string detectCsv, string xml, string dll) { InitializeComponent(); this.xmlPath = xml; this.learnCsv = learnCsv; this.detectCsv = detectCsv; this.dllPath = dll; tClient = new TelnetClient(); flightgearModel = new FlightgearModel(learnCsv, detectCsv, xmlPath, dllPath, tClient); JoystickView joystickview = new JoystickView(); joystickview.setFlightgearModel(flightgearModel); canvas_joystick.Children.Add(joystickview); mediaPanelView = new MediaPanelView(); mediaPanelView.setFlightgearModel(flightgearModel); grd_media_panel.Children.Add(mediaPanelView); infoView = new InfoView(); infoView.setFlightgearModel(flightgearModel); grd_info_view.Children.Add(infoView); FeaturesView featuresView = new FeaturesView(); featuresView.setFlightgearModel(flightgearModel); grd_feature_view.Children.Add(featuresView); anomalyView = new AnomalyView(); anomalyView.setFlightgearModel(flightgearModel); grd_anomaly_view.Children.Add(anomalyView); //DataContext = mediaPanel; /*List<string> featuresList = new List<string>(); * CreateNewCSVFromXml csvFromXaml = new CreateNewCSVFromXml(); * csvFromXaml.setFeaturesFromXml(xmlPath.Text); * csvFromXaml.createNewCSV(csvTrainPath.Text);*/ }