Beispiel #1
0
        private bool loadStandardEvents(Chilkat.Log log)
        {
            Chilkat.Xml xml = new Chilkat.Xml();
            if (StandardEventsXmlStr == null)
            {
                StandardEventsXmlStr = AppData.GetAppData("appData/apiManager/standardEvents.xml");
            }

            //if (!xml.LoadXmlFile(standardEventsXmlPath))
            if (!xml.LoadXml(StandardEventsXmlStr))
            {
                log.LogError("Failed to load standard events XML");
                return(false);
            }
            // No longer need this..
            //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 #2
0
        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);
        }
 static public string GenerateForMicroVersion()
 {
     if (m_genForMicroVersion == null)
     {
         m_genForMicroVersion = AppData.GetAppData("appData/apiManager/generateForMicroVersion.txt").Trim();
         //System.IO.File.ReadAllText(@"C:\ck2000\appData\apiManager\generateForMicroVersion.txt").Trim();
     }
     return(m_genForMicroVersion);
 }
        // 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);
        }
        static public ArrayList GetGenericClassNameList()
        {
            Chilkat.StringTable st = new Chilkat.StringTable();
            if (m_classListText == null)
            {
                m_classListText = AppData.GetAppData("appData/apiManager/classList.txt");
                if (m_classListText == null)
                {
                    return(null);
                }
            }
            Chilkat.StringBuilder sb = new Chilkat.StringBuilder();
            sb.Append(m_classListText);

            if (!st.AppendFromSb(sb))
            {
                return(null);
            }

            ArrayList alist = new ArrayList();

            int n = st.Count;
            int i;

            for (i = 0; i < n; i++)
            {
                string cname = st.StringAt(i);
                if (string.IsNullOrWhiteSpace(cname))
                {
                    continue;
                }
                alist.Add(cname);
            }

            return(alist);
        }
Beispiel #6
0
        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 strClassXml = AppData.GetAppData("appData/apiDef2/" + className + ".xml");

            //string path = GenBase.m_xmlApiDefPath + @"/" + className + ".xml";
            //if (!m_xml.LoadXmlFile(path))
            if (!m_xml.LoadXml(strClassXml))
            {
                log.LogData("failedToLoadClass", className);
                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, ...
            // No longer need this..
            //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);
        }