public static ILiteQueryable <ErrorEntity> GetErrors(ErrorLevel?ErrorLevel = null, DateTime?StartDateTime = null, DateTime?EndDateTime = null, string ValueInMessage = null, string ValueInError = null, string ValueInStackTrace = null) { return(LiteDBHelper.Load <ErrorEntity>().Where(e => (!ErrorLevel.HasValue || (ErrorLevel.HasValue && e.ErrorLevel == ErrorLevel)) && (!StartDateTime.HasValue || (StartDateTime.HasValue && e.DateTime >= StartDateTime)) && (!EndDateTime.HasValue || (EndDateTime.HasValue && e.DateTime <= EndDateTime)) && ( (ValueInMessage == null || (ValueInMessage != null && e.Message.Contains(ValueInMessage))) || (ValueInError == null || (ValueInError != null && e.Error.Contains(ValueInError))) || (ValueInStackTrace == null || (ValueInStackTrace != null && e.StackTrace.Contains(ValueInStackTrace))) ) )); }
public async static void init() { try { Mac = GetMACAddress(); #region Platforms var dataEntity = LiteDBHelper.Load <DataModel>().FirstOrDefault() ?? new DataModel() { Id = 1, ScrapGuid = "", ScrapEmail = "" }; //var burl = await GetGame("ยค", 1, false, dataEntity.ScrapGuid); //BaseUrls = burl.BaseUrls; var tmp = await LiteDBHelper.LoadAsync <PlatformResponse>(); platforms = tmp.FirstOrDefault()?.data.Platforms.Select(p => p) ?? null; platforms = null; Dictionary <int, List <string> > extensions; extensions = await Task.Run(() => JsonHandler.DownloadSerializedJsonData <EmuExtensionsEntity>("http://timeonline.se/RGHandler/EmulatorSupportList.json").Extensions.ToDictionary(em => em.id, em => em.extensoins)); if (platforms == null) { PlatformResponse p = null; var headers = new Dictionary <string, string>(); headers.Add("secret", RGHSettings.ProgGuid); headers.Add("version", RGHSettings.Version); await Task.Run(() => p = JsonHandler.DownloadSerializedJsonData <PlatformResponse>(PlatformApiPath, headers)); if (p != null) { await Task.Run(() => { platforms = p.data?.Platforms;/*?.Select(i => i.Value);*/ foreach (var pl in platforms) { pl.Extensions = extensions.ContainsKey(pl.Id) && !extensions[pl.Id].Any(s => s == "?") ? extensions[pl.Id] : new List <string>(); var icon = pl.Icon; var url = PlatformImagePath + icon; if (LiteDBHelper.FileExists("platform/images", icon)) { continue; } using (WebClient client = new WebClient()) { byte[] data = client.DownloadData(url); using (MemoryStream mem = new MemoryStream(data)) { LiteDBHelper.SaveFile("platform/images", icon, mem); } } } }); LiteDBHelper.Save(p); } } else { foreach (var pl in platforms) { pl.Extensions = extensions.ContainsKey(pl.Id) && !extensions[pl.Id].Any(s => s == "?") ? extensions[pl.Id] : new List <string>(); } } foreach (var pl in platforms) { using (MemoryStream mem = new MemoryStream()) { LiteDBHelper.LoadFile("platform/images", pl.Icon, mem); PlatformModels.Add(new PlatformModel(pl, LoadImage(mem))); } } #endregion Platforms } catch (Exception ex) { ErrorHandler.Error(ex); throw; } }
//LiteDBHelper.Load<DataModel>().FirstOrDefault() ?? new DataModel() { Id = 1, ScrapGuid = "", ScrapEmail = "" }; public static ILiteQueryable <ErrorEntity> GetAllErrors() => LiteDBHelper.Load <ErrorEntity>();