public static async Task <HttpResponseMessage> PostAsync( this ReportPackage package) { return(await LiteClient.PostAsync(new Uri(Config.Global.ReportUrl + "/report?".GlueGetList(new Dictionary <string, object>() { { "deviceid", (object)Critical.GetDeviceId() }, { "uuid", (object)Critical.GetUuid() } }, false) + package.UrlParameters), (Stream) new MemoryStream(package.GetRawStream().ToArray()))); }
protected async Task <bool?> Refresh() { int num = DateTime.UtcNow - Config.Global.StartupTimestamp < Config.Global.StartupExpirationTimeSpan ? 1 : 0; bool flag = Critical.IsUuidRequired() || Critical.IsDeviceIdRequired() || string.IsNullOrWhiteSpace(Config.Global.ReportUrl); if (num != 0 && !flag) { return(new bool?()); } if (!await LiteClient.RefreshStartupAsync()) { return(new bool?(false)); } Config.Global.StartupTimestamp = DateTime.UtcNow; Config.Global.Snapshot(); return(new bool?(true)); }
public static async Task <bool> RefreshStartupAsync() { StartupResponse startupAsync = await LiteClient.GetStartupAsync(); if (startupAsync == null) { return(Config.Global.ReportUrl != null); } if (startupAsync.DeviceId != null) { Critical.SetDeviceId(startupAsync.DeviceId); } if (startupAsync.Uuid != null) { Critical.SetUuid(startupAsync.Uuid); } Config.Global.ReportUrl = startupAsync.ReportUrl; return(true); }