private void ExtractFile(TreeIter iter, string filename) { waitWindow = new WaitWindow(this, "Extracting", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); Packer.Item item = packStore.GetValue(iter, 0) as Packer.Item; new Thread(new ThreadStart(() => { if (fileSystem.Extract(item, filename)) { done.WakeupMain(); } else { error.WakeupMain(); } })).Start(); }
private void OpenPack(string filename) { if (Packer.Create(System.IO.Path.GetExtension(filename), out fileSystem)) { waitWindow = new WaitWindow(this, "Opening", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); new Thread(new ThreadStart(() => { if (fileSystem.Open(filename)) { RebuildPackTree(fileSystem.ListFiles()); ChangePackActionSensitive(true); done.WakeupMain(); } else { error.WakeupMain(); } })).Start(); } }
private void HandleAddFilesAction() { if (fileSystem == null) { return; } CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Add files to pack", FileChooserAction.Open); dlg.FileChooser.SelectMultiple = true; using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = "All"; filter.AddPattern("*.*"); dlg.FileChooser.AddFilter(filter); } dlg.Ok += (sender, e) => { packTreeView.Selection.UnselectAll(); waitWindow = new WaitWindow(this, "Adding", ""); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { dlg.Destroy(); waitWindow.Destroy(); waitWindow = null; })); new Thread(new ThreadStart(() => { dlg.FileChooser.Filenames.ToList().ForEach( file => AppendFile(currentFolder, file)); done.WakeupMain(); })).Start(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void HandleAddFolderAction() { if (fileSystem == null) { return; } CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Add folder to pack", FileChooserAction.SelectFolder); dlg.Ok += (sender, e) => { packTreeView.Selection.UnselectAll(); waitWindow = new WaitWindow(this, "Adding", ""); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); new Thread(new ThreadStart(() => { string path = dlg.FileChooser.Filename; dlg.Destroy(); Packer.Item folderItem = NewItem(currentFolder, path); TreeIter folderIter = AppendItem(currentFolder, folderItem); if (!TreeIter.Zero.Equals(folderIter)) { AppendFolders(folderIter, folderItem.HDDPath); } done.WakeupMain(); })).Start(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void HandleSaveAction() { if (fileSystem == null) { return; } CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Save pack", FileChooserAction.Save); dlg.FileChooser.SelectMultiple = false; using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = fileSystem.Extension.ToUpper(); filter.AddPattern("*." + fileSystem.Extension.ToLower()); dlg.FileChooser.AddFilter(filter); } using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = "All"; filter.AddPattern("*.*"); dlg.FileChooser.AddFilter(filter); } dlg.Ok += (sender, e) => { string filename = dlg.FileChooser.Filename; waitWindow = new WaitWindow(this, "Saving", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); new Thread(new ThreadStart(() => { if (fileSystem.Save(filename)) { done.WakeupMain(); } else { error.WakeupMain(); } })).Start(); dlg.Destroy(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void OpenPack(string filename) { if (Packer.Create(System.IO.Path.GetExtension(filename), out fileSystem)) { waitWindow = new WaitWindow(this, "Opening", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); new Thread(new ThreadStart(() => { if (fileSystem.Open(filename)) { RebuildPackTree(fileSystem.ListFiles()); ChangePackActionSensitive(true); done.WakeupMain(); } else error.WakeupMain(); })).Start(); } }
private void HandleSaveAction() { if (fileSystem == null) return; CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Save pack", FileChooserAction.Save); dlg.FileChooser.SelectMultiple = false; using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = fileSystem.Extension.ToUpper(); filter.AddPattern("*." + fileSystem.Extension.ToLower()); dlg.FileChooser.AddFilter(filter); } using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = "All"; filter.AddPattern("*.*"); dlg.FileChooser.AddFilter(filter); } dlg.Ok += (sender, e) => { string filename = dlg.FileChooser.Filename; waitWindow = new WaitWindow(this, "Saving", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); new Thread(new ThreadStart(() => { if (fileSystem.Save(filename)) done.WakeupMain(); else error.WakeupMain(); })).Start(); dlg.Destroy(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void HandleAddFolderAction() { if (fileSystem == null) return; CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Add folder to pack", FileChooserAction.SelectFolder); dlg.Ok += (sender, e) => { packTreeView.Selection.UnselectAll(); waitWindow = new WaitWindow(this, "Adding", ""); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); new Thread(new ThreadStart(() => { string path = dlg.FileChooser.Filename; dlg.Destroy(); Packer.Item folderItem = NewItem(currentFolder, path); TreeIter folderIter = AppendItem(currentFolder, folderItem); if (!TreeIter.Zero.Equals(folderIter)) AppendFolders(folderIter, folderItem.HDDPath); done.WakeupMain(); })).Start(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void HandleAddFilesAction() { if (fileSystem == null) return; CustomFileChooserDialog dlg = new CustomFileChooserDialog(this, "Add files to pack", FileChooserAction.Open); dlg.FileChooser.SelectMultiple = true; using (Gtk.FileFilter filter = new Gtk.FileFilter()) { filter.Name = "All"; filter.AddPattern("*.*"); dlg.FileChooser.AddFilter(filter); } dlg.Ok += (sender, e) => { packTreeView.Selection.UnselectAll(); waitWindow = new WaitWindow(this, "Adding", ""); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { dlg.Destroy(); waitWindow.Destroy(); waitWindow = null; })); new Thread(new ThreadStart(() => { dlg.FileChooser.Filenames.ToList().ForEach( file => AppendFile(currentFolder, file)); done.WakeupMain(); })).Start(); }; dlg.Cancel += (sender, e) => dlg.Destroy(); dlg.Show(); }
private void ExtractFile(TreeIter iter, string filename) { waitWindow = new WaitWindow(this, "Extracting", filename); waitWindow.Show(); ThreadNotify done = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; })); ThreadNotify error = new ThreadNotify(new ReadyEvent(() => { waitWindow.Destroy(); waitWindow = null; CustomMessageDialog msg = new CustomMessageDialog(this, MessageType.Error, fileSystem.LastError); msg.Run(); msg.Destroy(); })); Packer.Item item = packStore.GetValue(iter, 0) as Packer.Item; new Thread(new ThreadStart(() => { if (fileSystem.Extract(item, filename)) done.WakeupMain(); else error.WakeupMain(); })).Start(); }