예제 #1
0
        public void Init(byte[] scriptBinary, LSLScriptInstance instance)
        {
            m_instance = instance;

            // Load the assembly into this AppDomain and create an instance of the
            // SecondLife.Script class (the main script class)
            Assembly scriptAssembly = Assembly.Load(scriptBinary);

            m_script = scriptAssembly.CreateInstance("SecondLife.Script") as LSLScriptBase;
            m_script.Init(this);

            // Create a dictionary of FastInvoke delegates for each method in the script
            MethodInfo[] methodInfos = m_script.GetType().GetMethods();
            m_methods = new Dictionary <string, FastInvokeDelegate>();
            for (int i = 0; i < methodInfos.Length; i++)
            {
                if (methodInfos[i].Module.Assembly == scriptAssembly)
                {
                    m_methods.Add(methodInfos[i].Name, FastInvoke.Create(methodInfos[i]));
                }
            }
        }
예제 #2
0
        public void Init(byte[] scriptBinary, LSLScriptInstance instance)
        {
            m_instance = instance;

            // Load the assembly into this AppDomain and create an instance of the
            // SecondLife.Script class (the main script class)
            Assembly scriptAssembly = Assembly.Load(scriptBinary);
            m_script = scriptAssembly.CreateInstance("SecondLife.Script") as LSLScriptBase;
            m_script.Init(this);

            // Create a dictionary of FastInvoke delegates for each method in the script
            MethodInfo[] methodInfos = m_script.GetType().GetMethods();
            m_methods = new Dictionary<string, FastInvokeDelegate>();
            for (int i = 0; i < methodInfos.Length; i++)
            {
                if (methodInfos[i].Module.Assembly == scriptAssembly)
                    m_methods.Add(methodInfos[i].Name, FastInvoke.Create(methodInfos[i]));
            }
        }