Exemplo n.º 1
0
 private void Init()
 {
     AppInfos    = new ApplicationInfos();
     UserGuides  = new List <HelpItem>();
     HelpVideos  = new List <HelpItem>();
     LoadSuccess = true;
 }
Exemplo n.º 2
0
        private void ParseConfigFile()
        {
            //-----------------------------------------------------------
            // Fill the local variables with infos found in the XML file.
            //-----------------------------------------------------------
            if (m_XmlReader != null)
            {
                try
                {
                    while (m_XmlReader.Read())
                    {
                        if ((m_XmlReader.IsStartElement()) && (m_XmlReader.Name == "kinovea"))
                        {
                            while (m_XmlReader.Read())
                            {
                                if (m_XmlReader.IsStartElement())
                                {
                                    if (m_XmlReader.Name == "software")
                                    {
                                        AppInfos = ParseAppInfos();
                                    }

                                    if (m_XmlReader.Name == "lang")
                                    {
                                        ParseHelpItems();
                                    }
                                }
                                else if (m_XmlReader.Name == "kinovea")
                                {
                                    break;
                                }
                                else
                                {
                                    // Fermeture d'un tag interne.
                                }
                            }
                        }
                    }
                    LoadSuccess = true;
                }
                catch (Exception)
                {
                    // Une erreur est survenue pendant le parsing.
                    LoadSuccess = false;
                }
                finally
                {
                    m_XmlReader.Close();
                }
            }
        }
Exemplo n.º 3
0
        private ApplicationInfos ParseAppInfos()
        {
            ApplicationInfos ai = new ApplicationInfos();

            ai.Version = new ThreePartsVersion(m_XmlReader.GetAttribute("release"));

            while (m_XmlReader.Read())
            {
                if (m_XmlReader.IsStartElement())
                {
                    if (m_XmlReader.Name == "filesize")
                    {
                        ai.FileSizeInBytes = int.Parse(m_XmlReader.ReadString());
                    }

                    if (m_XmlReader.Name == "location")
                    {
                        ai.FileLocation = m_XmlReader.ReadString();
                    }

                    if (m_XmlReader.Name == "changelog")
                    {
                        ai.ChangelogLocation = m_XmlReader.ReadString();
                    }
                }
                else if (m_XmlReader.Name == "software")
                {
                    break;
                }
                else
                {
                    // Fermeture d'un tag interne.
                }
            }

            return(ai);
        }