Exemple #1
0
 private void bgwListBuilder_DoWork(object sender, DoWorkEventArgs e)
 {
     _lastOpenPath = currentFileName;
     try
     {
         using (Cursors.WaitCursor)
         {
             using (BinaryReader s = new BinaryReader(new FileStream(currentFileName, FileMode.Open, FileAccess.Read)))
             {
                 char[] Magic = new char[4];
                 s.Read(Magic, 0, 4);
                 string magicStr = new string(Magic);
                 switch (magicStr)
                 {
                     case "RPF6":
                         {
                             archiveFile = new Version6();
                             break;
                         }
                     case "RPF3":
                         {
                             archiveFile = new Version3();
                             break;
                         }
                     case "RPF4":
                         {
                             archiveFile = new Version4();
                             break;
                         }
                     case "RPF7":
                         {
                             archiveFile = new Version7();
                             break;
                         }
                     default:
                         MessageBox.Show("Invalid archive selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         return;
                 }
             }
             archiveFile.Open(currentFileName);
             buildlist(archiveFile.RootDirectory);
             startBreadCrumb(archiveFile.RootDirectory);
         }
         this.Invoke((MethodInvoker)delegate
         {
             Text = Application.ProductName + " - " + new FileInfo(currentFileName).Name;
         });
     }
     catch (Exception ex)
     {
         this.Invoke((MethodInvoker)delegate
         {
             filelistview.ClearObjects();
             mainStatusbar.ItemLinks.Clear();
             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         });
     }
 }
Exemple #2
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     using (BinaryReader s = new BinaryReader(new FileStream(EntirePath, FileMode.Open, FileAccess.Read)))
     {
         try
         {
             char[] Magic = new char[4];
             s.Read(Magic, 0, 4);
             string magicStr = new string(Magic);
             s.Close();
             s.Dispose();
             switch (magicStr)
             {
                 case "RPF6":
                     {
                         archiveFile = new Version6();
                         break;
                     }
                 default:
                     MessageBox.Show(RDR_Explorer.Properties.Resources.ResourceManager.GetString("errInvArch"), RDR_Explorer.Properties.Resources.ResourceManager.GetString("err"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
             }
             archiveFile.Open(EntirePath);
             buildlist(archiveFile.RootDirectory);
             //startBreadCrumb(archiveFile.RootDirectory);
         }
         catch (Exception ex)
         {
             this.Invoke((MethodInvoker)delegate
             {
                 listView1.Items.Clear();
                 MessageBox.Show(ex.Message, RDR_Explorer.Properties.Resources.ResourceManager.GetString("err"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Application.Exit();
             });
         }
     }
 }