Beispiel #1
0
        private void addClassEntries(Chilkat.Xml xml)
        {
            int i, n;

            // the methods.
            Chilkat.Xml x = xml.FindChild("methods");
            if (x != null)
            {
                n = x.NumChildren;
                for (i = 0; i < n; i++)
                {
                    Chilkat.Xml xEntry  = x.GetChild(i);
                    XMethod     xMethod = new XMethod();
                    xMethod.LoadMethodXml(xEntry);
                    m_methods.Add(xMethod.EntryName, xMethod);
                    m_methodList.Add(xMethod);
                }
            }

            // the properties.
            x = xml.FindChild("properties");
            if (x != null)
            {
                n = x.NumChildren;
                for (i = 0; i < n; i++)
                {
                    Chilkat.Xml xEntry = x.GetChild(i);
                    XProperty   xprop  = new XProperty();
                    xprop.loadPropXml(xEntry);
                    m_props.Add(xprop.EntryName, xprop);
                    m_propList.Add(xprop);
                }
            }

            // the events.
            x = xml.FindChild("events");
            if (x != null)
            {
                n = x.NumChildren;
                for (i = 0; i < n; i++)
                {
                    Chilkat.Xml xEntry = x.GetChild(i);
                    // If the tag is "standard", ignore it because we'll be loading the standard events elsewhere..
                    if (xEntry.TagEquals("standard"))
                    {
                        continue;
                    }

                    XMethod xEvent = new XMethod();
                    xEvent.LoadMethodXml(xEntry);
                    m_events.Add(xEvent.EntryName, xEvent);
                    m_eventList.Add(xEvent);
                }
            }
        }
Beispiel #2
0
        private bool loadStandardEvents(Chilkat.Log log)
        {
            string standardEventsXmlPath = AppDataDir.BaseDir + "/appData/apiManager/standardEvents.xml";

            Chilkat.Xml xml = new Chilkat.Xml();
            if (!xml.LoadXmlFile(standardEventsXmlPath))
            {
                log.LogError("Failed to load standard events XML");
                return(false);
            }
            xml.AddOrUpdateAttribute("sourceXmlPath", standardEventsXmlPath);

            // The root of this XML document is an "events" node..
            int n = xml.NumChildren;

            for (int i = 0; i < n; i++)
            {
                Chilkat.Xml xEntry = xml.GetChild(i);
                XMethod     xEvent = new XMethod();
                xEvent.LoadMethodXml(xEntry);
                m_events.Add(xEvent.EntryName, xEvent);
                m_eventList.Add(xEvent);
            }

            return(true);
        }
