コード例 #1
0
        void Btn_Unpack_Click(object sender, RoutedEventArgs e)
        {
            var filenames = (from ListViewItem item in PackageList.Items
                             select item.Content as String).ToArray();

            new PleaseWait(null, "Unpacking", delegate(PleaseWait progress)
            {
                try
                {
                    FilesEditor.SetPath(0, null, progress);
                    Directory.CreateDirectory(LeftPath);
                    var streams = (from f in filenames
                                   select File.OpenRead(f) as Stream).ToArray();
                    progress.beginTask(0.3, 1.0);
                    var b = new PackageUnpack(streams, LeftPath, progress);
                    progress.endTask();
                    progress.beginTask(0.7, 1.0);
                    FilesEditor.SetPath(0, LeftPath, progress);
                    progress.endTask();
                }
                catch (Exception exc)
                {
                    progress.complete();
                    MessageBox.Show(exc.ToString(), "Error unpacking packages");
                }
            }).ShowDialog();
        }
コード例 #2
0
 void Unpack_Mod_Click(object sender, RoutedEventArgs e)
 {
     // TODO: PleaseWait
     try
     {
         string path = buildRightPath(ModPath.Text);
         if (Directory.Exists(path))
         {
             if (MessageBox.Show("This will overwrite any changes you have made\nsince the last time you packed this mod!\n\nAre you sure?", "Warning", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
             {
                 return;
             }
         }
         FilesEditor.SetPath(1, null, null);
         var stream = File.OpenRead(ModPath.Text);
         var b      = new PackageUnpack(new Stream[] { stream }, path, null);
         checkModReady();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.ToString(), "Error unpacking mod");
     }
 }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: VFedyk/sporemaster
 void Unpack_Mod_Click(object sender, RoutedEventArgs e)
 {
     // TODO: PleaseWait
     try
     {
         string path = buildRightPath(ModPath.Text);
         if (Directory.Exists(path))
         {
             if (MessageBox.Show("This will overwrite any changes you have made\nsince the last time you packed this mod!\n\nAre you sure?", "Warning", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                 return;
         }
         FilesEditor.SetPath(1, null, null);
         var stream = File.OpenRead(ModPath.Text);
         var b = new PackageUnpack(new Stream[] { stream }, path, null);
         checkModReady();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.ToString(), "Error unpacking mod");
     }
 }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: VFedyk/sporemaster
        void Btn_Unpack_Click(object sender, RoutedEventArgs e)
        {
            var filenames = (from ListViewItem item in PackageList.Items
                             select item.Content as String).ToArray();

            new PleaseWait(null, "Unpacking", delegate(PleaseWait progress)
            {
                try
                {
                    FilesEditor.SetPath(0, null, progress);
                    Directory.CreateDirectory(LeftPath);
                    var streams = (from f in filenames
                                   select File.OpenRead(f) as Stream).ToArray();
                    progress.beginTask(0.3, 1.0);
                    var b = new PackageUnpack(streams, LeftPath, progress);
                    progress.endTask();
                    progress.beginTask(0.7, 1.0);
                    FilesEditor.SetPath(0, LeftPath, progress);
                    progress.endTask();
                }
                catch (Exception exc)
                {
                    progress.complete();
                    MessageBox.Show(exc.ToString(), "Error unpacking packages");
                }

            }).ShowDialog();
        }