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); }
private bool loadBaseEntries(Chilkat.Log log) { // Do not add base entries for CkString or CkByteData. if (GenericName.Equals("CkString") || GenericName.Equals("CkByteData")) { return(true); } Chilkat.Xml xmlBase = new Chilkat.Xml(); //string baseXmlPath = NoBaseEntries ? GenBase.m_baseUtf8XmlPath : GenBase.m_baseEntriesXmlPath; string strBaseEntriesXml = ""; if (NoBaseEntries) { strBaseEntriesXml = AppData.GetAppData("appData/apiManager/basePropUtf8.xml"); } else { strBaseEntriesXml = AppData.GetAppData("appData/apiManager/baseEntries.xml"); } if (!xmlBase.LoadXml(strBaseEntriesXml)) //if (!xmlBase.LoadXmlFile(baseXmlPath)) { log.LogError("Failed to load baseEntries.xml"); return(false); } // No longer need this.. //xmlBase.AddOrUpdateAttribute("sourceXmlPath", baseXmlPath); addClassEntries(xmlBase); return(true); }
// 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); }
// 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); }
private bool loadBaseEntries(Chilkat.Log log) { // Do not add base entries for CkString or CkByteData. if (GenericName.Equals("CkString") || GenericName.Equals("CkByteData")) { return(true); } Chilkat.Xml xmlBase = new Chilkat.Xml(); string baseXmlPath = NoBaseEntries ? GenBase.m_baseUtf8XmlPath : GenBase.m_baseEntriesXmlPath; if (!xmlBase.LoadXmlFile(baseXmlPath)) { log.LogError("Failed to load baseEntries.xml"); return(false); } xmlBase.AddOrUpdateAttribute("sourceXmlPath", baseXmlPath); addClassEntries(xmlBase); return(true); }
public bool LoadClass(string className, Chilkat.Log log) { m_methods.Clear(); m_props.Clear(); m_events.Clear(); m_methodList.Clear(); m_propList.Clear(); m_eventList.Clear(); string path = GenBase.m_xmlApiDefPath + @"/" + className + ".xml"; if (!m_xml.LoadXmlFile(path)) { log.LogData("failedToLoad", path); return(false); } // Always indicate the source of the XML in the root node. // This makes it possible to save the entire XML document from any node // by getting the root XML node, then getting the sourceXmlPath, ... m_xml.AddOrUpdateAttribute("sourceXmlPath", path); addClassEntries(m_xml); if (!this.DnEventArgs) { // The base entries never actually get added to the m_xml. They are present in the // m_methods, m_props, and m_events. if (!loadBaseEntries(log)) { log.LogError("Failed to add base entries."); return(false); } } if (!integrateCommonLinks(log)) { log.LogError("Failed to integrate common links."); return(false); } if (HasEvents) { if (!loadStandardEvents(log)) { log.LogError("Failed to add standard events."); return(false); } } m_methodList.Sort(); m_propList.Sort(); m_eventList.Sort(); // Just to be sure.. string genericName = GenericName; if (genericName.Equals("CkString") || genericName.Equals("CkByteData")) { m_hasWideCharClass = false; } return(true); }