Update CS:GO team score gamedata.
2 using System.Collections.Generic;
19 public double total_time;
20 public uint num_calls;
21 public double min_time;
22 public double max_time;
23 public ProfileType type;
25 public double AverageTime
29 return total_time / num_calls;
36 public static string[] TypeStrings;
37 private DateTime m_start_time;
38 private double m_duration;
39 private List<ProfileItem> m_Items;
49 static ProfileReport()
51 TypeStrings = new string[4];
53 TypeStrings[0] = "unknown";
54 TypeStrings[1] = "native";
55 TypeStrings[2] = "callback";
56 TypeStrings[3] = "function";
59 public ProfileReport(string file)
66 xml = new XmlTextReader(file);
67 xml.WhitespaceHandling = WhitespaceHandling.None;
69 m_Items = new List<ProfileItem>();
71 type = ProfileType.ProfType_Unknown;
76 if (xml.NodeType == XmlNodeType.Element)
78 if (xml.Name.CompareTo("profile") == 0)
82 m_duration = Double.Parse(xml.GetAttribute("uptime"));
83 m_start_time = new DateTime(1970, 1, 1, 0, 0, 0);
84 t = Int32.Parse(xml.GetAttribute("time"));
85 m_start_time = m_start_time.AddSeconds(t);
89 if (xml.Name.CompareTo("report") == 0)
91 cur_report = xml.GetAttribute("name");
92 if (cur_report.CompareTo("natives") == 0)
94 type = ProfileType.ProfType_Native;
96 else if (cur_report.CompareTo("callbacks") == 0)
98 type = ProfileType.ProfType_Callback;
100 else if (cur_report.CompareTo("functions") == 0)
102 type = ProfileType.ProfType_Function;
106 type = ProfileType.ProfType_Unknown;
109 else if (xml.Name.CompareTo("item") == 0 && cur_report != null)
113 item = new ProfileItem();
114 item.name = xml.GetAttribute("name");
115 item.max_time = Double.Parse(xml.GetAttribute("maxtime"));
116 item.min_time = Double.Parse(xml.GetAttribute("mintime"));
117 item.num_calls = UInt32.Parse(xml.GetAttribute("numcalls"));
118 item.total_time = Double.Parse(xml.GetAttribute("totaltime"));
124 else if (xml.NodeType == XmlNodeType.EndElement)
126 if (xml.Name.CompareTo("profile") == 0)
130 else if (xml.Name.CompareTo("report") == 0)
139 public double Duration
147 public DateTime StartTime
155 public ProfileItem GetItem(int i)