Esempio n. 1
0
        private async void ViewDebugLog(object sender, RoutedEventArgs e)
        {
            if (ActionBlocked)
            {
                return;
            }
            ActionBlocked = true;

            FieldInfo LogInfo = ( FieldInfo )(( Button )sender).DataContext;

            StorageFile ISF = await AppStorage.MkTemp();

            string Location = FileLinks.ROOT_LOG + LogInfo.GetValue(null);

            if (Shared.Storage.FileExists(Location))
            {
                Bootstrap.LogInstance?.Stop();

                using (Stream s = Shared.Storage.GetStream(Location))
                    using (Stream ts = await ISF.OpenStreamForWriteAsync())
                    {
                        await s.CopyToAsync(ts);
                    }

                Bootstrap.LogInstance?.Start();
            }

            await ControlFrame.Instance.CloseSubView();

            ControlFrame.Instance.SubNavigateTo(MainSettings.Instance, () => new DirectTextViewer(ISF));
        }
Esempio n. 2
0
        private async void PreviewContent(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0 || TestRunning.IsActive)
            {
                return;
            }
            TestRunning.IsActive = true;

            TOCItem Item = ( TOCItem )e.AddedItems[0];
            Chapter Ch   = Item.Ch;

            if (Ch == null)
            {
                ProcManager.PanelMessage(ID, "Chapter is not available", LogType.INFO);
                return;
            }

            string                   VId     = Ch.Volume.Meta[AppKeys.GLOBAL_VID];
            string                   CId     = Ch.Meta[AppKeys.GLOBAL_CID];
            EpInstruction            EpInst  = TempInst.GetVolInsts().First(x => x.VId == VId).EpInsts.Cast <EpInstruction>().First(x => x.CId == CId);
            IEnumerable <ProcConvoy> Convoys = await EpInst.Process();

            StorageFile TempFile = await AppStorage.MkTemp();

            StringResources stx = StringResources.Load("LoadingMessage");

            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)
                {
                    await TempFile.WriteFile(( IStorageFile )Convoy.Payload, true, new byte[] { ( byte )'\n' });
                }
                else if (Convoy.Payload is IEnumerable <IStorageFile> )
                {
                    foreach (IStorageFile ISF in ((IEnumerable <IStorageFile>)Convoy.Payload))
                    {
                        ProcManager.PanelMessage(ID, string.Format(stx.Str("MergingContents"), ISF.Name), LogType.INFO);
                        await TempFile.WriteFile(ISF, true, new byte[] { ( byte )'\n' });
                    }
                }
            }

            ShowSource(TempFile);
            TestRunning.IsActive = false;
        }
Esempio n. 3
0
        private async void SaveTemp(DRequestCompletedEventArgs e, DownloadBookContext Context)
        {
            StorageFile ISF = await AppStorage.MkTemp(
                Context.Id
                + ". "
                + (string.IsNullOrEmpty(Context.Title) ? "[ Parse Needed ]" : Context.Title)
                + ".txt"
                );

            await ISF.WriteBytes(e.ResponseBytes);

            ViewSource.BSData.ImportItem(new LocalBook(ISF));
        }
Esempio n. 4
0
        private async Task ViewTestResult(BookInstruction Payload)
        {
            if (PreviewFile == null)
            {
                PreviewFile = await AppStorage.MkTemp();
            }

            await PreviewFile.WriteString(Payload.PlainTextInfo);

            var j = Dispatcher.RunIdleAsync(
                x => Frame.Navigate(typeof(DirectTextViewer), PreviewFile)
                );
        }
Esempio n. 5
0
        private async Task ViewTestResult(IEnumerable <BookInstruction> Payload)
        {
            if (Payload.Count() == 0)
            {
                return;
            }

            IStorageFile PreviewFile = await AppStorage.MkTemp();

            await PreviewFile.WriteString(
                string.Join("\n<<<<<<<<<<<<<<\n", Payload.Select(x => x.PlainTextInfo)));

            var j = Dispatcher.RunIdleAsync(
                x => Frame.Navigate(typeof(DirectTextViewer), PreviewFile)
                );
        }
Esempio n. 6
0
        private async void ViewBgTaskConf(object sender, RoutedEventArgs e)
        {
            if (ActionBlocked)
            {
                return;
            }
            ActionBlocked = true;

            StorageFile ISF = await AppStorage.MkTemp();

            await ISF.WriteString(new XRegistry( "<tasks />", FileLinks.ROOT_SETTING + FileLinks.TASKS ).ToString());

            await ControlFrame.Instance.CloseSubView();

            ControlFrame.Instance.SubNavigateTo(MainSettings.Instance, () => new DirectTextViewer(ISF));
        }
Esempio n. 7
0
        private async void ClearDebugLog(object sender, RoutedEventArgs e)
        {
            if (ActionBlocked)
            {
                return;
            }
            ActionBlocked = true;

            FieldInfo LogInfo  = ( FieldInfo )(( Button )sender).DataContext;
            string    Location = FileLinks.ROOT_LOG + LogInfo.GetValue(null);

            StorageFile ISF = await AppStorage.MkTemp();

            if (Shared.Storage.FileExists(Location))
            {
                Bootstrap.LogInstance?.Stop();
                Shared.Storage.DeleteFile(Location);
                Bootstrap.LogInstance?.Start();
            }

            ActionBlocked = false;
        }