Rev 224 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once#include "SpkForm.h"#include "AddDialog.h"#include "../../common/InputBox.h"#include "PackageInfo.h"#include "ConvertFile.h"#undef GetTempPath#define VERSION 1.30#define BETA 0namespace SpkExplorer {using namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;/// <summary>/// Summary for Form1////// WARNING: If you change the name of this class, you will need to change the/// 'Resource File Name' property for the managed resource compiler tool/// associated with all .resx files this class depends on. Otherwise,/// the designers will not be able to interact properly with localized/// resources associated with this form./// </summary>public ref class Form1 : public System::Windows::Forms::Form{public:Form1(array<System::String ^> ^args){InitializeComponent();this->AllowDrop = true;this->DoToolTips();this->Closed += gcnew System::EventHandler(this, &Form1::CloseEvent);this->Text = "SPK Explorer " + GetProgramVersionString((float)VERSION, (int)BETA);m_pLoadedList = new Utils::WStringList;m_pPackages = new CPackages;m_pPackages->startup(L".", _WS(IO::Path::GetTempPath()), _WS(Environment::GetFolderPath(Environment::SpecialFolder::Personal)));this->UpdateDisplay();m_curView = System::Windows::Forms::View::Details;m_lCopiedFiles = new CLinkList<C_File>;m_pCutFrom = nullptr;m_lDraggedFiles = new CLinkList<C_File>;m_pDraggedFrom = nullptr;m_iLocX = m_iLocY = -1;this->LoadData();if ( args )this->OpenFiles(args, true, true);}CLinkList<C_File> *CopiedFiles() { return m_lCopiedFiles; }void PastedFiles() { m_lCopiedFiles->clear(); this->ToolPaste->Enabled = false; }void DoToolTips(){this->toolTip1->SetToolTip(this->button1, "Click to close all open windows");}void RemoveCopied(bool deleteFrom){if ( m_lCopiedFiles->size() ){// restore the fileif ( m_pCutFrom && !deleteFrom )m_pCutFrom->RestoreCut(m_lCopiedFiles);elsem_lCopiedFiles->MemoryClear();m_pCutFrom = nullptr;m_lCopiedFiles->clear();this->ToolPaste->Enabled = false;}}void CopyFile(C_File *f, bool first){if ( first )this->RemoveCopied(false);C_File *newFile = new C_File();newFile->CopyData(f);m_lCopiedFiles->push_back(newFile);this->ToolPaste->Enabled = true;}void CutFile(C_File *f, SpkForm ^From, bool first){if ( first || From != m_pCutFrom )this->RemoveCopied(false);m_lCopiedFiles->push_back(f);m_pCutFrom = From;this->ToolPaste->Enabled = true;}void DragFile(C_File *f, SpkForm ^From){if ( m_pDraggedFrom != From )m_lDraggedFiles->clear();m_lDraggedFiles->push_back(f);m_pDraggedFrom = From;}SpkForm ^DragFromForm(){return m_pDraggedFrom;}void Dragged(SpkForm ^ToForm, bool copy){if ( !m_pDraggedFrom || m_lDraggedFiles->empty() )return;if ( m_pDraggedFrom != ToForm ){if ( copy ){for ( C_File *f = m_lDraggedFiles->First(); f; f = m_lDraggedFiles->Next() ){C_File *newFile = new C_File();newFile->CopyData(f);ToForm->DroppedFile(newFile);}}else{for ( C_File *f = m_lDraggedFiles->First(); f; f = m_lDraggedFiles->Next() ){m_pDraggedFrom->DraggedFile(f);ToForm->DroppedFile(f);}}}m_pDraggedFrom = nullptr;m_lDraggedFiles->clear();}void LoadData(){System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );CFileIO Config;if ( Config.open(_WS(mydoc) + L"/Egosoft/spkexplorer.dat") ){std::vector<Utils::WString> lines;if(Config.readLines(lines)){for (size_t i = 0; i < lines.size(); i++ ){Utils::WString line(lines.at(i));Utils::WString start = line.token(L":", 1).lower();Utils::WString rest = line.tokens(L":", 2).removeFirstSpace();if ( start.Compare(L"ExplorerSize") )this->Size = System::Drawing::Size(rest.token(L" ", 1).toInt(), rest.token(L" ", 2).toInt());else if ( start.Compare(L"ExplorerPos") ){m_iLocX = rest.token(L" ", 1).toInt();m_iLocY = rest.token(L" ", 2).toInt();}else if ( start.Compare(L"Loaded") )m_pLoadedList->pushBack(rest);else if ( start.Compare(L"ExplorerMax") )this->WindowState = FormWindowState::Maximized;}}}}void UpdateDisplay(){bool e = (this->tabControl1->HasChildren) ? true : false;SpkForm ^active = this->GetActiveChild();CBaseFile *activePackage = NULL;if ( active )activePackage = active->GetPackage();elsee = false;this->panel1->Visible = e;this->tabControl1->Visible = e;this->ToolPaste->Enabled = false;bool e2 = (activePackage) ? e : false;this->ToolExtract->Visible = false;this->ToolExtract2->Visible = false;this->ToolExtractAll2->Visible = false;this->toolStripButton1->Visible = false;this->ToolAdd->Visible = false;this->ToolAdd2->Visible = false;this->ToolRemove->Visible = false;this->ToolRemove2->Visible = false;if ( active && active->IsMultiPackage() ){this->ToolExtract2->Visible = true;this->ToolExtractAll2->Visible = true;this->ToolAdd2->Visible = true;this->ToolRemove2->Visible = true;}else{this->ToolExtract->Visible = true;this->toolStripButton1->Visible = true;this->ToolAdd->Visible = true;this->ToolRemove->Visible = true;}this->toolStripMenuItem1->Enabled = e;this->ToolExtractAll2->Enabled = e;this->toolStripButton1->Enabled = e2;this->ToolAdd->Enabled = e;this->ToolAdd2->Enabled = e;this->ToolInfo->Enabled = e2;this->toolStripMenuItem3->Enabled = e;if ( e && m_lCopiedFiles->size() )this->ToolPaste->Enabled = e2;this->UpdateDropDownOpen();if ( !e ){this->SelectedFile(false);this->SelectedPackage(false, false);}if ( !e || !activePackage )this->StatusFiles->Text = "";elsethis->StatusFiles->Text = "Files: " + activePackage->fileList().size() + " (" + _US(activePackage->fileSizeString()) + ")";}void SelectedFile(bool selected){this->ToolExtract->Enabled = selected;this->ToolRemove->Enabled = selected;}void SelectedPackage(bool fSelected, bool pSelected){this->ToolInfo->Enabled = pSelected;this->ToolExtract2->Enabled = (fSelected || pSelected) ? true : false;this->packagesToolStripMenuItem->Enabled = pSelected;this->filesToolStripMenuItem->Enabled = fSelected;this->ToolRemove2->Enabled = (fSelected || pSelected) ? true : false;this->toolStripMenuItem2->Enabled = pSelected;this->toolStripMenuItem4->Enabled = pSelected;this->toolStripMenuItem5->Enabled = pSelected;this->toolStripMenuItem6->Enabled = fSelected;}void UpdateDropDownOpen(){// clear them allthis->toolStripSplitButton1->DropDownItems->Clear();System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;newItem->Text = "Open Directory";newItem->Tag = "$DIR";newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);this->toolStripSplitButton1->DropDownItems->Add(newItem);this->toolStripSplitButton1->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());// add all none open itemsfor (auto itr = m_pLoadedList->begin(); itr != m_pLoadedList->end(); itr++){// check if we have it openSystem::String ^sFile = _US((*itr)->str.findReplace(L"/", L"\\"));if ( this->IsOpen(sFile) )continue;if ( this->IsOpen(_US((*itr)->str.findReplace(L"\\", L"/"))) )continue;// otherwise add it to the listSystem::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;newItem->Text = sFile;newItem->Tag = newItem->Text;newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);this->toolStripSplitButton1->DropDownItems->Add(newItem);}}void SaveData(){System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );CFileIO Config(_WS(mydoc) + L"/Egosoft/spkexplorer.dat");Utils::WStringList lines;if ( this->WindowState == FormWindowState::Normal ){lines.pushBack(Utils::WString(L"ExplorerSize:") + (long)this->Size.Width + L" " + (long)this->Size.Height);lines.pushBack(Utils::WString(L"ExplorerPos:") + (long)this->Location.X + L" " + (long)this->Location.Y);}else{lines.pushBack(Utils::WString(L"ExplorerPos:") + (long)this->RestoreBounds.Location.X + L" " + (long)this->RestoreBounds.Location.Y);lines.pushBack(Utils::WString(L"ExplorerSize:") + (long)this->RestoreBounds.Size.Width + L" " + (long)this->RestoreBounds.Size.Height);}if ( this->WindowState == FormWindowState::Maximized )lines.pushBack(L"ExplorerMax:");for (auto itr = m_pLoadedList->begin(); itr != m_pLoadedList->end(); itr++)lines.pushBack(Utils::WString(L"Loaded:") + (*itr)->data + L" " + (*itr)->str);Config.writeFile(&lines);}void CloseEvent(System::Object ^Sender, System::EventArgs ^E){this->CloseAll();this->SaveData();}protected:int m_iLocX;int m_iLocY;CPackages *m_pPackages;private: System::Windows::Forms::Panel^ panel1;protected:private: System::Windows::Forms::Button^ button1;private: System::Windows::Forms::ToolTip^ toolTip1;private: System::Windows::Forms::Timer^ timer1;private: System::Windows::Forms::ToolStripButton^ ToolAdd;private: System::Windows::Forms::ToolStripButton^ ToolRemove;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator4;private: System::Windows::Forms::ToolStripButton^ ToolPaste;private: System::Windows::Forms::ImageList^ imageList1;private: System::Windows::Forms::StatusStrip^ statusStrip1;private: System::Windows::Forms::ToolStripStatusLabel^ StatusFiles;private: System::Windows::Forms::ToolStripMenuItem^ layoutToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ maximisedToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator5;private: System::Windows::Forms::ToolStripMenuItem^ cascadeToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ tileVerticallyToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ tileHorizontalToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ ToolWindows;private: System::Windows::Forms::ToolStripMenuItem^ closeAllToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator6;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator7;private: System::Windows::Forms::ToolStripButton^ ToolInfo;private: System::Windows::Forms::ToolStripButton^ ToolExtract;private: System::Windows::Forms::ToolStripButton^ toolStripButton1;private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip1;private: System::Windows::Forms::ToolStripMenuItem^ packageToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem1;private: System::Windows::Forms::ToolStripDropDownButton^ ToolExtract2;private: System::Windows::Forms::ToolStripMenuItem^ packagesToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ filesToolStripMenuItem;private: System::Windows::Forms::ToolStripDropDownButton^ ToolExtractAll2;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem1;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem2;private: System::Windows::Forms::ToolStripDropDownButton^ ToolAdd2;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem3;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem4;private: System::Windows::Forms::ToolStripDropDownButton^ ToolRemove2;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem5;private: System::Windows::Forms::ToolStripMenuItem^ toolStripMenuItem6;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3;/// <summary>/// Clean up any resources being used./// </summary>~Form1(){if (components){delete components;}delete m_pLoadedList;}private: System::Windows::Forms::MenuStrip^ menuStrip1;protected:private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ openToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;private: System::Windows::Forms::ToolStrip^ toolStrip1;private: System::Windows::Forms::ToolStripSplitButton^ toolStripSplitButton1;private: System::Windows::Forms::ToolStripMenuItem^ viewToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ detailsToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ largeIconToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ listToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2;private: System::Windows::Forms::TabControl^ tabControl1;private:SpkForm ^GetActiveChild(){cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )return childForm;}return nullptr;}bool IsOpen(System::String ^file){cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( childForm->CheckFilename(file) )return true;}return false;}void ExtractSelected(){SpkForm ^child = this->GetActiveChild();if ( child ){System::String ^toDir = GetExtractDir(false);if ( toDir )child->ExtractSelected(toDir);}}void ExtractSelectedPackage(){SpkForm ^child = this->GetActiveChild();if ( child && child->IsMultiPackage() ){System::String ^toDir = GetExtractDir(true);if ( toDir )child->ExtractSelectedPackage(toDir);}}System::String ^GetExtractDir(bool package){SpkForm ^child = this->GetActiveChild();if ( child )return child->GetExtractDir(package);return nullptr;}void ExtractAll(){SpkForm ^child = this->GetActiveChild();if ( child ){System::String ^toDir = GetExtractDir(false);if ( toDir )child->ExtractAll(toDir);}}void ExtractAllPackage(){SpkForm ^child = this->GetActiveChild();if ( child && child->IsMultiPackage() ){System::String ^toDir = GetExtractDir(false);if ( toDir )child->ExtractAllPackage(toDir);}}void OpenDirectory(System::String ^dir){if ( !System::IO::Directory::Exists(dir) ){MessageBox::Show(this, "Unable to open packages from directory\nDirectory not found\n\n" + dir, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);return;}this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);}void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display){if ( !list )return;for ( int i = 0; i < list->Length; i++ )this->Open(list[i], display, checkExtension);cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( !childForm->TabPage()->Visible ){childForm->Show();childForm->TabPage()->Show();}}}void OpenFiles(ArrayList ^list, bool checkExtension, bool display){if ( !list )return;for ( int i = 0; i < list->Count; i++ )this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( !childForm->TabPage()->Visible ){childForm->Show();childForm->TabPage()->Show();}}}void Open(System::String ^file, bool display, bool checkExtension){if ( checkExtension ){if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 )return;}if ( !System::IO::File::Exists(file) ){if ( display )MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);return;}float fVersion;Utils::WString sFile = _WS(file);int fileType = CSpkFile::CheckFile(sFile, &fVersion);if ( fVersion > (float)FILEVERSION ){if ( display )MessageBox::Show(this, "Package file is created with a newer version, unable to open", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);return;}if ( fileType == SPKFILE_INVALID ){if ( display ){if ( String::Compare(IO::FileInfo(file).Extension, ".xsp") == 0){if ( MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nThis could be an old format XSP file, would u like to attempt to convert the file?\nThis will overright the existing file", "Load Error", MessageBoxButtons::YesNo, MessageBoxIcon::Error) == Windows::Forms::DialogResult::Yes ){ConvertFile ^convert = gcnew ConvertFile(file);if ( convert->ShowDialog(this) == Windows::Forms::DialogResult::OK )this->Open(file, display, checkExtension);elseMessageBox::Show(this, "Invalid package file:\n" + file + "\n\nUnable to convert package\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);}}elseMessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);}return;}// open multi packageTabPage ^tp;SpkForm ^childForm;int error;if ( fileType == SPKFILE_MULTI ){CMultiSpkFile *mspk = m_pPackages->openMultiPackage(sFile, &error);if ( mspk ){tp = gcnew TabPage();childForm = gcnew SpkForm(this, tabControl1, tp, m_pPackages);childForm->SetMultiPackage(mspk, file);tp->ImageIndex = this->imageList1->Images->IndexOfKey("multi");if ( tp->ImageIndex == -1 )tp->ImageIndex = 0;}}else{CBaseFile *package = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);if ( package ){tp = gcnew TabPage();if ( this->imageList1->Images->IndexOfKey(file) == -1 ){if (package->icon()){package->ReadIconFileToMemory();Utils::WString sIconFile = _WS(IO::Path::GetTempPath()) + L"\\" + CFileIO(sFile).baseName() + L"." + package->iconExt();if ( package->extractFile(package->icon(), CFileIO(sIconFile).fullFilename(), false)){String ^iconFile = _US(sIconFile);if ( IO::File::Exists(iconFile) ){String ^ext = System::IO::FileInfo(iconFile).Extension;if ( !String::Compare(ext, "bmp", false) || !String::Compare(ext, "ico", false) )this->imageList1->Images->Add(file, Bitmap::FromFile(iconFile));else{Bitmap ^myBitmap = gcnew Bitmap(iconFile);if ( myBitmap )this->imageList1->Images->Add(file, myBitmap);}}}}}tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);if ( tp->ImageIndex == -1 )tp->ImageIndex = 0;childForm = gcnew SpkForm(this, tabControl1, tp, m_pPackages);childForm->SetPackage(package, file);}}if ( tp && childForm ){ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(file, this->imageList1->Images[tp->ImageIndex], gcnew System::EventHandler(this, &Form1::WindowSelectEvent));childForm->SetToolButton(toolBut);this->ToolWindows->DropDownItems->Add(toolBut);tp->Parent = tabControl1;childForm->Text = file;if ( display || !this->HasChildren ){tp->Show();childForm->Show();tabControl1->SelectedTab = tp;}childForm->WindowState = FormWindowState::Maximized;childForm->ChangeView(m_curView);// adjust the loaded listsFile = sFile.findReplace(L"/", L"\\").remove(9).remove('\r').remove('\n');m_pLoadedList->remove(sFile);m_pLoadedList->pushFront(sFile);while ( m_pLoadedList->size() > 15 )m_pLoadedList->popBack();this->SaveData();this->UpdateDropDownOpen();}else{if ( display ){System::String ^sError = "Unknown Error (" + _US(Utils::WString::Number(error)) + ")";switch ( error ){case INSTALLERR_OLD:sError = "Old unsupported package file";break;case INSTALLERR_INVALID:sError = "Invalid Package File";break;case INSTALLERR_NOMULTI:sError = "Multi-Packages not currently supported";break;}MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);}}}void Open(){OpenFileDialog ^ofd = gcnew OpenFileDialog();ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";ofd->FilterIndex = 1;ofd->RestoreDirectory = true;ofd->Multiselect = true;if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )this->OpenFiles(ofd->FileNames, false, true);}void CloseAll(){cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){delete ((SpkForm ^)children[i])->TabPage();delete children[i];}this->RemoveCopied(true);this->UpdateDisplay();}void ChangeView(System::Windows::Forms::View view){this->listToolStripMenuItem->Checked = false;this->largeIconToolStripMenuItem->Checked = false;this->detailsToolStripMenuItem->Checked = false;cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];childForm->ChangeView(view);}m_curView = view;}void LoadFiles(String ^loadFrom){if ( System::IO::File::Exists(loadFrom) ){System::String ^lines = System::IO::File::ReadAllText(loadFrom);try { System::IO::File::Delete(loadFrom); }catch (System::IO::IOException ^) {}catch (System::Exception ^) {}if ( lines ){Utils::WString strLines = _WS(lines);std::vector<Utils::WString> aLines;if(strLines.tokenise(L"\n", aLines)){ArrayList ^list = gcnew ArrayList();for (size_t i = 0; i < aLines.size(); i++ ){Utils::WString l = aLines[i];l = l.findRemove(L"\r");Utils::WString first = l.token(L":", 1);Utils::WString rest = l.tokens(L":", 2);rest.removeFirstSpace();if ( first.Compare(L"File") )list->Add(_US(rest));}this->OpenFiles(list, true, true);}}}}void AddPackage(){SpkForm ^active = this->GetActiveChild();if ( !active )return;if ( !active->IsMultiPackage() )return;OpenFileDialog ^ofd = gcnew OpenFileDialog();ofd->Filter = "All Vaild|*.spk;*.xsp|Packages|*.spk|Ships|*.xsp";ofd->FilterIndex = 1;ofd->RestoreDirectory = true;ofd->Multiselect = true;ofd->Title = "Select packages(s) to add";if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK ){AddDialog ^ad = gcnew AddDialog(NULL, active->GetMultiPackage());ad->AddFileArray(ofd->FileNames, "", -1, 0);ad->ShowDialog(this);active->UpdateView(false);}}void AddFile(){SpkForm ^active = this->GetActiveChild();if ( !active )return;CBaseFile *activePackage = active->GetPackage();if ( !activePackage )return;// add filtersOpenFileDialog ^ofd = gcnew OpenFileDialog();System::String ^filter;for ( int i = 0; i < FILETYPE_MAX; i++ ){if ( filter )filter += "|";filter += _US(GetFileTypeString(i));filter += "|";// add extensionsswitch ( i ){case FILETYPE_SCRIPT:case FILETYPE_UNINSTALL:case FILETYPE_MAP:case FILETYPE_TEXT:case FILETYPE_MISSION:filter += "*.pck;*.xml";break;case FILETYPE_README:filter += "*.txt;*.doc";break;case FILETYPE_MOD:filter += "*.cat";break;case FILETYPE_SOUND:filter += "*.wav";break;case FILETYPE_SCREEN:case FILETYPE_ADVERT:filter += "*.jpg;*.png";break;case FILETYPE_SHIPSCENE:case FILETYPE_COCKPITSCENE:filter += "*.pbd;*.bod";break;case FILETYPE_SHIPMODEL:filter += "*.pbd;*.bod;*.bob;*.pbb";break;default:filter += "*.*";}}ofd->Filter = filter;ofd->FilterIndex = 1;ofd->RestoreDirectory = true;ofd->Multiselect = true;ofd->Title = "Select File(s) to add to package";if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK ){System::String ^dir;if ( (ofd->FilterIndex - 1) == FILETYPE_EXTRA ){InputBox ^input = gcnew InputBox("Enter the directory for extra files", "PluginManager/Extras/$scriptname");if ( input->ShowDialog() == System::Windows::Forms::DialogResult::OK )dir = input->GetInput();}AddDialog ^ad = gcnew AddDialog(activePackage, active->GetMultiPackage());ad->AddFileArray(ofd->FileNames, dir, ofd->FilterIndex - 1, 0);ad->ShowDialog(this);active->UpdateView(false);}}void RemoveSelectedPackage(){SpkForm ^child = this->GetActiveChild();if ( child )child->RemoveSelectedPackage();}void RemoveSelected(){SpkForm ^child = this->GetActiveChild();if ( child )child->RemoveSelected();}System::Windows::Forms::View m_curView;Utils::WStringList *m_pLoadedList;CLinkList<C_File> *m_lCopiedFiles;SpkForm ^m_pCutFrom;CLinkList<C_File> *m_lDraggedFiles;SpkForm ^m_pDraggedFrom;private: System::ComponentModel::IContainer^ components;/// <summary>/// Required designer variable./// </summary>#pragma region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>void InitializeComponent(void){this->components = (gcnew System::ComponentModel::Container());System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->layoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->maximisedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->cascadeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->tileVerticallyToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->tileHorizontalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());this->detailsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->largeIconToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->listToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->ToolWindows = (gcnew System::Windows::Forms::ToolStripMenuItem());this->closeAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());this->toolStripSplitButton1 = (gcnew System::Windows::Forms::ToolStripSplitButton());this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());this->ToolAdd = (gcnew System::Windows::Forms::ToolStripButton());this->ToolAdd2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());this->toolStripMenuItem3 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripMenuItem4 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->ToolRemove2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());this->toolStripMenuItem5 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripMenuItem6 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->ToolRemove = (gcnew System::Windows::Forms::ToolStripButton());this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());this->ToolExtract2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());this->packagesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->filesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->ToolExtract = (gcnew System::Windows::Forms::ToolStripButton());this->ToolExtractAll2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());this->toolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripMenuItem2 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());this->ToolPaste = (gcnew System::Windows::Forms::ToolStripButton());this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());this->ToolInfo = (gcnew System::Windows::Forms::ToolStripButton());this->tabControl1 = (gcnew System::Windows::Forms::TabControl());this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));this->panel1 = (gcnew System::Windows::Forms::Panel());this->button1 = (gcnew System::Windows::Forms::Button());this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());this->StatusFiles = (gcnew System::Windows::Forms::ToolStripStatusLabel());this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));this->packageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->fileToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->menuStrip1->SuspendLayout();this->toolStrip1->SuspendLayout();this->panel1->SuspendLayout();this->statusStrip1->SuspendLayout();this->contextMenuStrip1->SuspendLayout();this->SuspendLayout();//// menuStrip1//this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->fileToolStripMenuItem,this->viewToolStripMenuItem, this->ToolWindows});this->menuStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;this->menuStrip1->Location = System::Drawing::Point(0, 0);this->menuStrip1->Name = L"menuStrip1";this->menuStrip1->Size = System::Drawing::Size(746, 24);this->menuStrip1->TabIndex = 1;this->menuStrip1->Text = L"menuStrip1";//// fileToolStripMenuItem//this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->openToolStripMenuItem,this->toolStripSeparator1, this->exitToolStripMenuItem});this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);this->fileToolStripMenuItem->Text = L"&File";//// openToolStripMenuItem//this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"openToolStripMenuItem.Image")));this->openToolStripMenuItem->Name = L"openToolStripMenuItem";this->openToolStripMenuItem->Size = System::Drawing::Size(103, 22);this->openToolStripMenuItem->Text = L"&Open";this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);//// toolStripSeparator1//this->toolStripSeparator1->Name = L"toolStripSeparator1";this->toolStripSeparator1->Size = System::Drawing::Size(100, 6);//// exitToolStripMenuItem//this->exitToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"exitToolStripMenuItem.Image")));this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";this->exitToolStripMenuItem->Size = System::Drawing::Size(103, 22);this->exitToolStripMenuItem->Text = L"E&xit";this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);//// viewToolStripMenuItem//this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(5) {this->layoutToolStripMenuItem,this->toolStripSeparator5, this->detailsToolStripMenuItem, this->largeIconToolStripMenuItem, this->listToolStripMenuItem});this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);this->viewToolStripMenuItem->Text = L"&View";//// layoutToolStripMenuItem//this->layoutToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(4) {this->maximisedToolStripMenuItem,this->cascadeToolStripMenuItem, this->tileVerticallyToolStripMenuItem, this->tileHorizontalToolStripMenuItem});this->layoutToolStripMenuItem->Name = L"layoutToolStripMenuItem";this->layoutToolStripMenuItem->Size = System::Drawing::Size(110, 22);this->layoutToolStripMenuItem->Text = L"Layout";//// maximisedToolStripMenuItem//this->maximisedToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"maximisedToolStripMenuItem.Image")));this->maximisedToolStripMenuItem->Name = L"maximisedToolStripMenuItem";this->maximisedToolStripMenuItem->Size = System::Drawing::Size(151, 22);this->maximisedToolStripMenuItem->Text = L"Maximised";this->maximisedToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::maximisedToolStripMenuItem_Click);//// cascadeToolStripMenuItem//this->cascadeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"cascadeToolStripMenuItem.Image")));this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";this->cascadeToolStripMenuItem->Size = System::Drawing::Size(151, 22);this->cascadeToolStripMenuItem->Text = L"Cascade";this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);//// tileVerticallyToolStripMenuItem//this->tileVerticallyToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"tileVerticallyToolStripMenuItem.Image")));this->tileVerticallyToolStripMenuItem->Name = L"tileVerticallyToolStripMenuItem";this->tileVerticallyToolStripMenuItem->Size = System::Drawing::Size(151, 22);this->tileVerticallyToolStripMenuItem->Text = L"Tile Vertical";this->tileVerticallyToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileVerticallyToolStripMenuItem_Click);//// tileHorizontalToolStripMenuItem//this->tileHorizontalToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"tileHorizontalToolStripMenuItem.Image")));this->tileHorizontalToolStripMenuItem->Name = L"tileHorizontalToolStripMenuItem";this->tileHorizontalToolStripMenuItem->Size = System::Drawing::Size(151, 22);this->tileHorizontalToolStripMenuItem->Text = L"Tile Horizontal";this->tileHorizontalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileHorizontalToolStripMenuItem_Click);//// toolStripSeparator5//this->toolStripSeparator5->Name = L"toolStripSeparator5";this->toolStripSeparator5->Size = System::Drawing::Size(107, 6);//// detailsToolStripMenuItem//this->detailsToolStripMenuItem->Checked = true;this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;this->detailsToolStripMenuItem->Name = L"detailsToolStripMenuItem";this->detailsToolStripMenuItem->Size = System::Drawing::Size(110, 22);this->detailsToolStripMenuItem->Text = L"Details";this->detailsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::detailsToolStripMenuItem_Click);//// largeIconToolStripMenuItem//this->largeIconToolStripMenuItem->Name = L"largeIconToolStripMenuItem";this->largeIconToolStripMenuItem->Size = System::Drawing::Size(110, 22);this->largeIconToolStripMenuItem->Text = L"Icons";this->largeIconToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::largeIconToolStripMenuItem_Click);//// listToolStripMenuItem//this->listToolStripMenuItem->Name = L"listToolStripMenuItem";this->listToolStripMenuItem->Size = System::Drawing::Size(110, 22);this->listToolStripMenuItem->Text = L"List";this->listToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::listToolStripMenuItem_Click);//// ToolWindows//this->ToolWindows->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->closeAllToolStripMenuItem,this->toolStripSeparator6});this->ToolWindows->Name = L"ToolWindows";this->ToolWindows->Size = System::Drawing::Size(68, 20);this->ToolWindows->Text = L"Windows";//// closeAllToolStripMenuItem//this->closeAllToolStripMenuItem->Name = L"closeAllToolStripMenuItem";this->closeAllToolStripMenuItem->Size = System::Drawing::Size(120, 22);this->closeAllToolStripMenuItem->Text = L"Close All";this->closeAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::closeAllToolStripMenuItem_Click);//// toolStripSeparator6//this->toolStripSeparator6->Name = L"toolStripSeparator6";this->toolStripSeparator6->Size = System::Drawing::Size(117, 6);//// toolStrip1//this->toolStrip1->GripStyle = System::Windows::Forms::ToolStripGripStyle::Hidden;this->toolStrip1->ImageScalingSize = System::Drawing::Size(32, 32);this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(15) {this->toolStripSplitButton1,this->toolStripSeparator2, this->ToolAdd, this->ToolAdd2, this->ToolRemove2, this->ToolRemove, this->toolStripSeparator3, this->ToolExtract2,this->ToolExtract, this->ToolExtractAll2, this->toolStripButton1, this->toolStripSeparator4, this->ToolPaste, this->toolStripSeparator7,this->ToolInfo});this->toolStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;this->toolStrip1->Location = System::Drawing::Point(0, 24);this->toolStrip1->Name = L"toolStrip1";this->toolStrip1->Size = System::Drawing::Size(746, 54);this->toolStrip1->TabIndex = 2;this->toolStrip1->Text = L"toolStrip1";//// toolStripSplitButton1//this->toolStripSplitButton1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripSplitButton1.Image")));this->toolStripSplitButton1->ImageTransparentColor = System::Drawing::Color::Magenta;this->toolStripSplitButton1->Name = L"toolStripSplitButton1";this->toolStripSplitButton1->RightToLeft = System::Windows::Forms::RightToLeft::No;this->toolStripSplitButton1->Size = System::Drawing::Size(84, 51);this->toolStripSplitButton1->Text = L"Open";this->toolStripSplitButton1->ButtonClick += gcnew System::EventHandler(this, &Form1::toolStripSplitButton1_ButtonClick);//// toolStripSeparator2//this->toolStripSeparator2->Name = L"toolStripSeparator2";this->toolStripSeparator2->Size = System::Drawing::Size(6, 54);//// ToolAdd//this->ToolAdd->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolAdd.Image")));this->ToolAdd->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolAdd->Name = L"ToolAdd";this->ToolAdd->Size = System::Drawing::Size(54, 51);this->ToolAdd->Text = L"Add File";this->ToolAdd->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->ToolAdd->Click += gcnew System::EventHandler(this, &Form1::toolStripButton2_Click);//// ToolAdd2//this->ToolAdd2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripMenuItem3,this->toolStripMenuItem4});this->ToolAdd2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolAdd2.Image")));this->ToolAdd2->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolAdd2->Name = L"ToolAdd2";this->ToolAdd2->Size = System::Drawing::Size(63, 51);this->ToolAdd2->Text = L"Add File";this->ToolAdd2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;//// toolStripMenuItem3//this->toolStripMenuItem3->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem3.Image")));this->toolStripMenuItem3->Name = L"toolStripMenuItem3";this->toolStripMenuItem3->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem3->Text = L"Packages";this->toolStripMenuItem3->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem3_Click);//// toolStripMenuItem4//this->toolStripMenuItem4->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem4.Image")));this->toolStripMenuItem4->Name = L"toolStripMenuItem4";this->toolStripMenuItem4->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem4->Text = L"Files";this->toolStripMenuItem4->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem4_Click);//// ToolRemove2//this->ToolRemove2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripMenuItem5,this->toolStripMenuItem6});this->ToolRemove2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolRemove2.Image")));this->ToolRemove2->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolRemove2->Name = L"ToolRemove2";this->ToolRemove2->Size = System::Drawing::Size(84, 51);this->ToolRemove2->Text = L"Remove File";this->ToolRemove2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;//// toolStripMenuItem5//this->toolStripMenuItem5->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem5.Image")));this->toolStripMenuItem5->Name = L"toolStripMenuItem5";this->toolStripMenuItem5->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem5->Text = L"Packages";this->toolStripMenuItem5->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem5_Click);//// toolStripMenuItem6//this->toolStripMenuItem6->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem6.Image")));this->toolStripMenuItem6->Name = L"toolStripMenuItem6";this->toolStripMenuItem6->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem6->Text = L"Files";this->toolStripMenuItem6->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem6_Click);//// ToolRemove//this->ToolRemove->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolRemove.Image")));this->ToolRemove->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolRemove->Name = L"ToolRemove";this->ToolRemove->Size = System::Drawing::Size(75, 51);this->ToolRemove->Text = L"Remove File";this->ToolRemove->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->ToolRemove->Click += gcnew System::EventHandler(this, &Form1::ToolRemove_Click);//// toolStripSeparator3//this->toolStripSeparator3->Name = L"toolStripSeparator3";this->toolStripSeparator3->Size = System::Drawing::Size(6, 54);//// ToolExtract2//this->ToolExtract2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->packagesToolStripMenuItem,this->filesToolStripMenuItem});this->ToolExtract2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolExtract2.Image")));this->ToolExtract2->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolExtract2->Name = L"ToolExtract2";this->ToolExtract2->Size = System::Drawing::Size(102, 51);this->ToolExtract2->Text = L"Extract Selected";this->ToolExtract2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;//// packagesToolStripMenuItem//this->packagesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"packagesToolStripMenuItem.Image")));this->packagesToolStripMenuItem->Name = L"packagesToolStripMenuItem";this->packagesToolStripMenuItem->Size = System::Drawing::Size(123, 22);this->packagesToolStripMenuItem->Text = L"Packages";this->packagesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packagesToolStripMenuItem_Click);//// filesToolStripMenuItem//this->filesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"filesToolStripMenuItem.Image")));this->filesToolStripMenuItem->Name = L"filesToolStripMenuItem";this->filesToolStripMenuItem->Size = System::Drawing::Size(123, 22);this->filesToolStripMenuItem->Text = L"Files";this->filesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::filesToolStripMenuItem_Click);//// ToolExtract//this->ToolExtract->Enabled = false;this->ToolExtract->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolExtract.Image")));this->ToolExtract->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolExtract->Name = L"ToolExtract";this->ToolExtract->Size = System::Drawing::Size(93, 51);this->ToolExtract->Text = L"Extract Selected";this->ToolExtract->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->ToolExtract->Click += gcnew System::EventHandler(this, &Form1::ToolExtract_Click);//// ToolExtractAll2//this->ToolExtractAll2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->toolStripMenuItem1,this->toolStripMenuItem2});this->ToolExtractAll2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolExtractAll2.Image")));this->ToolExtractAll2->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolExtractAll2->Name = L"ToolExtractAll2";this->ToolExtractAll2->Size = System::Drawing::Size(72, 51);this->ToolExtractAll2->Text = L"Extract All";this->ToolExtractAll2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;//// toolStripMenuItem1//this->toolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem1.Image")));this->toolStripMenuItem1->Name = L"toolStripMenuItem1";this->toolStripMenuItem1->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem1->Text = L"Packages";this->toolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem1_Click);//// toolStripMenuItem2//this->toolStripMenuItem2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripMenuItem2.Image")));this->toolStripMenuItem2->Name = L"toolStripMenuItem2";this->toolStripMenuItem2->Size = System::Drawing::Size(123, 22);this->toolStripMenuItem2->Text = L"Files";this->toolStripMenuItem2->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem2_Click);//// toolStripButton1//this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"toolStripButton1.Image")));this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;this->toolStripButton1->Name = L"toolStripButton1";this->toolStripButton1->Size = System::Drawing::Size(63, 51);this->toolStripButton1->Text = L"Extract All";this->toolStripButton1->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->toolStripButton1->Click += gcnew System::EventHandler(this, &Form1::toolStripButton1_Click);//// toolStripSeparator4//this->toolStripSeparator4->Name = L"toolStripSeparator4";this->toolStripSeparator4->Size = System::Drawing::Size(6, 54);//// ToolPaste//this->ToolPaste->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolPaste.Image")));this->ToolPaste->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolPaste->Name = L"ToolPaste";this->ToolPaste->Size = System::Drawing::Size(39, 51);this->ToolPaste->Text = L"Paste";this->ToolPaste->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->ToolPaste->Click += gcnew System::EventHandler(this, &Form1::ToolPaste_Click);//// toolStripSeparator7//this->toolStripSeparator7->Name = L"toolStripSeparator7";this->toolStripSeparator7->Size = System::Drawing::Size(6, 54);//// ToolInfo//this->ToolInfo->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"ToolInfo.Image")));this->ToolInfo->ImageTransparentColor = System::Drawing::Color::Magenta;this->ToolInfo->Name = L"ToolInfo";this->ToolInfo->Size = System::Drawing::Size(79, 51);this->ToolInfo->Text = L"Package Info";this->ToolInfo->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;this->ToolInfo->Click += gcnew System::EventHandler(this, &Form1::ToolInfo_Click);//// tabControl1//this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;this->tabControl1->ImageList = this->imageList1;this->tabControl1->Location = System::Drawing::Point(0, 0);this->tabControl1->Name = L"tabControl1";this->tabControl1->SelectedIndex = 0;this->tabControl1->Size = System::Drawing::Size(725, 23);this->tabControl1->TabIndex = 3;this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::tabControl1_SelectedIndexChanged);//// imageList1//this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^ >(resources->GetObject(L"imageList1.ImageStream")));this->imageList1->TransparentColor = System::Drawing::Color::Transparent;this->imageList1->Images->SetKeyName(0, L"standard");this->imageList1->Images->SetKeyName(1, L"multi");//// panel1//this->panel1->Controls->Add(this->tabControl1);this->panel1->Controls->Add(this->button1);this->panel1->Dock = System::Windows::Forms::DockStyle::Top;this->panel1->Location = System::Drawing::Point(0, 78);this->panel1->Name = L"panel1";this->panel1->Size = System::Drawing::Size(746, 23);this->panel1->TabIndex = 5;//// button1//this->button1->Dock = System::Windows::Forms::DockStyle::Right;this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,static_cast<System::Byte>(0)));this->button1->ForeColor = System::Drawing::Color::Red;this->button1->Location = System::Drawing::Point(725, 0);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(21, 23);this->button1->TabIndex = 4;this->button1->Text = L"X";this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);//// toolTip1//this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;this->toolTip1->ToolTipTitle = L"Close All";//// timer1//this->timer1->Enabled = true;this->timer1->Interval = 500;this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);//// statusStrip1//this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->StatusFiles});this->statusStrip1->Location = System::Drawing::Point(0, 541);this->statusStrip1->Name = L"statusStrip1";this->statusStrip1->Size = System::Drawing::Size(746, 22);this->statusStrip1->TabIndex = 7;this->statusStrip1->Text = L"statusStrip1";//// StatusFiles//this->StatusFiles->Name = L"StatusFiles";this->StatusFiles->Size = System::Drawing::Size(79, 17);this->StatusFiles->Text = L"Files: 1 (10KB)";//// contextMenuStrip1//this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->packageToolStripMenuItem,this->fileToolStripMenuItem1});this->contextMenuStrip1->Name = L"contextMenuStrip1";this->contextMenuStrip1->Size = System::Drawing::Size(119, 48);//// packageToolStripMenuItem//this->packageToolStripMenuItem->Name = L"packageToolStripMenuItem";this->packageToolStripMenuItem->Size = System::Drawing::Size(118, 22);this->packageToolStripMenuItem->Text = L"Package";//// fileToolStripMenuItem1//this->fileToolStripMenuItem1->Name = L"fileToolStripMenuItem1";this->fileToolStripMenuItem1->Size = System::Drawing::Size(118, 22);this->fileToolStripMenuItem1->Text = L"File";//// Form1//this->AllowDrop = true;this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->AutoValidate = System::Windows::Forms::AutoValidate::EnableAllowFocusChange;this->BackColor = System::Drawing::SystemColors::Control;this->ClientSize = System::Drawing::Size(746, 563);this->Controls->Add(this->statusStrip1);this->Controls->Add(this->panel1);this->Controls->Add(this->toolStrip1);this->Controls->Add(this->menuStrip1);this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));this->IsMdiContainer = true;this->MainMenuStrip = this->menuStrip1;this->Name = L"Form1";this->Text = L"SPK Explorer";this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragDrop);this->DragOver += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragOver);this->menuStrip1->ResumeLayout(false);this->menuStrip1->PerformLayout();this->toolStrip1->ResumeLayout(false);this->toolStrip1->PerformLayout();this->panel1->ResumeLayout(false);this->statusStrip1->ResumeLayout(false);this->statusStrip1->PerformLayout();this->contextMenuStrip1->ResumeLayout(false);this->ResumeLayout(false);this->PerformLayout();}#pragma endregionprivate: System::Void tabControl1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) ){childForm->Select();break;}}}private: System::Void Event_Open(System::Object^ sender, System::EventArgs^ e) {System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);if ( item->Tag == "$DIR" ){FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;fbd->Description = "Select the path to load all valid files from";if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )this->OpenDirectory(fbd->SelectedPath);}else{this->Open(cli::safe_cast<System::String ^>(item->Tag), true, false);}}private: System::Void openToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->Open();}private: System::Void toolStripSplitButton1_ButtonClick(System::Object^ sender, System::EventArgs^ e) {this->Open();}private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->Close();}private: System::Void detailsToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->ChangeView(System::Windows::Forms::View::Details);this->detailsToolStripMenuItem->Checked = true;this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;}private: System::Void listToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->ChangeView(System::Windows::Forms::View::List);this->listToolStripMenuItem->Checked = true;this->listToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;}private: System::Void largeIconToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->ChangeView(System::Windows::Forms::View::LargeIcon);this->largeIconToolStripMenuItem->Checked = true;this->largeIconToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;}private: System::Void toolStripButton1_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractAll();}private: System::Void ToolExtract_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractSelected();}private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {if ( m_iLocX != -1 && m_iLocY != -1 )this->Location = System::Drawing::Point(m_iLocX, m_iLocY);this->UpdateDropDownOpen();}private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {this->CloseAll();}private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {if ( IO::File::Exists(IO::Path::GetTempPath() + "\\spkexplorer_load.dat") )this->LoadFiles(IO::Path::GetTempPath() + "\\spkexplorer_load.dat");}private: System::Void toolStripButton2_Click(System::Object^ sender, System::EventArgs^ e) {this->AddFile();}private: System::Void ToolRemove_Click(System::Object^ sender, System::EventArgs^ e) {this->RemoveSelected();}private: System::Void Form1_DragOver(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) {e->Effect = DragDropEffects::None;if (e->Data->GetDataPresent(DataFormats::FileDrop)){cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);int i;for(i = 0; i < a->Length; i++){if ( String::Compare(IO::FileInfo(a[i]).Extension, ".xsp", true) == 0 || String::Compare(IO::FileInfo(a[i]).Extension, ".spk", true) == 0 ){e->Effect = DragDropEffects::Copy;break;}}}}private: System::Void Form1_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) {if (e->Data->GetDataPresent(DataFormats::FileDrop)){cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);this->OpenFiles(a, true, true);}}private: System::Void ToolPaste_Click(System::Object^ sender, System::EventArgs^ e) {SpkForm ^child = this->GetActiveChild();if ( child )child->PasteFiles(m_lCopiedFiles);}private: System::Void maximisedToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {SpkForm ^child = this->GetActiveChild();if ( child )child->WindowState = FormWindowState::Maximized;}private: System::Void cascadeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->LayoutMdi(MdiLayout::Cascade);}private: System::Void tileVerticallyToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->LayoutMdi(MdiLayout::TileVertical);}private: System::Void tileHorizontalToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->LayoutMdi(MdiLayout::TileHorizontal);}private: System::Void closeAllToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->CloseAll();}private: System::Void WindowSelectEvent(System::Object^ sender, System::EventArgs^ e) {ToolStripMenuItem ^menu = cli::safe_cast<ToolStripMenuItem ^>(sender);if ( menu ){cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;for ( int i = 0; i < children->Length; i++ ){SpkForm ^childForm = (SpkForm ^)children[i];if ( childForm->MenuItem() == menu ){childForm->Select();break;}}}}private: System::Void ToolInfo_Click(System::Object^ sender, System::EventArgs^ e) {SpkForm ^child = this->GetActiveChild();if ( child ){PackageInfo ^info = gcnew PackageInfo(child->GetPackage(), 44);info->ShowDialog(this);}}private: System::Void filesToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractSelected();}private: System::Void packagesToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractSelectedPackage();}private: System::Void toolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractAllPackage();}private: System::Void toolStripMenuItem2_Click(System::Object^ sender, System::EventArgs^ e) {this->ExtractAll();}private: System::Void toolStripMenuItem4_Click(System::Object^ sender, System::EventArgs^ e) {this->AddFile();}private: System::Void toolStripMenuItem3_Click(System::Object^ sender, System::EventArgs^ e) {this->AddPackage();}private: System::Void toolStripMenuItem6_Click(System::Object^ sender, System::EventArgs^ e) {this->RemoveSelected();}private: System::Void toolStripMenuItem5_Click(System::Object^ sender, System::EventArgs^ e) {this->RemoveSelectedPackage();}};}