コード例 #1
0
        public void ReconstructKeywordHTTP()
        {
            HTTPReconOptionDialog reconDlg = new HTTPReconOptionDialog();

            reconDlg.Owner = App.Current.MainWindow;
            if (reconDlg.ShowDialog() != true)
            {
                return;
            }
            List <string> keywords = reconDlg.Keywords.ToList();

            var dlg = new CommonOpenFileDialog();

            dlg.IsFolderPicker = true;

            var res = dlg.ShowDialog();

            if (res == CommonFileDialogResult.Ok)
            {
                ProgressDialog pdlg = new ProgressDialog();
                pdlg.Owner  = Application.Current.MainWindow;
                pdlg.Works += (o, ea) =>
                {
                    var tuple = (Tuple <BackgroundWorker, object>)ea.Argument;
                    BackgroundWorker worker = tuple.Item1;

                    ProgressChangedEventHandler h = (sender, e) =>
                    {
                        worker.ReportProgress(e.ProgressPercentage, e.UserState);
                    };
                    Fsource.ProgressChanged += h;

                    try
                    {
                        Fsource.KeywordHttpReconstruct(dlg.FileName, keywords);
                    }
                    finally
                    {
                        Fsource.ProgressChanged -= h;
                    }
                };

                pdlg.AddProgressChangedHandler((o, e) =>
                {
                    Tuple <FileAnalyze.ProgressSource, object> t = e.UserState as Tuple <FileAnalyze.ProgressSource, object>;
                    if (t.Item1 == FileAnalyze.ProgressSource.HttpReconstruct)
                    {
                        pdlg.ProgressValue  = e.ProgressPercentage;
                        pdlg.ProgressString = (string)t.Item2;
                    }
                });

                pdlg.ShowDialog();
            }
        }