aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs86
1 files changed, 43 insertions, 43 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 8ad8110..485531d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -34,7 +34,7 @@ using System.Security.Policy;
34using System.Reflection; 34using System.Reflection;
35using System.Globalization; 35using System.Globalization;
36using System.Xml; 36using System.Xml;
37using libsecondlife; 37using OpenMetaverse;
38using log4net; 38using log4net;
39using Nini.Config; 39using Nini.Config;
40using Amib.Threading; 40using Amib.Threading;
@@ -76,28 +76,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
76 76
77 // Maps the local id to the script inventory items in it 77 // Maps the local id to the script inventory items in it
78 78
79 private Dictionary<uint, List<LLUUID> > m_PrimObjects = 79 private Dictionary<uint, List<UUID> > m_PrimObjects =
80 new Dictionary<uint, List<LLUUID> >(); 80 new Dictionary<uint, List<UUID> >();
81 81
82 // Maps the LLUUID above to the script instance 82 // Maps the UUID above to the script instance
83 83
84 private Dictionary<LLUUID, IScriptInstance> m_Scripts = 84 private Dictionary<UUID, IScriptInstance> m_Scripts =
85 new Dictionary<LLUUID, IScriptInstance>(); 85 new Dictionary<UUID, IScriptInstance>();
86 86
87 // Maps the asset ID to the assembly 87 // Maps the asset ID to the assembly
88 88
89 private Dictionary<LLUUID, string> m_Assemblies = 89 private Dictionary<UUID, string> m_Assemblies =
90 new Dictionary<LLUUID, string>(); 90 new Dictionary<UUID, string>();
91 91
92 // This will list AppDomains by script asset 92 // This will list AppDomains by script asset
93 93
94 private Dictionary<LLUUID, AppDomain> m_AppDomains = 94 private Dictionary<UUID, AppDomain> m_AppDomains =
95 new Dictionary<LLUUID, AppDomain>(); 95 new Dictionary<UUID, AppDomain>();
96 96
97 // List the scripts running in each appdomain 97 // List the scripts running in each appdomain
98 98
99 private Dictionary<LLUUID, List<LLUUID> > m_DomainScripts = 99 private Dictionary<UUID, List<UUID> > m_DomainScripts =
100 new Dictionary<LLUUID, List<LLUUID> >(); 100 new Dictionary<UUID, List<UUID> >();
101 101
102 private Queue m_CompileQueue = new Queue(100); 102 private Queue m_CompileQueue = new Queue(100);
103 IWorkItemResult m_CurrentCompile = null; 103 IWorkItemResult m_CurrentCompile = null;
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
125 // private struct RezScriptParms 125 // private struct RezScriptParms
126 // { 126 // {
127 // uint LocalID; 127 // uint LocalID;
128 // LLUUID ItemID; 128 // UUID ItemID;
129 // string Script; 129 // string Script;
130 // } 130 // }
131 131
@@ -314,7 +314,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
314 get { return false; } 314 get { return false; }
315 } 315 }
316 316
317 public void OnRezScript(uint localID, LLUUID itemID, string script, int startParam, bool postOnRez) 317 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez)
318 { 318 {
319 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez}; 319 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez};
320 320
@@ -395,7 +395,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
395 { 395 {
396 Object[] p = (Object[])parm; 396 Object[] p = (Object[])parm;
397 uint localID = (uint)p[0]; 397 uint localID = (uint)p[0];
398 LLUUID itemID = (LLUUID)p[1]; 398 UUID itemID = (UUID)p[1];
399 string script =(string)p[2]; 399 string script =(string)p[2];
400 int startParam = (int)p[3]; 400 int startParam = (int)p[3];
401 bool postOnRez = (bool)p[4]; 401 bool postOnRez = (bool)p[4];
@@ -411,7 +411,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
411 if (item == null) 411 if (item == null)
412 return false; 412 return false;
413 413
414 LLUUID assetID = item.AssetID; 414 UUID assetID = item.AssetID;
415 415
416// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})", 416// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})",
417// item.Name, itemID.ToString()); 417// item.Name, itemID.ToString());
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
430 string text = "Error compiling script:\r\n" + e.Message.ToString(); 430 string text = "Error compiling script:\r\n" + e.Message.ToString();
431 if (text.Length > 1000) 431 if (text.Length > 1000)
432 text = text.Substring(0, 1000); 432 text = text.Substring(0, 1000);
433 World.SimChat(Helpers.StringToField(text), 433 World.SimChat(Utils.StringToBytes(text),
434 ChatTypeEnum.DebugChannel, 2147483647, 434 ChatTypeEnum.DebugChannel, 2147483647,
435 part.AbsolutePosition, 435 part.AbsolutePosition,
436 part.Name, part.UUID, false); 436 part.Name, part.UUID, false);
@@ -455,7 +455,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
455 if ((!m_Scripts.ContainsKey(itemID)) || 455 if ((!m_Scripts.ContainsKey(itemID)) ||
456 (m_Scripts[itemID].AssetID != assetID)) 456 (m_Scripts[itemID].AssetID != assetID))
457 { 457 {
458 LLUUID appDomain = assetID; 458 UUID appDomain = assetID;
459 459
460 if (part.ParentGroup.RootPart.IsAttachment) 460 if (part.ParentGroup.RootPart.IsAttachment)
461 appDomain = part.ParentGroup.RootPart.UUID; 461 appDomain = part.ParentGroup.RootPart.UUID;
@@ -480,7 +480,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
480 m_AppDomains[appDomain].AssemblyResolve += 480 m_AppDomains[appDomain].AssemblyResolve +=
481 new ResolveEventHandler( 481 new ResolveEventHandler(
482 AssemblyResolver.OnAssemblyResolve); 482 AssemblyResolver.OnAssemblyResolve);
483 m_DomainScripts[appDomain] = new List<LLUUID>(); 483 m_DomainScripts[appDomain] = new List<UUID>();
484 } 484 }
485 catch (Exception e) 485 catch (Exception e)
486 { 486 {
@@ -507,7 +507,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
507 } 507 }
508 508
509 if (!m_PrimObjects.ContainsKey(localID)) 509 if (!m_PrimObjects.ContainsKey(localID))
510 m_PrimObjects[localID] = new List<LLUUID>(); 510 m_PrimObjects[localID] = new List<UUID>();
511 511
512 if (!m_PrimObjects[localID].Contains(itemID)) 512 if (!m_PrimObjects[localID].Contains(itemID))
513 m_PrimObjects[localID].Add(itemID); 513 m_PrimObjects[localID].Add(itemID);
@@ -518,7 +518,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
518 return true; 518 return true;
519 } 519 }
520 520
521 public void OnRemoveScript(uint localID, LLUUID itemID) 521 public void OnRemoveScript(uint localID, UUID itemID)
522 { 522 {
523 lock (m_Scripts) 523 lock (m_Scripts)
524 { 524 {
@@ -569,24 +569,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
569 } 569 }
570 } 570 }
571 571
572 public void OnScriptReset(uint localID, LLUUID itemID) 572 public void OnScriptReset(uint localID, UUID itemID)
573 { 573 {
574 ResetScript(itemID); 574 ResetScript(itemID);
575 } 575 }
576 576
577 public void OnStartScript(uint localID, LLUUID itemID) 577 public void OnStartScript(uint localID, UUID itemID)
578 { 578 {
579 StartScript(itemID); 579 StartScript(itemID);
580 } 580 }
581 581
582 public void OnStopScript(uint localID, LLUUID itemID) 582 public void OnStopScript(uint localID, UUID itemID)
583 { 583 {
584 StopScript(itemID); 584 StopScript(itemID);
585 } 585 }
586 586
587 private void CleanAssemblies() 587 private void CleanAssemblies()
588 { 588 {
589 List<LLUUID> assetIDList = new List<LLUUID>(m_Assemblies.Keys); 589 List<UUID> assetIDList = new List<UUID>(m_Assemblies.Keys);
590 590
591 foreach (IScriptInstance i in m_Scripts.Values) 591 foreach (IScriptInstance i in m_Scripts.Values)
592 { 592 {
@@ -594,7 +594,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
594 assetIDList.Remove(i.AssetID); 594 assetIDList.Remove(i.AssetID);
595 } 595 }
596 596
597 foreach (LLUUID assetID in assetIDList) 597 foreach (UUID assetID in assetIDList)
598 { 598 {
599// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]); 599// m_log.DebugFormat("[XEngine] Removing unreferenced assembly {0}", m_Assemblies[assetID]);
600 try 600 try
@@ -615,7 +615,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
615 } 615 }
616 } 616 }
617 617
618 private void UnloadAppDomain(LLUUID id) 618 private void UnloadAppDomain(UUID id)
619 { 619 {
620 if (m_AppDomains.ContainsKey(id)) 620 if (m_AppDomains.ContainsKey(id))
621 { 621 {
@@ -681,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
681 if (!m_PrimObjects.ContainsKey(localID)) 681 if (!m_PrimObjects.ContainsKey(localID))
682 return false; 682 return false;
683 683
684 foreach (LLUUID itemID in m_PrimObjects[localID]) 684 foreach (UUID itemID in m_PrimObjects[localID])
685 { 685 {
686 if (m_Scripts.ContainsKey(itemID)) 686 if (m_Scripts.ContainsKey(itemID))
687 { 687 {
@@ -699,7 +699,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
699 // 699 //
700 // Post an event to a single script 700 // Post an event to a single script
701 // 701 //
702 public bool PostScriptEvent(LLUUID itemID, EventParams p) 702 public bool PostScriptEvent(UUID itemID, EventParams p)
703 { 703 {
704 if (m_Scripts.ContainsKey(itemID)) 704 if (m_Scripts.ContainsKey(itemID))
705 { 705 {
@@ -737,7 +737,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
737 return null; 737 return null;
738 } 738 }
739 739
740 private IScriptInstance GetInstance(LLUUID itemID) 740 private IScriptInstance GetInstance(UUID itemID)
741 { 741 {
742 IScriptInstance instance; 742 IScriptInstance instance;
743 lock (m_Scripts) 743 lock (m_Scripts)
@@ -749,7 +749,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
749 return instance; 749 return instance;
750 } 750 }
751 751
752 public void SetScriptState(LLUUID itemID, bool running) 752 public void SetScriptState(UUID itemID, bool running)
753 { 753 {
754 IScriptInstance instance = GetInstance(itemID); 754 IScriptInstance instance = GetInstance(itemID);
755 if (instance != null) 755 if (instance != null)
@@ -761,7 +761,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
761 } 761 }
762 } 762 }
763 763
764 public bool GetScriptState(LLUUID itemID) 764 public bool GetScriptState(UUID itemID)
765 { 765 {
766 IScriptInstance instance = GetInstance(itemID); 766 IScriptInstance instance = GetInstance(itemID);
767 if (instance != null) 767 if (instance != null)
@@ -769,35 +769,35 @@ namespace OpenSim.Region.ScriptEngine.XEngine
769 return false; 769 return false;
770 } 770 }
771 771
772 public void ApiResetScript(LLUUID itemID) 772 public void ApiResetScript(UUID itemID)
773 { 773 {
774 IScriptInstance instance = GetInstance(itemID); 774 IScriptInstance instance = GetInstance(itemID);
775 if (instance != null) 775 if (instance != null)
776 instance.ApiResetScript(); 776 instance.ApiResetScript();
777 } 777 }
778 778
779 public void ResetScript(LLUUID itemID) 779 public void ResetScript(UUID itemID)
780 { 780 {
781 IScriptInstance instance = GetInstance(itemID); 781 IScriptInstance instance = GetInstance(itemID);
782 if (instance != null) 782 if (instance != null)
783 instance.ResetScript(); 783 instance.ResetScript();
784 } 784 }
785 785
786 public void StartScript(LLUUID itemID) 786 public void StartScript(UUID itemID)
787 { 787 {
788 IScriptInstance instance = GetInstance(itemID); 788 IScriptInstance instance = GetInstance(itemID);
789 if (instance != null) 789 if (instance != null)
790 instance.Start(); 790 instance.Start();
791 } 791 }
792 792
793 public void StopScript(LLUUID itemID) 793 public void StopScript(UUID itemID)
794 { 794 {
795 IScriptInstance instance = GetInstance(itemID); 795 IScriptInstance instance = GetInstance(itemID);
796 if (instance != null) 796 if (instance != null)
797 instance.Stop(0); 797 instance.Stop(0);
798 } 798 }
799 799
800 public DetectParams GetDetectParams(LLUUID itemID, int idx) 800 public DetectParams GetDetectParams(UUID itemID, int idx)
801 { 801 {
802 IScriptInstance instance = GetInstance(itemID); 802 IScriptInstance instance = GetInstance(itemID);
803 if (instance != null) 803 if (instance != null)
@@ -805,22 +805,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
805 return null; 805 return null;
806 } 806 }
807 807
808 public LLUUID GetDetectID(LLUUID itemID, int idx) 808 public UUID GetDetectID(UUID itemID, int idx)
809 { 809 {
810 IScriptInstance instance = GetInstance(itemID); 810 IScriptInstance instance = GetInstance(itemID);
811 if (instance != null) 811 if (instance != null)
812 return instance.GetDetectID(idx); 812 return instance.GetDetectID(idx);
813 return LLUUID.Zero; 813 return UUID.Zero;
814 } 814 }
815 815
816 public void SetState(LLUUID itemID, string newState) 816 public void SetState(UUID itemID, string newState)
817 { 817 {
818 IScriptInstance instance = GetInstance(itemID); 818 IScriptInstance instance = GetInstance(itemID);
819 if (instance == null) 819 if (instance == null)
820 return; 820 return;
821 instance.SetState(newState); 821 instance.SetState(newState);
822 } 822 }
823 public string GetState(LLUUID itemID) 823 public string GetState(UUID itemID)
824 { 824 {
825 IScriptInstance instance = GetInstance(itemID); 825 IScriptInstance instance = GetInstance(itemID);
826 if (instance == null) 826 if (instance == null)
@@ -828,7 +828,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
828 return instance.State; 828 return instance.State;
829 } 829 }
830 830
831 public int GetStartParameter(LLUUID itemID) 831 public int GetStartParameter(UUID itemID)
832 { 832 {
833 IScriptInstance instance = GetInstance(itemID); 833 IScriptInstance instance = GetInstance(itemID);
834 if (instance == null) 834 if (instance == null)
@@ -836,7 +836,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
836 return instance.StartParam; 836 return instance.StartParam;
837 } 837 }
838 838
839 public bool GetScriptRunning(LLUUID objectID, LLUUID itemID) 839 public bool GetScriptRunning(UUID objectID, UUID itemID)
840 { 840 {
841 return GetScriptState(itemID); 841 return GetScriptState(itemID);
842 } 842 }