public string featuresToString() { String features = ""; String SrcIP2 = ""; String DestIP2 = ""; String SrcMAC2 = ""; String DestMAC2 = ""; Utilities convertor = new Utilities(); if (SrcMAC != null) { SrcMAC2 = convertor.convertMACtoString(SrcMAC); } if (DestMAC != null) { DestMAC2 = convertor.convertMACtoString(DestMAC); } //DestMAC[0].ToString() + "-" + DestMAC[1].ToString() + "-" + DestMAC[2].ToString() + "-" + DestMAC[3].ToString()+ "-" + DestMAC[4].ToString() + "-" + DestMAC[5].ToString(); if (SrcIP != null) { SrcIP2 = convertor.convertIPtoString(SrcIP); } //SrcIP[0].ToString() + "." + SrcIP[1].ToString() + "." + SrcIP[2].ToString()+"." + SrcIP[3].ToString(); if (DestIP != null) { DestIP2 = convertor.convertIPtoString(DestIP); } features += SrcMAC2 + "," + DestMAC2 + "," + SrcIP2 + "," + DestIP2 + "," + SrcPort.ToString() + "," + DestPort.ToString() + "," + Protocol.ToString() + "," + TBT.ToString() + "," + FPS.ToString() + "," + APL.ToString() + "," + AB.ToString() + "," + BS.ToString() + "," + PS.ToString() + "," + DPL.ToString() + "," + PPS.ToString() + "," + PV.ToString() + "," + PX.ToString() + "," + NNP.ToString() + "," + NSP.ToString() + "," + PSP.ToString() + "," + Duration.ToString() + "," + this.Type.ToString() + "," + IOPR + "," + AIT + "," + Reconnect; return(features); }
public void RunScript(string filetoread) { try { Program.MainForm.ClearOutput(); if (this.TextLength == 0) throw new Exception("script is empty"); string srcfile = Program.MainForm.GetScriptFileName(); if (srcfile != "") Directory.SetCurrentDirectory(Path.GetDirectoryName(srcfile)); NSP N = new NSP(); NSP.WriteBuffer = WriteBuffer; /* try to use the right richTextBox2 for WriteBuffer * this doesn't work yet because WriteBuffer is static * and richTextBox2 can change mid-execution... */ richTextBox2 = Program.MainForm.richTextBox2; N.ExecScript(this.Text, srcfile); } catch (Exception ex) { Program.MainForm.AppendOutput(ex.Message); MessageBox.Show(ex.Message, "RunScript()"); } }