private XDocument LoadConfiguration()
 {
     using (var fileStream = File.Open(UserConfigPath, FileMode.Open, FileAccess.Read))
     {
         // Created a decrypted file stream:
         using (var inputStream = new Utilities.DpapiStream(fileStream))
         {
             return(XDocument.Load(inputStream));
         }
     }
 }
        private void SaveConfiguration(XDocument configurationDocument)
        {
            var path = UserConfigPath;

            // Make sure the configuration directory exists:
            Directory.CreateDirectory(Path.GetDirectoryName(path));

            using (var fileStream = File.Create(path))
            {
                // Encrypt the file, since it contains authentication information.
                using (var encryptedStream = new Utilities.DpapiStream(fileStream))
                {
                    configurationDocument.Save(encryptedStream);
                }
            }
        }
        private void SaveConfiguration(XDocument configurationDocument)
        {
            var path = UserConfigPath;

            // Make sure the configuration directory exists:
            Directory.CreateDirectory(Path.GetDirectoryName(path));

            using (var fileStream = File.Create(path))
            {
                // Encrypt the file, since it contains authentication information.
                using (var encryptedStream = new Utilities.DpapiStream(fileStream))
                {
                    configurationDocument.Save(encryptedStream);
                }
            }
        }
 private XDocument LoadConfiguration()
 {
     using (var fileStream = File.Open(UserConfigPath, FileMode.Open, FileAccess.Read))
     {
         // Created a decrypted file stream:
         using (var inputStream = new Utilities.DpapiStream(fileStream))
         {
             return XDocument.Load(inputStream);
         }
     }
 }