private async Task <AVideoEntity> CreateVideo(FileInfo file) { AVideoEntity video = await videoService.FindByNameAsync(file.DirectoryName, file.Name); if (video != null) { Console.WriteLine("文件已存在..."); return(video); } video = new AVideoEntity(); video.Path = file.DirectoryName; video.Name = file.Name; video.Producer = ""; video.Title = AnimeUtils.ParseTitle(video.Name); video.Language = "ja"; video.Length = file.Length; video.XInsert_ = file.CreationTime; video.XUpdate_ = file.LastWriteTime; video = await videoService.SaveAsync(video); return(video); }
private async Task DiscoveryAnime(string path, bool children) { DirectoryInfo root = new DirectoryInfo(path); if (!root.Exists) { Console.WriteLine("目录不存在"); // 文件目录不存在 // TODO: 这里应该有个报警. return; } if (children) { DirectoryInfo[] dirs = root.GetDirectories(); foreach (var dir in dirs) { await DiscoveryAnime(dir.FullName, children); } } FileInfo[] files = root.GetFiles(); foreach (var file in files) { if (!AnimeUtils.IsMedia(file.Name)) { // 如果当前文件不是视频档案 continue; } AVideoEntity video = await CreateVideo(file); //BAuthorEntity author = await CreateAuthor(book.Author); } }
/// <summary> /// 图层移动 /// </summary> public sealed override void Moveto(Coord pos, bool swf) { if (!MatchUtils.IsEmpty(this.Target) && this.Equals(this.Target.Netmap) && this.Target.Enable && this.Enable) { try { pos = this.Extent.Correct(this.Target, this.Target.Option.Exist("Limits") ? this.Target.Option.Fetch <Bound>("Limits").Correct(this.Target, pos) : pos); } catch { pos = null; } finally { if (pos != null && (!pos.Compare(this.Target, this.Target.Center) || (new StackFrame(1)).GetMethod().Equals(typeof(Geog).GetMethod("Resize")))) { // 动画移动 if (swf) { AnimeUtils.Launch(new Action <MagicAnime, Coord, Tile>((anime, point, maper) => { try { if (!MatchUtils.IsEmpty(Tile.anime) && !Tile.anime.Equals(anime)) { Tile.anime.Abort(); } } catch { anime.Abort(); { anime = null; point = null; maper = null; } } finally { if (!MatchUtils.IsEmpty(Tile.anime = anime)) { if (!maper.Equals(maper.Target.Netmap) || maper.Target.Manual) { maper.Noswf(); { anime = null; point = null; maper = null; } } else { Pixel middle = maper.Crd2px(maper.Target.Center), finish = maper.Crd2px(point); if (!MatchUtils.IsEmpty(middle) && !MatchUtils.IsEmpty(finish)) { double dev, inv; // 移动地图 if (finish.Compare(maper.Target, middle.Offset( (inv = Math.Abs(dev = finish.X - middle.X)) > maper.Speed ? maper.Speed * inv / dev : dev, (inv = Math.Abs(dev = finish.Y - middle.Y)) > maper.Speed ? maper.Speed * inv / dev : dev ))) { maper.Noswf(); { maper.Moveto(finish); } } else { maper.Moveto(middle); } } } } } }), new Object[] { pos, this }); } else { Pixel middle = this.Crd2px(pos); if (!MatchUtils.IsEmpty(middle)) { // 地图位置 Canvas.SetTop(this.Target.Vessel, this.Nature.T = Math.Round(this.Nature.Y + this.Target.Screen.Y - middle.Y)); Canvas.SetLeft(this.Target.Vessel, this.Nature.L = Math.Round(this.Nature.X + this.Target.Screen.X - middle.X)); // 重绘地图 { this.Build(middle); } // 事件通知 this.Trigger(this.Target.Listen.DragEvent, this.Target.Center = pos); } } } } } }