public void SetupHeader(ModelGroup test) { // Setup the log file header if (test.requiredProperty != null) { // List attributes that are set in every generated model (prerequisites) readmePrereqs.Add(new List <string>()); // First line of table must be blank readmePrereqs.Add(new List <string> { "Property", // First cells are a static label "**Values**" }); readmePrereqs.Add(new List <string> { ":---:", // Hyphens for row after header ":---:", }); for (int i = 0; i < test.requiredProperty.Count; i++) { string attributeName; attributeName = test.requiredProperty[i].name.ToString(); attributeName = ReadmeStringHelper.GenerateNameWithSpaces(attributeName); readmePrereqs.Add(new List <string> { attributeName, ReadmeStringHelper.ConvertTestValueToString(test.requiredProperty[i]) }); } } // Now start the table for generated models readme.Add(new List <string>()); // First line of table must be blank readme.Add(new List <string> { " ", "Reference Image" // First cell is empty, the second is a static header name }); readme.Add(new List <string> { ":---:", // Hyphens for rows after header ":---:" }); for (int i = 0; i < test.properties.Count; i++) { string attributeName; if (test.properties[i].prerequisite != Propertyname.Undefined && test.properties[i].propertyGroup == 0) { attributeName = test.properties[i].prerequisite.ToString() + test.properties[i].name.ToString(); } else { attributeName = test.properties[i].name.ToString(); } attributeName = ReadmeStringHelper.GenerateNameWithSpaces(attributeName); if (attributeName != lastName) // Skip duplicate names caused by non-binary attributes { lastName = attributeName; readme[1].Add(attributeName); readme[2].Add(":---:"); } } }
public void SetupTable(ModelGroup test, int comboIndex, List <List <Property> > combos) { string modelGroupName = test.modelGroupName.ToString(); string modelNumber = comboIndex.ToString("D2"); string liveURL = string.Format("https://bghgary.github.io/glTF-Asset-Generator/Preview/BabylonJS/?fileName={0}_{1}.gltf", modelGroupName, modelNumber); readme.Add(new List <string> // New row for a new model { // Displays the number of the model and is a link to the model string.Format("[{1}]({0}_{1}.gltf)<br>[View]({2})", modelGroupName, modelNumber, liveURL), // Also a reference image in the second cell string.Format("[<img src=\"Thumbnails/{0}_{1}.png\" align=\"middle\">](ReferenceImages/{0}_{1}.png)", modelGroupName, modelNumber) }); int logIndex = readme.Count - 1; List <int> nonBinaryUsed = new List <int>(); foreach (var possibleAttribute in test.properties) { var attributeIndex = combos[comboIndex].FindIndex(e => e.name == possibleAttribute.name && e.prerequisite == possibleAttribute.prerequisite); if (attributeIndex != -1) { if (possibleAttribute.propertyGroup > 0) { var alreadyUsed = nonBinaryUsed.Exists(x => x == possibleAttribute.propertyGroup); if (alreadyUsed) { // Overwrites the empty cell if a nonbinary of the same time had already been encountered and not used readme[logIndex][readme[logIndex].Count - 1] = ReadmeStringHelper.ConvertTestValueToString(possibleAttribute); } else { // Creates a new cell, since this nonbinary type had not been encountered before readme[logIndex].Add(ReadmeStringHelper.ConvertTestValueToString(possibleAttribute)); nonBinaryUsed.Add(possibleAttribute.propertyGroup); } } else { readme[logIndex].Add(ReadmeStringHelper.ConvertTestValueToString(possibleAttribute)); } } else { if (possibleAttribute.propertyGroup > 0) { var alreadyUsed = nonBinaryUsed.Exists(x => x == possibleAttribute.propertyGroup); if (!alreadyUsed) { readme[logIndex].Add(" "); nonBinaryUsed.Add(possibleAttribute.propertyGroup); } } else { readme[logIndex].Add(" "); } } } }