protected void HandleLoadAvatarProfile(string[] cmdparams)
        {
            if (cmdparams.Length != 6)
            {
                MainConsole.Instance.Info("[AvatarProfileArchiver] Not enough parameters!");
                return;
            }
            StreamReader reader   = new StreamReader(cmdparams[5]);
            string       document = reader.ReadToEnd();

            reader.Close();
            reader.Dispose();

            string[]      lines = document.Split('\n');
            List <string> file  = new List <string>(lines);
            Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(file[1]);

            Dictionary <string, object> results = replyData["result"] as Dictionary <string, object>;
            UserAccount UDA = new UserAccount
            {
                Name        = cmdparams[3] + cmdparams[4],
                PrincipalID = UUID.Random(),
                ScopeID     = UUID.Zero,
                UserFlags   = int.Parse(results["UserFlags"].ToString()),
                UserLevel   = 0,
                UserTitle   = results["UserTitle"].ToString(),
                Email       = results["Email"].ToString(),
                Created     = int.Parse(results["Created"].ToString())
            };

            //For security... Don't want everyone loading full god mode.
            UserAccountService.StoreUserAccount(UDA);

            replyData = WebUtils.ParseXmlResponse(file[2]);
            IUserProfileInfo UPI = new IUserProfileInfo();

            UPI.FromKVP(replyData["result"] as Dictionary <string, object>);
            //Update the principle ID to the new user.
            UPI.PrincipalID = UDA.PrincipalID;

            IProfileConnector profileData = DataManager.DataManager.RequestPlugin <IProfileConnector>();

            if (profileData.GetUserProfile(UPI.PrincipalID) == null)
            {
                profileData.CreateNewProfile(UPI.PrincipalID);
            }

            profileData.UpdateUserProfile(UPI);

            MainConsole.Instance.Info("[AvatarProfileArchiver] Loaded Avatar Profile from " + cmdparams[5]);
        }
Esempio n. 2
0
        protected void HandleLoadAvatarProfile(string module, string[] cmdparams)
        {
            if (cmdparams.Length != 6)
            {
                m_log.Info("[AvatarProfileArchiver] Not enough parameters!");
                return;
            }
            StreamReader reader   = new StreamReader(cmdparams[5]);
            string       document = reader.ReadToEnd();

            reader.Close();
            reader.Dispose();

            string[]      lines = document.Split('\n');
            List <string> file  = new List <string>(lines);
            Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(file[1]);

            Dictionary <string, object> results = replyData["result"] as Dictionary <string, object>;
            UserAccount UDA = new UserAccount();

            UDA.Name        = cmdparams[3] + cmdparams[4];
            UDA.PrincipalID = UUID.Random();
            UDA.ScopeID     = UUID.Zero;
            UDA.UserFlags   = int.Parse(results["UserFlags"].ToString());
            UDA.UserLevel   = 0; //For security... Don't want everyone loading full god mode.
            UDA.UserTitle   = results["UserTitle"].ToString();
            UDA.Email       = results["Email"].ToString();
            UDA.Created     = int.Parse(results["Created"].ToString());
            if (results.ContainsKey("ServiceURLs") && results["ServiceURLs"] != null)
            {
                UDA.ServiceURLs = new Dictionary <string, object>();
                string str = results["ServiceURLs"].ToString();
                if (str != string.Empty)
                {
                    string[] parts = str.Split(new char[] { ';' });
                    foreach (string s in parts)
                    {
                        string[] parts2 = s.Split(new char[] { '*' });
                        if (parts2.Length == 2)
                        {
                            UDA.ServiceURLs[parts2[0]] = parts2[1];
                        }
                    }
                }
            }
            UserAccountService.StoreUserAccount(UDA);

            replyData = WebUtils.ParseXmlResponse(file[2]);
            IUserProfileInfo UPI = new IUserProfileInfo();

            UPI.FromKVP(replyData["result"] as Dictionary <string, object>);
            //Update the principle ID to the new user.
            UPI.PrincipalID = UDA.PrincipalID;

            IProfileConnector profileData = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>();

            if (profileData.GetUserProfile(UPI.PrincipalID) == null)
            {
                profileData.CreateNewProfile(UPI.PrincipalID);
            }

            profileData.UpdateUserProfile(UPI);

            m_log.Info("[AvatarProfileArchiver] Loaded Avatar Profile from " + cmdparams[5]);
        }