Exemplo n.º 1
0
        public static void CheckAvatorMatch()
        {
            Dictionary <string, List <string> > matchRecord = new Dictionary <string, List <string> >();
            List <string> avators = new List <string>();
            var           folder  = @"G:\Github\AllInOneAV\Setting\avator";
            var           avs     = JavDataBaseManager.GetActress();

            foreach (var f in Directory.GetDirectories(folder))
            {
                foreach (var a in Directory.GetFiles(f))
                {
                    if (!avators.Contains(a))
                    {
                        avators.Add(a);
                    }
                }
            }

            foreach (var a in avs)
            {
                foreach (var m in avators.OrderByDescending(x => x.Length))
                {
                    if (m.Contains(a.Name))
                    {
                        if (!matchRecord.ContainsKey(a.Name))
                        {
                            matchRecord.Add(a.Name, new List <string>()
                            {
                                m.Replace(@"G:\Github\AllInOneAV\Setting\", @"\Imgs\").Replace(@"\", "/")
                            });
                            break;
                        }
                    }
                }
            }

            foreach (var m in matchRecord)
            {
                ScanDataBaseManager.UpdateFaviAvator(m.Key, m.Value.FirstOrDefault());
            }

            Console.ReadKey();
        }