void Machine_Thread() { Devices = Library.LoadCsv(File.ReadAllText("Config.csv"), ';'); int numberOfiFace = 0; int numberOfMA500 = 0; for (int i = 0; i < Devices.GetLength(0); i++) { if (Devices[i][2] == "IFACE") { numberOfiFace++; } if (Devices[i][2] == "MA500") { numberOfMA500++; } } bool bSetMaxThread = ThreadPool.SetMaxThreads(Devices.GetLength(0), 500); iFace [] iFaceMachine = new iFace[numberOfiFace]; MA500 [] MA500Machine = new MA500[numberOfMA500]; int r = 0, c = 0; for (int i = 0; i < Devices.GetLength(0); i++) { if (Devices[i][2] == "IFACE") { iFaceMachine[r] = new iFace(Devices[i][0], Devices[i][1]); Thread t = new Thread(iFaceMachine[r].iFace_Connect); t.Start(); r++; } if (Devices[i][2] == "MA500") { MA500Machine[c] = new MA500(Devices[i][0], Devices[i][1]); Thread t = new Thread(MA500Machine[c].MA500_Connect); t.Start(); c++; } } }
void read_config() { Devices = Library.LoadCsv(File.ReadAllText("Config.csv"), ';'); int numberOfiFace = 0; int numberOfMA500 = 0; for (int i = 0; i < Devices.GetLength(0); i++) { if (Devices[i][2] == "IFACE") { numberOfiFace++; } if (Devices[i][2] == "MA500") { numberOfMA500++; } } iFace[] iFaceMachine = new iFace[numberOfiFace]; MA500[] MA500Machine = new MA500[numberOfMA500]; int r = 0, c = 0; for (int i = 0; i < Devices.GetLength(0); i++) { if (Devices[i][2] == "IFACE") { iFaceMachine[r] = new iFace(Devices[i][0], Devices[i][1]); iFaceMachine[r].iFace_Connect(); //iFaceMachine[r].iFace_ReadLog(); r++; } if (Devices[i][2] == "MA500") { MA500Machine[c] = new MA500(Devices[i][0], Devices[i][1]); MA500Machine[c].MA500_Connect(); //MA500Machine[c].MA500_ReadLog(); c++; } } }