private void PrintProductVSLine(VSLine vsLine, StringBuilder sb) { if (IgnoreQANames.Contains(vsLine.Name.ToLower())) { sb.Append(string.Format("<tr class='{1}'><td class='name-col'>{0}</td>", vsLine.Name, altLine ? "vs-tr-alt" : "vs-tr")); } else { sb.Append(string.Format("<tr class='{1}'><td class='name-col'><a href='/Glossary.aspx?name={0}&v1={2}&v2={3}&upc={4}' target='_blank' title='click to see explanation'>{0}</a></td>", vsLine.Name, altLine ? "vs-tr-alt" : "vs-tr", HttpUtility.UrlEncode(vsLine.Value1), HttpUtility.UrlEncode(vsLine.Value2), UPC1)); } altLine = !altLine; if (vsLine.Value2 == null) { sb.Append(string.Format("<td class='value-col'>{0}</td><td class='value-col'><span style='color:#999'>N/A</span></td><td></td>", vsLine.Value1)); } else if (vsLine.Value1 == null) { sb.Append(string.Format("<td class='value-col'><span style='color:#999'>N/A</span></td><td class='value-col'>{0}</td><td></td>", vsLine.Value2)); } else { VSPair vsPair = VSCommon.PrintDiff2Values(vsLine.Value1, vsLine.Value2); sb.Append(string.Format("<td class='value-col'{1}>{0} {2}</td>", vsPair.Value1, string.IsNullOrEmpty(vsLine.CssStyle) ? "" : " style='" + vsLine.CssStyle + "'", vsLine.Value1Comment)); sb.Append(string.Format("<td class='value-col'{1}>{0} {2}</td>", vsPair.Value2, string.IsNullOrEmpty(vsLine.CssStyle) ? "" : " style='" + vsLine.CssStyle + "'", vsLine.Value2Comment)); // smart vs and comment if (vsPair.ChangeType != ChangeType.Unchanged && vsLine.SmartVsValues != null && vsLine.SmartVsValues.Length == 2 && vsLine.SmartVsValues[0] != null && vsLine.SmartVsValues[1] != null) { decimal diff = vsLine.SmartVsValues[0].Value - vsLine.SmartVsValues[1].Value; if (diff != 0 && vsLine.SmartVsValues[0].Unit == vsLine.SmartVsValues[1].Unit) { if (vsLine.SmartVsValues[0].PreposeUnit) { sb.Append(string.Format("<td class='comment-col'><span class='smartvs'>{0} {1}{2}</span> {3}</td>", diff > 0 ? ">" : "<", vsLine.SmartVsValues[0].Unit, Math.Abs(diff), vsLine.SmartComment)); } else { sb.Append(string.Format("<td class='comment-col'><span class='smartvs'>{0} {1}{2}</span> {3}</td>", diff > 0 ? ">" : "<", Math.Abs(diff), vsLine.SmartVsValues[0].Unit, vsLine.SmartComment)); } } else { sb.Append("<td class='comment-col'></td>"); } } else { sb.Append("<td class='comment-col'></td>"); } } sb.Append("</tr>"); }
public void Parse(string filePath) { PreParse(filePath); if (UseDebug) { Debug.Log("ARM Parse : " + FilePath); } numRooms = buffer.ReadUInt32(); rooms = new VSRoom[numRooms]; for (int i = 0; i < numRooms; i++) { VSRoom room = new VSRoom(); room.name = "Room_" + i; room.u1 = buffer.ReadUInt32(); // ? (RAM only) room.mapLength = buffer.ReadUInt32(); // lenght of map graphics section (RAM: pointer to section) room.zoneNumber = buffer.ReadUInt16(); room.mapNumber = buffer.ReadUInt16(); rooms[i] = room; } for (int i = 0; i < numRooms; i++) { rooms[i].numVertices = buffer.ReadUInt32(); rooms[i].vertices = new List <VSVertex>(); for (int j = 0; j < rooms[i].numVertices; j++) { VSVertex vertex = new VSVertex(); int x = -buffer.ReadInt16(); int y = -buffer.ReadInt16(); int z = -buffer.ReadInt16(); buffer.ReadInt16(); vertex.position = new Vector3(x, y, z); rooms[i].vertices.Add(vertex); } rooms[i].numTriangles = buffer.ReadUInt32(); rooms[i].triangles = new List <VSFace>(); for (int j = 0; j < rooms[i].numTriangles; j++) { VSFace face = new VSFace(); face.verticesCount = 3; face.type = 0x24; face.side = 8; face.vertices = new List <int>(); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); rooms[i].triangles.Add(face); } rooms[i].numQuads = buffer.ReadUInt32(); rooms[i].quads = new List <VSFace>(); for (int j = 0; j < rooms[i].numQuads; j++) { VSFace face = new VSFace(); face.verticesCount = 4; face.type = 0x2C; face.side = 8; face.vertices = new List <int>(); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); face.vertices.Add(buffer.ReadByte()); rooms[i].quads.Add(face); } rooms[i].numFloorLines = buffer.ReadUInt32(); rooms[i].floorLines = new List <VSLine>(); for (int j = 0; j < rooms[i].numFloorLines; j++) { VSLine line = new VSLine(); line.points = new List <VSVertex>(); line.points.Add(rooms[i].vertices[buffer.ReadByte()]); line.points.Add(rooms[i].vertices[buffer.ReadByte()]); buffer.ReadInt16(); rooms[i].floorLines.Add(line); } rooms[i].numWallLines = buffer.ReadUInt32(); rooms[i].wallLines = new List <VSLine>(); for (int j = 0; j < rooms[i].numWallLines; j++) { VSLine line = new VSLine(); line.points = new List <VSVertex>(); line.points.Add(rooms[i].vertices[buffer.ReadByte()]); line.points.Add(rooms[i].vertices[buffer.ReadByte()]); buffer.ReadInt16(); rooms[i].wallLines.Add(line); } rooms[i].numMark = buffer.ReadUInt32(); rooms[i].markers = new List <byte[]>(); for (int j = 0; j < rooms[i].numMark; j++) { rooms[i].markers.Add(buffer.ReadBytes(4)); } } if (UseDebug) { Debug.Log(FileName + " n° of Rooms : " + numRooms + " File Length : " + buffer.BaseStream.Length); } if (buffer.BaseStream.Position != buffer.BaseStream.Length) // snowfly forest rooms have no names { if (UseDebug) { Debug.Log("Room info len : " + (buffer.BaseStream.Length - buffer.BaseStream.Position) / numRooms); } for (int i = 0; i < numRooms; i++) { if (UseDebug) { Debug.Log(i + " - Ptr : " + buffer.BaseStream.Position); } // The following lines of code work with the French version of Vagrant Story SLES 02755 if (buffer.BaseStream.Position + 36 <= buffer.BaseStream.Length) { int num1 = buffer.ReadInt16(); int num2 = buffer.ReadInt16(); int num3 = buffer.ReadInt16(); byte[] bn = buffer.ReadBytes(24); string sname = ""; foreach (byte b in bn) { sname = sname + VS.Utils.L10n.Charset(b); } rooms[i].name = sname; int num4 = buffer.ReadInt16(); int num5 = buffer.ReadInt16(); int num6 = buffer.ReadInt16(); //Debug.Log("num1 : " + num1 + " num2 : " + num2 + " num3 : " + num3 + " num4 : " + num4 + " num5 : " + num5 + " num5 : " + num6); if (UseDebug) { Debug.Log(sname); } } } } buffer.Close(); fileStream.Close(); Parsed = true; }