Exemplo n.º 1
0
        /// <summary>
        /// get a list of available images for the given date
        /// </summary>
        /// <param name="date">DateTime</param>
        public void GetImages(DateTime date)
        {
            Images.Clear();

            if (!File.Exists(Path.Combine(m_folder, c_image_db)))
            {
                EnumerateToFile();
            }

            List <String> files = File.ReadAllLines(Path.Combine(m_folder, c_image_db)).ToList <String>();

            foreach (String file in files)
            {
                String[] split = file.Split(new String[] { "$_$" }, StringSplitOptions.RemoveEmptyEntries);
                if (split.Length > 1)
                {
                    ImageInfo inf = new ImageInfo()
                    {
                        Path = split[0], Name = split[1]
                    };
                    inf.ParseDateTime(split[1]);
                    if (inf.DateOf(date))
                    {
                        Images.Add(inf);
                    }
                }
            }

            // finally sort by datetime
            Images.Sort(delegate(ImageInfo c1, ImageInfo c2) { return(c1.ImageDateTime.CompareTo(c2.ImageDateTime)); });
        }