Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
commit
377bc27c1f
|
@ -32,7 +32,6 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public delegate void ExpectUserDelegate(AgentCircuitData agent);
|
public delegate void ExpectUserDelegate(AgentCircuitData agent);
|
||||||
|
|
||||||
public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod);
|
|
||||||
|
|
||||||
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
|
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@ namespace OpenSim.Framework
|
||||||
public interface IRegionCommsListener
|
public interface IRegionCommsListener
|
||||||
{
|
{
|
||||||
event ExpectUserDelegate OnExpectUser;
|
event ExpectUserDelegate OnExpectUser;
|
||||||
event ExpectPrimDelegate OnExpectPrim;
|
|
||||||
event GenericCall2 OnExpectChildAgent;
|
event GenericCall2 OnExpectChildAgent;
|
||||||
event AgentCrossing OnAvatarCrossingIntoRegion;
|
event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
event PrimCrossing OnPrimCrossingIntoRegion;
|
event PrimCrossing OnPrimCrossingIntoRegion;
|
||||||
|
|
|
@ -38,6 +38,6 @@ namespace OpenSim.Framework
|
||||||
string ExtraToXmlString();
|
string ExtraToXmlString();
|
||||||
void ExtraFromXmlString(string xmlstr);
|
void ExtraFromXmlString(string xmlstr);
|
||||||
string GetStateSnapshot();
|
string GetStateSnapshot();
|
||||||
void SetState(string xmlstr, UUID regionID);
|
void SetState(string xmlstr, IScene s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ namespace OpenSim.Framework
|
||||||
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
|
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
|
||||||
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
||||||
private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent;
|
private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent;
|
||||||
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
|
|
||||||
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
|
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
|
||||||
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
|
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
|
||||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||||
|
@ -53,7 +52,6 @@ namespace OpenSim.Framework
|
||||||
#region IRegionCommsListener Members
|
#region IRegionCommsListener Members
|
||||||
|
|
||||||
public event ExpectUserDelegate OnExpectUser;
|
public event ExpectUserDelegate OnExpectUser;
|
||||||
public event ExpectPrimDelegate OnExpectPrim;
|
|
||||||
public event GenericCall2 OnExpectChildAgent;
|
public event GenericCall2 OnExpectChildAgent;
|
||||||
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
public event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
public event PrimCrossing OnPrimCrossingIntoRegion;
|
public event PrimCrossing OnPrimCrossingIntoRegion;
|
||||||
|
@ -95,17 +93,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod)
|
|
||||||
{
|
|
||||||
handlerExpectPrim = OnExpectPrim;
|
|
||||||
if (handlerExpectPrim != null)
|
|
||||||
{
|
|
||||||
handlerExpectPrim(primID, objData, XMLMethod);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
|
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
|
||||||
{
|
{
|
||||||
handlerChildAgentUpdate = OnChildAgentUpdate;
|
handlerChildAgentUpdate = OnChildAgentUpdate;
|
||||||
|
@ -128,18 +115,6 @@ namespace OpenSim.Framework
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position,
|
|
||||||
bool isPhysical)
|
|
||||||
{
|
|
||||||
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
|
|
||||||
if (handlerPrimCrossingIntoRegion != null)
|
|
||||||
{
|
|
||||||
handlerPrimCrossingIntoRegion(primID, position, isPhysical);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID)
|
public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID)
|
||||||
{
|
{
|
||||||
handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed;
|
handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed;
|
||||||
|
|
|
@ -263,8 +263,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
{
|
{
|
||||||
// We need to make a local copy of the object
|
// We need to make a local copy of the object
|
||||||
ISceneObject sogClone = sog.CloneForNewScene();
|
ISceneObject sogClone = sog.CloneForNewScene();
|
||||||
sogClone.SetState(sog.GetStateSnapshot(),
|
sogClone.SetState(sog.GetStateSnapshot(), s);
|
||||||
s.RegionInfo.RegionID);
|
|
||||||
return s.IncomingCreateObject(sogClone);
|
return s.IncomingCreateObject(sogClone);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -294,15 +293,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
|
|
||||||
#region Misc
|
#region Misc
|
||||||
|
|
||||||
public UUID GetRegionID(ulong regionhandle)
|
public Scene GetScene(ulong regionhandle)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_sceneList)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionhandle)
|
if (s.RegionInfo.RegionHandle == regionhandle)
|
||||||
return s.RegionInfo.RegionID;
|
return s;
|
||||||
}
|
}
|
||||||
// ? weird. should not happen
|
// ? weird. should not happen
|
||||||
return m_sceneList[0].RegionInfo.RegionID;
|
return m_sceneList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLocalRegion(ulong regionhandle)
|
public bool IsLocalRegion(ulong regionhandle)
|
||||||
|
|
|
@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
if (args["extra"] != null)
|
if (args["extra"] != null)
|
||||||
extraStr = args["extra"].AsString();
|
extraStr = args["extra"].AsString();
|
||||||
|
|
||||||
UUID regionID = m_localBackend.GetRegionID(regionhandle);
|
IScene s = m_localBackend.GetScene(regionhandle);
|
||||||
SceneObjectGroup sog = null;
|
SceneObjectGroup sog = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -663,7 +663,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sog.SetState(stateXmlStr, regionID);
|
sog.SetState(stateXmlStr, s);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -695,8 +695,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
if (args["itemid"] != null)
|
if (args["itemid"] != null)
|
||||||
itemID = args["itemid"].AsUUID();
|
itemID = args["itemid"].AsUUID();
|
||||||
|
|
||||||
//UUID regionID = m_localBackend.GetRegionID(regionhandle);
|
|
||||||
|
|
||||||
// This is the meaning of PUT object
|
// This is the meaning of PUT object
|
||||||
bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
|
bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
|
||||||
|
|
||||||
|
|
|
@ -184,12 +184,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<UUID> GetInventoryList();
|
List<UUID> GetInventoryList();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the names of the assemblies associated with scripts in this inventory.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
string[] GetScriptAssemblies();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the xml representing the saved states of scripts in this inventory.
|
/// Get the xml representing the saved states of scripts in this inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -197,7 +191,5 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// A <see cref="Dictionary`2"/>
|
/// A <see cref="Dictionary`2"/>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Dictionary<UUID, string> GetScriptStates();
|
Dictionary<UUID, string> GetScriptStates();
|
||||||
|
|
||||||
bool CanBeDeleted();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
string ScriptEngineName { get; }
|
string ScriptEngineName { get; }
|
||||||
|
|
||||||
string GetAssemblyName(UUID itemID);
|
|
||||||
string GetXMLState(UUID itemID);
|
string GetXMLState(UUID itemID);
|
||||||
bool CanBeDeleted(UUID itemID);
|
void SetXMLState(UUID itemID, string xml);
|
||||||
|
|
||||||
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
||||||
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
||||||
|
|
|
@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (left > 0)
|
if (left > 0)
|
||||||
{
|
{
|
||||||
x = m_inventoryDeletes.Dequeue();
|
x = m_inventoryDeletes.Dequeue();
|
||||||
if (!x.objectGroup.CanBeDeleted())
|
|
||||||
{
|
|
||||||
m_inventoryDeletes.Enqueue(x);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
|
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
|
||||||
|
|
|
@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
||||||
m_persistAfter *= 10000000;
|
m_persistAfter *= 10000000;
|
||||||
|
|
||||||
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
|
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
||||||
|
|
||||||
IConfig packetConfig = m_config.Configs["PacketPool"];
|
IConfig packetConfig = m_config.Configs["PacketPool"];
|
||||||
if (packetConfig != null)
|
if (packetConfig != null)
|
||||||
|
@ -2381,103 +2381,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return successYN;
|
return successYN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handle a scene object that is crossing into this region from another.
|
|
||||||
/// NOTE: Unused as of 2009-02-09. Soon to be deleted.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="regionHandle"></param>
|
|
||||||
/// <param name="primID"></param>
|
|
||||||
/// <param name="objXMLData"></param>
|
|
||||||
/// <param name="XMLMethod"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
|
|
||||||
{
|
|
||||||
if (XMLMethod == 0)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
|
|
||||||
SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
|
|
||||||
if (sceneObject.IsAttachment)
|
|
||||||
sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
|
|
||||||
|
|
||||||
return AddSceneObject(sceneObject);
|
|
||||||
}
|
|
||||||
else if ((XMLMethod == 100) && m_allowScriptCrossings)
|
|
||||||
{
|
|
||||||
m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor");
|
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
|
||||||
doc.LoadXml(objXMLData);
|
|
||||||
|
|
||||||
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
|
|
||||||
if (rootL.Count == 1)
|
|
||||||
{
|
|
||||||
XmlNode rootNode = rootL[0];
|
|
||||||
if (rootNode != null)
|
|
||||||
{
|
|
||||||
XmlNodeList partL = rootNode.ChildNodes;
|
|
||||||
|
|
||||||
foreach (XmlNode part in partL)
|
|
||||||
{
|
|
||||||
XmlNodeList nodeL = part.ChildNodes;
|
|
||||||
|
|
||||||
switch (part.Name)
|
|
||||||
{
|
|
||||||
case "Assemblies":
|
|
||||||
foreach (XmlNode asm in nodeL)
|
|
||||||
{
|
|
||||||
string fn = asm.Attributes.GetNamedItem("Filename").Value;
|
|
||||||
|
|
||||||
Byte[] filedata = Convert.FromBase64String(asm.InnerText);
|
|
||||||
string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
|
|
||||||
path = Path.Combine(path, fn);
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
{
|
|
||||||
FileStream fs = File.Create(path);
|
|
||||||
fs.Write(filedata, 0, filedata.Length);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "ScriptStates":
|
|
||||||
foreach (XmlNode st in nodeL)
|
|
||||||
{
|
|
||||||
string id = st.Attributes.GetNamedItem("UUID").Value;
|
|
||||||
UUID uuid = new UUID(id);
|
|
||||||
XmlNode state = st.ChildNodes[0];
|
|
||||||
|
|
||||||
XmlDocument sdoc = new XmlDocument();
|
|
||||||
XmlNode sxmlnode = sdoc.CreateNode(
|
|
||||||
XmlNodeType.XmlDeclaration,
|
|
||||||
"", "");
|
|
||||||
sdoc.AppendChild(sxmlnode);
|
|
||||||
|
|
||||||
XmlNode newnode = sdoc.ImportNode(state, true);
|
|
||||||
sdoc.AppendChild(newnode);
|
|
||||||
|
|
||||||
string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
|
|
||||||
spath = Path.Combine(spath, uuid.ToString());
|
|
||||||
FileStream sfs = File.Create(spath + ".state");
|
|
||||||
ASCIIEncoding enc = new ASCIIEncoding();
|
|
||||||
Byte[] buf = enc.GetBytes(sdoc.InnerXml);
|
|
||||||
sfs.Write(buf, 0, buf.Length);
|
|
||||||
sfs.Close();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
|
|
||||||
RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IncomingCreateObject(ISceneObject sog)
|
public bool IncomingCreateObject(ISceneObject sog)
|
||||||
{
|
{
|
||||||
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
||||||
|
@ -3350,7 +3253,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
|
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
|
||||||
//m_eventManager.OnRegionUp += OtherRegionUp;
|
//m_eventManager.OnRegionUp += OtherRegionUp;
|
||||||
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||||
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
|
|
||||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
||||||
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
|
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
|
||||||
m_sceneGridService.KiPrimitive += SendKillObject;
|
m_sceneGridService.KiPrimitive += SendKillObject;
|
||||||
|
@ -3374,7 +3276,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_sceneGridService.KiPrimitive -= SendKillObject;
|
m_sceneGridService.KiPrimitive -= SendKillObject;
|
||||||
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
|
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
|
||||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
||||||
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
|
|
||||||
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||||
//m_eventManager.OnRegionUp -= OtherRegionUp;
|
//m_eventManager.OnRegionUp -= OtherRegionUp;
|
||||||
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
|
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
|
||||||
|
|
|
@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Prim will arrive shortly
|
/// A Prim will arrive shortly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ExpectPrimDelegate OnExpectPrim;
|
|
||||||
public event CloseAgentConnection OnCloseAgentConnection;
|
public event CloseAgentConnection OnCloseAgentConnection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
|
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
|
||||||
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
|
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
|
||||||
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
|
|
||||||
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
||||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||||
//private RegionUp handlerRegionUp = null; // OnRegionUp;
|
//private RegionUp handlerRegionUp = null; // OnRegionUp;
|
||||||
|
@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
|
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
|
||||||
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
|
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
|
||||||
{
|
{
|
||||||
//m_interregionCommsOut = comms_out;
|
|
||||||
|
|
||||||
//m_regionInfo = regionInfos;
|
|
||||||
//m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
|
|
||||||
//regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
|
|
||||||
|
|
||||||
//if (regionCommsHost != null)
|
|
||||||
//{
|
|
||||||
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
|
|
||||||
|
|
||||||
// regionCommsHost.debugRegionName = regionInfos.RegionName;
|
|
||||||
// regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
|
|
||||||
// regionCommsHost.OnExpectUser += NewUserConnection;
|
|
||||||
// regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
|
|
||||||
// regionCommsHost.OnCloseAgentConnection += CloseConnection;
|
|
||||||
// regionCommsHost.OnRegionUp += newRegionUp;
|
|
||||||
// regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
|
|
||||||
// regionCommsHost.OnLogOffUser += GridLogOffUser;
|
|
||||||
// regionCommsHost.OnGetLandData += FetchLandData;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
|
||||||
//if (regionCommsHost != null)
|
|
||||||
//{
|
|
||||||
// regionCommsHost.OnLogOffUser -= GridLogOffUser;
|
|
||||||
// regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
|
|
||||||
// regionCommsHost.OnRegionUp -= newRegionUp;
|
|
||||||
// regionCommsHost.OnExpectUser -= NewUserConnection;
|
|
||||||
// regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
|
|
||||||
// regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
|
||||||
// regionCommsHost.OnCloseAgentConnection -= CloseConnection;
|
|
||||||
// regionCommsHost.OnGetLandData -= FetchLandData;
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// m_log.ErrorFormat(
|
|
||||||
// "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
|
|
||||||
// m_regionInfo.RegionName, e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// regionCommsHost = null;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region CommsManager Event handlers
|
#region CommsManager Event handlers
|
||||||
|
@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// We have a new prim from a neighbor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="primID">unique ID for the primative</param>
|
|
||||||
/// <param name="objXMLData">XML2 encoded data of the primative</param>
|
|
||||||
/// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param>
|
|
||||||
/// <returns>True if the prim was accepted, false if it was not</returns>
|
|
||||||
protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
|
|
||||||
{
|
|
||||||
handlerExpectPrim = OnExpectPrim;
|
|
||||||
if (handlerExpectPrim != null)
|
|
||||||
{
|
|
||||||
return handlerExpectPrim(primID, objXMLData, XMLMethod);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
|
protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
|
||||||
{
|
{
|
||||||
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
|
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
|
||||||
|
|
|
@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public string GetStateSnapshot()
|
public string GetStateSnapshot()
|
||||||
{
|
{
|
||||||
//m_log.Debug(" >>> GetStateSnapshot <<<");
|
|
||||||
|
|
||||||
List<string> assemblies = new List<string>();
|
|
||||||
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
|
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
|
||||||
|
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
foreach (string a in part.Inventory.GetScriptAssemblies())
|
|
||||||
{
|
|
||||||
if (a != "" && !assemblies.Contains(a))
|
|
||||||
assemblies.Add(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
|
foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
|
||||||
{
|
|
||||||
states[s.Key] = s.Value;
|
states[s.Key] = s.Value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (states.Count < 1 || assemblies.Count < 1)
|
if (states.Count < 1)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
|
@ -342,104 +331,49 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
xmldoc.AppendChild(rootElement);
|
xmldoc.AppendChild(rootElement);
|
||||||
|
|
||||||
XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
|
|
||||||
"");
|
|
||||||
|
|
||||||
rootElement.AppendChild(wrapper);
|
XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
|
||||||
|
|
||||||
foreach (string assembly in assemblies)
|
|
||||||
{
|
|
||||||
string fn = Path.GetFileName(assembly);
|
|
||||||
if (fn == String.Empty)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
String filedata = String.Empty;
|
|
||||||
|
|
||||||
if (File.Exists(assembly+".text"))
|
|
||||||
{
|
|
||||||
FileInfo tfi = new FileInfo(assembly+".text");
|
|
||||||
|
|
||||||
if (tfi == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Byte[] tdata = new Byte[tfi.Length];
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
|
|
||||||
tfs.Read(tdata, 0, tdata.Length);
|
|
||||||
tfs.Close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
filedata = new System.Text.ASCIIEncoding().GetString(tdata);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileInfo fi = new FileInfo(assembly);
|
|
||||||
|
|
||||||
if (fi == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Byte[] data = new Byte[fi.Length];
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
|
|
||||||
fs.Read(data, 0, data.Length);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
filedata = System.Convert.ToBase64String(data);
|
|
||||||
}
|
|
||||||
XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
|
|
||||||
XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
|
|
||||||
assemblyName.Value = fn;
|
|
||||||
assemblyData.Attributes.Append(assemblyName);
|
|
||||||
|
|
||||||
assemblyData.InnerText = filedata;
|
|
||||||
|
|
||||||
wrapper.AppendChild(assemblyData);
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper = xmldoc.CreateElement("", "ScriptStates",
|
|
||||||
"");
|
"");
|
||||||
|
|
||||||
rootElement.AppendChild(wrapper);
|
rootElement.AppendChild(wrapper);
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, string> state in states)
|
foreach (KeyValuePair<UUID, string> state in states)
|
||||||
{
|
{
|
||||||
XmlElement stateData = xmldoc.CreateElement("", "State", "");
|
|
||||||
|
|
||||||
XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
|
|
||||||
stateID.Value = state.Key.ToString();
|
|
||||||
stateData.Attributes.Append(stateID);
|
|
||||||
|
|
||||||
XmlDocument sdoc = new XmlDocument();
|
XmlDocument sdoc = new XmlDocument();
|
||||||
sdoc.LoadXml(state.Value);
|
sdoc.LoadXml(state.Value);
|
||||||
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
|
XmlNodeList rootL = sdoc.GetElementsByTagName("State");
|
||||||
XmlNode rootNode = rootL[0];
|
XmlNode rootNode = rootL[0];
|
||||||
|
|
||||||
XmlNode newNode = xmldoc.ImportNode(rootNode, true);
|
XmlNode newNode = xmldoc.ImportNode(rootNode, true);
|
||||||
stateData.AppendChild(newNode);
|
wrapper.AppendChild(newNode);
|
||||||
wrapper.AppendChild(stateData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return xmldoc.InnerXml;
|
return xmldoc.InnerXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState(string objXMLData, UUID RegionID)
|
public void SetState(string objXMLData, IScene ins)
|
||||||
{
|
{
|
||||||
|
if (!(ins is Scene))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Scene s = (Scene)ins;
|
||||||
|
|
||||||
if (objXMLData == String.Empty)
|
if (objXMLData == String.Empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
IScriptModule scriptModule = null;
|
||||||
|
|
||||||
|
foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
|
||||||
|
{
|
||||||
|
if (sm.ScriptEngineName == s.DefaultScriptEngine)
|
||||||
|
scriptModule = sm;
|
||||||
|
else if (scriptModule == null)
|
||||||
|
scriptModule = sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scriptModule == null)
|
||||||
|
return;
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -457,69 +391,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
|
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
|
||||||
if (rootL.Count == 1)
|
if (rootL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement rootE = (XmlElement)rootL[0];
|
||||||
|
|
||||||
|
XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
|
||||||
|
if (dataL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement dataE = (XmlElement)dataL[0];
|
||||||
|
|
||||||
|
foreach (XmlNode n in dataE.ChildNodes)
|
||||||
{
|
{
|
||||||
XmlNode rootNode = rootL[0];
|
XmlElement stateE = (XmlElement)n;
|
||||||
if (rootNode != null)
|
UUID itemID = new UUID(stateE.GetAttribute("UUID"));
|
||||||
{
|
|
||||||
XmlNodeList partL = rootNode.ChildNodes;
|
|
||||||
|
|
||||||
foreach (XmlNode part in partL)
|
scriptModule.SetXMLState(itemID, n.OuterXml);
|
||||||
{
|
|
||||||
XmlNodeList nodeL = part.ChildNodes;
|
|
||||||
|
|
||||||
switch (part.Name)
|
|
||||||
{
|
|
||||||
case "Assemblies":
|
|
||||||
foreach (XmlNode asm in nodeL)
|
|
||||||
{
|
|
||||||
string fn = asm.Attributes.GetNamedItem("Filename").Value;
|
|
||||||
|
|
||||||
Byte[] filedata = Convert.FromBase64String(asm.InnerText);
|
|
||||||
string path = Path.Combine("ScriptEngines", RegionID.ToString());
|
|
||||||
path = Path.Combine(path, fn);
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
{
|
|
||||||
FileStream fs = File.Create(path);
|
|
||||||
fs.Write(filedata, 0, filedata.Length);
|
|
||||||
fs.Close();
|
|
||||||
|
|
||||||
Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
|
|
||||||
fs = File.Create(path+".text");
|
|
||||||
fs.Write(textbytes, 0, textbytes.Length);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "ScriptStates":
|
|
||||||
foreach (XmlNode st in nodeL)
|
|
||||||
{
|
|
||||||
string id = st.Attributes.GetNamedItem("UUID").Value;
|
|
||||||
UUID uuid = new UUID(id);
|
|
||||||
XmlNode state = st.ChildNodes[0];
|
|
||||||
|
|
||||||
XmlDocument sdoc = new XmlDocument();
|
|
||||||
XmlNode sxmlnode = sdoc.CreateNode(
|
|
||||||
XmlNodeType.XmlDeclaration,
|
|
||||||
"", "");
|
|
||||||
sdoc.AppendChild(sxmlnode);
|
|
||||||
|
|
||||||
XmlNode newnode = sdoc.ImportNode(state, true);
|
|
||||||
sdoc.AppendChild(newnode);
|
|
||||||
|
|
||||||
string spath = Path.Combine("ScriptEngines", RegionID.ToString());
|
|
||||||
spath = Path.Combine(spath, uuid.ToString());
|
|
||||||
FileStream sfs = File.Create(spath + ".state");
|
|
||||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
|
||||||
Byte[] buf = enc.GetBytes(sdoc.InnerXml);
|
|
||||||
sfs.Write(buf, 0, buf.Length);
|
|
||||||
sfs.Close();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3341,17 +3341,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
foreach (SceneObjectPart part in Children.Values)
|
|
||||||
{
|
|
||||||
if (!part.CanBeDeleted())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetUpdatePriority(IClientAPI client)
|
public double GetUpdatePriority(IClientAPI client)
|
||||||
{
|
{
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
switch (Scene.UpdatePrioritizationScheme)
|
||||||
|
|
|
@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Inventory.ApplyNextOwnerPermissions();
|
Inventory.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
return Inventory.CanBeDeleted();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -857,36 +857,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] GetScriptAssemblies()
|
|
||||||
{
|
|
||||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
|
||||||
|
|
||||||
List<string> ret = new List<string>();
|
|
||||||
if (engines == null) // No engine at all
|
|
||||||
return new string[0];
|
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
|
||||||
{
|
|
||||||
foreach (IScriptModule e in engines)
|
|
||||||
{
|
|
||||||
if (e != null)
|
|
||||||
{
|
|
||||||
string n = e.GetAssemblyName(item.ItemID);
|
|
||||||
if (n != String.Empty)
|
|
||||||
{
|
|
||||||
if (!ret.Contains(n))
|
|
||||||
ret.Add(n);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<UUID, string> GetScriptStates()
|
public Dictionary<UUID, string> GetScriptStates()
|
||||||
{
|
{
|
||||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
@ -916,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
if (!ContainsScripts())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
|
||||||
|
|
||||||
if (engines == null) // No engine at all
|
|
||||||
return true;
|
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
|
||||||
{
|
|
||||||
foreach (IScriptModule e in engines)
|
|
||||||
{
|
|
||||||
if (!e.CanBeDeleted(item.ItemID))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
UUID GetDetectID(int idx);
|
UUID GetDetectID(int idx);
|
||||||
void SaveState(string assembly);
|
void SaveState(string assembly);
|
||||||
void DestroyScriptInstance();
|
void DestroyScriptInstance();
|
||||||
bool CanBeDeleted();
|
|
||||||
|
|
||||||
IScriptApi GetApi(string name);
|
IScriptApi GetApi(string name);
|
||||||
|
|
||||||
|
|
|
@ -1011,10 +1011,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
get { return m_RegionID; }
|
get { return m_RegionID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1245,34 +1245,219 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAssemblyName(UUID itemID)
|
|
||||||
{
|
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
|
||||||
if (instance == null)
|
|
||||||
return "";
|
|
||||||
return instance.GetAssemblyName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetXMLState(UUID itemID)
|
public string GetXMLState(UUID itemID)
|
||||||
{
|
{
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
IScriptInstance instance = GetInstance(itemID);
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
return "";
|
return "";
|
||||||
return instance.GetXMLState();
|
string xml = instance.GetXMLState();
|
||||||
|
|
||||||
|
XmlDocument sdoc = new XmlDocument();
|
||||||
|
sdoc.LoadXml(xml);
|
||||||
|
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
|
||||||
|
XmlNode rootNode = rootL[0];
|
||||||
|
|
||||||
|
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
XmlElement stateData = doc.CreateElement("", "State", "");
|
||||||
|
XmlAttribute stateID = doc.CreateAttribute("", "UUID", "");
|
||||||
|
stateID.Value = itemID.ToString();
|
||||||
|
stateData.Attributes.Append(stateID);
|
||||||
|
XmlAttribute assetID = doc.CreateAttribute("", "Asset", "");
|
||||||
|
assetID.Value = instance.AssetID.ToString();
|
||||||
|
stateData.Attributes.Append(assetID);
|
||||||
|
doc.AppendChild(stateData);
|
||||||
|
|
||||||
|
// Add <ScriptState>...</ScriptState>
|
||||||
|
XmlNode xmlstate = doc.ImportNode(rootNode, true);
|
||||||
|
stateData.AppendChild(xmlstate);
|
||||||
|
|
||||||
|
string assemName = instance.GetAssemblyName();
|
||||||
|
|
||||||
|
string fn = Path.GetFileName(assemName);
|
||||||
|
|
||||||
|
string assem = String.Empty;
|
||||||
|
|
||||||
|
if (File.Exists(assemName + ".text"))
|
||||||
|
{
|
||||||
|
FileInfo tfi = new FileInfo(assemName + ".text");
|
||||||
|
|
||||||
|
if (tfi != null)
|
||||||
|
{
|
||||||
|
Byte[] tdata = new Byte[tfi.Length];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileStream tfs = File.Open(assemName + ".text",
|
||||||
|
FileMode.Open, FileAccess.Read);
|
||||||
|
tfs.Read(tdata, 0, tdata.Length);
|
||||||
|
tfs.Close();
|
||||||
|
|
||||||
|
assem = new System.Text.ASCIIEncoding().GetString(tdata);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(assemName);
|
||||||
|
|
||||||
|
if (fi != null)
|
||||||
|
{
|
||||||
|
Byte[] data = new Byte[fi.Length];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read);
|
||||||
|
fs.Read(data, 0, data.Length);
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
assem = System.Convert.ToBase64String(data);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted(UUID itemID)
|
}
|
||||||
{
|
}
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
|
||||||
if (instance == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return instance.CanBeDeleted();
|
string map = String.Empty;
|
||||||
|
|
||||||
|
if (File.Exists(fn + ".map"))
|
||||||
|
{
|
||||||
|
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
|
||||||
|
StreamReader msr = new StreamReader(mfs);
|
||||||
|
|
||||||
|
map = msr.ReadToEnd();
|
||||||
|
|
||||||
|
msr.Close();
|
||||||
|
mfs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
|
||||||
|
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
|
||||||
|
|
||||||
|
assemblyName.Value = fn;
|
||||||
|
assemblyData.Attributes.Append(assemblyName);
|
||||||
|
|
||||||
|
assemblyData.InnerText = assem;
|
||||||
|
|
||||||
|
stateData.AppendChild(assemblyData);
|
||||||
|
|
||||||
|
XmlElement mapData = doc.CreateElement("", "LineMap", "");
|
||||||
|
XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
|
||||||
|
|
||||||
|
mapName.Value = fn + ".map";
|
||||||
|
mapData.Attributes.Append(mapName);
|
||||||
|
|
||||||
|
mapData.InnerText = map;
|
||||||
|
|
||||||
|
stateData.AppendChild(mapData);
|
||||||
|
return doc.InnerXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
|
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetXMLState(UUID itemID, string xml)
|
||||||
|
{
|
||||||
|
if (xml == String.Empty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
doc.LoadXml(xml);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlNodeList rootL = doc.GetElementsByTagName("State");
|
||||||
|
if (rootL.Count < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement rootE = (XmlElement)rootL[0];
|
||||||
|
|
||||||
|
if (rootE.GetAttribute("UUID") != itemID.ToString())
|
||||||
|
return;
|
||||||
|
|
||||||
|
string assetID = rootE.GetAttribute("Asset");
|
||||||
|
|
||||||
|
XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
|
||||||
|
|
||||||
|
if (stateL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement stateE = (XmlElement)stateL[0];
|
||||||
|
|
||||||
|
if (World.m_trustBinaries)
|
||||||
|
{
|
||||||
|
XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
|
||||||
|
|
||||||
|
if (assemL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement assemE = (XmlElement)assemL[0];
|
||||||
|
|
||||||
|
string fn = assemE.GetAttribute("Filename");
|
||||||
|
string base64 = assemE.InnerText;
|
||||||
|
|
||||||
|
string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
path = Path.Combine(path, fn);
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
Byte[] filedata = Convert.FromBase64String(base64);
|
||||||
|
|
||||||
|
FileStream fs = File.Create(path);
|
||||||
|
fs.Write(filedata, 0, filedata.Length);
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
fs = File.Create(path + ".text");
|
||||||
|
StreamWriter sw = new StreamWriter(fs);
|
||||||
|
|
||||||
|
sw.Write(base64);
|
||||||
|
|
||||||
|
sw.Close();
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
statepath = Path.Combine(statepath, itemID.ToString() + ".state");
|
||||||
|
|
||||||
|
FileStream sfs = File.Create(statepath);
|
||||||
|
StreamWriter ssw = new StreamWriter(sfs);
|
||||||
|
|
||||||
|
ssw.Write(stateE.OuterXml);
|
||||||
|
|
||||||
|
ssw.Close();
|
||||||
|
sfs.Close();
|
||||||
|
|
||||||
|
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
|
||||||
|
|
||||||
|
XmlElement mapE = (XmlElement)mapL[0];
|
||||||
|
|
||||||
|
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
|
||||||
|
|
||||||
|
FileStream mfs = File.Create(mappath);
|
||||||
|
StreamWriter msw = new StreamWriter(mfs);
|
||||||
|
|
||||||
|
msw.Write(mapE.InnerText);
|
||||||
|
|
||||||
|
msw.Close();
|
||||||
|
mfs.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue