Reworked the JSON serialisation
This commit is contained in:
@@ -161,62 +161,6 @@ namespace Test_Merge
|
||||
}
|
||||
Windows.Clear();
|
||||
}
|
||||
public virtual string ToJSON()
|
||||
{
|
||||
string result = "";
|
||||
result += "\"" + Name + "\":{" + Environment.NewLine;
|
||||
result += "\t" + "\"x\":" + Bounds.X + "," + Environment.NewLine;
|
||||
result += "\t" + "\"y\":" + Bounds.Y + "," + Environment.NewLine;
|
||||
result += "\t" + "\"width\":" + Bounds.Width + "," + Environment.NewLine;
|
||||
result += "\t" + "\"height\":" + Bounds.Height;
|
||||
|
||||
if (Windows.Count != 0)
|
||||
{
|
||||
result += "," + Environment.NewLine;
|
||||
|
||||
result += "\t" + "\"Windows\":[" + Environment.NewLine;
|
||||
result += "\t\t{" + Environment.NewLine;
|
||||
int Wcount = 0;
|
||||
foreach (Window w in Windows)
|
||||
{
|
||||
result += "\t\t" + w.ToJSON();
|
||||
Wcount++;
|
||||
if (Wcount != Windows.Count)
|
||||
result += ",";
|
||||
}
|
||||
result += "\t\t}" + Environment.NewLine;
|
||||
result += "\t" + "]" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += Environment.NewLine;
|
||||
}
|
||||
if (Zones.Count != 0)
|
||||
{
|
||||
result += "," + Environment.NewLine;
|
||||
|
||||
result += "\t" + "\"Zones\":[" + Environment.NewLine;
|
||||
result += "\t\t{" + Environment.NewLine;
|
||||
int Zcount = 0;
|
||||
//foreach (Zone z in Zones)
|
||||
//{
|
||||
result += "\t\t" + Zones[0].ToJSON();
|
||||
Zcount++;
|
||||
if (Zcount != Zones.Count)
|
||||
//result += ",";
|
||||
//}
|
||||
result += "\t\t}" + Environment.NewLine;
|
||||
result += "\t" + "]" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += Environment.NewLine;
|
||||
}
|
||||
|
||||
result += "}";
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Checks if the given Rectangle fits in the current zone
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user