Ejemplo n.º 1
0
        private static void DeleteRelevantFiles(bool debug = false)
        {
            StreamWriter strm = null;

            if (debug)
            {
                strm = new StreamWriter(new FileInfo("delete.txt").OpenWrite());
            }

            foreach (var pa in HumanProccesedList)
            {
                foreach (var p in pa)
                {
                    if (debug)
                    {
                        strm.WriteLine("'{1}': {0}".SFormat(p.First, p.Last));
                    }

                    switch (p.First)
                    {
                    case "del":
                        Cache.RemoveFile(p.Last);

                        new FileInfo(Path.GetFullPath(Path.Combine(RelDir, p.Last))).Delete();

                        if (debug)
                        {
                            strm.WriteLine("'{0}' deleted".SFormat(p.Last));
                        }
                        break;

                    case "keep":
                    default:
                        break;
                    }
                }
            }

            if (debug)
            {
                strm.Close();
            }

            Cache.WriteCache();
        }
Ejemplo n.º 2
0
        private static int LoadCachedFiles(string cachefile = "cache.hash")
        {
            Cache = new HashCache(new FileInfo(cachefile));

            int iters = CompareUtils.LoadImageHashes(RelDir, Cache);

            foreach (string file in Cache.Filenames)
            {
                var fulf = Path.GetFullPath(Path.Combine(RelDir, file));

                if (!new FileInfo(fulf).Exists)
                {
                    Cache.RemoveFile(file);
                }
            }

            Cache.WriteCache();

            return(iters);
        }