public void AddNode() { for (int i = CreateNode.numberIN; i < FormAddNode.numberIN + CreateNode.numberIN; i++) { var node = Node.CreateNode("IN"); Console.WriteLine(node.Text_Name + "--+--" + node.Index + " Index"); panel_simu.Controls.Add(node); ListNodeIN.Add(node); InfoNode infoNode = InfoNode.GetInstance(); infoNode.SetData(node); } for (int i = CreateNode.numberMN; i < FormAddNode.numberMN + CreateNode.numberMN; i++) { InfoNode infoNode = InfoNode.GetInstance(); var node = Node.CreateNode("MN"); panel_simu.Controls.Add(node); ListNodeMN.Add(node); infoNode.SetData(node); } Console.WriteLine(CreateNode.numberIN + "-------------"); for (int i = CreateNode.numberAE; i < FormAddNode.numberAE + CreateNode.numberAE; i++) { var node = Node.CreateNode("AE"); panel_simu.Controls.Add(node); ListNodeAE.Add(node); InfoNode infoNode = InfoNode.GetInstance(); infoNode.SetData(node); } }
public int test_connect_IN() { InfoNode infoNode = InfoNode.GetInstance(); List <String> list = new List <string>(); String listToIN = ""; String listIN = "Port"; String listINMax = "Port"; String listDistance = "Distance"; for (int i = 0; i < ListNodeIN.Count; i++) { for (int j = 0; j < ListNodeMN.Count; j++) { if (ListNodeIN[i].InRange(ListNodeMN[j])) { //list_node_to_IN.Add(ListNodeMN[j]); Console.WriteLine("Node connect to IN is: " + ListNodeMN[j].Text + " " + ListNodeMN[j].index + " " + Simulation.ListNodeMN[ListNodeMN[j].index].Node_Port); list.Add(Simulation.ListNodeMN[ListNodeMN[j].index].Node_Port); listToIN = listToIN + Simulation.ListNodeMN[ListNodeMN[j].index].Node_Port; listIN = listIN + "-" + Simulation.ListNodeMN[ListNodeMN[j].index].Node_Port; listDistance = listDistance + "-" + ListNodeIN[i].InDistance(ListNodeMN[j]); } if (ListNodeIN[i].InDistance(ListNodeMN[j])) { listINMax = listINMax + "-" + Simulation.ListNodeMN[ListNodeMN[j].index].Node_Port; } } } String a = listToIN; Console.WriteLine(listToIN + " aaa " + id + listDistance); SQLiteConnection sqlite_conn; sqlite_conn = GetDataProxy.CreateConnection(); GetDataProxy.InsertData(sqlite_conn, a, id); GetDataProxy.ReadData(sqlite_conn, id); sqlite_conn.Dispose(); //String sourceFile = "C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/DataProxy/MyDatabase.sqlite"; //String destFile = "C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/DataProxy/MyDatabase2.sqlite"; String filePathMin = "C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/DataProxy/dataMin.txt"; String filePathMax = "C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/DataProxy/dataMax.txt"; File.WriteAllText(filePathMin, listIN); File.WriteAllText(filePathMax, listINMax); //System.IO.File.Copy(sourceFile, destFile, true); list_node_In = new List <Node>(); id++; t = list.Count(); //Console.WriteLine("Simulator---" + list[0]); flag = true; return(t); }
public void doCofig() { CreateNode creNode = CreateNode.GetInstance(); InfoNode infoNode = InfoNode.GetInstance(); String remoteCsePort_string = "org.eclipse.om2m.remoteCsePort_string="; String cseBaseAddress_string = "org.eclipse.om2m.cseBaseAddress_string="; String cseBaseName = "org.eclipse.om2m.cseBaseName="; String cseBaseId = "org.eclipse.om2m.cseBaseId="; String remoteCseId_string = "org.eclipse.om2m.remoteCseId_string="; String remoteCseName_string = "org.eclipse.om2m.remoteCseName_string="; String cseMNPort = "org.eclipse.equinox.http.jetty.http.port="; //Config IN for (int i = 0; i < Simulation.ListNodeIN.Count; i++) { StreamReader readerIN = new StreamReader("C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/in-cse-" + i + "/x86_64/configuration/config.ini"); String contentIN = readerIN.ReadToEnd(); //Console.WriteLine(contentIN); readerIN.Close(); StreamWriter writerIN = new StreamWriter("C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/in-cse-" + i + "/x86_64/configuration/config.ini"); contentIN = Regex.Replace(contentIN, cseBaseName, cseBaseName + Simulation.ListNodeIN[i].Node_Name); contentIN = Regex.Replace(contentIN, cseBaseId, cseBaseId + Simulation.ListNodeIN[i].Node_Id); writerIN.Write(contentIN); writerIN.Close(); //Console.WriteLine(contentIN); } //Chỉnh config MN for (int i = 0; i < Simulation.ListNodeMN.Count; i++) { StreamReader reader = new StreamReader("C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/mn-cse-" + i + "/x86_64/configuration/config.ini"); String content = reader.ReadToEnd(); //Console.WriteLine(content); reader.Close(); StreamWriter writer = new StreamWriter("C:/Users/eduyduy/Documents/SIMULATOR/IN-MN-Standard/mn-cse-" + i + "/x86_64/configuration/config.ini"); // content = Regex.Replace(content, remoteCsePort_string, remoteCsePort_string + " " + NodeConect.MN_PORT[i]); // content = Regex.Replace(content, cseBaseAddress_string, cseBaseAddress_string + " " + NodeConect.MN_IP[i]); // content = Regex.Replace(content, cseBaseName, cseBaseName + Simulation.ListNodeMN[i].Node_Name); // content = Regex.Replace(content, cseBaseId, cseBaseId + " " + Simulation.ListNodeMN[i].Node_Id); // content = Regex.Replace(content, remoteCseId_string, remoteCseId_string + " " + NodeConect.MN_ID[i]); // content = Regex.Replace(content, remoteCseName_string, remoteCseName_string + " " + NodeConect.MN_NAME[i]); content = Regex.Replace(content, cseMNPort, cseMNPort + Simulation.ListNodeMN[i].Node_Port); writer.Write(content); writer.Close(); // Console.WriteLine(content); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); CreateNode.CreateData(); createNode(); //Đưa dữ liệu thiết lập trong infoNode vào node InfoNode infoNode = InfoNode.GetInstance(); for (int i = 0; i < ListNodeIN.Count; i++) { infoNode.SetData(ListNodeIN[i]); } for (int i = 0; i < ListNodeMN.Count; i++) { infoNode.SetData(ListNodeMN[i]); } if (txtColumn.Text == "") { txtColumn.ForeColor = Color.Gray; } }