private object Deserialize(Type targetType, XmlRpcObjectBase item, PropertyInfo[] properties) { if (item is XmlRpcStruct strct) { return(DeserializeStruct(targetType, strct, properties)); } // todo: implement any other types that may be supported like serialize as strings, integers, doubles, etc throw new NotImplementedException(); return(default(object)); }
private async Task <XmlRpcObject> ApiRequest(string method, params KeyValuePair <string, object>[] arguments) { Interlocked.Increment(ref totalRequests); Interlocked.Increment(ref totalRequestsToday); Interlocked.Increment(ref totalRequestsInTimeBlock); if (requestBlockTimeLimit == DateTime.MinValue) { requestBlockTimeLimit = DateTime.Now; } var url = isVip ? VipApiUrl : ApiUrl; var requestData = BuildRequestData(method, arguments); var request = CreatePostAsync(url, requestData); try { using (var response = await request.GetResponseAsync()) { if (response.Headers.HasKeys()) { var headerKeys = response.Headers.AllKeys; if (headerKeys.Contains("Content-Location")) { isVip = isVip || response.Headers.Get("Content-Location")?.ToLower() == "https://vip-api.opensubtitles.org.local/xml-rpc"; } if (headerKeys.Contains("Download-Quota")) { if (int.TryParse(response.Headers.Get("Download-Quota"), out var quota)) { Volatile.Write(ref downloadQuota, quota); } } } return(XmlRpcObjectBase.Parse(await GetResponseStringAsync(response))); } } catch (Exception exc) { // for now... return(null); } }
public XmlRpcMember(XmlRpcString name, XmlRpcObjectBase value) { Name = name; Value = value; }
public void Add(XmlRpcObjectBase child) { children.Add(child); }
internal void Add(XmlRpcObjectBase child) { children.Add(child); }