Exemple #1
0
        public void Init()
        {
            // UNDONE: this is crap. The whole engine shouldn't have to be recreated and
            // reinitialized for each compile. Unfortunately it's the only way I've found
            // to work around the "Variable 'AED' has not been declared" problem.
            // A better solution needs to be found as this one seems to consume roughly
            // 240K of RAM each compile.

            m_vsae             = new Microsoft.JScript.Vsa.VsaEngine();
            m_vsae.RootMoniker = "com.spiffcode://script";
            m_vsae.Site        = this;
            m_vsae.InitNew();

            m_vsae.SetOption("print", true);                    // Enable the 'print' function for scripters
            m_vsae.SetOption("fast", false);                    // Enable legacy mode
            m_vsae.RootNamespace = "script";
            m_vsaciScript        = (IVsaCodeItem)m_vsae.Items.CreateItem("scriptspace",
                                                                         VsaItemType.Code, VsaItemFlag.None);

            m_vsae.Items.CreateItem("mscorlib.dll", VsaItemType.Reference, VsaItemFlag.None);
            m_vsae.Items.CreateItem("System.Windows.Forms.dll", VsaItemType.Reference, VsaItemFlag.None);
//			m_vsae.Items.CreateItem("System.dll", VsaItemType.Reference, VsaItemFlag.None);

            string[] astrNames = new String[m_htGlobals.Count];
            m_htGlobals.Keys.CopyTo(astrNames, 0);

            for (int i = 0; i < m_htGlobals.Count; i++)
            {
                IVsaGlobalItem vsagi = (IVsaGlobalItem)m_vsae.Items.CreateItem(astrNames[i],
                                                                               VsaItemType.AppGlobal, VsaItemFlag.None);
                // UNDONE: this doesn't seem to be working
                vsagi.ExposeMembers = true;
//				object obInstance = m_htGlobals[astrNames[i]];
//				vsagi.TypeString = obInstance.GetType().FullName;
            }
        }
        public void Init()
        {
            // UNDONE: this is crap. The whole engine shouldn't have to be recreated and
            // reinitialized for each compile. Unfortunately it's the only way I've found
            // to work around the "Variable 'AED' has not been declared" problem.
            // A better solution needs to be found as this one seems to consume roughly
            // 240K of RAM each compile.

            m_vsae = new Microsoft.JScript.Vsa.VsaEngine();
            m_vsae.RootMoniker = "com.spiffcode://script";
            m_vsae.Site = this;
            m_vsae.InitNew();

            m_vsae.SetOption("print", true);	// Enable the 'print' function for scripters
            m_vsae.SetOption("fast", false);	// Enable legacy mode
            m_vsae.RootNamespace = "script";
            m_vsaciScript = (IVsaCodeItem)m_vsae.Items.CreateItem("scriptspace",
                    VsaItemType.Code, VsaItemFlag.None);

            m_vsae.Items.CreateItem("mscorlib.dll", VsaItemType.Reference, VsaItemFlag.None);
            m_vsae.Items.CreateItem("System.Windows.Forms.dll", VsaItemType.Reference, VsaItemFlag.None);
            //			m_vsae.Items.CreateItem("System.dll", VsaItemType.Reference, VsaItemFlag.None);

            string[] astrNames = new String[m_htGlobals.Count];
            m_htGlobals.Keys.CopyTo(astrNames, 0);

            for (int i = 0; i < m_htGlobals.Count; i++) {
                IVsaGlobalItem vsagi = (IVsaGlobalItem)m_vsae.Items.CreateItem(astrNames[i],
                        VsaItemType.AppGlobal, VsaItemFlag.None);
                // UNDONE: this doesn't seem to be working
                vsagi.ExposeMembers = true;
            //				object obInstance = m_htGlobals[astrNames[i]];
            //				vsagi.TypeString = obInstance.GetType().FullName;
            }
        }