GetGlobal() public méthode

public GetGlobal ( ) : Dispatch2
Résultat Dispatch2
Exemple #1
0
        public static void Main(string[] args)
        {
            TJS.mStorage = null;
            TJS.Initialize();
            TJS mScriptEngine = new TJS();
            TJS.SetConsoleOutput(new DebugConsoleOutput());

            Dispatch2 dsp = mScriptEngine.GetGlobal();
            Variant ret = new Variant();
            mScriptEngine.ExecScript("Debug.message(\"Hello, world!\");", ret, dsp, null, 0);

            System.Console.Out.WriteLine("Hello World!");
        }
Exemple #2
0
 /// <summary>TJSGetExceptionObject : retrieves TJS 'Exception' object</summary>
 /// <exception cref="TJSException">TJSException</exception>
 /// <exception cref="VariantException">VariantException</exception>
 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public static void GetExceptionObject(TJS tjs, Variant res, Variant msg, Variant 
     trace)
 {
     if (res == null)
     {
         return;
     }
     // not prcess
     // retrieve class "Exception" from global
     Dispatch2 global = tjs.GetGlobal();
     Variant val = new Variant();
     int hr = global.PropGet(0, EXCEPTION_NAME, val, global);
     if (hr < 0)
     {
         throw new TJSException(ExceptionNotFound);
     }
     // create an Exception object
     Holder<Dispatch2> excpobj = new Holder<Dispatch2>(null);
     VariantClosure clo = val.AsObjectClosure();
     Variant[] pmsg = new Variant[1];
     pmsg[0] = msg;
     hr = clo.CreateNew(0, null, excpobj, pmsg, clo.mObjThis);
     if (hr < 0)
     {
         throw new TJSException(ExceptionNotFound);
     }
     Dispatch2 disp = excpobj.mValue;
     if (trace != null)
     {
         string trace_name = "trace";
         disp.PropSet(Interface.MEMBERENSURE, trace_name, trace, disp);
     }
     res.Set(disp, disp);
     excpobj = null;
 }