Пример #1
0
        public void timer()
        {
            folder = new ClassFolder();

            string[] files = Directory.GetFiles(folder.getEntry());

            string[] contestfiles = Directory.GetFiles(folder.getContest());

            XmlSerializer serializer1 = new XmlSerializer(typeof(Entry));


            XmlSerializer serializer = new XmlSerializer(typeof(Contest));

            foreach (var c in contestfiles)
            {
                stream = File.Open(c, FileMode.Open);
            }
            if (stream != null)
            {
                contest = (Contest)serializer.Deserialize(stream);

                /**/
                foreach (var f in files)
                {
                    Stream stream1 = File.Open(f, FileMode.Open);

                    Entry entry = (Entry)serializer1.Deserialize(stream1);

                    if (contest.WinVotes(entry.vote, contest.maxVote) == true)
                    {
                        ok          = contest.WinVotes(entry.vote, contest.maxVote);
                        entryname   = entry.entry;
                        namecontest = contest.contest;

                        votes = entry.vote;
                    }

                    stream1.Close();
                }

                /**/
                DateTime dt = contest.specificDate;

                TimeSpan time = new TimeSpan(dt.Ticks);

                if (contest.IsExpired(dt) == false)
                {
                    // lblDate.Text = "Expires:\n" + dt.ToLongDateString() + " " + dt.ToLongTimeString();
                    // MessageBox.Show(dt.ToLongDateString()+" "+ dt.ToLongTimeString());
                }
                else
                {
                    /*   WINNER    */

                    // MessageBox.Show("Not this time");
                }
                stream.Close();
            }
        }