aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization/External
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Serialization/External')
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs6
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs44
-rw-r--r--OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs34
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs22
-rw-r--r--OpenSim/Framework/Serialization/External/UserProfileSerializer.cs12
5 files changed, 59 insertions, 59 deletions
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index 55640ac..1523fa9 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");
@@ -369,7 +369,7 @@ namespace OpenSim.Framework.Serialization.External
369 break; 369 break;
370 370
371 case XmlNodeType.XmlDeclaration: 371 case XmlNodeType.XmlDeclaration:
372 // For various reasons, not all serializations have xml declarations (or consistent ones) 372 // 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. 373 // and as it's embedded inside a byte stream we don't need it anyway, so ignore.
374 break; 374 break;
375 375
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..617c451 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,14 @@ 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
67 xtr.ReadStartElement("RegionSettings"); 67 xtr.ReadStartElement("RegionSettings");
68 68
69 xtr.ReadStartElement("General"); 69 xtr.ReadStartElement("General");
70 70
71 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 71 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
72 { 72 {
73 switch (xtr.Name) 73 switch (xtr.Name)
@@ -113,10 +113,10 @@ namespace OpenSim.Framework.Serialization.External
113 break; 113 break;
114 } 114 }
115 } 115 }
116 116
117 xtr.ReadEndElement(); 117 xtr.ReadEndElement();
118 xtr.ReadStartElement("GroundTextures"); 118 xtr.ReadStartElement("GroundTextures");
119 119
120 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 120 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
121 { 121 {
122 switch (xtr.Name) 122 switch (xtr.Name)
@@ -159,10 +159,10 @@ namespace OpenSim.Framework.Serialization.External
159 break; 159 break;
160 } 160 }
161 } 161 }
162 162
163 xtr.ReadEndElement(); 163 xtr.ReadEndElement();
164 xtr.ReadStartElement("Terrain"); 164 xtr.ReadStartElement("Terrain");
165 165
166 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) 166 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
167 { 167 {
168 switch (xtr.Name) 168 switch (xtr.Name)
@@ -212,19 +212,19 @@ namespace OpenSim.Framework.Serialization.External
212 212
213 xtr.Close(); 213 xtr.Close();
214 sr.Close(); 214 sr.Close();
215 215
216 return settings; 216 return settings;
217 } 217 }
218 218
219 public static string Serialize(RegionSettings settings) 219 public static string Serialize(RegionSettings settings)
220 { 220 {
221 StringWriter sw = new StringWriter(); 221 StringWriter sw = new StringWriter();
222 XmlTextWriter xtw = new XmlTextWriter(sw); 222 XmlTextWriter xtw = new XmlTextWriter(sw);
223 xtw.Formatting = Formatting.Indented; 223 xtw.Formatting = Formatting.Indented;
224 xtw.WriteStartDocument(); 224 xtw.WriteStartDocument();
225 225
226 xtw.WriteStartElement("RegionSettings"); 226 xtw.WriteStartElement("RegionSettings");
227 227
228 xtw.WriteStartElement("General"); 228 xtw.WriteStartElement("General");
229 xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); 229 xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
230 xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); 230 xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
@@ -255,7 +255,7 @@ namespace OpenSim.Framework.Serialization.External
255 xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); 255 xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString());
256 xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); 256 xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString());
257 xtw.WriteEndElement(); 257 xtw.WriteEndElement();
258 258
259 xtw.WriteStartElement("Terrain"); 259 xtw.WriteStartElement("Terrain");
260 xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); 260 xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
261 xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); 261 xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
@@ -275,12 +275,12 @@ namespace OpenSim.Framework.Serialization.External
275 xtw.WriteElementString("SpawnPoint", sp.ToString()); 275 xtw.WriteElementString("SpawnPoint", sp.ToString());
276 } 276 }
277 xtw.WriteEndElement(); 277 xtw.WriteEndElement();
278 278
279 xtw.WriteEndElement(); 279 xtw.WriteEndElement();
280 280
281 xtw.Close(); 281 xtw.Close();
282 sw.Close(); 282 sw.Close();
283 283
284 return sw.ToString(); 284 return sw.ToString();
285 } 285 }
286 } 286 }
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index 994cede..9b02553 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>
@@ -212,8 +212,8 @@ namespace OpenSim.Framework.Serialization.External
212 212
213 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID); 213 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
214 return item; 214 return item;
215 } 215 }
216 216
217 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService) 217 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
218 { 218 {
219 StringWriter sw = new StringWriter(); 219 StringWriter sw = new StringWriter();
@@ -294,11 +294,11 @@ namespace OpenSim.Framework.Serialization.External
294 } 294 }
295 295
296 writer.WriteEndElement(); 296 writer.WriteEndElement();
297 297
298 writer.Close(); 298 writer.Close();
299 sw.Close(); 299 sw.Close();
300 300
301 return sw.ToString(); 301 return sw.ToString();
302 } 302 }
303 } 303 }
304} 304}
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 }