Exemplo n.º 1
0
        public static void SaveUserAccount(WatsonAccount account)
        {
            if (!Directory.Exists(GetELearningLabStoragePath()))
            {
                Directory.CreateDirectory(GetELearningLabStoragePath());
            }

            Dictionary <string, string> user = new Dictionary <string, string>()
            {
                { "endpoint", account.GetRegion() },
                { "key", account.GetKey() }
            };
            XElement   root = new XElement("user", from kv in user select new XElement(kv.Key, kv.Value));
            FileStream file = File.Open(GetAccessKeyFilePath(), FileMode.OpenOrCreate);

            root.Save(file);
            file.Close();
        }