mirror of
https://github.com/opensim/opensim.git
synced 2026-07-02 00:15:45 +08:00
Merge branch 'master' into careminster
This commit is contained in:
@@ -78,6 +78,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
private string m_ScriptErrorMessage;
|
||||
private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
|
||||
private bool m_AppDomainLoading;
|
||||
private Dictionary<UUID,ArrayList> m_ScriptErrors =
|
||||
new Dictionary<UUID,ArrayList>();
|
||||
|
||||
// disable warning: need to keep a reference to XEngine.EventManager
|
||||
// alive to avoid it being garbage collected
|
||||
@@ -657,87 +659,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
|
||||
if (!m_AddingAssemblies.ContainsKey(assembly)) {
|
||||
m_AddingAssemblies[assembly] = 1;
|
||||
} else {
|
||||
m_AddingAssemblies[assembly]++;
|
||||
}
|
||||
}
|
||||
|
||||
string[] warnings = m_Compiler.GetWarnings();
|
||||
|
||||
if (warnings != null && warnings.Length != 0)
|
||||
{
|
||||
foreach (string warning in warnings)
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY WARNING INWORLD
|
||||
string text = "Warning:\n" + warning;
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
assetID, text, true))
|
||||
{
|
||||
if (presence != null && (!postOnRez))
|
||||
presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
|
||||
|
||||
World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
}
|
||||
}
|
||||
catch (Exception e2) // LEGIT: User Scripting
|
||||
{
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Error displaying warning in-world: " +
|
||||
e2.ToString());
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Warning:\r\n" +
|
||||
warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
lock(m_ScriptErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
|
||||
|
||||
m_ScriptFailCount++;
|
||||
string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
assetID, text, false))
|
||||
lock (m_AddingAssemblies)
|
||||
{
|
||||
if (presence != null && (!postOnRez))
|
||||
presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
|
||||
World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
|
||||
if (!m_AddingAssemblies.ContainsKey(assembly)) {
|
||||
m_AddingAssemblies[assembly] = 1;
|
||||
} else {
|
||||
m_AddingAssemblies[assembly]++;
|
||||
}
|
||||
}
|
||||
|
||||
string[] warnings = m_Compiler.GetWarnings();
|
||||
|
||||
if (warnings != null && warnings.Length != 0)
|
||||
{
|
||||
foreach (string warning in warnings)
|
||||
{
|
||||
if (!m_ScriptErrors.ContainsKey(itemID))
|
||||
m_ScriptErrors[itemID] = new ArrayList();
|
||||
|
||||
m_ScriptErrors[itemID].Add(warning);
|
||||
// try
|
||||
// {
|
||||
// // DISPLAY WARNING INWORLD
|
||||
// string text = "Warning:\n" + warning;
|
||||
// if (text.Length > 1000)
|
||||
// text = text.Substring(0, 1000);
|
||||
// if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
// assetID, text, true))
|
||||
// {
|
||||
// if (presence != null && (!postOnRez))
|
||||
// presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
|
||||
//
|
||||
// World.SimChat(Utils.StringToBytes(text),
|
||||
// ChatTypeEnum.DebugChannel, 2147483647,
|
||||
// part.AbsolutePosition,
|
||||
// part.Name, part.UUID, false);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Error displaying warning in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Warning:\r\n" +
|
||||
// warning);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e2) // LEGIT: User Scripting
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[XEngine]: "+
|
||||
"Error displaying error in-world: " +
|
||||
e2.ToString());
|
||||
m_log.Error("[XEngine]: " +
|
||||
"Errormessage: Error compiling script:\r\n" +
|
||||
e.Message.ToString());
|
||||
}
|
||||
// try
|
||||
// {
|
||||
if (!m_ScriptErrors.ContainsKey(itemID))
|
||||
m_ScriptErrors[itemID] = new ArrayList();
|
||||
// DISPLAY ERROR INWORLD
|
||||
// m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
|
||||
//
|
||||
m_ScriptFailCount++;
|
||||
m_ScriptErrors[itemID].Add(e.Message.ToString());
|
||||
// string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
|
||||
// if (text.Length > 1000)
|
||||
// text = text.Substring(0, 1000);
|
||||
// if (!ShowScriptSaveResponse(item.OwnerID,
|
||||
// assetID, text, false))
|
||||
// {
|
||||
// if (presence != null && (!postOnRez))
|
||||
// presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
|
||||
// World.SimChat(Utils.StringToBytes(text),
|
||||
// ChatTypeEnum.DebugChannel, 2147483647,
|
||||
// part.AbsolutePosition,
|
||||
// part.Name, part.UUID, false);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[XEngine]: "+
|
||||
// "Error displaying error in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[XEngine]: " +
|
||||
// "Errormessage: Error compiling script:\r\n" +
|
||||
// e.Message.ToString());
|
||||
// }
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1555,7 +1567,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
public ArrayList GetScriptErrors(UUID itemID)
|
||||
{
|
||||
return new ArrayList();
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
lock (m_ScriptErrors)
|
||||
{
|
||||
if (m_ScriptErrors.ContainsKey(itemID))
|
||||
{
|
||||
ArrayList ret = m_ScriptErrors[itemID];
|
||||
m_ScriptErrors.Remove(itemID);
|
||||
return ret;
|
||||
}
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user