diff options
author | Diva Canto | 2010-11-29 08:43:33 -0800 |
---|---|---|
committer | Diva Canto | 2010-11-29 08:43:33 -0800 |
commit | f86c438653fc3c8356a8f0c43a055b1928183f02 (patch) | |
tree | b8ad05db04efde6385eeaed48dcbe4e896133ad5 /OpenSim/Services/HypergridService/HGAssetService.cs | |
parent | Changed the parser for InventoryItem deserialization. Moved some utility func... (diff) | |
download | opensim-SC_OLD-f86c438653fc3c8356a8f0c43a055b1928183f02.zip opensim-SC_OLD-f86c438653fc3c8356a8f0c43a055b1928183f02.tar.gz opensim-SC_OLD-f86c438653fc3c8356a8f0c43a055b1928183f02.tar.bz2 opensim-SC_OLD-f86c438653fc3c8356a8f0c43a055b1928183f02.tar.xz |
Preservation of creator information now also working in IARs. Cleaned up usage help. Moved Osp around, deleted unnecessary OspInventoryWrapperPlugin, added manipulation of SOP's xml representation in a generic ExternalRepresentationUtils function.
Diffstat (limited to 'OpenSim/Services/HypergridService/HGAssetService.cs')
-rw-r--r-- | OpenSim/Services/HypergridService/HGAssetService.cs | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 9b098a0..584ab6f 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -35,6 +35,7 @@ using log4net; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | 36 | ||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Serialization.External; | ||
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Services.AssetService; | 41 | using OpenSim.Services.AssetService; |
@@ -131,48 +132,7 @@ namespace OpenSim.Services.HypergridService | |||
131 | protected byte[] AdjustIdentifiers(byte[] data) | 132 | protected byte[] AdjustIdentifiers(byte[] data) |
132 | { | 133 | { |
133 | string xml = Utils.BytesToString(data); | 134 | string xml = Utils.BytesToString(data); |
134 | return Utils.StringToBytes(RewriteSOP(xml)); | 135 | return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_ProfileServiceURL, m_Cache, UUID.Zero)); |
135 | } | ||
136 | |||
137 | protected string RewriteSOP(string xml) | ||
138 | { | ||
139 | XmlDocument doc = new XmlDocument(); | ||
140 | doc.LoadXml(xml); | ||
141 | XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); | ||
142 | |||
143 | foreach (XmlNode sop in sops) | ||
144 | { | ||
145 | UserAccount creator = null; | ||
146 | bool hasCreatorData = false; | ||
147 | XmlNodeList nodes = sop.ChildNodes; | ||
148 | foreach (XmlNode node in nodes) | ||
149 | { | ||
150 | if (node.Name == "CreatorID") | ||
151 | creator = m_Cache.GetUser(node.InnerText); | ||
152 | if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty) | ||
153 | hasCreatorData = true; | ||
154 | |||
155 | //if (node.Name == "OwnerID") | ||
156 | //{ | ||
157 | // UserAccount owner = GetUser(node.InnerText); | ||
158 | // if (owner != null) | ||
159 | // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName; | ||
160 | //} | ||
161 | } | ||
162 | if (!hasCreatorData && creator != null) | ||
163 | { | ||
164 | XmlElement creatorData = doc.CreateElement("CreatorData"); | ||
165 | creatorData.InnerText = m_ProfileServiceURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; | ||
166 | sop.AppendChild(creatorData); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | using (StringWriter wr = new StringWriter()) | ||
171 | { | ||
172 | doc.Save(wr); | ||
173 | return wr.ToString(); | ||
174 | } | ||
175 | |||
176 | } | 136 | } |
177 | 137 | ||
178 | } | 138 | } |