Esempio n. 1
0
 /// <summary>
 /// Serializes the dictionary of environments profiles.
 /// </summary>
 /// <param name="environmentProfiles"></param>
 /// <returns>The serialized environments profiles</returns>
 public string SerializeEnvironmentProfiles(EnvironmentProfileCollection environmentProfiles)
 {
     if (environmentProfiles == null)
     {
         throw new ArgumentNullException("environmentProfiles");
     }
     return(JsonConvert.SerializeObject(environmentProfiles, Formatting.Indented));
 }
Esempio n. 2
0
        /// <summary>
        /// Reads the list of environment profiles.
        /// </summary>
        public void Read()
        {
            Debug.Assert(_iOStream != null);
            Debug.Assert(_profileParser != null);

            SelectedEnvironment = null;
            string content = _iOStream.Read();

            _environmentProfileCollection = content == null ? new EnvironmentProfileCollection() : _profileParser.DeserializeEnvironmentProfiles(content);
        }
Esempio n. 3
0
        /// <summary>
        /// Deserializes the content into a dictionary of environment profiles.
        /// </summary>
        /// <param name="data">The environment profiles data.</param>
        /// <returns>The deserialized dictionary of environment profiles</returns>
        public EnvironmentProfileCollection DeserializeEnvironmentProfiles(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                throw new ArgumentNullException("data");
            }
            EnvironmentProfileCollection jsonDictionary = JsonConvert.DeserializeObject <EnvironmentProfileCollection>(data, _jsonDeserializingSettings);

            return(jsonDictionary);
        }