/// <summary>
        /// Adds a code scriptlet to the script. This method is used in environments where the
        /// persistent state of the script is intertwined with the host document and the host
        /// is responsible for restoring the script, rather than through an IPersist* interface.
        /// The primary examples are HTML scripting languages that allow scriptlets of code
        /// embedded in the HTML document to be attached to intrinsic events (for instance,
        /// ONCLICK="button1.text='Exit'").
        /// </summary>
        /// <param name="defaultName">The default name to associate with the scriptlet. If the
        /// scriptlet does not contain naming information (as in the ONCLICK example above),
        /// this name will be used to identify the scriptlet. If this parameter is NULL, the
        /// scripting engine manufactures a unique name, if necessary.</param>
        /// <param name="code">The scriptlet text to add. The interpretation of this string
        /// depends on the scripting language.</param>
        /// <param name="itemName">The item name associated with this scriptlet. This parameter,
        /// in addition to pstrSubItemName, identifies the object for which the scriptlet is
        /// an event handler.</param>
        /// <param name="subItemName">The name of a subobject of the named item with which this
        /// scriptlet is associated; this name must be found in the named item's type
        /// information. This parameter is NULL if the scriptlet is to be associated with the
        /// named item instead of a subitem. This parameter, in addition to pstrItemName,
        /// identifies the specific object for which the scriptlet is an event handler.</param>
        /// <param name="eventName">The name of the event for which the scriptlet is an event
        /// handler.</param>
        /// <param name="delimiter">The end-of-scriptlet delimiter. When the pstrCode parameter
        /// is parsed from a stream of text, the host typically uses a delimiter, such as two
        /// single quotation marks (''), to detect the end of the scriptlet. This parameter
        /// specifies the delimiter that the host used, allowing the scripting engine to
        /// provide some conditional primitive preprocessing (for example, replacing a single
        /// quotation mark ['] with two single quotation marks for use as a delimiter).
        /// Exactly how (and if) the scripting engine makes use of this information depends
        /// on the scripting engine. Set this parameter to NULL if the host did not use a
        /// delimiter to mark the end of the scriptlet.</param>
        /// <param name="sourceContextCookie">Application-defined value that is used for
        /// debugging purposes.</param>
        /// <param name="startingLineNumber">Zero-based value that specifies which line the
        /// parsing will begin at.</param>
        /// <param name="flags">Flags associated with the scriptlet.</param>
        /// <returns>
        /// Actual name used to identify the scriptlet. This is to be in
        /// order of preference: a name explicitly specified in the scriptlet text, the
        /// default name provided in pstrDefaultName, or a unique name synthesized by the
        /// scripting engine.
        /// </returns>
        public string AddScriptlet(
            string defaultName,
            string code,
            string itemName,
            string subItemName,
            string eventName,
            string delimiter,
            IntPtr sourceContextCookie,
            uint startingLineNumber,
            ScriptTextFlags flags)
        {
            string name;

            if (_parse32 != null)
            {
                _parse32.AddScriptlet(
                    defaultName,
                    code,
                    itemName,
                    subItemName,
                    eventName,
                    delimiter,
                    sourceContextCookie,
                    startingLineNumber,
                    flags,
                    out name,
                    out _exceptionInfo);
            }
            else if (_parse64 != null)
            {
                _parse64.AddScriptlet(
                    defaultName,
                    code,
                    itemName,
                    subItemName,
                    eventName,
                    delimiter,
                    sourceContextCookie,
                    startingLineNumber,
                    flags,
                    out name,
                    out _exceptionInfo);
            }
            else
            {
                throw new NotImplementedException(NeitherValidMessage);
            }

            return(name);
        }
