public string ToXMLstring() { string res = ""; if (IsComment) { res += "<tr bgcolor = 'green'>"; } else if (!IsValid) { res += "<tr bgcolor = 'red'>"; } else { res += "<tr>"; } res += "<td>" + Name; res += "</td><td>" + Group; res += "</td><td>" + Address.ToString(); res += "</td><td>" + MAIS.ToString(); res += "</td><td>" + LSB.ToString(); res += "</td><td>" + MSB.ToString(); res += "</td><td>" + valid_type[(int)Type]; res += "</td><td>" + valid_fpga[(int)FPGA]; res += "</td><td>" + Init; res += "</td><td>" + Comment + "</td></tr>"; return(res); }
public string ToEntry(bool last = false) { string res = ""; if (IsComment) { res += "--"; } if (Type == type_field.FIELD) { res += "\t\t\t\t\t" + "(" + Name + getSpaces(35 - Name.Length) + ","; } else { res += "\t\t\t\t" + "(" + Name + getSpaces(39 - Name.Length) + ","; } string adrs = Address.ToString(); res += getSpaces(8 - adrs.Length) + adrs + ","; res += " " + MAIS.ToString() + ","; string lsb = LSB.ToString(); string msb = MSB.ToString(); res += getSpaces(3 - lsb.Length) + lsb + "," + getSpaces(3 - msb.Length) + msb + ","; res += " " + valid_type[(int)Type] + getSpaces(5 - valid_type[(int)Type].Length) + ","; res += " " + valid_fpga[(int)FPGA] + getSpaces(4 - valid_fpga[(int)FPGA].Length) + ","; if (int.TryParse(Init, out int x)) { res += getSpaces(Math.Max(4 - Init.Length, 0)) + Init + ")"; } else { res += Init + ")"; } if (!last) { res += ","; } if (Comment != "") { res += "\t-- " + Comment; } res += "\n"; return(res); }