using System; using System.Text; using System.Linq; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.PMR.EmbeddedParameters; using Tango.Stubs; using System.IO; using Tango.PMR.IO; using Google.Protobuf; string[] Main_Card_EEpromAddress = { "DATA_SIZE", "DANCER_0", "DANCER_1", "DANCER_2", "DRYER_CENTER", "DRYER_CYCLES", "MIDTANK_1_A", "MIDTANK_1_B", "MIDTANK_2_A", "MIDTANK_2_B", "MIDTANK_3_A", "MIDTANK_3_B", "MIDTANK_4_A", "MIDTANK_4_B", "MIDTANK_5_A", "MIDTANK_5_B", "MIDTANK_6_A", "MIDTANK_6_B", "MIDTANK_7_A", "MIDTANK_7_B", "MIDTANK_8_A", "MIDTANK_8_B", "WINDER_CALIBRATION", "EMBEDDED_VERSION", "EEPROM_ALARM_SUPPORT", "EEPROM_ORIFICE1_ZERO_VALUE", "EEPROM_ORIFICE3_ZERO_VALUE", "EEPROM_WASTE_TANK_ZERO_VALUE", "EEPROM_PULLER_TENSION_POSITION", "EEPROM_WINDER_TENSION_POSITION", "EEPROM_INIT_FAILURE_COUNTER", "DANCER_3", "DANCER_4", "EEPROM_PRESSURE_SENSOR_V0_0", "EEPROM_PRESSURE_SENSOR_V0_1", "EEPROM_DRIER_LOADING_ARM_ANGLE"}; public void OnExecute(StubManager stubManager) { string filename = "c:\\temp\\mainEEProm10104.csv";//stubManager.ShowResponseWindow("Please Enter FileName"); string line; string[] Table1 = new string [4] ; int i; // Read the file and display it line by line. stubManager.Write("\r\nfile name " + filename); System.IO.StreamReader file = new System.IO.StreamReader(filename); line = file.ReadLine(); stubManager.Write("\r\n line " + line); line = file.ReadLine(); stubManager.Write("\r\n line " + line); int j=0; while(line != null) { j++; //stubManager.Write("\r\n line " + line + " null? " + (line==null)); string[] words = line.Split(','); i=0; foreach (var word in words) { Table1[i]=word; i=i+1; } //stubManager.Write("\r\nfile read\t"+ (i) + " " + Table1[1] + " "+ Table1[2] + " "+ Table1[3] + " "); int Address = Convert.ToInt32(Table1[0]); int Data = Convert.ToInt32(Table1[2]); string name = Table1[1]; //stubManager.Write("\r\nfile read\t"+ (i) + " " + j + " "+ Table1[2] + " "+ Data + " "); if (Address>0) { StubMainCardEEpromWriteRequest stubMainCardEEpromWriteRequest = new StubMainCardEEpromWriteRequest(); stubMainCardEEpromWriteRequest.Address = j; stubMainCardEEpromWriteRequest.Data = Data; var response = stubManager.Run(stubMainCardEEpromWriteRequest); stubManager.Write("\r\nMain_Card_Data write \t"+ j + " " +Table1[1] + " address \t "+ j+" data: \t" + Data); } line = file.ReadLine(); } stubManager.Write("\r\n last line " + line + "null? " + (line==null)); }