示例#2
0
        /// <summary>
        /// Adds a code scriptlet to the script. This method is used in environments where the
        /// persistent state of the script is intertwined with the host document and the host
        /// is responsible for restoring the script, rather than through an IPersist* interface.
        /// The primary examples are HTML scripting languages that allow scriptlets of code
        /// embedded in the HTML document to be attached to intrinsic events (for instance,
        /// ONCLICK="button1.text='Exit'").
        /// </summary>
        /// <param name="defaultName">The default name to associate with the scriptlet. If the
        /// scriptlet does not contain naming information (as in the ONCLICK example above),
        /// this name will be used to identify the scriptlet. If this parameter is NULL, the
        /// scripting engine manufactures a unique name, if necessary.</param>
        /// <param name="code">The scriptlet text to add. The interpretation of this string
        /// depends on the scripting language.</param>
        /// <param name="itemName">The item name associated with this scriptlet. This parameter,
        /// in addition to pstrSubItemName, identifies the object for which the scriptlet is
        /// an event handler.</param>
        /// <param name="subItemName">The name of a subobject of the named item with which this
        /// scriptlet is associated; this name must be found in the named item's type
        /// information. This parameter is NULL if the scriptlet is to be associated with the
        /// named item instead of a subitem. This parameter, in addition to pstrItemName,
        /// identifies the specific object for which the scriptlet is an event handler.</param>
        /// <param name="eventName">The name of the event for which the scriptlet is an event
        /// handler.</param>
        /// <param name="delimiter">The end-of-scriptlet delimiter. When the pstrCode parameter
        /// is parsed from a stream of text, the host typically uses a delimiter, such as two
        /// single quotation marks (''), to detect the end of the scriptlet. This parameter
        /// specifies the delimiter that the host used, allowing the scripting engine to
        /// provide some conditional primitive preprocessing (for example, replacing a single
        /// quotation mark ['] with two single quotation marks for use as a delimiter).
        /// Exactly how (and if) the scripting engine makes use of this information depends
        /// on the scripting engine. Set this parameter to NULL if the host did not use a
        /// delimiter to mark the end of the scriptlet.</param>
        /// <param name="sourceContextCookie">Application-defined value that is used for
        /// debugging purposes</param>
        /// <param name="startingLineNumber">Zero-based value that specifies which line the
        /// parsing will begin at</param>
        /// <param name="flags">Flags associated with the scriptlet</param>
        /// <returns>
        /// Actual name used to identify the scriptlet. This is to be in
        /// order of preference: a name explicitly specified in the scriptlet text, the
        /// default name provided in pstrDefaultName, or a unique name synthesized by the
        /// scripting engine.
        /// </returns>
        public string AddScriptlet(
            string defaultName,
            string code,
            string itemName,
            string subItemName,
            string eventName,
            string delimiter,
            IntPtr sourceContextCookie,
            uint startingLineNumber,
            ScriptTextFlags flags)
        {
            string name;

            if (_is64Bit)
            {
                _activeScriptParse64.AddScriptlet(
                    defaultName,
                    code,
                    itemName,
                    subItemName,
                    eventName,
                    delimiter,
                    sourceContextCookie,
                    startingLineNumber,
                    flags,
                    out name,
                    out _lastException);
            }
            else
            {
                _activeScriptParse32.AddScriptlet(
                    defaultName,
                    code,
                    itemName,
                    subItemName,
                    eventName,
                    delimiter,
                    sourceContextCookie,
                    startingLineNumber,
                    flags,
                    out name,
                    out _lastException);
            }

            return(name);
        }
示例#3
0
 public void AddScriptlet(
     string defaultName,
     string code,
     string itemName,
     string subItemName,
     string eventName,
     string delimiter,
     ulong sourceContext,
     uint startingLineNumber,
     ScriptTextFlags flags,
     out string name,
     out EXCEPINFO excepInfo)
 {
     if (is64Bit)
     {
         activeScriptParse64.AddScriptlet(
             defaultName,
             code,
             itemName,
             subItemName,
             eventName,
             delimiter,
             sourceContext,
             startingLineNumber,
             flags,
             out name,
             out excepInfo);
     }
     else
     {
         activeScriptParse32.AddScriptlet(
             defaultName,
             code,
             itemName,
             subItemName,
             eventName,
             delimiter,
             (uint)sourceContext,
             startingLineNumber,
             flags,
             out name,
             out excepInfo);
     }
 }
 internal void AddScriptlet(
     string defaultName,
     string code,
     string itemName,
     string subItemName,
     string eventName,
     string delimiter,
     IntPtr sourceContextCookie,
     uint startingLineNumber,
     ScriptText flags,
     out string name,
     out EXCEPINFO exceptionInfo)
 {
     if (asp32 != null)
     {
         asp32.AddScriptlet(defaultName, code, itemName, subItemName, eventName,
                            delimiter, sourceContextCookie, startingLineNumber, flags, out name, out exceptionInfo);
     }
     else
     {
         asp64.AddScriptlet(defaultName, code, itemName, subItemName, eventName,
                            delimiter, sourceContextCookie, startingLineNumber, flags, out name, out exceptionInfo);
     }
 }