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); }
// creates the lowercase method for this string property. // if this property is not a string, then returns null. public XMethod ToLowerCaseStringMethod() { if (m_gt != ChilkatTypes.GT_STRING) { return(null); } // If this is a string property, then create an XMethod object // from the xProp that is the lowercase name returning a string with no args. XMethod xLowerCaseProp = new XMethod(); Chilkat.Xml x = cloneEntryXml(); if (x == null) { return(null); } x.Tag = "method"; string strName = StringUtil.ToLowerFirstChar(x.GetAttrValue("name")); x.UpdateAttribute("name", strName); // The "cppType" child (return type for the method) must change from "CkString &" to "const char *" //x.UpdateChildContent("cppType", "const char *"); x.NewChild2("args2", ""); xLowerCaseProp.IsLowercaseAlt = true; // Set IsLowercaseAlt before loading the XML... xLowerCaseProp.LoadMethodXml(x); return(xLowerCaseProp); }
public XMethod GetMethodByName(string name) { // If we passed the async name of the method, then // remove the Async ending, get the method, // check to see if it is async, and if so, convert it to the // async method and return it. if (name.EndsWith("Async")) { name = name.Replace("Async", ""); if (!m_methods.ContainsKey(name)) { return(null); } XMethod xMeth = (XMethod)m_methods[name]; if (!xMeth.HasAsyncFunction(GenericName)) { return(null); } XMethod xMethAsync = xMeth.CreateAsyncMethod(); return(xMethAsync); } if (!m_methods.ContainsKey(name)) { return(null); } return((XMethod)m_methods[name]); }
// creates the lowercase method for this string method. public XMethod ToLowerCaseStringMethod() { if (m_gt != ChilkatTypes.GT_STRING) { return(null); } // If this is a string method, then create an XMethod object // from the xProp that is the lowercase name returning a string with no args. XMethod xLowerCaseMeth = new XMethod(); Chilkat.Xml x = cloneEntryXml(); if (x == null) { throw new Exception(); } string strName = StringUtil.ToLowerFirstChar(x.GetAttrValue("name")); x.UpdateAttribute("name", strName); xLowerCaseMeth.m_isLowerCaseAlt = true; xLowerCaseMeth.LoadMethodXml(x); return(xLowerCaseMeth); }
public XMethod CreateAsyncMethod() { Chilkat.Xml xml = cloneEntryXml(); convertMethodToAsync(xml); XMethod asyncMethod = new XMethod(); asyncMethod.LoadMethodXml(xml); return(asyncMethod); }
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); } } }
// Load common links, such as those for UnlockComponent, from appData\apiManager\commonLinks.xml private bool integrateCommonLinks(Chilkat.Log log) { // No need for refdoc links if we're not using this code for refdoc generation. if (AppData.GitHubCodeBase) { return(true); } Chilkat.Xml xmlCommon = new Chilkat.Xml(); if (!xmlCommon.LoadXmlFile(AppData.BaseDir + "/appData/apiManager/commonLinks.xml")) { log.LogError("Failed to load commonLinks.xml"); return(false); } int i; int n = xmlCommon.NumChildren; string strName = null; for (i = 0; i < n; i++) { xmlCommon.GetChild2(i); strName = xmlCommon.GetAttrValue("name"); if ((strName != null) && xmlCommon.HasChildWithTag("links2")) { if (xmlCommon.TagEquals("method")) { XMethod method = GetMethodByName(strName); if (method != null) { xmlCommon.FindChild2("links2"); method.CopyLinks(xmlCommon); xmlCommon.GetParent2(); } } else if (xmlCommon.TagEquals("property")) { XProperty prop = GetPropertyByName(strName); if (prop != null) { xmlCommon.FindChild2("links2"); prop.CopyLinks(xmlCommon); xmlCommon.GetParent2(); } } } xmlCommon.GetParent2(); } return(true); }
void RemoveEvent(string name) { m_events.Remove(name); int n = m_eventList.Count; for (int i = 0; i < n; i++) { XMethod xMethod = (XMethod)m_eventList[i]; if (xMethod.EntryName.Equals(name)) { m_eventList.RemoveAt(i); break; } } removeXmlEntry("events", "event", name); }
public void RemoveMethod(string name) { m_methods.Remove(name); int n = m_methodList.Count; for (int i = 0; i < n; i++) { XMethod xMethod = (XMethod)m_methodList[i]; if (xMethod.EntryName.Equals(name)) { m_methodList.RemoveAt(i); break; } } removeXmlEntry("methods", "method", name); }
// Load common links, such as those for UnlockComponent, from C:\ck2000\appData\apiManager\commonLinks.xml private bool integrateCommonLinks(Chilkat.Log log) { Chilkat.Xml xmlCommon = new Chilkat.Xml(); if (!xmlCommon.LoadXmlFile(PATH_COMMON_LINKS_XML)) { log.LogError("Failed to load commonLinks.xml"); return(false); } int i; int n = xmlCommon.NumChildren; string strName = null; for (i = 0; i < n; i++) { xmlCommon.GetChild2(i); strName = xmlCommon.GetAttrValue("name"); if ((strName != null) && xmlCommon.HasChildWithTag("links2")) { if (xmlCommon.TagEquals("method")) { XMethod method = GetMethodByName(strName); if (method != null) { xmlCommon.FindChild2("links2"); method.CopyLinks(xmlCommon); xmlCommon.GetParent2(); } } else if (xmlCommon.TagEquals("property")) { XProperty prop = GetPropertyByName(strName); if (prop != null) { xmlCommon.FindChild2("links2"); prop.CopyLinks(xmlCommon); xmlCommon.GetParent2(); } } } xmlCommon.GetParent2(); } return(true); }
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; }