Beispiel #1
0
        private bool IsThumbsDBOld()
        {
            string [] tfiles   = null;
            string    thumbsDB = this.sourceDirectory + Path.DirectorySeparatorChar + "thumbsDB";

            files.Clear();

            foreach (string ext in exts)
            {
                tfiles = Directory.GetFiles(this.sourceDirectory, ext);

                foreach (string file in tfiles)
                {
                    files.Add(file);
                }
            }

            thumbNails = new ThumbnailList(files.Count);

            DateTime lastestModTime = DateTime.MinValue;

            for (int j = 0; j < files.Count; j++)
            {
                string file = (string)files[j];
                if (lastestModTime < File.GetCreationTime(file))
                {
                    lastestModTime = File.GetCreationTime(file);
                }

                if (lastestModTime < File.GetLastWriteTime(file))
                {
                    lastestModTime = File.GetLastWriteTime(file);
                }
            }

            DateTime thumbsDBTime = File.GetLastWriteTime(this.SourceDirectory + Path.DirectorySeparatorChar + "Thumbs.iw");

            if (lastestModTime > thumbsDBTime)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        private void LoadFromThumbsDB()
        {
            FileStream   f  = File.Open(this.SourceDirectory + Path.DirectorySeparatorChar + "Thumbs.iw", FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(f);

            // clear old thumbnail images
            if (thumbNails != null)
            {
                foreach (Bitmap b in thumbNails)
                {
                    if (b != null)
                    {
                        b.Dispose();
                    }
                }

                thumbNails.Clear();
            }

            thumbNails = new ThumbnailList();

            // clear old thumbnail paths
            if (files != null)
            {
                files.Clear();
            }

            while (br.BaseStream.Position != br.BaseStream.Length)
            {
                byte[] image = br.ReadBytes(10054);
                char[] pathC = br.ReadChars(1024);
                string path  = new String(pathC).Trim();

                MemoryStream ms    = new MemoryStream(image);
                Bitmap       thumb = new Bitmap(ms);
                thumbNails.Add(thumb);
                files.Add(path);

                image = null;
                pathC = null;
                path  = null;
            }

            br.Close();
        }
Beispiel #3
0
        private void LoadFromThumbsDB()
        {
            FileStream f = File.Open(this.SourceDirectory + Path.DirectorySeparatorChar + "Thumbs.iw", FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(f);

            // clear old thumbnail images
            if (thumbNails != null)
            {
                foreach (Bitmap b in thumbNails)
                {
                    if (b != null)
                        b.Dispose();
                }
                
                thumbNails.Clear();
            }

            thumbNails = new ThumbnailList();

            // clear old thumbnail paths
            if( files != null )
                files.Clear();

            while (br.BaseStream.Position != br.BaseStream.Length)
            {
                byte[] image = br.ReadBytes(10054);
                char[] pathC = br.ReadChars(1024);
                string path = new String(pathC).Trim();

                MemoryStream ms = new MemoryStream(image);
                Bitmap thumb = new Bitmap(ms);
                thumbNails.Add(thumb);
                files.Add(path);
                
                image = null;
                pathC = null;
                path = null;
            }

            br.Close();            
        }
Beispiel #4
0
        private bool IsThumbsDBOld()
        {            
            string []tfiles = null;            
            string thumbsDB = this.sourceDirectory + Path.DirectorySeparatorChar + "thumbsDB";

            files.Clear();
            
            foreach(string ext in exts )
            {
                tfiles = Directory.GetFiles(this.sourceDirectory, ext);

                foreach (string file in tfiles)
                {
                    files.Add(file);
                }
            }

            thumbNails = new ThumbnailList(files.Count);

            DateTime lastestModTime = DateTime.MinValue ;

            for (int j = 0; j < files.Count; j++)
            {
                string file = (string)files[j];
                if( lastestModTime < File.GetCreationTime(file) )
                    lastestModTime = File.GetCreationTime(file);

                if( lastestModTime < File.GetLastWriteTime(file) )
                    lastestModTime = File.GetLastWriteTime(file);
            }

            DateTime thumbsDBTime = File.GetLastWriteTime(this.SourceDirectory + Path.DirectorySeparatorChar + "Thumbs.iw");

            if (lastestModTime > thumbsDBTime)
                return true;
            else
                return false;
            
        }