Beispiel #3
0
        // xml points to "links2" containing individual links.
        // For example:
        //<links2>
        //    <link linkType="external">
        //        <text>Minimizing SMTP Connections</text>
        //        <url>http://www.chilkatsoft.com/p/p_176.asp</url>
        //    </link>
        //    <link linkType="example">
        //        <url>smtp_ssh_tunnel.asp</url>
        //        <text>SMTP SSH Tunneling (Port Forwarding)</text>
        //    </link>
        //    <link linkType="example">
        //        <url>smtp_hotmail_live.asp</url>
        //        <text>Send Email with Hotmail (live.com) -- smtp-mail.outlook.com</text>
        //    </link>
        //</links2>

        public bool UseRefdocLinks(Chilkat.Xml xml)
        {
            m_xml = xml;
            m_links.Clear();

            int numChildren = xml.NumChildren;
            int i;

            for (i = 0; i < numChildren; i++)
            {
                Chilkat.Xml xLink = xml.GetChild(i);
                RefdocLink  link  = new RefdocLink(xLink);
                m_links.Add(link);
            }

            return(true);
        }
        public void UpdateArg(int index, string argName, string objcName, string genericType)
        {
            //<args2>
            //    <arg name="encodedBytes" type="string" objcName="encodedBytes" />
            //    <arg name="encoding" type="string" objcName="encoding" />
            //</args2>

            Chilkat.Xml xArg = m_xml.GetChild(index);
            if (xArg == null)
            {
                throw new Exception();
            }

            xArg.UpdateAttribute("name", argName);
            xArg.UpdateAttribute("type", genericType);
            xArg.UpdateAttribute("objcName", objcName);

            MethodArg arg = (MethodArg)m_args[index];

            arg.UpdateArg(argName, objcName, genericType);

            return;
        }
        // Convert method XML to its Async variant so that we can use the normal code generation methods..
        static private void convertMethodToAsync(Chilkat.Xml xml)
        {
            //<method cpp="1" dn="1" ax="1" events="1" name="QuickGetObj" axId="221">
            //    <gType>HttpResponse</gType>
            //    <cppType>CkHttpResponse *</cppType>

            string returnType = xml.GetChildContent("gType");
            // Is this an object?  If so, we'll add a link to the async_returnObject example
            int returnGt = ChilkatTypes.genericToGt(returnType);


            xml.UpdateChildContent("gType", "Task");
            xml.UpdateChildContent("cppType", "CkTask *");
            xml.RemoveAttribute("status");      // It returns a Task object, not a status bool..
            xml.RemoveAttribute("outArgName");  // If this method had an output arg, the async does not...

            int axId = xml.GetAttrValueInt("axId");

            axId += 500;
            xml.UpdateAttributeInt("axId", axId);

            string origMethodName = xml.GetAttrValue("name");

            xml.UpdateAttribute("name", origMethodName + "Async");

            xml.UpdateChildContent("descrip", "Creates an asynchronous task to call the " + origMethodName +
                                   " method with the arguments provided.  (Async methods are available starting in Chilkat v9.5.0.52.)");

            xml.RemoveChild("links");

            bool bAlreadyHasAsyncExamples = false;

            // Check to see if this method already has async examples.
            // If so, when we leave it alone.
            // Otherwise, we add the default example..
            RefdocLinks rdLinks = new RefdocLinks();

            Chilkat.Xml xLinks2 = xml.FindChild("links2");
            if (xLinks2 != null)
            {
                int numChildren = xLinks2.NumChildren;
                for (int i = 0; i < numChildren; i++)
                {
                    Chilkat.Xml xLink = xLinks2.GetChild(i);
                    if (xLink.HasAttrWithValue("async", "1"))
                    {
                        bAlreadyHasAsyncExamples = true;
                        break;
                    }
                }
            }

            if (!bAlreadyHasAsyncExamples)
            {
                xml.RemoveChild("links2");

                Chilkat.Xml xmlLinks2 = xml.NewChild("links2", "");
                Chilkat.Xml xmlLink;

                xmlLink = xmlLinks2.NewChild("link", "");
                xmlLink.AddAttribute("lang", "activex");
                xmlLink.AddAttribute("linkType", "external");
                xmlLink.AddAttribute("async", "1");
                xmlLink.NewChild2("text", "VB6 Programs MUST Call FinalizeThreadPool Just Before Exiting");
                xmlLink.NewChild2("url", "https://www.example-code.com/vb6/async_finalize_thread_pool_on_exit.asp");

                xmlLink = xmlLinks2.NewChild("link", "");
                xmlLink.AddAttribute("lang", "nodejs");
                xmlLink.AddAttribute("linkType", "external");
                xmlLink.AddAttribute("async", "1");
                xmlLink.NewChild2("text", "How to Run a Node.js Asynchronous Task");
                xmlLink.NewChild2("url", "http://www.cknotes.com/asynchronous-chilkat-methods-in-node-js/");

                xmlLink = xmlLinks2.NewChild("link", "");
                xmlLink.AddAttribute("lang", "activex");
                xmlLink.AddAttribute("linkType", "external");
                xmlLink.AddAttribute("async", "1");
                xmlLink.NewChild2("text", "Asynchronous Methods in VB6 - Be Very Careful with Callbacks");
                xmlLink.NewChild2("url", "http://www.chilkatforum.com/questions/10870/asynchronous-methods-in-vb6-be-very-careful-with-callbacks");

                xmlLink = xmlLinks2.NewChild("link", "");
                xmlLink.AddAttribute("skiplang", "nodejs");
                xmlLink.AddAttribute("async", "1");
                xmlLink.AddAttribute("linkType", "example");
                xmlLink.NewChild2("text", "How to Run an Asynchronous Task");
                xmlLink.NewChild2("url", "async_task.asp");

                if (returnGt == ChilkatTypes.GT_OBJECT)
                {
                    xmlLink = xmlLinks2.NewChild("link", "");
                    xmlLink.AddAttribute("skiplang", "nodejs");
                    xmlLink.AddAttribute("async", "1");
                    xmlLink.AddAttribute("linkType", "example");
                    xmlLink.NewChild2("text", "How to Return an Object from an Async Task");
                    xmlLink.NewChild2("url", "async_returnObject.asp");
                }
            }


            return;
        }