} // func TryGetLogEvent public static async Task GetLogLinesAsync(DEHttpClient http, string path, int start, int count, Action <string, LogLine> process) { var xLines = await http.GetXmlAsync(Program.MakeUri(path, new PropertyValue("action", "listget"), new PropertyValue("id", "tw_lines"), new PropertyValue("desc", false), new PropertyValue("start", start), new PropertyValue("count", count) ), rootName : "list"); var lines = xLines.Element("items")?.Elements("line"); if (lines != null) { foreach (var x in lines) { process( path, new LogLine( FromMsgTypeString(x.GetAttribute("typ", "I")), GetDateTime(x.GetAttribute("stamp", null)), x.Value ) ); } } } // func GetLogLinesAsync
} // func GetLogPropertyInfo public static async Task GetLogPropertiesAsync(DEHttpClient http, string path, Action <string, LogProperty> process = null) { var xProperties = await http.GetXmlAsync(Program.MakeUri(path, new PropertyValue("action", "listget"), new PropertyValue("id", "tw_properties") ), rootName : "list"); var properties = xProperties.Element("items")?.Elements("property"); if (properties != null) { foreach (var x in properties) { var name = x.GetAttribute("name", null); if (name == null) { continue; } // parse info var propertyInfo = new LogPropertyInfo(name, x.GetAttribute("displayname", name), LuaType.GetType(x.GetAttribute("type", "string"), lateAllowed: true).Type, x.GetAttribute("description", name), x.GetAttribute("format", null) ); UpdatePropertyInfo(propertyInfo); // process value process?.Invoke(path, new LogProperty(propertyInfo, x.Value)); } } } // func GetLogProperties
} // func CreateHttp public Task <XElement> GetXmlData(string requestUri) => request.GetXmlAsync(requestUri);