OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
/// <summary>
/// Takes a XML representation of a SceneObjectPart and returns another XML representation
/// with creator data added to it.
/// </summary>
/// <param name="xml">The SceneObjectPart represented in XML2</param>
/// <param name="homeURL">The URL of the user agents service (home) for the creator</param>
/// <param name="userService">The service for retrieving user account information</param>
/// <param name="scopeID">The scope of the user account information (Grid ID)</param>
/// <returns>The SceneObjectPart represented in XML2</returns>
Takes a XML representation of a SceneObjectPart and returns another XML representation
with creator data added to it.
Takes a XML representation of a SceneObjectPart and returns another XML representation with creator data added to it .
public static string RewriteSOP(string xml, string homeURL, IUserAccountService userService, UUID scopeID)
        {
            if (xml == string.Empty || homeURL == string.Empty || userService == null)
                return xml;
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
            foreach (XmlNode sop in sops)
            {
                UserAccount creator = null;
                bool hasCreatorData = false;
                XmlNodeList nodes = sop.ChildNodes;
                foreach (XmlNode node in nodes)
                {
                    if (node.Name == "CreatorID")
                    {
                        UUID uuid = UUID.Zero;
                        UUID.TryParse(node.InnerText, out uuid);
                        creator = userService.GetUserAccount(scopeID, uuid);
                    }
                    if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
                        hasCreatorData = true;
                }
                if (!hasCreatorData && creator != null)
                {
                    XmlElement creatorData = doc.CreateElement("CreatorData");
                    creatorData.InnerText = CalcCreatorData(homeURL, creator.FirstName + " " + creator.LastName);
                    sop.AppendChild(creatorData);
                }
            }
            using (StringWriter wr = new StringWriter())
            {
                doc.Save(wr);
                return wr.ToString();
            }
        }
public static string RewriteSOP ( string xml , string homeURL , IUserAccountService userService , UUID scopeID ) { if ( xml == string . Empty || homeURL == string . Empty || userService == null ) return xml ; XmlDocument doc = new XmlDocument ( ) ; doc . LoadXml ( xml ) ; XmlNodeList sops = doc . GetElementsByTagName ( " " ) ; foreach ( XmlNode sop in sops ) { UserAccount creator = null ; bool hasCreatorData = false ; XmlNodeList nodes = sop . ChildNodes ; foreach ( XmlNode node in nodes ) { if ( node . Name == " " ) { UUID uuid = UUID . Zero ; UUID . TryParse ( node . InnerText , out uuid ) ; creator = userService . GetUserAccount ( scopeID , uuid ) ; } if ( node . Name == " " && node . InnerText != null && node . InnerText != string . Empty ) hasCreatorData = true ; } if ( ! hasCreatorData && creator != null ) { XmlElement creatorData = doc . CreateElement ( " " ) ; creatorData . InnerText = CalcCreatorData ( homeURL , creator . FirstName + " " + creator . LastName ) ; sop . AppendChild ( creatorData ) ; } } using ( StringWriter wr = new StringWriter ( ) ) { doc . Save ( wr ) ; return wr . ToString ( ) ; } }
Takes a XML representation of a SceneObjectPart and returns another XML representation
with creator data added to it.
Takes a XML representation of a SceneObjectPart and returns another XML representation with creator data added to it .
//if (node.Name == "OwnerID") //{ //    UserAccount owner = GetUser(node.InnerText); //    if (owner != null) //        node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName; //}
The SceneObjectPart represented in XML2
The SceneObjectPart represented in XML2
xml
string
The SceneObjectPart represented in XML2
The SceneObjectPart represented in XML2
homeURL
string
The URL of the user agents service (home) for the creator
The URL of the user agents service ( home ) for the creator
userService
IUserAccountService
The service for retrieving user account information
The service for retrieving user account information
scopeID
UUID
The scope of the user account information (Grid ID)
The scope of the user account information ( Grid ID )