示例#1
0
        void LoadDictionnary(bool merge, string fileToMerge)
        {
            if (!SetOperationRunning())
            {
                return;
            }

            //Show a progress bar. Use it to block other operations while hashDic not initialized correctly
            avBar      = new AvancementBar();
            avBar.Text = "Loading hash list ...";

            hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;

            //Building the dictionnary
            if (!merge)
            {
                t_worker = new Thread(new ThreadStart(hashDic.LoadHashList));
                t_worker.Start();
            }
            else
            {
                t_worker = new Thread(new ParameterizedThreadStart(hashDic.MergeHashList));
                t_worker.Start(fileToMerge);
            }

            //Wait until the dictionnary is loaded
            avBar.ShowDialog();
            hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
            avBar.Dispose();

            OperationFinished(); //valid here because we are waiting for the dialog
        }
        private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (CurrentMypFH != null)
            {
                CurrentMypFH.Dispose();
            }
            t_worker.Abort();

            if (hashDic.needsSave == true)
            {
                avBar              = new AvancementBar();
                avBar.Text         = "Saving hash list ...";
                hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;
                t_worker           = new Thread(new ThreadStart(hashDic.SaveHashList));
                t_worker.Start();

                avBar.ShowDialog();
                hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
                avBar.Dispose();
            }
            Application.Exit();
        }
示例#3
0
        private void mergeDictionaryFile_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openArchiveDialog.Filter = "Dictionary File|*.txt";
            if (openArchiveDialog.ShowDialog() == DialogResult.OK)
            {
                if (!SetOperationRunning())
                {
                    return;
                }

                //Show a progress bar
                avBar              = new AvancementBar();
                avBar.Text         = "Merging hash list ...";
                hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;
                t_worker           = new Thread(new ParameterizedThreadStart(hashDic.MergeHashList));
                t_worker.Start(openArchiveDialog.FileName);
                //Wait until the dictionnary is loaded
                avBar.ShowDialog();
                hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
                avBar.Dispose();

                OperationFinished();
            }
        }
        private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (CurrentMypFH != null)
                CurrentMypFH.Dispose();
            t_worker.Abort();

            if (hashDic.needsSave == true)
            {
                avBar = new AvancementBar();
                avBar.Text = "Saving hash list ...";
                hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;
                t_worker = new Thread(new ThreadStart(hashDic.SaveHashList));
                t_worker.Start();

                avBar.ShowDialog();
                hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
                avBar.Dispose();
            }
            Application.Exit();
        }
示例#5
0
        private void mergeDictionaryFile_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openArchiveDialog.Filter = "Dictionary File|*.txt";
            if (openArchiveDialog.ShowDialog() == DialogResult.OK)
            {
                if (!SetOperationRunning()) return;

                //Show a progress bar
                avBar = new AvancementBar();
                avBar.Text = "Merging hash list ...";
                hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;
                t_worker = new Thread(new ParameterizedThreadStart(hashDic.MergeHashList));
                t_worker.Start(openArchiveDialog.FileName);
                //Wait until the dictionnary is loaded
                avBar.ShowDialog();
                hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
                avBar.Dispose();

                OperationFinished();
            }
        }
示例#6
0
        void LoadDictionnary(bool merge, string fileToMerge)
        {
            if (!SetOperationRunning()) return;

            //Show a progress bar. Use it to block other operations while hashDic not initialized correctly
            avBar = new AvancementBar();
            avBar.Text = "Loading hash list ...";

            hashDic.HashEvent += avBar.UpdateDictionaryEventHandler;

            //Building the dictionnary
            if (!merge)
            {
                t_worker = new Thread(new ThreadStart(hashDic.LoadHashList));
                t_worker.Start();
            }
            else
            {
                t_worker = new Thread(new ParameterizedThreadStart(hashDic.MergeHashList));
                t_worker.Start(fileToMerge);
            }

            //Wait until the dictionnary is loaded
            avBar.ShowDialog();
            hashDic.HashEvent -= avBar.UpdateDictionaryEventHandler;
            avBar.Dispose();

            OperationFinished(); //valid here because we are waiting for the dialog
        }