internal static List <AbstractCompetition> GetCompetitions()
        {
            IEnumerable <string>       competitions    = ImagePaths.GetCompetitionZipFilesList();
            List <AbstractCompetition> competitionList = new List <AbstractCompetition>();

            foreach (var item in competitions)
            {
                var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                var competitionFileName = ImagePaths.RemoveSourcePathStart(item);
                if (competitionFileName.ToLower().EndsWith(".iris"))
                {
                    var competitionDateString = competitionFileName.Substring(0, 10);
                    var competitionDate       = DateTime.Parse(competitionDateString);
                    var competitionName       = competitionFileName.Substring(0, competitionFileName.Length - 5);

                    if (competitionDate >= today)
                    {
                        CompetitionHelper.ExtractFiles(competitionName);
                        CompetitionHelper.CreateDatabase(competitionName);

                        AbstractCompetition competition = CompetitionFactory.Load(competitionName);
                        competitionList.Add(competition);
                    }
                }
            }
            return(competitionList);
        }
 public CompetitionPanel(AbstractCompetition competition, XmlNode eachPanelNode, int panelPosition)
 {
     this.competition   = competition;
     this.eachPanelNode = eachPanelNode;
     this.panelPosition = panelPosition;
     this.panelAuthor   = eachPanelNode.Attributes["author"].InnerText;
     this.panelId       = panelAuthor + "_" + panelPosition + ".jpg";
 }
        internal CompetitionImage(AbstractCompetition competition, string imagePath, string title, string author, int imagePosition)
        {
            this.competition   = competition;
            this.imagePosition = imagePosition;

            this.imagePath   = imagePath;
            this.imageTitle  = title;
            this.imageAuthor = author;
        }
        internal CompetitionImage(AbstractCompetition competition, XmlNode imageNode, int imagePosition)
        {
            this.competition   = competition;
            this.imagePosition = imagePosition;

            this.imagePath   = imageNode.InnerText;
            this.imageTitle  = imageNode.Attributes["title"].InnerText;
            this.imageAuthor = imageNode.Attributes["author"].InnerText;
            this.imageId     = imageNode.Attributes["id"].InnerText;
            this.audioPath   = imageNode.Attributes["audio"].InnerText;
        }
        internal static AbstractCompetition Load(string competitionFileName)
        {
            string competitionDirectory     = ImagePaths.GetExtractDirectory(competitionFileName);
            AbstractCompetition competition = null;

            try
            {
                // Load image order details
                XmlDocument orderingDocument = new XmlDocument();
                orderingDocument.Load(competitionDirectory + "/" + CONTROL_FILENAME);
                XmlNode rootNode         = orderingDocument.FirstChild;
                string  competitionStyle = rootNode["Style"].InnerText;
                string  clubName         = rootNode["Club"].InnerText;
                string  trophyName       = rootNode["Trophy"].InnerText;
                string  competitionKey   = rootNode["CompKey"].InnerText;
                string  resultsKey       = rootNode["ResultsKey"].InnerText;
                bool    scoring          = rootNode["Scoring"].InnerText.ToLower() == "true";

                switch (competitionStyle.ToLower())
                {
                case "panel":
                    competition = LoadPanelCompetition(competitionFileName, competitionDirectory, rootNode, clubName, trophyName, competitionKey, resultsKey);
                    break;

                default:
                    competition = LoadSingleImageCompetition(competitionFileName, competitionDirectory, rootNode, clubName, trophyName, scoring, competitionKey, resultsKey);
                    break;
                }
            }
            catch (Exception e)
            {
                string clubName   = "Competition zip file broken";
                string trophyName = e.Message;
                competition = new Competition(competitionFileName, competitionDirectory, clubName, trophyName, null, null);
            }

            return(competition);
        }