예제 #1
0
        public ActiveScriptWrapper64(string progID, WindowsScriptEngineFlags flags)
        {
            // ReSharper disable SuspiciousTypeConversion.Global

            pActiveScript                 = RawCOMHelpers.CreateInstance <IActiveScript>(progID);
            pActiveScriptParse            = RawCOMHelpers.QueryInterface <IActiveScriptParse64>(pActiveScript);
            pActiveScriptDebug            = RawCOMHelpers.QueryInterface <IActiveScriptDebug64>(pActiveScript);
            pActiveScriptGarbageCollector = RawCOMHelpers.QueryInterfaceNoThrow <IActiveScriptGarbageCollector>(pActiveScript);
            pDebugStackFrameSniffer       = RawCOMHelpers.QueryInterface <IDebugStackFrameSnifferEx64>(pActiveScript);

            activeScript                 = (IActiveScript)Marshal.GetObjectForIUnknown(pActiveScript);
            activeScriptParse            = (IActiveScriptParse64)activeScript;
            activeScriptDebug            = (IActiveScriptDebug64)activeScript;
            activeScriptGarbageCollector = activeScript as IActiveScriptGarbageCollector;
            debugStackFrameSniffer       = (IDebugStackFrameSnifferEx64)activeScript;

            if (flags.HasFlag(WindowsScriptEngineFlags.EnableStandardsMode))
            {
                var activeScriptProperty = activeScript as IActiveScriptProperty;
                if (activeScriptProperty != null)
                {
                    object name;
                    activeScriptProperty.GetProperty(ScriptProp.Name, IntPtr.Zero, out name);
                    if (Equals(name, "JScript"))
                    {
                        object value = ScriptLanguageVersion.Standards;
                        activeScriptProperty.SetProperty(ScriptProp.InvokeVersioning, IntPtr.Zero, ref value);
                    }
                }
            }

            // ReSharper restore SuspiciousTypeConversion.Global
        }
예제 #2
0
        public ActiveScriptWrapper64(string progID)
        {
            pActiveScript                 = RawCOMHelpers.CreateInstance <IActiveScript>(progID);
            pActiveScriptParse            = RawCOMHelpers.QueryInterface <IActiveScriptParse64>(pActiveScript);
            pActiveScriptDebug            = RawCOMHelpers.QueryInterface <IActiveScriptDebug64>(pActiveScript);
            pActiveScriptGarbageCollector = RawCOMHelpers.QueryInterfaceNoThrow <IActiveScriptGarbageCollector>(pActiveScript);
            pDebugStackFrameSniffer       = RawCOMHelpers.QueryInterface <IDebugStackFrameSnifferEx64>(pActiveScript);

            activeScript                 = (IActiveScript)Marshal.GetObjectForIUnknown(pActiveScript);
            activeScriptParse            = (IActiveScriptParse64)activeScript;
            activeScriptDebug            = (IActiveScriptDebug64)activeScript;
            activeScriptGarbageCollector = activeScript as IActiveScriptGarbageCollector;
            debugStackFrameSniffer       = (IDebugStackFrameSnifferEx64)activeScript;
        }
예제 #3
0
        public override void Close()
        {
            activeScript.Close();

            debugStackFrameSniffer       = null;
            activeScriptGarbageCollector = null;
            activeScriptDebug            = null;
            activeScriptParse            = null;
            activeScript = null;

            RawCOMHelpers.ReleaseAndEmpty(ref pDebugStackFrameSniffer);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptGarbageCollector);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptDebug);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptParse);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScript);
        }
예제 #4
0
        public override void EnumCodeContextsOfPosition(UIntPtr sourceContext, uint offset, uint length, out IEnumDebugCodeContexts enumContexts)
        {
            var del = RawCOMHelpers.GetMethodDelegate <RawEnumCodeContextsOfPosition>(pActiveScriptDebug, 5);

            RawCOMHelpers.HResult.Check(del(pActiveScriptDebug, sourceContext.ToUInt64(), offset, length, out enumContexts));
        }
예제 #5
0
        public override void InterruptScriptThread(uint scriptThreadID, ref EXCEPINFO excepInfo, ScriptInterruptFlags flags)
        {
            var del = RawCOMHelpers.GetMethodDelegate <RawInterruptScriptThread>(pActiveScript, 14);

            del(pActiveScript, scriptThreadID, ref excepInfo, flags);
        }