예제 #1
0
파일: M0000.cs 프로젝트: MewX/wenku10
        private async Task M0003_Books_TypeW()
        {
            if (!X.Exists)
            {
                return;
            }

            string VRoot = "shared/transfers/Volumes/";

            if (!Shared.Storage.DirExist(VRoot))
            {
                return;
            }

            string IntroRoot = "intro/";

            List <Book> Entries = new List <Book>();

            string[] Dirs = Shared.Storage.ListDirs(VRoot);
            int      l    = Dirs.Length;

            await Dirs.ExecEach(async ( Id, i ) =>
            {
                MesgR(stx.Text("MightTakeAWhile") + string.Format("{1}/{2} ( {0} )", Id, i + 1, l));
                BookItem Item = X.Instance <BookItem>(XProto.BookItemEx, Id);

                if (Shared.Storage.FileExists(IntroRoot + Id + ".txt"))
                {
                    Item.Info.LongDescription = Shared.Storage.GetString(IntroRoot + Id + ".txt");
                }

                await Item.XCallAsync <bool>("Migrate", VRoot + Id);
                Entries.Add(Item.Entry);
            });

            MesgR(stx.Text("SavingRecords"));
            Shared.BooksDb.SaveBooks(Entries.ToArray());

            Purge(IntroRoot);
            Purge(VRoot);
        }