コード例 #1
0
ファイル: LSLScriptInstance.cs プロジェクト: jhurliman/simian
        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
ファイル: LSLScriptInstance.cs プロジェクト: thoys/simian
        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]));
            }
        }