public void Notify(FFIExecutionSession session)
        {
            Type[] appTypes = session.ExtensionAppTypes;
            foreach (var item in appTypes)
            {
                //If the specified key is not found then the HashTable returns null.
                IExtensionApplication app = mExtensionApps[item] as IExtensionApplication;
                if (null == app)
                    continue;

                switch (session.State)
                {
                    case ProtoCore.ExecutionStateEventArgs.State.kExecutionBegin:
                        app.OnBeginExecution(session);
                        break;
                    case ProtoCore.ExecutionStateEventArgs.State.kExecutionEnd:
                        app.OnEndExecution(session);
                        break;
                    case ProtoCore.ExecutionStateEventArgs.State.kExecutionBreak:
                        app.OnSuspendExecution(session);
                        break;
                    case ProtoCore.ExecutionStateEventArgs.State.kExecutionResume:
                        app.OnResumeExecution(session);
                        break;
                    default:
                        break;
                }
            }
        }
Example #2
0
        public void Notify(FFIExecutionSession session)
        {
            Type[] appTypes = session.ExtensionAppTypes;
            foreach (var item in appTypes)
            {
                //If the specified key is not found then the HashTable returns null.
                IExtensionApplication app = mExtensionApps[item] as IExtensionApplication;
                if (null == app)
                {
                    continue;
                }

                switch (session.State)
                {
                case ProtoCore.ExecutionStateEventArgs.State.ExecutionBegin:
                    app.OnBeginExecution(session);
                    break;

                case ProtoCore.ExecutionStateEventArgs.State.ExecutionEnd:
                    app.OnEndExecution(session);
                    break;

                case ProtoCore.ExecutionStateEventArgs.State.ExecutionBreak:
                    app.OnSuspendExecution(session);
                    break;

                case ProtoCore.ExecutionStateEventArgs.State.ExecutionResume:
                    app.OnResumeExecution(session);
                    break;

                default:
                    break;
                }
            }
        }
Example #3
0
        public bool RegisterExtensionApplicationType(Core core, SysType type)
        {
            if (!typeof(IExtensionApplication).IsAssignableFrom(type))
            {
                return(false);
            }

            FFIExecutionSession session = GetSession(core, true);

            session.AddExtensionAppType(type);
            return(true);
        }
        public bool RegisterExtensionApplicationType(ProtoLanguage.CompileStateTracker compileState, SysType type)
        {
            if (!typeof(IExtensionApplication).IsAssignableFrom(type))
            {
                return(false);
            }

            FFIExecutionSession session = GetSession(compileState, true);

            session.AddExtensionAppType(type);
            return(true);
        }
Example #5
0
        private void OnExecutionEvent(object sender, ExecutionStateEventArgs e)
        {
            Core core = sender as Core;
            FFIExecutionSession session = GetSession(core, false);

            //If there wasn't any session created, there was no extension app
            //registered for the session
            if (null == session)
            {
                return;
            }

            session.State = e.ExecutionState;
            mApploader.Notify(session);
        }
        private void OnExecutionEvent(object sender, ExecutionStateEventArgs e)
        {
            ProtoLanguage.CompileStateTracker compileState = sender as ProtoLanguage.CompileStateTracker;
            FFIExecutionSession session = GetSession(compileState, false);

            //If there wasn't any session created, there was no extension app
            //registered for the session
            if (null == session)
            {
                return;
            }

            session.State = e.ExecutionState;
            mApploader.Notify(session);
        }
        private FFIExecutionSession GetSession(RuntimeCore runtimeCore, bool createIfNone)
        {
            FFIExecutionSession session = null;
            lock (mSessions)
            {
                if (!mSessions.TryGetValue(runtimeCore, out session) && createIfNone)
                {
                    session = new FFIExecutionSession(runtimeCore);
                    runtimeCore.ExecutionEvent += OnExecutionEvent;
                    runtimeCore.Dispose += OnDispose;
                    mSessions.Add(runtimeCore, session);
                }
            }

            return session;
        }
Example #8
0
        private FFIExecutionSession GetSession(RuntimeCore runtimeCore, bool createIfNone)
        {
            FFIExecutionSession session = null;

            lock (mSessions)
            {
                if (!mSessions.TryGetValue(runtimeCore, out session) && createIfNone)
                {
                    session = new FFIExecutionSession(runtimeCore);
                    runtimeCore.ExecutionEvent += OnExecutionEvent;
                    runtimeCore.Dispose        += OnDispose;
                    mSessions.Add(runtimeCore, session);
                }
            }

            return(session);
        }
Example #9
0
        private FFIExecutionSession GetSession(Core core, bool createIfNone)
        {
            FFIExecutionSession session = null;

            if (!mSessions.TryGetValue(core, out session) && createIfNone)
            {
                lock (mSessions)
                {
                    if (!mSessions.TryGetValue(core, out session))
                    {
                        session              = new FFIExecutionSession(core);
                        core.ExecutionEvent += OnExecutionEvent;
                        core.Dispose        += OnDispose;
                        mSessions.Add(core, session);
                    }
                }
            }

            return(session);
        }
Example #10
0
        private void OnDispose(Core sender)
        {
            if (null == mSessions)
            {
                return;
            }

            FFIExecutionSession session = null;

            if (mSessions.TryGetValue(sender, out session))
            {
                lock (mSessions)
                {
                    mSessions.Remove(sender);
                }
                mSessions.Remove(sender);
                session.Dispose();
                sender.ExecutionEvent -= OnExecutionEvent;
            }
        }
        private FFIExecutionSession GetSession(ProtoLanguage.CompileStateTracker compileState, bool createIfNone)
        {
            FFIExecutionSession session = null;

            if (!mSessions.TryGetValue(compileState, out session) && createIfNone)
            {
                lock (mSessions)
                {
                    if (!mSessions.TryGetValue(compileState, out session))
                    {
                        session = new FFIExecutionSession(compileState);
                        compileState.ExecutionEvent += OnExecutionEvent;
                        compileState.Dispose        += OnDispose;
                        mSessions.Add(compileState, session);
                    }
                }
            }

            return(session);
        }
        private void OnDispose(ProtoLanguage.CompileStateTracker sender)
        {
            if (null == mSessions)
            {
                return;
            }

            FFIExecutionSession session = null;

            if (mSessions.TryGetValue(sender, out session))
            {
                lock (mSessions)
                {
                    mSessions.Remove(sender);
                }
                mSessions.Remove(sender);
                session.Dispose();
                sender.ExecutionEvent -= OnExecutionEvent;
            }
        }
Example #13
0
        private void OnDispose(RuntimeCore sender)
        {
            if (mSessions == null)
            {
                return;
            }

            FFIExecutionSession session = null;

            lock (mSessions)
            {
                if (mSessions.TryGetValue(sender, out session))
                {
                    mSessions.Remove(sender);
                    session.Dispose();
                    sender.Dispose        -= OnDispose;
                    sender.ExecutionEvent -= OnExecutionEvent;
                }
                mSelf = null;
            }
        }
        private FFIExecutionSession GetSession(Core core, bool createIfNone)
        {
            FFIExecutionSession session = null;
            if(!mSessions.TryGetValue(core, out session) && createIfNone)
            {
                lock (mSessions)
                {
                    if (!mSessions.TryGetValue(core, out session))
                    {
                        session = new FFIExecutionSession(core);
                        core.ExecutionEvent += OnExecutionEvent;
                        core.Dispose += OnDispose;
                        mSessions.Add(core, session);
                    }
                }
            }

            return session;
        }