Exemple #1
0
        private async void LoadChapterInst(Chapter C)
        {
            BookInstruction BkInst   = ( BookInstruction )CurrentBook ?? new BookInstruction(C.Book);
            XRegistry       Settings = SpiderBook.GetSettings(BkInst.ZoneId, BkInst.ZItemId);

            EpInstruction            Inst    = new EpInstruction(C, Settings);
            IEnumerable <ProcConvoy> Convoys = await Inst.Process();

            string ChapterText = "";

            foreach (ProcConvoy Konvoi in Convoys)
            {
                ProcConvoy Convoy = ProcManager.TracePackage(
                    Konvoi
                    , (d, c) =>
                    c.Payload is IEnumerable <IStorageFile> ||
                    c.Payload is IStorageFile
                    );

                if (Convoy == null)
                {
                    continue;
                }

                if (Convoy.Payload is IStorageFile)
                {
                    ChapterText += await(( IStorageFile )Convoy.Payload).ReadString();
                }
                else if (Convoy.Payload is IEnumerable <IStorageFile> )
                {
                    foreach (IStorageFile ISF in ((IEnumerable <IStorageFile>)Convoy.Payload))
                    {
                        Shared.LoadMessage("MergingContents", ISF.Name);
                        ChapterText += (await ISF.ReadString()) + "\n";
                    }
                }
            }

            await new ContentParser().ParseAsync(ChapterText, C);

            OnComplete(C);
        }