/// <summary>
        ///     Reads the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>CredentialsStore.</returns>
        private static CredentialsStore Read(XmlTextReader reader)
        {
            var retVal = new CredentialsStore();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    string elementName   = reader.Name;
                    bool   hasAttributes = reader.MoveToFirstAttribute();
                    while (hasAttributes)
                    {
                        string attributeName  = reader.Name;
                        string attributeValue = reader.Value;
                        if (attributeName == "Credential")
                        {
                            retVal.Values[elementName] = attributeValue;
                        }
                        hasAttributes = reader.MoveToNextAttribute();
                    }
                    reader.MoveToElement();
                    break;

                default:
                    break;
                }
            }
            return(retVal);
        }
 /// <summary>
 ///     Writes the specified file path.
 /// </summary>
 /// <param name="filePath">The file path.</param>
 /// <param name="credentials">The credentials.</param>
 public static void Write(string filePath, CredentialsStore credentials)
 {
     using (var writer = new XmlTextWriter(filePath, Encoding.UTF8))
     {
         Write(credentials, writer);
     }
 }
 /// <summary>
 ///     Writes the specified credentials.
 /// </summary>
 /// <param name="credentials">The credentials.</param>
 /// <param name="writer">The writer.</param>
 private static void Write(CredentialsStore credentials, XmlWriter writer)
 {
     writer.WriteStartElement("ReSTCredentials", "");
     foreach (KeyValuePair <string, string> pair in credentials.Values)
     {
         writer.WriteStartElement(pair.Key, "");
         writer.WriteAttributeString("Credential", pair.Value);
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }