コード例 #1
0
ファイル: FilesNew.cs プロジェクト: djkurtb/SBU-Extractor
        public override void CountData(string file, IWin32Window owner, DataGridViewCell cell)
        {
            dataList.Clear();

            this.countDataCell = cell;
            ExtractDataFrom    = file;

            StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom));

            ProgressEnds = sr.BaseStream.Length + 2;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = 0;
            sr.Close();

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            Thread extractionThread = new Thread(this.ExtractDataStructureThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Counting " + this.GetLabel() + "...", "Bytes");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            extractionThread.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #2
0
        private void ScanForStartEnds(IWin32Window owner)
        {
            StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom));

            ProgressEnds = sr.BaseStream.Length;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = -2;
            sr.Close();

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            Thread extractionThread = new Thread(this.ScanThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Finding Jpegs (" + this.GetLabel() + ")...", "Bytes");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            extractionThread.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #3
0
        public override void CountData(string file, IWin32Window owner, DataGridViewCell cell)
        {
            CountDataCell = cell;

            StreamReader sbu = new StreamReader(File.OpenRead(file));

            // Sets the Length of the file
            ProgressEnds = sbu.BaseStream.Length;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = -2;
            sbu.Close();

            // creates the Thread which counts the data
            Thread th = new Thread(CountDataThread);

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Counting " + Label + "...", "Bytes");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            th.Start(file);

            // shows the Progressbar as an Dialog to disable owner
            pb.ShowDialog(owner);
        }
コード例 #4
0
        public override void ExtractData(string fromFile, string toPath, IWin32Window owner)
        {
            ExtractDataFrom = fromFile;
            // add backslash to easely add the file name
            ExtractDataTo = toPath + "\\";

            // create directory if its not existing!
            if (!Directory.Exists(ExtractDataTo))
            {
                Directory.CreateDirectory(ExtractDataTo);
            }

            // Open the SBU-File
            using (StreamReader sourceFile = new StreamReader(File.OpenRead(ExtractDataFrom)))
            {
                // Set the ProgressEnds to the length of the SBU-File
                ProgressEnds = sourceFile.BaseStream.Length;
                // the Progressbar has not to be closed to early
                Progress = -2;
            }

            // create Progressbar window
            Progressbar pb = new Progressbar("Extracting " + Label + "...", "Bytes");

            // set Maximum of the Progress
            pb.SetMaximum(ProgressEnds);

            // create Threads
            Thread th   = new Thread(this.ExtractDataThread);
            Thread prbr = new Thread(this.ProgressBarThread);

            // Ask for extracting to a single file
            DialogResult res = MessageBox.Show(owner, "Extract \"" + Label + "\" to single file?", "Extraction method - " + Label,
                                               MessageBoxButtons.YesNo);

            // save the answer
            ExtractToSingleFile = res == DialogResult.Yes;

            // Start the Threads
            prbr.Start(pb);
            th.Start();


            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #5
0
ファイル: FilesNew.cs プロジェクト: djkurtb/SBU-Extractor
        public override void ExtractData(string fromFile, string toPath, IWin32Window owner)
        {
            if (fromFile != ExtractDataFrom)
            {
                this.CountData(fromFile, owner, null);
            }

            ExtractDataFrom = fromFile;
            // add backslash to easely add the file name
            ExtractDataTo = toPath + "\\";

            // create directory if its not existing!
            if (!Directory.Exists(ExtractDataTo))
            {
                Directory.CreateDirectory(ExtractDataTo);
            }

            ProgressEnds = dataList.Count + 1;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = 0;

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            Thread extractionThread = new Thread(this.ExtractDataThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Extracting " + this.GetLabel() + "...", "Files");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            extractionThread.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #6
0
ファイル: Jpeg.cs プロジェクト: djkurtb/SBU-Extractor
        public override void ExtractData(string fromFile, string toPath, IWin32Window owner)
        {
            ExtractDataFrom = fromFile;
            // add backslash to easely add the file name
            ExtractDataTo = toPath + "\\";

            // create directory if its not existing!
            if (!Directory.Exists(ExtractDataTo))
            {
                Directory.CreateDirectory(ExtractDataTo);
            }

            StreamReader sr = new StreamReader(File.OpenRead(ExtractDataFrom));

            ProgressEnds = sr.BaseStream.Length;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = -2;
            sr.Close();

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            Thread extractionThread = new Thread(this.ExtractDataThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Extracting " + this.GetLabel() + "...", "Bytes");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            extractionThread.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #7
0
        private void ExtractDataOfPositions(IWin32Window owner)
        {
            ProgressEnds = starts.Count * ends.Count;
            // is set to -2 because the Progressbar has not to be closed to early
            Progress = -2;

            // creates the Thread which updates the data for the progressbar
            Thread progressBar = new Thread(ProgressBarThread);

            Thread extractionThread = new Thread(this.ExtractThread);

            // creates the Progressbar Window
            Progressbar pb = new Progressbar("Extracting Jpegs (" + this.GetLabel() + ")...", "Possibilities");

            // Sets the Maximum of the Progressbar
            pb.SetMaximum(ProgressEnds);

            // starts both Threads
            progressBar.Start(pb);
            extractionThread.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }
コード例 #8
0
        public override void ExtractData(string fromFile, string toPath, IWin32Window owner)
        {
            ExtractDataFrom = fromFile;
            ExtractDataTo   = Path.Combine(toPath, "phonebook.xml.gz");

            if (!Directory.Exists(toPath))
            {
                Directory.CreateDirectory(toPath);
            }

            // Open the encrpted file
            using (StreamReader sourceFile = new StreamReader(File.OpenRead(ExtractDataFrom)))
            {
                // Set the ProgressEnds to the length of the file
                ProgressEnds = sourceFile.BaseStream.Length;
                // the Progressbar has not to be closed to early
                Progress = -2;
            }

            // create Progressbar window
            Progressbar pb = new Progressbar("Extracting " + GetLabel() + "...", "Bytes");

            // set Maximum of the Progress
            pb.SetMaximum(ProgressEnds);

            // create Threads
            Thread th   = new Thread(this.ExtractDataThread);
            Thread prbr = new Thread(this.ProgressBarThread);

            // Start the Threads
            prbr.Start(pb);
            th.Start();

            // show Progressbar and disable the owner
            pb.ShowDialog(owner);
        }