コード例 #1
0
 static void SaveCurrentApiModels()
 {
     lock (currentApiModels)
     {
         Utility.SetSecured(currentApiModelString, currentApiModels.ToJson(), "mediaPlayer");
     }
 }
コード例 #2
0
        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>();
            }
        }