aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Framework/Serialization
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs4
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs9
-rw-r--r--OpenSim/Framework/Serialization/External/LandDataSerializer.cs1
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs44
-rw-r--r--OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs35
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs24
-rw-r--r--OpenSim/Framework/Serialization/External/UserProfileSerializer.cs12
-rw-r--r--OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs10
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs12
9 files changed, 78 insertions, 73 deletions
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index ab3c285..9081411 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -72,12 +72,12 @@ namespace OpenSim.Framework.Serialization
72 /// Path for region settings. 72 /// Path for region settings.
73 /// </value> 73 /// </value>
74 public const string SETTINGS_PATH = "settings/"; 74 public const string SETTINGS_PATH = "settings/";
75 75
76 /// <value> 76 /// <value>
77 /// Path for region settings. 77 /// Path for region settings.
78 /// </value> 78 /// </value>
79 public const string LANDDATA_PATH = "landdata/"; 79 public const string LANDDATA_PATH = "landdata/";
80 80
81 /// <value> 81 /// <value>
82 /// Path for user profiles 82 /// Path for user profiles
83 /// </value> 83 /// </value>
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 55640ac..af130a5 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Serialization.External
106 { 106 {
107 errors = true; 107 errors = true;
108 parseExceptionAction(nodeToFill, nodeName, e); 108 parseExceptionAction(nodeToFill, nodeName, e);
109 109
110 if (xtr.EOF) 110 if (xtr.EOF)
111 { 111 {
112 m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to unexpected end of XML"); 112 m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to unexpected end of XML");
113 break; 113 break;
114 } 114 }
115 115
116 if (++numErrors == 10) 116 if (++numErrors == 10)
117 { 117 {
118 m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to too many parsing errors"); 118 m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to too many parsing errors");
@@ -156,6 +156,7 @@ namespace OpenSim.Framework.Serialization.External
156 return xml; 156 return xml;
157 157
158 XmlDocument doc = new XmlDocument(); 158 XmlDocument doc = new XmlDocument();
159 doc.XmlResolver=null;
159 doc.LoadXml(xml); 160 doc.LoadXml(xml);
160 XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); 161 XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
161 162
@@ -220,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External
220 using (StringWriter sw = new StringWriter()) 221 using (StringWriter sw = new StringWriter())
221 using (XmlTextWriter writer = new XmlTextWriter(sw)) 222 using (XmlTextWriter writer = new XmlTextWriter(sw))
222 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) 223 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
223 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) 224 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true}))
224 { 225 {
225 TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); 226 TransformXml(reader, writer, sceneName, homeURL, userService, scopeID);
226 227
@@ -369,7 +370,7 @@ namespace OpenSim.Framework.Serialization.External
369 break; 370 break;
370 371
371 case XmlNodeType.XmlDeclaration: 372 case XmlNodeType.XmlDeclaration:
372 // For various reasons, not all serializations have xml declarations (or consistent ones) 373 // For various reasons, not all serializations have xml declarations (or consistent ones)
373 // and as it's embedded inside a byte stream we don't need it anyway, so ignore. 374 // and as it's embedded inside a byte stream we don't need it anyway, so ignore.
374 break; 375 break;
375 376
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index e42d56f..33ffd83 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -178,6 +178,7 @@ namespace OpenSim.Framework.Serialization.External
178 178
179 using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) 179 using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData)))
180 { 180 {
181 reader.ProhibitDtd = true;
181 reader.ReadStartElement("LandData"); 182 reader.ReadStartElement("LandData");
182 183
183 ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader); 184 ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader);
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs
index fa7160f..a1e9d55 100644
--- a/OpenSim/Framework/Serialization/External/OspResolver.cs
+++ b/OpenSim/Framework/Serialization/External/OspResolver.cs
@@ -35,13 +35,13 @@ using OpenSim.Services.Interfaces;
35namespace OpenSim.Framework.Serialization 35namespace OpenSim.Framework.Serialization
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for 38 /// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
39 /// identifying user profiles or supplying a simple name if no profile is available. 39 /// identifying user profiles or supplying a simple name if no profile is available.
40 /// </summary> 40 /// </summary>
41 public class OspResolver 41 public class OspResolver
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 public const string OSPA_PREFIX = "ospa:"; 45 public const string OSPA_PREFIX = "ospa:";
46 public const string OSPA_NAME_KEY = "n"; 46 public const string OSPA_NAME_KEY = "n";
47 public const string OSPA_NAME_VALUE_SEPARATOR = " "; 47 public const string OSPA_NAME_VALUE_SEPARATOR = " ";
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Serialization
76 76
77 return null; 77 return null;
78 } 78 }
79 79
80 /// <summary> 80 /// <summary>
81 /// Make an OSPA given a user name 81 /// Make an OSPA given a user name
82 /// </summary> 82 /// </summary>
@@ -89,17 +89,17 @@ namespace OpenSim.Framework.Serialization
89 89
90// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); 90// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
91// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); 91// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
92 92
93 return ospa; 93 return ospa;
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
97 /// Resolve an osp string into the most suitable internal OpenSim identifier. 97 /// Resolve an osp string into the most suitable internal OpenSim identifier.
98 /// </summary> 98 /// </summary>
99 /// 99 ///
100 /// In some cases this will be a UUID if a suitable profile exists on the system. In other cases, this may 100 /// In some cases this will be a UUID if a suitable profile exists on the system. In other cases, this may
101 /// just return the same identifier after creating a temporary profile. 101 /// just return the same identifier after creating a temporary profile.
102 /// 102 ///
103 /// <param name="ospa"></param> 103 /// <param name="ospa"></param>
104 /// <param name="commsManager"></param> 104 /// <param name="commsManager"></param>
105 /// <returns> 105 /// <returns>
@@ -111,14 +111,14 @@ namespace OpenSim.Framework.Serialization
111 if (!ospa.StartsWith(OSPA_PREFIX)) 111 if (!ospa.StartsWith(OSPA_PREFIX))
112 { 112 {
113// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa); 113// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa);
114 return UUID.Zero; 114 return UUID.Zero;
115 } 115 }
116 116
117// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); 117// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
118 118
119 string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); 119 string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
120 string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); 120 string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
121 121
122 foreach (string tuple in ospaTuples) 122 foreach (string tuple in ospaTuples)
123 { 123 {
124 int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR); 124 int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);
@@ -128,17 +128,17 @@ namespace OpenSim.Framework.Serialization
128 m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa); 128 m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
129 continue; 129 continue;
130 } 130 }
131 131
132 string key = tuple.Remove(tupleSeparatorIndex).Trim(); 132 string key = tuple.Remove(tupleSeparatorIndex).Trim();
133 string value = tuple.Substring(tupleSeparatorIndex + 1).Trim(); 133 string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
134 134
135 if (OSPA_NAME_KEY == key) 135 if (OSPA_NAME_KEY == key)
136 return ResolveOspaName(value, userService); 136 return ResolveOspaName(value, userService);
137 } 137 }
138 138
139 return UUID.Zero; 139 return UUID.Zero;
140 } 140 }
141 141
142 /// <summary> 142 /// <summary>
143 /// Hash a profile name into a UUID 143 /// Hash a profile name into a UUID
144 /// </summary> 144 /// </summary>
@@ -148,7 +148,7 @@ namespace OpenSim.Framework.Serialization
148 { 148 {
149 return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0); 149 return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0);
150 } 150 }
151 151
152 /// <summary> 152 /// <summary>
153 /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile 153 /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile
154 /// then a temporary user profile is inserted in the cache. 154 /// then a temporary user profile is inserted in the cache.
@@ -164,13 +164,13 @@ namespace OpenSim.Framework.Serialization
164 return UUID.Zero; 164 return UUID.Zero;
165 165
166 int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); 166 int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
167 167
168 if (nameSeparatorIndex < 0) 168 if (nameSeparatorIndex < 0)
169 { 169 {
170 m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); 170 m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
171 return UUID.Zero; 171 return UUID.Zero;
172 } 172 }
173 173
174 string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); 174 string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
175 string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); 175 string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
176 176
@@ -178,14 +178,14 @@ namespace OpenSim.Framework.Serialization
178 if (account != null) 178 if (account != null)
179 { 179 {
180// m_log.DebugFormat( 180// m_log.DebugFormat(
181// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}", 181// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}",
182// account.PrincipalID, firstName, lastName); 182// account.PrincipalID, firstName, lastName);
183 183
184 return account.PrincipalID; 184 return account.PrincipalID;
185 } 185 }
186// else 186// else
187// { 187// {
188// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name); 188// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name);
189// } 189// }
190 190
191 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc 191 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
@@ -194,11 +194,11 @@ namespace OpenSim.Framework.Serialization
194 tempUserProfile.FirstName = firstName; 194 tempUserProfile.FirstName = firstName;
195 tempUserProfile.SurName = lastName; 195 tempUserProfile.SurName = lastName;
196 tempUserProfile.ID = HashName(tempUserProfile.Name); 196 tempUserProfile.ID = HashName(tempUserProfile.Name);
197 197
198 m_log.DebugFormat( 198 m_log.DebugFormat(
199 "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); 199 "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
200 commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); 200 commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
201 201
202 return tempUserProfile.ID; 202 return tempUserProfile.ID;
203 */ 203 */
204 204
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
index 19468c3..fd21f3e 100644
--- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Framework.Serialization.External
50 { 50 {
51 return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length)); 51 return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
52 } 52 }
53 53
54 /// <summary> 54 /// <summary>
55 /// Deserialize settings 55 /// Deserialize settings
56 /// </summary> 56 /// </summary>
@@ -60,14 +60,15 @@ namespace OpenSim.Framework.Serialization.External
60 public static RegionSettings Deserialize(string serializedSettings) 60 public static RegionSettings Deserialize(string serializedSettings)
61 { 61 {
62 RegionSettings settings = new RegionSettings(); 62 RegionSettings settings = new RegionSettings();
63 63
64 StringReader sr = new StringReader(serializedSettings); 64 StringReader sr = new StringReader(serializedSettings);
65 XmlTextReader xtr = new XmlTextReader(sr); 65 XmlTextReader xtr = new XmlTextReader(sr);
66 66 xtr.ProhibitDtd = true;
67
67 xtr.ReadStartElement("RegionSettings"); 68 xtr.ReadStartElement("RegionSettings");
68 69
69 xtr.ReadStartElement("General"); 70 xtr.ReadStartElement("General");
70 71
71 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 72 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
72 { 73 {
73 switch (xtr.Name) 74 switch (xtr.Name)
@@ -113,10 +114,10 @@ namespace OpenSim.Framework.Serialization.External
113 break; 114 break;
114 } 115 }
115 } 116 }
116 117
117 xtr.ReadEndElement(); 118 xtr.ReadEndElement();
118 xtr.ReadStartElement("GroundTextures"); 119 xtr.ReadStartElement("GroundTextures");
119 120
120 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 121 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
121 { 122 {
122 switch (xtr.Name) 123 switch (xtr.Name)
@@ -159,10 +160,10 @@ namespace OpenSim.Framework.Serialization.External
159 break; 160 break;
160 } 161 }
161 } 162 }
162 163
163 xtr.ReadEndElement(); 164 xtr.ReadEndElement();
164 xtr.ReadStartElement("Terrain"); 165 xtr.ReadStartElement("Terrain");
165 166
166 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 167 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
167 { 168 {
168 switch (xtr.Name) 169 switch (xtr.Name)
@@ -212,19 +213,19 @@ namespace OpenSim.Framework.Serialization.External
212 213
213 xtr.Close(); 214 xtr.Close();
214 sr.Close(); 215 sr.Close();
215 216
216 return settings; 217 return settings;
217 } 218 }
218 219
219 public static string Serialize(RegionSettings settings) 220 public static string Serialize(RegionSettings settings)
220 { 221 {
221 StringWriter sw = new StringWriter(); 222 StringWriter sw = new StringWriter();
222 XmlTextWriter xtw = new XmlTextWriter(sw); 223 XmlTextWriter xtw = new XmlTextWriter(sw);
223 xtw.Formatting = Formatting.Indented; 224 xtw.Formatting = Formatting.Indented;
224 xtw.WriteStartDocument(); 225 xtw.WriteStartDocument();
225 226
226 xtw.WriteStartElement("RegionSettings"); 227 xtw.WriteStartElement("RegionSettings");
227 228
228 xtw.WriteStartElement("General"); 229 xtw.WriteStartElement("General");
229 xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); 230 xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
230 xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); 231 xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
@@ -255,7 +256,7 @@ namespace OpenSim.Framework.Serialization.External
255 xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); 256 xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString());
256 xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); 257 xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString());
257 xtw.WriteEndElement(); 258 xtw.WriteEndElement();
258 259
259 xtw.WriteStartElement("Terrain"); 260 xtw.WriteStartElement("Terrain");
260 xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); 261 xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
261 xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); 262 xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
@@ -275,12 +276,12 @@ namespace OpenSim.Framework.Serialization.External
275 xtw.WriteElementString("SpawnPoint", sp.ToString()); 276 xtw.WriteElementString("SpawnPoint", sp.ToString());
276 } 277 }
277 xtw.WriteEndElement(); 278 xtw.WriteEndElement();
278 279
279 xtw.WriteEndElement(); 280 xtw.WriteEndElement();
280 281
281 xtw.Close(); 282 xtw.Close();
282 sw.Close(); 283 sw.Close();
283 284
284 return sw.ToString(); 285 return sw.ToString();
285 } 286 }
286 } 287 }
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index 994cede..12194ad 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -36,9 +36,9 @@ using log4net;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40namespace OpenSim.Framework.Serialization.External 40namespace OpenSim.Framework.Serialization.External
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Serialize and deserialize user inventory items as an external format. 43 /// Serialize and deserialize user inventory items as an external format.
44 /// </summary> 44 /// </summary>
@@ -49,14 +49,14 @@ namespace OpenSim.Framework.Serialization.External
49 private static Dictionary<string, Action<InventoryItemBase, XmlReader>> m_InventoryItemXmlProcessors 49 private static Dictionary<string, Action<InventoryItemBase, XmlReader>> m_InventoryItemXmlProcessors
50 = new Dictionary<string, Action<InventoryItemBase, XmlReader>>(); 50 = new Dictionary<string, Action<InventoryItemBase, XmlReader>>();
51 51
52 #region InventoryItemBase Processor initialization 52 #region InventoryItemBase Processor initialization
53 static UserInventoryItemSerializer() 53 static UserInventoryItemSerializer()
54 { 54 {
55 m_InventoryItemXmlProcessors.Add("Name", ProcessName); 55 m_InventoryItemXmlProcessors.Add("Name", ProcessName);
56 m_InventoryItemXmlProcessors.Add("ID", ProcessID); 56 m_InventoryItemXmlProcessors.Add("ID", ProcessID);
57 m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType); 57 m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType);
58 m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID); 58 m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID);
59 m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID); 59 m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
60 m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData); 60 m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData);
61 m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate); 61 m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate);
62 m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner); 62 m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner);
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Serialization.External
73 m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID); 73 m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID);
74 m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned); 74 m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned);
75 } 75 }
76 #endregion 76 #endregion
77 77
78 #region InventoryItemBase Processors 78 #region InventoryItemBase Processors
79 private static void ProcessName(InventoryItemBase item, XmlReader reader) 79 private static void ProcessName(InventoryItemBase item, XmlReader reader)
@@ -189,7 +189,7 @@ namespace OpenSim.Framework.Serialization.External
189 { 189 {
190 return Deserialize(Encoding.ASCII.GetString(serialization, 0, serialization.Length)); 190 return Deserialize(Encoding.ASCII.GetString(serialization, 0, serialization.Length));
191 } 191 }
192 192
193 /// <summary> 193 /// <summary>
194 /// Deserialize settings 194 /// Deserialize settings
195 /// </summary> 195 /// </summary>
@@ -202,6 +202,8 @@ namespace OpenSim.Framework.Serialization.External
202 202
203 using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) 203 using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization)))
204 { 204 {
205 reader.ProhibitDtd = true;
206
205 reader.ReadStartElement("InventoryItem"); 207 reader.ReadStartElement("InventoryItem");
206 208
207 ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>( 209 ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>(
@@ -212,8 +214,8 @@ namespace OpenSim.Framework.Serialization.External
212 214
213 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID); 215 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
214 return item; 216 return item;
215 } 217 }
216 218
217 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService) 219 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
218 { 220 {
219 StringWriter sw = new StringWriter(); 221 StringWriter sw = new StringWriter();
@@ -294,11 +296,11 @@ namespace OpenSim.Framework.Serialization.External
294 } 296 }
295 297
296 writer.WriteEndElement(); 298 writer.WriteEndElement();
297 299
298 writer.Close(); 300 writer.Close();
299 sw.Close(); 301 sw.Close();
300 302
301 return sw.ToString(); 303 return sw.ToString();
302 } 304 }
303 } 305 }
304} 306}
diff --git a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
index c685a15..34eaa99 100644
--- a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
@@ -42,31 +42,31 @@ namespace OpenSim.Framework.Serialization.External
42 { 42 {
43 public const int MAJOR_VERSION = 0; 43 public const int MAJOR_VERSION = 0;
44 public const int MINOR_VERSION = 1; 44 public const int MINOR_VERSION = 1;
45 45
46 public static string Serialize(UUID userID, string firstName, string lastName) 46 public static string Serialize(UUID userID, string firstName, string lastName)
47 { 47 {
48 StringWriter sw = new StringWriter(); 48 StringWriter sw = new StringWriter();
49 XmlTextWriter xtw = new XmlTextWriter(sw); 49 XmlTextWriter xtw = new XmlTextWriter(sw);
50 xtw.Formatting = Formatting.Indented; 50 xtw.Formatting = Formatting.Indented;
51 xtw.WriteStartDocument(); 51 xtw.WriteStartDocument();
52 52
53 xtw.WriteStartElement("user_profile"); 53 xtw.WriteStartElement("user_profile");
54 xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString()); 54 xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString());
55 xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString()); 55 xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString());
56 56
57 xtw.WriteElementString("name", firstName + " " + lastName); 57 xtw.WriteElementString("name", firstName + " " + lastName);
58 xtw.WriteElementString("id", userID.ToString()); 58 xtw.WriteElementString("id", userID.ToString());
59 xtw.WriteElementString("about", ""); 59 xtw.WriteElementString("about", "");
60 60
61 // Not sure if we're storing this yet, need to take a look 61 // Not sure if we're storing this yet, need to take a look
62// xtw.WriteElementString("Url", profile.Url); 62// xtw.WriteElementString("Url", profile.Url);
63 // or, indeed, interests 63 // or, indeed, interests
64 64
65 xtw.WriteEndElement(); 65 xtw.WriteEndElement();
66 66
67 xtw.Close(); 67 xtw.Close();
68 sw.Close(); 68 sw.Close();
69 69
70 return sw.ToString(); 70 return sw.ToString();
71 } 71 }
72 } 72 }
diff --git a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
index acec20f..7dfb87b 100644
--- a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4 4
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Serialization")] 8[assembly: AssemblyTitle("OpenSim.Framework.Serialization")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices;
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
27// Major Version 27// Major Version
28// Minor Version 28// Minor Version
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.3.*")] 32[assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)]
33 33
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index 2a3bc48..a5c3d0a 100644
--- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Framework.Serialization
113 lock (m_bw) 113 lock (m_bw)
114 { 114 {
115 m_bw.Write(finalZeroPadding); 115 m_bw.Write(finalZeroPadding);
116 116
117 m_bw.Flush(); 117 m_bw.Flush();
118 m_bw.Close(); 118 m_bw.Close();
119 } 119 }
@@ -149,7 +149,7 @@ namespace OpenSim.Framework.Serialization
149 { 149 {
150// m_log.DebugFormat( 150// m_log.DebugFormat(
151// "[TAR ARCHIVE WRITER]: Data for {0} is {1} bytes", filePath, (null == data ? "null" : data.Length.ToString())); 151// "[TAR ARCHIVE WRITER]: Data for {0} is {1} bytes", filePath, (null == data ? "null" : data.Length.ToString()));
152 152
153 byte[] header = new byte[512]; 153 byte[] header = new byte[512];
154 154
155 // file path field (100) 155 // file path field (100)
@@ -208,18 +208,18 @@ namespace OpenSim.Framework.Serialization
208 { 208 {
209 // Write out header 209 // Write out header
210 m_bw.Write(header); 210 m_bw.Write(header);
211 211
212 // Write out data 212 // Write out data
213 // An IOException occurs if we try to write out an empty array in Mono 2.6 213 // An IOException occurs if we try to write out an empty array in Mono 2.6
214 if (data.Length > 0) 214 if (data.Length > 0)
215 m_bw.Write(data); 215 m_bw.Write(data);
216 216
217 if (data.Length % 512 != 0) 217 if (data.Length % 512 != 0)
218 { 218 {
219 int paddingRequired = 512 - (data.Length % 512); 219 int paddingRequired = 512 - (data.Length % 512);
220 220
221 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired); 221 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired);
222 222
223 byte[] padding = new byte[paddingRequired]; 223 byte[] padding = new byte[paddingRequired];
224 m_bw.Write(padding); 224 m_bw.Write(padding);
225 } 225 }