Exemplo n.º 1
0
        private void button_Merge_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Filename Database Dump (*.bin)|*.bin";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (!Helper.IsFileValid(openFileDialog.FileName))
                {
                    return;
                }

                List <FilenameDatabaseEntry> newEntries;
                using (FileStream stream = File.Open(openFileDialog.FileName, FileMode.Open))
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    newEntries = (List <FilenameDatabaseEntry>)formatter.Deserialize(stream);
                }

                LoadingDialog loadingDialog = new LoadingDialog();
                loadingDialog.SetData(this);
                Thread thread = new Thread(delegate() {
                    Merge(newEntries);
                });
                loadingDialog.ShowDialog(thread);
            }
            FilenameDatabase.Save();
            filenameDatabaseDataTable1.UpdateView(false);
        }
Exemplo n.º 2
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Filename Database Dump (*.bin)|*.bin";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                FilenameDatabase.Save(saveFileDialog.FileName);
            }
        }
 private void Merge()
 {
     DescriptionChanged(this, new DescriptionChangedArgs("Merging with filename database..."));
     for (int i = 0; i < WulinshuRaymonfAPI.Entries.Count; i++)
     {
         ProgressChanged(this, new ProgressChangedArgs(i, WulinshuRaymonfAPI.Entries.Count));
         WulinshuRaymonfAPIEntry entry = WulinshuRaymonfAPI.Entries[i];
         FilenameDatabase.Add(entry.CreateDatabaseEntry());
     }
     FilenameDatabase.Save();
     Finished(this, new FinishedArgs(true));
 }
Exemplo n.º 4
0
        private void button_Generate_Click(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();

            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                FilenameCrawler crawler       = new FilenameCrawler();
                LoadingDialog   loadingDialog = new LoadingDialog();
                loadingDialog.SetData(crawler);
                Thread thread = new Thread(delegate() {
                    crawler.GenerateFilenameDatabase(folderDialog.SelectedPath);
                });
                loadingDialog.ShowDialog(thread);

                FilenameDatabase.Save();
                filenameDatabaseDataTable1.UpdateView(false);
            }
        }