// Get this entry's reference doc links. // Return null for no links. private RefdocLinks initRefdocLinks() { if (AppData.GitHubCodeBase) { return(null); } Chilkat.Xml pXml = m_xml; Chilkat.Xml xml = new Chilkat.Xml(); if (m_name.Equals("LastErrorText")) { string strXml = AppData.GetAppData("appData/refdoc/LastErrorTextLinks.xml"); xml.LoadXml(strXml); //if (!xml.LoadXmlFile(AppData.BaseDir + "/appData/refdoc/LastErrorTextLinks.xml")) return null; pXml = xml; } else if (m_name.Equals("UnlockComponent")) { string strXml = AppData.GetAppData("appData/refdoc/UnlockComponentLinks.xml"); xml.LoadXml(strXml); //if (!xml.LoadXmlFile(AppData.BaseDir + "/appData/refdoc/UnlockComponentLinks.xml")) return null; pXml = xml; } else if (m_name.Equals("Utf8")) { string strXml = AppData.GetAppData("appData/refdoc/Utf8Links.xml"); xml.LoadXml(strXml); //if (!xml.LoadXmlFile(AppData.BaseDir + "/appData/refdoc/Utf8Links.xml")) return null; pXml = xml; } else { pXml = m_xml.FindChild("links2"); if (pXml == null) { pXml = m_xml.NewChild("links2", ""); } } if (pXml == null) { return(null); } //if (pXml.NumChildren == 0) return null; RefdocLinks rdl = new RefdocLinks(); if (!rdl.UseRefdocLinks(pXml)) { return(null); } return(rdl); }
public void InitNewMethod(string name) { m_xml = new Chilkat.Xml(); m_xml.Tag = "method"; m_xml.AddAttribute("name", name); m_xml.NewChild2("gType", "void"); m_xml.NewChild2("descrip", ""); Chilkat.Xml xArgs = m_xml.NewChild("args2", ""); m_name = name; m_methodArgs = new MethodArgs(xArgs); }
public void LoadMethodXml(Chilkat.Xml p) { this.loadEntryXml(p); Chilkat.Xml xArgs2 = p.FindChild("args2"); if (xArgs2 == null) { xArgs2 = p.NewChild("args2", ""); } m_methodArgs = new MethodArgs(xArgs2); }
public void initNewProperty(string name) { m_xml = new Chilkat.Xml(); m_xml.Tag = "property"; m_xml.AddAttribute("name", name); m_xml.NewChild2("gType", "bool"); m_xml.NewChild2("descrip", ""); m_xml.UpdateAttribute("read", "1"); m_xml.UpdateAttribute("write", "1"); Chilkat.Xml xArgs = m_xml.NewChild("args2", ""); m_name = name; m_methodArgs = new MethodArgs(xArgs); }
public void AddMethod(XMethod xMethod) { if (xMethod == null) { return; } if (ContainsMethod(xMethod.EntryName)) { throw new Exception(); } m_methodList.Add(xMethod); m_methodList.Sort(); m_methods.Add(xMethod.EntryName, xMethod); Chilkat.Xml x = m_xml.FindChild("methods"); if (x == null) { x = m_xml.NewChild("methods", ""); } Chilkat.Xml xm = xMethod.GetXml_careful(); x.AddChildTree(xm); return; }
public void loadPropXml(Chilkat.Xml p) { this.loadEntryXml(p); // Properties can NEVER be write-only. They can only be read-write or read-only. m_readOnly = !m_xml.HasAttrWithValue("write", "1"); // Ensure that we have a m_methodArgs object, even for a property, which should be empty. Chilkat.Xml xArgs2 = p.FindChild("args2"); if (xArgs2 == null) { xArgs2 = p.NewChild("args2", ""); } m_methodArgs = new MethodArgs(xArgs2); }
// 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"); // Add to the links, because these standard links will be placed in the superscript link area.. Chilkat.Xml xmlLinks2 = xml.FindChild("links2"); if (xmlLinks2 == null) { xmlLinks2 = xml.NewChild("links2", ""); } Chilkat.Xml xmlLink; xmlLink = xmlLinks2.NewChild("link", ""); xmlLink.AddAttribute("lang", "activex"); xmlLink.AddAttribute("linkType", "external"); xmlLink.AddAttribute("async", "1"); xmlLink.AddAttribute("superscriptAsync", "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.AddAttribute("superscriptAsync", "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.AddAttribute("superscriptAsync", "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("superscriptAsync", "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("superscriptAsync", "1"); xmlLink.AddAttribute("linkType", "example"); xmlLink.NewChild2("text", "How to Return an Object from an Async Task"); xmlLink.NewChild2("url", "async_returnObject.asp"); } //} return; }