Exemple #1
0
        private static Config FromJSON(JObject iJSON)
        {
            Config pConConfig = new Config();

            pConConfig.Options = ConfigOptions.FromJSON(iJSON["Options"].Value<JObject>());

            JObject pJOtFilters = iJSON["Filters"].Value<JObject>();
            if(pJOtFilters != null)
            {
                JArray pJAyArtists = pJOtFilters["Artists"].Value<JArray>();
                foreach(JObject curArtistFilter in pJAyArtists)
                {
                    ArtistFilter pAFrArtistFilter = (ArtistFilter)FilterBase.FromJSON(curArtistFilter);
                    pConConfig.AllFilters.Add(pAFrArtistFilter);
                    pConConfig.ArtistFilters.Add(pAFrArtistFilter.Value, pAFrArtistFilter);
                }

                JArray pJAyTracks = pJOtFilters["Tracks"].Value<JArray>();
                foreach (JObject curTrackFilter in pJAyTracks)
                {
                    TrackFilter pTFrTrackFilter = (TrackFilter)FilterBase.FromJSON(curTrackFilter);
                    pConConfig.AllFilters.Add(pTFrTrackFilter);
                    pConConfig.TrackFilters.Add(pTFrTrackFilter.URI, pTFrTrackFilter);
                }
            }

            return (pConConfig);
        }
Exemple #2
0
        public static void Init(String iDefaultsFullPath, String iFullPath)
        {
            if(!File.Exists(iFullPath))
            {
                //restore all defaults
                String pStrDefaults = File.ReadAllText(iDefaultsFullPath);
                File.WriteAllText(iFullPath, pStrDefaults);
            }

            Config pConCurrent = Load(iFullPath);
            cConCurrent = pConCurrent;
        }