Esempio n. 1
0
        static ICallRefHandler GetCallRefHandler(int reference, uint instance, string resourceName)
        {
            ICallRefHandler handler;

            if (resourceName == "__internal")
            {
                handler = InternalCallRefHandler.Get();
            }
            else
            {
                handler = ScriptEnvironment.CurrentEnvironment.Resource.Manager.GetResource(resourceName);
            }

            if (handler == null)
            {
                throw new ArgumentException("Invalid resource name.");
            }

            if (handler is Resource)
            {
                var state = ((Resource)handler).State;

                if (state != ResourceState.Running && state != ResourceState.Starting && state != ResourceState.Parsing)
                {
                    throw new ArgumentException("Resource wasn't running.");
                }
            }

            return handler;
        }
Esempio n. 2
0
        public static InternalCallRefHandler Get()
        {
            if (ms_instance == null)
            {
                ms_instance = new InternalCallRefHandler();
            }

            return(ms_instance);
        }