/// <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)); }
/// <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); }
/// <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); }