static void SaveCurrentApiModels() { lock (currentApiModels) { Utility.SetSecured(currentApiModelString, currentApiModels.ToJson(), "mediaPlayer"); } }
static void LoadModels() { if (currentApiModels != null) { return; } var data = Utility.GetSecured(currentApiModelString, "mediaPlayer"); try { currentApiModels = string.IsNullOrWhiteSpace(data) ? new Dictionary <int, ApiModel>() : data.ToObject <Dictionary <int, ApiModel> >(); if (!IsFirstRun) { return; } lock (currentApiModels) { currentApiModels?.ForEach(x => x.Value.ExtraData = ""); } SaveCurrentApiModels(); } catch (Exception ex) { LogManager.Shared.Report(ex); currentApiModels = new Dictionary <int, ApiModel>(); } }