示例#1
0
        private void DoExtractHandler(object sender, DoWorkEventArgs e)
        {
            extractProgress = 0;
            if (fileNodeList.Count > 0)
            {
                FileNode rootnode = fileNodeList[0];
                totalProgress = rootnode.getSelectedCount();
                SetProgressbarMax(totalProgress);
                SetProgressbar(0, totalProgress);
            }
            if (totalProgress == 0)
            {
                if (!CNMode)
                {
                    PrintLog("Nothing selected.");
                }
                else
                {
                    PrintLog("未选择任何文件");
                }
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    ExtractBtn.IsEnabled     = true;
                    RegExCheckBox.IsEnabled  = true;
                    FilterBox.IsEnabled      = true;
                    ApplyFilterBtn.IsEnabled = true;
                    PauseBtn.Visibility      = Visibility.Hidden;
                    TerminateBtn.Visibility  = Visibility.Hidden;
                }));
                return;
            }
            if (!CNMode)
            {
                PrintLog("Export to: " + outputDirectory, true);
                PrintLog("It may take a long time to extract all the files you selected which depends on the file size and amount you selected.");
            }
            else
            {
                PrintLog("解包至: " + outputDirectory, true);
                PrintLog("根据你所选取的文件数量和大小,这可能会花费很长时间,请耐心等待");
            }
            int failed = 0;

            if (mergeChecked)
            {
                chunkMap.FirstOrDefault().Value.ExtractSelected(fileNodeList, outputDirectory, this);
            }
            else
            {
                failed = mainChunk.ExtractSelected(fileNodeList, outputDirectory, this);
            }
            if (failed > 0)
            {
                if (!CNMode)
                {
                    PrintLog($"{failed} files failed to extract in total.");
                }
                else
                {
                    PrintLog($"总计{failed}个文件提取失败");
                }
            }
            Dispatcher.BeginInvoke(new Action(() =>
            {
                ExtractBtn.IsEnabled     = true;
                RegExCheckBox.IsEnabled  = true;
                FilterBox.IsEnabled      = true;
                ApplyFilterBtn.IsEnabled = true;
                PauseBtn.Visibility      = Visibility.Hidden;
                TerminateBtn.Visibility  = Visibility.Hidden;
                PauseBtn.Background      = System.Windows.Media.Brushes.Orange;
                PauseBtn.Content         = CNMode ? "暂停" : "Pause";
                terminateFlag            = false;
                pauseFlag = false;
            }));
            if (!CNMode)
            {
                PrintLog("Finished!");
            }
            else
            {
                PrintLog("提取完成!");
            }
        }
示例#2
0
        private void DoExtractHandler(object sender, DoWorkEventArgs e)
        {
            extract_progress = 0;
            if (itemlist.Count > 0)
            {
                FileNode rootnode = itemlist[0];
                total_progress = rootnode.getSelectedCount();
                setProgressbarMax(total_progress);
                setProgressbar(0, total_progress);
            }
            if (total_progress == 0)
            {
                if (!CNMode)
                {
                    printlog("Nothing selected.");
                }
                else
                {
                    printlog("未选择任何文件");
                }
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    ExtractBtn.IsEnabled    = true;
                    RegExCheckBox.IsEnabled = true;
                    FilterBox.IsEnabled     = true;
                }));
                return;
            }
            if (!CNMode)
            {
                printlog("Export to: " + output_directory, true);
                printlog("It may take a long time to extract all the files you selected which depends on the file size and amount you selected.");
            }
            else
            {
                printlog("解包至: " + output_directory, true);
                printlog("根据你所选取的文件数量和大小,这可能会花费很长时间,请耐心等待");
            }
            int failed = 0;

            if (filterText != "")
            {
                filterEnabled = true;
                if (regexEnabled)
                {
                    filterRegex = new Regex(filterText);
                }
                else
                {
                    filterRegex = null;
                }
            }
            else
            {
                filterEnabled = false;
            }
            if (CombineChecked)
            {
                chunkMap.FirstOrDefault().Value.ExtractSelected(itemlist, output_directory, this);
            }
            else
            {
                failed = mainChunk.ExtractSelected(itemlist, output_directory, this);
            }
            if (failed > 0)
            {
                if (!CNMode)
                {
                    printlog($"{failed} files failed to extract in total.");
                }
                else
                {
                    printlog($"总计{failed}个文件提取失败");
                }
            }
            Dispatcher.BeginInvoke(new Action(() =>
            {
                ExtractBtn.IsEnabled    = true;
                RegExCheckBox.IsEnabled = true;
                FilterBox.IsEnabled     = true;
            }));
            if (!CNMode)
            {
                printlog("Finished!");
            }
            else
            {
                printlog("提取完成!");
            }
        }