forked from izrik/FbxSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseObject.cs
53 lines (48 loc) · 1.38 KB
/
ParseObject.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Text;
namespace FbxSharp
{
public class ParseObject
{
public string Name;
public List<object> Values = new List<object>();
public List<ParseObject> Properties = new List<ParseObject>();
public bool HasEmptyBlock = true;
public override string ToString()
{
var sb = new StringBuilder();
sb.Append(Name);
sb.Append(":");
if (Values != null)
{
sb.Append(" ");
if (Values.Count == 0)
{
}
else if (Values.Count == 1)
{
sb.Append(Values[0].ToString());
}
else
{
sb.AppendFormat("{0} values", Values.Count);
}
}
if (Properties != null || HasEmptyBlock)
{
sb.Append(" { ");
if (!HasEmptyBlock && Properties.Count > 0)
{
sb.AppendFormat("{0} properties", Properties.Count);
}
sb.Append(" }");
}
return sb.ToString();
}
public ParseObject FindPropertyByName(string name)
{
return this.Properties.Find(p => p.Name == name);
}
}
}