Пример #1
0
        /// <summary>
        /// Check to see if API is installed
        /// </summary>
        /// <param name="version">Check version number</param>
        /// <param name="name">Check API name</param>
        /// <returns>true if installed</returns>
        public int IsAPIInstalled(string version, string name)
        {
            int success = 0;

            /// Check for 2.1 version
            if (version.StartsWith("2.1.0"))
            {
                version = "2.1.0";
            }

            if (_installedAPIList != null)
            {
                APIClass result = _installedAPIList.Find(i => i.Version.Contains(version));

                if (result != null)
                {
                    success = 1;
                }
            }

            if (_installedNDKList != null)
            {
                APIClass result = _installedNDKList.Find(i => i.Version.Contains(version));

                if (result != null)
                {
                    success = 2;
                }
            }

            return(success);
        }
Пример #2
0
        /// <summary>
        /// Get list of installed APIs
        /// </summary>
        /// <returns></returns>
        public void GetInstalledAPIList()
        {
            try
            {
                _installedAPIList = new List <APIClass>();
                _installedNDKList = new List <APIClass>();

                string[] dirPaths = new string[2];
                dirPaths[0] = bbndkPathConst + @"\..\qconfig\";
                dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\";

                for (int i = 0; i < 2; i++)
                {
                    string[] filePaths = Directory.GetFiles(dirPaths[i], "*.xml");
                    foreach (string file in filePaths)
                    {
                        try
                        {
                            XmlDocument xmlDoc = new XmlDocument();
                            xmlDoc.Load(file);
                            XmlNodeList name       = xmlDoc.GetElementsByTagName("name");
                            XmlNodeList version    = xmlDoc.GetElementsByTagName("version");
                            XmlNodeList hostpath   = xmlDoc.GetElementsByTagName("host");
                            XmlNodeList targetpath = xmlDoc.GetElementsByTagName("target");

                            if (i == 0)
                            {
                                APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0).InnerText);
                                _installedAPIList.Add(aclass);
                            }
                            else
                            {
                                APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0) == null ? "2.1.0" : version.Item(0).InnerText);
                                _installedNDKList.Add(aclass);
                            }
                        }
                        catch
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #3
0
        /// <summary>
        /// Get list of installed APIs
        /// </summary>
        /// <returns></returns>
        private void GetInstalledNDKList()
        {
            try
            {
                _installedNDKList = new List<APIClass>();

                string dirPaths = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\";

                string[] filePaths = Directory.GetFiles(dirPaths, "*.xml");
                foreach (string file in filePaths)
                {
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(file);
                        XmlNodeList name = xmlDoc.GetElementsByTagName("name");
                        XmlNodeList version = xmlDoc.GetElementsByTagName("version");
                        XmlNodeList hostpath = xmlDoc.GetElementsByTagName("host");
                        XmlNodeList targetpath = xmlDoc.GetElementsByTagName("target");

                        APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0) == null ? "2.1.0" : version.Item(0).InnerText);
                        _installedNDKList.Add(aclass);
                    }
                    catch
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
Пример #4
0
        /// <summary>
        /// Get list of installed APIs
        /// </summary>
        /// <returns></returns>
        private void GetInstalledAPIList()
        {
            try
            {
                _installedAPIList = new List<APIClass>();

                string dirPaths = GlobalFunctions.bbndkPathConst + @"\..\qconfig\";

                string[] filePaths = Directory.GetFiles(dirPaths, "*.xml");
                foreach (string file in filePaths)
                {
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(file);
                        XmlNodeList name = xmlDoc.GetElementsByTagName("name");
                        XmlNodeList version = xmlDoc.GetElementsByTagName("version");
                        XmlNodeList hostpath = xmlDoc.GetElementsByTagName("host");
                        XmlNodeList targetpath = xmlDoc.GetElementsByTagName("target");

                        APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0).InnerText);
                        _installedAPIList.Add(aclass);
                    }
                    catch
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }