mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
Massive tab and trailing space cleanup
This commit is contained in:
@@ -72,12 +72,12 @@ namespace OpenSim.Framework.Serialization
|
||||
/// Path for region settings.
|
||||
/// </value>
|
||||
public const string SETTINGS_PATH = "settings/";
|
||||
|
||||
|
||||
/// <value>
|
||||
/// Path for region settings.
|
||||
/// </value>
|
||||
public const string LANDDATA_PATH = "landdata/";
|
||||
|
||||
|
||||
/// <value>
|
||||
/// Path for user profiles
|
||||
/// </value>
|
||||
|
||||
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
errors = true;
|
||||
parseExceptionAction(nodeToFill, nodeName, e);
|
||||
|
||||
|
||||
if (xtr.EOF)
|
||||
{
|
||||
m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to unexpected end of XML");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (++numErrors == 10)
|
||||
{
|
||||
m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to too many parsing errors");
|
||||
@@ -369,7 +369,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
break;
|
||||
|
||||
case XmlNodeType.XmlDeclaration:
|
||||
// For various reasons, not all serializations have xml declarations (or consistent ones)
|
||||
// For various reasons, not all serializations have xml declarations (or consistent ones)
|
||||
// and as it's embedded inside a byte stream we don't need it anyway, so ignore.
|
||||
break;
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ using OpenSim.Services.Interfaces;
|
||||
namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
|
||||
/// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
|
||||
/// identifying user profiles or supplying a simple name if no profile is available.
|
||||
/// </summary>
|
||||
public class OspResolver
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
public const string OSPA_PREFIX = "ospa:";
|
||||
public const string OSPA_NAME_KEY = "n";
|
||||
public const string OSPA_NAME_VALUE_SEPARATOR = " ";
|
||||
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Serialization
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Make an OSPA given a user name
|
||||
/// </summary>
|
||||
@@ -89,17 +89,17 @@ namespace OpenSim.Framework.Serialization
|
||||
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
|
||||
|
||||
return ospa;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolve an osp string into the most suitable internal OpenSim identifier.
|
||||
/// </summary>
|
||||
///
|
||||
///
|
||||
/// In some cases this will be a UUID if a suitable profile exists on the system. In other cases, this may
|
||||
/// just return the same identifier after creating a temporary profile.
|
||||
///
|
||||
///
|
||||
/// <param name="ospa"></param>
|
||||
/// <param name="commsManager"></param>
|
||||
/// <returns>
|
||||
@@ -111,14 +111,14 @@ namespace OpenSim.Framework.Serialization
|
||||
if (!ospa.StartsWith(OSPA_PREFIX))
|
||||
{
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa);
|
||||
return UUID.Zero;
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
|
||||
|
||||
|
||||
string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
|
||||
string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
|
||||
|
||||
|
||||
foreach (string tuple in ospaTuples)
|
||||
{
|
||||
int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);
|
||||
@@ -128,17 +128,17 @@ namespace OpenSim.Framework.Serialization
|
||||
m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
string key = tuple.Remove(tupleSeparatorIndex).Trim();
|
||||
string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
|
||||
|
||||
|
||||
if (OSPA_NAME_KEY == key)
|
||||
return ResolveOspaName(value, userService);
|
||||
}
|
||||
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Hash a profile name into a UUID
|
||||
/// </summary>
|
||||
@@ -148,7 +148,7 @@ namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile
|
||||
/// then a temporary user profile is inserted in the cache.
|
||||
@@ -164,13 +164,13 @@ namespace OpenSim.Framework.Serialization
|
||||
return UUID.Zero;
|
||||
|
||||
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
|
||||
|
||||
|
||||
if (nameSeparatorIndex < 0)
|
||||
{
|
||||
m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
|
||||
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
|
||||
string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
|
||||
|
||||
@@ -178,14 +178,14 @@ namespace OpenSim.Framework.Serialization
|
||||
if (account != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}",
|
||||
// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}",
|
||||
// account.PrincipalID, firstName, lastName);
|
||||
|
||||
|
||||
return account.PrincipalID;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name);
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name);
|
||||
// }
|
||||
|
||||
// XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
|
||||
@@ -194,11 +194,11 @@ namespace OpenSim.Framework.Serialization
|
||||
tempUserProfile.FirstName = firstName;
|
||||
tempUserProfile.SurName = lastName;
|
||||
tempUserProfile.ID = HashName(tempUserProfile.Name);
|
||||
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
|
||||
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
|
||||
|
||||
|
||||
return tempUserProfile.ID;
|
||||
*/
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize settings
|
||||
/// </summary>
|
||||
@@ -60,14 +60,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
public static RegionSettings Deserialize(string serializedSettings)
|
||||
{
|
||||
RegionSettings settings = new RegionSettings();
|
||||
|
||||
|
||||
StringReader sr = new StringReader(serializedSettings);
|
||||
XmlTextReader xtr = new XmlTextReader(sr);
|
||||
|
||||
|
||||
xtr.ReadStartElement("RegionSettings");
|
||||
|
||||
|
||||
xtr.ReadStartElement("General");
|
||||
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
@@ -113,10 +113,10 @@ namespace OpenSim.Framework.Serialization.External
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xtr.ReadEndElement();
|
||||
xtr.ReadStartElement("GroundTextures");
|
||||
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
@@ -159,10 +159,10 @@ namespace OpenSim.Framework.Serialization.External
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xtr.ReadEndElement();
|
||||
xtr.ReadStartElement("Terrain");
|
||||
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
@@ -212,19 +212,19 @@ namespace OpenSim.Framework.Serialization.External
|
||||
|
||||
xtr.Close();
|
||||
sr.Close();
|
||||
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
public static string Serialize(RegionSettings settings)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
xtw.Formatting = Formatting.Indented;
|
||||
xtw.WriteStartDocument();
|
||||
|
||||
|
||||
xtw.WriteStartElement("RegionSettings");
|
||||
|
||||
|
||||
xtw.WriteStartElement("General");
|
||||
xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
|
||||
xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
|
||||
@@ -255,7 +255,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString());
|
||||
xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString());
|
||||
xtw.WriteEndElement();
|
||||
|
||||
|
||||
xtw.WriteStartElement("Terrain");
|
||||
xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
|
||||
xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
|
||||
@@ -275,12 +275,12 @@ namespace OpenSim.Framework.Serialization.External
|
||||
xtw.WriteElementString("SpawnPoint", sp.ToString());
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
|
||||
xtw.Close();
|
||||
sw.Close();
|
||||
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
|
||||
namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize user inventory items as an external format.
|
||||
/// </summary>
|
||||
@@ -49,14 +49,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
private static Dictionary<string, Action<InventoryItemBase, XmlReader>> m_InventoryItemXmlProcessors
|
||||
= new Dictionary<string, Action<InventoryItemBase, XmlReader>>();
|
||||
|
||||
#region InventoryItemBase Processor initialization
|
||||
#region InventoryItemBase Processor initialization
|
||||
static UserInventoryItemSerializer()
|
||||
{
|
||||
m_InventoryItemXmlProcessors.Add("Name", ProcessName);
|
||||
m_InventoryItemXmlProcessors.Add("ID", ProcessID);
|
||||
m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType);
|
||||
m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID);
|
||||
m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
|
||||
m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
|
||||
m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData);
|
||||
m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate);
|
||||
m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner);
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID);
|
||||
m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region InventoryItemBase Processors
|
||||
private static void ProcessName(InventoryItemBase item, XmlReader reader)
|
||||
@@ -189,7 +189,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
return Deserialize(Encoding.ASCII.GetString(serialization, 0, serialization.Length));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize settings
|
||||
/// </summary>
|
||||
@@ -212,8 +212,8 @@ namespace OpenSim.Framework.Serialization.External
|
||||
|
||||
//m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
@@ -294,11 +294,11 @@ namespace OpenSim.Framework.Serialization.External
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
|
||||
writer.Close();
|
||||
sw.Close();
|
||||
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,31 +42,31 @@ namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
public const int MAJOR_VERSION = 0;
|
||||
public const int MINOR_VERSION = 1;
|
||||
|
||||
|
||||
public static string Serialize(UUID userID, string firstName, string lastName)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
xtw.Formatting = Formatting.Indented;
|
||||
xtw.WriteStartDocument();
|
||||
|
||||
|
||||
xtw.WriteStartElement("user_profile");
|
||||
xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString());
|
||||
xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString());
|
||||
|
||||
|
||||
xtw.WriteElementString("name", firstName + " " + lastName);
|
||||
xtw.WriteElementString("id", userID.ToString());
|
||||
xtw.WriteElementString("about", "");
|
||||
|
||||
|
||||
// Not sure if we're storing this yet, need to take a look
|
||||
// xtw.WriteElementString("Url", profile.Url);
|
||||
// or, indeed, interests
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
|
||||
xtw.Close();
|
||||
sw.Close();
|
||||
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Framework.Serialization")]
|
||||
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace OpenSim.Framework.Serialization
|
||||
lock (m_bw)
|
||||
{
|
||||
m_bw.Write(finalZeroPadding);
|
||||
|
||||
|
||||
m_bw.Flush();
|
||||
m_bw.Close();
|
||||
}
|
||||
@@ -149,7 +149,7 @@ namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[TAR ARCHIVE WRITER]: Data for {0} is {1} bytes", filePath, (null == data ? "null" : data.Length.ToString()));
|
||||
|
||||
|
||||
byte[] header = new byte[512];
|
||||
|
||||
// file path field (100)
|
||||
@@ -208,18 +208,18 @@ namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
// Write out header
|
||||
m_bw.Write(header);
|
||||
|
||||
|
||||
// Write out data
|
||||
// An IOException occurs if we try to write out an empty array in Mono 2.6
|
||||
if (data.Length > 0)
|
||||
m_bw.Write(data);
|
||||
|
||||
|
||||
if (data.Length % 512 != 0)
|
||||
{
|
||||
int paddingRequired = 512 - (data.Length % 512);
|
||||
|
||||
|
||||
//m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired);
|
||||
|
||||
|
||||
byte[] padding = new byte[paddingRequired];
|
||||
m_bw.Write(padding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user