From: Alan Webb <alan_webb@us.ibm.com>

Cleanup tabs and spacing.
0.6.5-rc1
Dr Scofield 2009-04-23 14:38:55 +00:00
parent 4b7a208559
commit 07b435b2b9
2 changed files with 70 additions and 70 deletions

View File

@ -443,49 +443,49 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
StringReader sr; StringReader sr;
XmlTextReader reader; XmlTextReader reader;
XmlNodeList parts; XmlNodeList parts;
XmlDocument doc; XmlDocument doc;
int linkNum; int linkNum;
doc = new XmlDocument(); doc = new XmlDocument();
doc.LoadXml(xmlData); doc.LoadXml(xmlData);
parts = doc.GetElementsByTagName("RootPart"); parts = doc.GetElementsByTagName("RootPart");
if(parts.Count == 0) if (parts.Count == 0)
{ {
throw new Exception("[SCENE] Invalid Xml format - no root part"); throw new Exception("[SCENE] Invalid Xml format - no root part");
} }
else else
{ {
sr = new StringReader(parts[0].InnerXml); sr = new StringReader(parts[0].InnerXml);
reader = new XmlTextReader(sr); reader = new XmlTextReader(sr);
SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
parts = doc.GetElementsByTagName("Part"); parts = doc.GetElementsByTagName("Part");
for (int i=0; i<parts.Count ; i++) for (int i=0; i<parts.Count ; i++)
{ {
sr = new StringReader(parts[i].InnerXml); sr = new StringReader(parts[i].InnerXml);
reader = new XmlTextReader(sr); reader = new XmlTextReader(sr);
SceneObjectPart part = SceneObjectPart.FromXml(reader); SceneObjectPart part = SceneObjectPart.FromXml(reader);
linkNum = part.LinkNum; linkNum = part.LinkNum;
AddPart(part); AddPart(part);
part.LinkNum = linkNum; part.LinkNum = linkNum;
part.TrimPermissions(); part.TrimPermissions();
part.StoreUndoState(); part.StoreUndoState();
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
// Script state may, or may not, exist. Not having any, is NOT // Script state may, or may not, exist. Not having any, is NOT
// ever a problem. // ever a problem.
LoadScriptState(doc); LoadScriptState(doc);
} }
catch (Exception e) catch (Exception e)
@ -521,37 +521,37 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlData); doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
// Process the root part first // Process the root part first
if(parts.Count > 0) if (parts.Count > 0)
{ {
StringReader sr = new StringReader(parts[0].OuterXml); StringReader sr = new StringReader(parts[0].OuterXml);
XmlTextReader reader = new XmlTextReader(sr); XmlTextReader reader = new XmlTextReader(sr);
SetRootPart(CreatePartFromXml(reader)); SetRootPart(CreatePartFromXml(reader));
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
// Then deal with the rest // Then deal with the rest
for(int i=1; i<parts.Count; i++) for (int i=1; i<parts.Count; i++)
{ {
StringReader sr = new StringReader(parts[i].OuterXml); StringReader sr = new StringReader(parts[i].OuterXml);
XmlTextReader reader = new XmlTextReader(sr); XmlTextReader reader = new XmlTextReader(sr);
SceneObjectPart part = CreatePartFromXml(reader); SceneObjectPart part = CreatePartFromXml(reader);
AddPart(part); AddPart(part);
part.StoreUndoState(); part.StoreUndoState();
reader.Close(); reader.Close();
sr.Close(); sr.Close();
} }
// Script state may, or may not, exist. Not having any, is NOT // Script state may, or may not, exist. Not having any, is NOT
// ever a problem. // ever a problem.
LoadScriptState(doc); LoadScriptState(doc);
} }
catch (Exception e) catch (Exception e)
@ -587,18 +587,18 @@ namespace OpenSim.Region.Framework.Scenes
private void LoadScriptState(XmlDocument doc) private void LoadScriptState(XmlDocument doc)
{ {
XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState");
if(nodes.Count > 0) if (nodes.Count > 0)
{ {
m_savedScriptState = new Dictionary<UUID, string>(); m_savedScriptState = new Dictionary<UUID, string>();
foreach(XmlNode node in nodes) foreach (XmlNode node in nodes)
{ {
if(node.Attributes["UUID"] != null) if (node.Attributes["UUID"] != null)
{ {
UUID itemid = new UUID(node.Attributes["UUID"].Value); UUID itemid = new UUID(node.Attributes["UUID"].Value);
m_savedScriptState.Add(itemid, node.InnerXml); m_savedScriptState.Add(itemid, node.InnerXml);
} }
} }
} }
} }
@ -851,19 +851,19 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
if(states.Count > 0) if (states.Count > 0)
{ {
// Now generate the necessary XML wrappings // Now generate the necessary XML wrappings
writer.WriteStartElement(String.Empty, "GroupScriptStates", String.Empty); writer.WriteStartElement(String.Empty, "GroupScriptStates", String.Empty);
foreach(UUID itemid in states.Keys) foreach (UUID itemid in states.Keys)
{ {
doc.LoadXml(states[itemid]); doc.LoadXml(states[itemid]);
writer.WriteStartElement(String.Empty, "SavedScriptState", String.Empty); writer.WriteStartElement(String.Empty, "SavedScriptState", String.Empty);
writer.WriteAttributeString(String.Empty, "UUID", String.Empty, itemid.ToString()); writer.WriteAttributeString(String.Empty, "UUID", String.Empty, itemid.ToString());
writer.WriteRaw(doc.DocumentElement.OuterXml); // Writes ScriptState element writer.WriteRaw(doc.DocumentElement.OuterXml); // Writes ScriptState element
writer.WriteEndElement(); // End of SavedScriptState writer.WriteEndElement(); // End of SavedScriptState
} }
writer.WriteEndElement(); // End of GroupScriptStates writer.WriteEndElement(); // End of GroupScriptStates
} }
} }

View File

@ -265,7 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if(m_part.ParentGroup.m_savedScriptState != null) if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID); RestoreSavedScriptState(item.OldItemID, item.ItemID);
m_items[item.ItemID].PermsMask = 0; m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero; m_items[item.ItemID].PermsGranter = UUID.Zero;
@ -283,7 +283,7 @@ namespace OpenSim.Region.Framework.Scenes
private void RestoreSavedScriptState(UUID oldID, UUID newID) private void RestoreSavedScriptState(UUID oldID, UUID newID)
{ {
if(m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
{ {
string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(), string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(),
newID.ToString()+".state"); newID.ToString()+".state");