示例#1
0
        /// <summary>
        /// Loads and executes a new script.
        /// </summary>
        /// <param name="scriptPath"></param>
        /// <param name="module"></param>
        public bool Load(string scriptPath, hModule module)
        {
            var prevParentModule = module.GetPrevious();

            if (prevParentModule is null)
            {
                prevParentModule.SetPrevious(/* this.field_0x38 */ null);
            }

            bool moduleLoaded = ModuleLoad(scriptPath, module);

            if (moduleLoaded)
            {
                return(moduleLoaded);
            }

            // if path is absolute
            // do something..

            var scriptFilePath = scriptPath + ".adc";

            LoadCode(scriptFilePath);

            // check if loaded
            // if it is, return true, or false
            return(false);
        }
示例#2
0
        public bool Require(string moduleName)
        {
            if (Modules.ContainsKey(moduleName))
            {
                return(Modules[moduleName]);
            }

            hModule newModule = new hModule();

            Load(moduleName, hmodule);
        }
示例#3
0
        private bool ModuleLoad(string name, hModule module)
        {
            var handle = GetModuleHandle(name);

            if (handle is null)
            {
                return(false);
            }

            handle(module);
            return(true);
        }
示例#4
0
        public void SetPrevious(hModule module)
        {
            if (Previous != null)
            {
                ; // weak_ref module provided
            }
            if (Previous is null)
            {
                Previous = module;
                return;
            }

            // Previous weak_unref
            Previous = module;
        }