예제 #1
0
        public static void Insert115FileSha(List <FileItemModel> models, bool truncate = false)
        {
            var files = models.Where(x => !string.IsNullOrEmpty(x.fid)).ToList();

            Console.WriteLine($"获取到{files.Count}个文件");
            int index = 1;

            if (files != null && files.Any())
            {
                if (truncate)
                {
                    ScanDataBaseManager.TruncateOneOneFiveFileShaMapping();
                }

                foreach (var file in files)
                {
                    Console.WriteLine($"正在处理{index++}");

                    OneOneFiveFileShaMapping entity = new OneOneFiveFileShaMapping()
                    {
                        FileName  = file.n,
                        FileSize  = file.s,
                        Sha       = file.sha,
                        IsOnLocal = false
                    };

                    ScanDataBaseManager.InserOneOneFiveFileShaMapping(entity);
                }
            }
        }