1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
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<StubMainCardEEpromWriteResponse>(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));
}
|