Sub SaveDTCCfgAsJava()
Dim Cfg() As String
Prj_DTCCfg_Path = Sheet4.Cells(1, 2)
TSECaseGeneratorRessourcesPath = Sheet4.Cells(2, 2)
Generate_TSECaseGeneratorRessources = Sheet4.Cells(3, 2)
MainLib_Path = Sheet4.Cells(4, 2)
Database_Path = Sheet4.Cells(5, 2)
Specification_Path = Sheet4.Cells(6, 2)
MainLib_Name = Sheet4.Cells(7, 2)
MainLib_Path = Replace(MainLib_Path, “”, “\”)
Database_Path = Replace(Database_Path, “”, “\”)
Specification_Path = Replace(Specification_Path, “”, “\”)
Prj_DTCCfgFile = Prj_DTCCfg_Path & “” & “Prj_DTCCfg.java”
TSECaseGeneratorRessourcesFile = TSECaseGeneratorRessourcesPath & “\TSECaseGeneratorRessources.properties”
'set and open file for output
fnum = FreeFile()
Open Prj_DTCCfgFile For Output As fnum
'write project info and then a blank line. Note the comma is required
Print #fnum, “package prjUtils;”;
Write #fnum,
Write #fnum,
Write #fnum,
Write #fnum,
Print #fnum, “public class Prj_DTCCfg”
Print #fnum, “{”
Write #fnum,
Print #fnum, " /*************************************************************************"
Print #fnum, " * Configuration Parameters Extracted from Project Specification"
Print #fnum, " *************************************************************************/"
Write #fnum,
Write #fnum,
'Rest the Txt string
TXT = “”
Print #fnum, “/* ---------- Sensors DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] SensorsFailuresDTCIndex_Table = {”
Do Until Sheet9.Cells(row_index, col_index).Value = “”
If Sheet9.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + "};"
Else
TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + " ,"
End If
number_of_columns = number_of_columns + 1
col_index = col_index + 1
Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
Print #fnum, “/* ---------- Sensors DTCs ------------ */”
Write #fnum,
row_index = 2 'rest row_index
TXT = “final public static String [][] SensorsFailuresDTC_Table = {
{”
Do Until Sheet9.Cells(row_index, 1).Value = “”
col_index = 1
Do Until Sheet9.Cells(row_index, col_index).Value = “”
'MsgBox “”"" + Sheet1.Cells(row_index, col_index).Value + “”""
'Write #fnum, “” + Sheet1.Cells(row_index, col_index).Value + “”
If Sheet9.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + "}" + Chr(10)
Else
TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + " ,"
End If
col_index = col_index + 1
Loop
row_index = row_index + 1
If Sheet9.Cells(row_index, 1).Value <> "" Then
TXT = TXT + ",{"
End If
Loop
TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
Print #fnum, “/* ---------- Sensors DTCs 2 index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] PowerSupplyFailuresDTCIndex_Table = {”
Do Until Sheet11.Cells(row_index, col_index).Value = “”
If Sheet11.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + "};"
Else
TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + " ,"
End If
number_of_columns = number_of_columns + 1
col_index = col_index + 1
Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
Print #fnum, “/* ---------- Sensors DTCs 2 ------------ */”
Write #fnum,
row_index = 2 'rest row_index
TXT = “final public static String [][] PowerSupply_FailuresDTC_Table = {
{”
Do Until Sheet11.Cells(row_index, 1).Value = “”
col_index = 1
Do Until Sheet11.Cells(row_index, col_index).Value = “”
'MsgBox “”"" + Sheet1.Cells(row_index, col_index).Value + “”""
'Write #fnum, “” + Sheet1.Cells(row_index, col_index).Value + “”
If Sheet11.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + "}" + Chr(10)
Else
TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + " ,"
End If
col_index = col_index + 1
Loop
row_index = row_index + 1
If Sheet11.Cells(row_index, 1).Value <> "" Then
TXT = TXT + ",{"
End If
Loop
TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
Print #fnum, “/* ---------- LED DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] LEDFailuresDTCIndex_Table = {”
Do Until Sheet13.Cells(row_index, col_index).Value = “”
If Sheet13.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet13.Cells(row_index, col_index).Value + """" + "};"
Else
TXT = TXT + """" + Sheet13.Cells(row_index, col_index).Value + """" + " ,"
End If
number_of_columns = number_of_columns + 1
col_index = col_index + 1
Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
row_index = 2 'rest row_index
Print #fnum, “/* ---------- LED DTCs ------------ */”
Write #fnum,
TXT = “final public static String [][] LEDFailuresDTC_Table = {”
Print #fnum, TXT
Do Until Sheet13.Cells(row_index, 1).Value = “”
col_index = 1
TXT = “{”
Do Until Sheet13.Cells(row_index, col_index).Value = “”
If Sheet13.Cells(row_index, col_index + 1).Value = “” Then
TXT = TXT + “”"" + Sheet13.Cells(row_index, col_index).Value + “”"" + “},”
Else
TXT = TXT + “”"" + Sheet13.Cells(row_index, col_index).Value + “”"" + " ,"
End If
col_index = col_index + 1
Loop
Print #fnum, TXT
row_index = row_index + 1
Loop
TXT = “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
Print #fnum, “/* ----------P4U Switch DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] P4U_SwitchFailuresDTCIndex_Table = {”
Do Until Sheet12.Cells(row_index, col_index).Value = “”
If Sheet12.Cells(row_index, col_index + 1).Value = "" Then
TXT = TXT + """" + Sheet12.Cells(row_index, col_index).Value + """" + "};"
Else
TXT = TXT + """" + Sheet12.Cells(row_index, col_index).Value + """" + " ,"
End If
number_of_columns = number_of_columns + 1
col_index = col_index + 1
Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,
'Rest the Txt string
TXT = “”
row_index = 2 'rest row_index
Print #fnum, “/* ---------- P4U switch DTCs ------------ */”
Write #fnum,
TXT = “final public static String [][] P4U_SwitchFailuresDTC_Table = {”
Print #fnum, TXT
Do Until Sheet12.Cells(row_index,