示例#1
0
        // NOTE: pass in the ENTIRE response
        public static void HandleUserRegistrationData(XElement pResponse)
        {
            string sKey   = pResponse.Element("Data").Element("Key").Value;
            string sEmail = pResponse.Element("Data").Element("Email").Value;

            // write _key file
            File.WriteAllLines(Master.GetBaseDir() + "_key.dat", new List <string>()
            {
                sKey, sEmail
            });
            Master.SetKey(sKey);
            Master.SetEmail(sEmail);

            // check if clan data
            if (pResponse.Element("Data").Element("ClanStubs") != null)
            {
                List <string> lClanLines = new List <string>();
                foreach (XElement pElement in pResponse.Element("Data").Element("ClanStubs").Elements("ClanStub"))
                {
                    string sClanName = pElement.Attribute("ClanName").Value;
                    string sUserName = pElement.Attribute("UserName").Value;

                    lClanLines.Add(sClanName + "|" + sUserName);
                }

                File.WriteAllLines(Master.GetBaseDir() + "_clans.dat", lClanLines);
            }
        }
示例#2
0
 public static void FillKeyEmail()
 {
     string[] aLines = File.ReadAllLines(Master.GetBaseDir() + "_key.dat");
     Master.SetKey(aLines[0]);
     Master.SetEmail(aLines[1]);
 }