public static void init() { ProgramSetting = LiteDBHelper.RGHGetData(); var asse = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; var version = $"{asse.Major}.{asse.Minor}.{asse.Build}"; Version = version; }
private static void Log(ErrorEntity errorEntity) { System.Diagnostics.Debug.WriteLine(errorEntity.ToString()); if (RGHSettings.LogLevel >= errorEntity.ErrorLevel) { LiteDBHelper.Save(errorEntity); } }
public static void Save() { var ftplst = ProgramSetting.FtpSettingList.FirstOrDefault(s => s.Id == ProgramSetting.SelectedFtpSetting.Id); if (ftplst != null) { ftplst.Name = ProgramSetting.SelectedFtpSetting.Name; ftplst.FtpHost = ProgramSetting.SelectedFtpSetting.FtpHost; ftplst.FtpUserName = ProgramSetting.SelectedFtpSetting.FtpUserName; ftplst.FtpPassword = ProgramSetting.SelectedFtpSetting.FtpPassword; } LiteDBHelper.RGHSetData(ProgramSetting); ProgramSetting.Dirty = false; }
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 static void init() { Instance = new LiteDBHelper(); Instance.connect(); }
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>();