Subversion Repositories spk

Rev

Rev 227 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#pragma once

#include "PackageForm.h"
#include "MultiForm.h"
#include "Options.h"
#include "LoadShip.h"
#include "ImportShip.h"
#include "CreationWizard.h"
#include "LoadText.h"
//TODO: remove this dependacy
#include "../../ModMerge/src/Forms/Form1.h"
#include "ModDiff.h"
#include "Waiting.h"
#include "FileExplorer.h"
#include "SelectGame.h"
#include "SelectFilesystem.h"
#include <VirtualFileSystem.h>


using namespace System;
using namespace System::IO;

namespace Creator {

        enum {SWITCH_NONE, SWITCH_CREATE, SWITCH_EXTRACT, SWITCH_EXTRACTHERE, SWITCH_EXPORT};

        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:
                static bool CheckCommandArguments(array<System::String ^> ^args);

        public:
                Form1(array<System::String ^> ^args);
                !Form1();

                void parseCommandArguments(array<System::String ^> ^args);

                void ModMerge()
                {
                        ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
                        merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
                        merge->TopMost = true;
                        if ( !_pGameDir->isEmpty() ) 
                                merge->SetGameDir(-1, _US(_pGameDir->first()));
                        merge->ShowDialog(this);
                }

                void ModDiffDialog()
                {
                        ModDiff ^diff = gcnew ModDiff(_pGameDir, m_pPackages);
                        diff->ShowDialog(this);
                }

                void OpenArchive()
                {
                        OpenFileDialog ^ofd = gcnew OpenFileDialog();
                        ofd->Filter = "All Supported Archives|*.zip; *.rar|Zip Archive (*.zip)|*.zip|Rar Archive (*.rar)|*.rar";
                        ofd->Title = "Select archive file you wish to import from";
                        ofd->FilterIndex = 1;
                        ofd->RestoreDirectory = true;
                        ofd->Multiselect = false;

                        if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                        {
                                m_sConvertFile = ofd->FileName;
                                m_pWait = gcnew Waiting("Converting Archive");
                                this->backgroundWorker1->RunWorkerAsync();
                                m_pWait->ShowDialog(this);
                        }
                }

                String ^ParseText(int game, String ^text)
                {
                        String ^t = text;

                        bool found = true;
                        int pos = 0;
                        while (found)
                        {
                                pos = t->IndexOf(L'{', pos);
                                found = false;
                                if ( pos > -1 )
                                {
                                        int page = -1;
                                        int id = -1;

                                        int commaPos = t->IndexOf(L',', pos);
                                        if ( commaPos > -1 )
                                        {
                                                page = Convert::ToInt32(t->Substring(pos + 1, commaPos - (pos + 1)));
                                                int endPos = t->IndexOf(L'}', commaPos);
                                                if ( endPos > -1 )
                                                {
                                                        id = Convert::ToInt32(t->Substring(commaPos + 1, endPos - (commaPos + 1)));
                                                        found = true;
                                                        t = t->Replace(t->Substring(pos, endPos - pos + 1 ), this->FindText(game, page, id));
                                                }
                                        }
                                }
                        }
                        return t;
                }

                CGameDirectories *gameDirectories()
                {
                        return _pGameDir;
                }

                void LoadText(CVirtualFileSystem *vfs)
                {
                        this->LoadText(false, false, vfs);
                }

                String ^FindText(int game, int page, int id)
                {
                        this->LoadText(false, false, NULL);

                        Utils::WString text = _pGameDir->findText(game, 44, page, id);
                        if ( !text.empty() ) {
                                return ParseText(game, _US(text));
                        }

                        return nullptr;
                }

                void UpdateStatus()
                {
                        bool e = (this->tabControl1->HasChildren) ? true : false;

                        BaseForm ^active = this->GetActiveChild();
                        if ( active && active->GetFormType() == FORMTYPE_SINGLE )
                        {
                                CBaseFile *activePackage = ((PackageForm ^)active)->GetPackage();
                                if ( !activePackage )
                                        e = false;
                                else
                                        this->StatusFiles->Text = "Files: " + activePackage->fileList().size() + " (" + _US(activePackage->fileSizeString()) + ")";
                        }
                        else if ( active && active->GetFormType() == FORMTYPE_MULTI )
                        {
                                CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
                                if ( !activePackage )
                                        e = false;
                                else
                                        this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + _US(SPK::GetSizeString(activePackage->GetFileSize())) + ")";
                        }
                        else
                                e = false;

                        if ( !e  )
                                this->StatusFiles->Text = "";
                }

                void UpdateDisplay()
                {
                        bool e = (this->tabControl1->HasChildren) ? true : false;

                        BaseForm ^active = this->GetActiveChild();
                        if ( !active )
                                e = false;
                        else if ( active->GetFormType() != FORMTYPE_SINGLE && active->GetFormType() != FORMTYPE_MULTI)
                                e = false;

                        this->saveAsToolStripMenuItem->Enabled = e;
                        this->saveToolStripMenuItem->Enabled = e;
                        this->tabControl1->Visible = e;

                        if ( !this->PanelTab->Visible && e )
                        {
                                this->PanelTab->Visible = e;
                                this->toolStrip1->SendToBack();
                                this->menuStrip1->SendToBack();
                        }
                        else if ( !e )
                                this->PanelTab->Visible = e;

                        this->UpdateStatus();
                        this->UpdateDropDownOpen();
                }

                void OpenFileExplorer()
                {
                        FileExplorer ^file = gcnew FileExplorer(this, m_pPackages);
                        file->Show(this);
                }

                void OpenFile(String ^filename)
                {
                        ArrayList ^a = gcnew ArrayList();
                        a->Add(filename);

                        this->OpenFiles(a, false, true);
                }

        protected:
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~Form1()
                {
                        if (components)
                        {
                                delete components;
                        }
                                delete m_settings;
                                delete m_pPackages;
                                delete m_pLoadedList;
                                delete _pGameDir;
                }

        protected: 
                bool                     m_bAutoClose;
                int                              m_iLocX;
                int                              m_iLocY;
                Utils::WStringList      *m_pLoadedList;
                CPackages *m_pPackages;
                SPK::CGameDirectories   *_pGameDir;

                SSettings               *m_settings;
                String                  ^m_sConvertFile;
                Waiting                 ^m_pWait;
                CBaseFile               *m_pConverted;

                //System::Collections::Hashtable ^textList;

        private: System::Windows::Forms::MenuStrip^  menuStrip1;
        private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  newToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  windowsToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  layoutToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  cascadeToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  horizontalToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  verticalToolStripMenuItem;
        private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
        private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  saveAsToolStripMenuItem;
        private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
        private: System::Windows::Forms::Panel^  PanelTab;
        private: System::Windows::Forms::TabControl^  tabControl1;
        private: System::Windows::Forms::Button^  button1;
        private: System::Windows::Forms::ToolStrip^  toolStrip1;
        private: System::Windows::Forms::ToolStripSplitButton^  toolStripSplitButton1;

        private: System::Windows::Forms::ImageList^  imageList1;
        private: System::Windows::Forms::ToolStripDropDownButton^  toolStripButton1;
        private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem1;
        private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem1;


        private: System::Windows::Forms::Timer^  timer1;
        private: System::Windows::Forms::StatusStrip^  statusStrip1;
        private: System::Windows::Forms::ToolStripStatusLabel^  StatusFiles;
private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  configToolStripMenuItem;
private: System::Windows::Forms::ImageList^  imageListGames;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
private: System::Windows::Forms::ToolStripButton^  toolStripButton2;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator5;
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem1;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator4;
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem1;
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator6;
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator7;
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem1;
private: System::Windows::Forms::ToolTip^  toolTip1;
private: System::Windows::Forms::ImageList^  imageListSmall;
private: System::Windows::Forms::ImageList^  imageListLarge;
private: System::Windows::Forms::ImageList^  imageListFiles;
private: System::Windows::Forms::ToolStripMenuItem^  multiPackageToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  toolsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator8;
private: System::Windows::Forms::ToolStripDropDownButton^  toolStripDropDownButton1;
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem1;
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem1;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator10;
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem1;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator9;
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  fromArchiveToolStripMenuItem;
private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageUpdatesToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator11;
private: System::Windows::Forms::ToolStripMenuItem^  fileExplorerToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  multiPackageToolStripMenuItem1;
private: System::Windows::Forms::ToolStripMenuItem^  fromArchiveToolStripMenuItem1;
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem1;

        private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;


        private:
                BaseForm ^GetActiveChild()
                {
                         cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                         for ( int i = 0; i < children->Length; i++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( !childForm->TabPage() )
                                         continue;
                                 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
                                         return childForm;
                         }

                         return nullptr;
                }

                void ImportShip();
                void ImportShipFromVFS();

                String ^getShipSelection(CVirtualFileSystem *pVfs, System::String ^*shipName);


                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++ )
                        {
                                BaseForm ^childForm = (BaseForm ^)children[i];
                                if ( !childForm->TabPage()->Visible )
                                {
                                        childForm->Show();
                                        childForm->TabPage()->Show();
                                }
                        }
                }

                void OpenOptionsMenu()
                {
                         Options ^opt = gcnew Options(this->imageListGames, _pGameDir, m_pPackages, m_settings);
                         if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                         {
                                 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
                         }

                         if ( opt->LoadText() )
                                 this->LoadText(false, true, NULL);
                }

                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++ )
                        {
                                BaseForm ^childForm = (BaseForm ^)children[i];
                                if ( !childForm->TabPage()->Visible )
                                {
                                        childForm->Show();
                                        childForm->TabPage()->Show();
                                }
                        }
                }

                void Open()
                {
                        OpenFileDialog ^ofd = gcnew OpenFileDialog();
                        ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
                        ofd->Title = "Select the package/ship file to open";
                        ofd->FilterIndex = 1;
                        ofd->RestoreDirectory = true;
                        ofd->Multiselect = true;

                        if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                                this->OpenFiles(ofd->FileNames, false, true);
                }

                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);
                                        int num;
                                        Utils::WString *aLines = strLines.tokenise(L"\n", &num);
                                        if ( num && aLines )
                                        {
                                                ArrayList ^list = gcnew ArrayList();
                                                for ( int i = 0; i < num; i++ )
                                                {
                                                        Utils::WString l = aLines[i];
                                                        l = l.remove('\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));
                                                }

                                                CLEANSPLIT(aLines, num)

                                                this->OpenFiles(list, true, true);
                                        }

                                }
                        }                       
                }

                void ExportPackage(String ^file)
                {
                        Utils::WString sFile = _WS(file);
                        int error = 0;

                        CBaseFile *p = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);
                        if ( !p ) {
                                MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                        else {
                                String ^to = IO::FileInfo(file).DirectoryName;
                                int game = 0;
                                if ( p->IsMultipleGamesInPackage() ) {
                                        SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
                                        if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
                                                game = selGame->GetGame() + 1;
                                        }
                                        else
                                                to = nullptr;
                                }
                                else if ( p->IsAnyGameInPackage() ) {
                                        game = p->FindFirstGameInPackage();
                                }

                                if ( to && to->Length ) {
                                        Utils::WString exportFilename = CFileIO(sFile).changeFileExtension(L"zip");
                                        if ( game ) {
                                                exportFilename = CFileIO(exportFilename).dir() + L"/" + CFileIO(exportFilename).baseName() + L"_" + CBaseFile::ConvertGameToString(game) + L".zip";
                                        }
                                        if ( p->saveToArchive(exportFilename, game, m_pPackages->GetGameExe())) {
                                                String ^message = "Export: " + file + "\nTo: " + _US(CFileIO(exportFilename).filename());
                                                if ( game ) {
                                                        message += "\nGame: " + _US(m_pPackages->GetGameExe()->game(game - 1)->sName);
                                                }
                                                MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                        }
                                        else {
                                                MessageBox::Show(this, "Error: Unable to export to:\n" + _US(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);                                    }
                                }
                        }
                }

                void ExtractPackage(String ^file, bool here)
                {
                        Utils::WString sFile = _WS(file);
                        int error = 0;

                        CBaseFile *p = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);
                        if ( !p ) {
                                MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                        else {
                                String ^to = nullptr;
                                if ( here ) {
                                        to = IO::FileInfo(file).DirectoryName;
                                }
                                else {
                                        FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
                                        fbd->Description = "Select the path to extract package to";
                                        if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                                                to = fbd->SelectedPath;
                                }

                                if ( to && to->Length ) {
                                        // check if theres multiple games in package
                                        int game = 0;
                                        if ( p->IsMultipleGamesInPackage() ) {
                                                SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
                                                if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
                                                        game = selGame->GetGame() + 1;
                                                }
                                                else
                                                        to = nullptr;
                                        }
                                        else if ( p->IsAnyGameInPackage() ) {
                                                game = p->FindFirstGameInPackage();
                                        }

                                        if ( to && to->Length ) 
                                        {
                                                if (m_pPackages->extractAll(p, _WS(to), game, true)) 
                                                {
                                                        String ^message = "Extracted: " + file + "\nTo: " + to;
                                                        if ( game )
                                                                message += "\nGame: " + _US(m_pPackages->GetGameExe()->game(game - 1)->sName);
                                                        MessageBox::Show(this, message, "Extracted Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                                }
                                                else 
                                                        MessageBox::Show(this, "Error: Unable to extract to:\n" + to, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                        }
                                }
                        }
                }

                void SavePackagerScript(String ^file)
                {
                        Utils::WString sFile = _WS(file);
                        Utils::WStringList malformed, unknown;
                        CBaseFile *package = m_pPackages->loadPackagerScript(sFile, -1, NULL, &malformed, &unknown);
                        if ( package )
                        {
                                Utils::WString saveto = package->filename();
                                saveto = saveto.findReplace(L"$DEFAULTDIR", CFileIO(sFile).dir() + L"/");
                                saveto = saveto.findReplace(L"$PATH", CFileIO(sFile).dir());
                                saveto = saveto.asFilename();

                                if ( !saveto.right(4).Compare(L".spk") && package->GetType() != TYPE_XSP )
                                        saveto += L".spk";
                                else if ( !saveto.right(4).Compare(L".xsp") && package->GetType() == TYPE_XSP )
                                        saveto += L".xsp";
                                // write script
                                if ( package->writeFile(saveto) ) {
                                        String ^message = "Package: " + _US(saveto) + " has been created\n";
                                        if ( package->AutoGenerateUpdateFile() )
                                                package->createUpdateFile(CFileIO(saveto).dir());
                                        Utils::WString exportto = package->exportFilename();
                                        if ( !exportto.empty() ) {
                                                exportto = exportto.findReplace(L"$DEFAULTDIR", CFileIO(sFile).dir() + L"/");
                                                exportto = exportto.findReplace(L"$PATH", CFileIO(sFile).dir());
                                                exportto = exportto.asFilename();
                                                if ( package->saveToArchive(exportto, 0, m_pPackages->GetGameExe())) {
                                                        message += "\nExported to:\n" + _US(exportto) + "\n";
                                                        if ( package->IsAnyGameInPackage() ) {
                                                                for ( int i = 0; i < m_pPackages->GetGameExe()->numGames(); i++ ) {
                                                                        if ( package->IsGameInPackage(i + 1) ) {
                                                                                Utils::WString exportFile = CFileIO(saveto).dir() + L"/" + CFileIO(saveto).baseName() + L"_" + CBaseFile::ConvertGameToString(i + 1) + L"." + CFileIO(exportto).extension();
                                                                                if ( package->saveToArchive(exportFile, i + 1, m_pPackages->GetGameExe())) {
                                                                                        message += _US(CFileIO(exportFile).filename()) + "\n";
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }
                                        MessageBox::Show(this, message, "Package Created", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                }
                                else
                                        MessageBox::Show(this, "Error: Unable to create package from script\n" + file, "Error Creating Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                }

                void OpenPackagerScript(String ^file)
                {
                        Utils::WStringList malformed, unknown;
                        CBaseFile *package = m_pPackages->loadPackagerScript(_WS(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
                        if ( package )
                        {
                                package->SetDataCompression(SPKCOMPRESS_7ZIP);
                                PackageForm ^childForm = this->OpenPackage(true, package, file, "");
                                childForm->Text = _US(package->filename());
                        }
                }
                void OpenPackagerScript()
                {
                        OpenFileDialog ^ofd = gcnew OpenFileDialog();
                        ofd->Filter = "Packager Script (*.sps)|*.sps";
                        ofd->FilterIndex = 1;
                        ofd->Title = "Select the packager script to create a package from";
                        ofd->RestoreDirectory = true;
                        ofd->Multiselect = false;

                        if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                                OpenPackagerScript(ofd->FileName);
                }

                MultiForm ^OpenPackage(bool display, CMultiSpkFile *package, String ^file, String ^title)
                {
                        Utils::WString sFile = _WS(file);
                        TabPage ^tp = gcnew TabPage();
                        tp->Text = title;
                        tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
                        if ( tp->ImageIndex == -1 )
                                tp->ImageIndex = 0;

                        ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
                        MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
                        
                        childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
                        this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
                        childForm->WindowState = FormWindowState::Minimized;

                        this->ProcessOpen(false, tp, childForm);
                        childForm->LoadPackage(package, file);
                        this->ProcessOpen(display, tp, childForm);

                        childForm->WindowState = Windows::Forms::FormWindowState::Maximized;
                        return childForm;
                }
                PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
                {
                        Utils::WString sFile = _WS(file);

                        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);
                                                        }
                                                }
                                        }
                                }
                        }

                        TabPage ^tp = gcnew TabPage();
                        tp->Text = title;
                        tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
                        if ( tp->ImageIndex == -1 )
                                tp->ImageIndex = 0;

                        ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
                        PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
                        childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
                        this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
                        childForm->WindowState = FormWindowState::Minimized;

                        this->ProcessOpen(false, tp, childForm);
                        childForm->LoadPackage(package, file);
                        this->ProcessOpen(display, tp, childForm);

                        return childForm;
                }

                void ProcessOpen(bool display, TabPage ^tp, BaseForm ^childForm)
                {
                        tp->Parent = tabControl1;
                        if ( display || !this->HasChildren )
                        {
                                tabControl1->SelectedTab = tp;
                                tp->Show();
                                childForm->Show();
                                childForm->WindowState = FormWindowState::Maximized;
                                this->UpdateStatus();
                        }
                }

                void GeneratePackageUpdates()
                {
                        FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
                        fbd->Description = "Select the path to generate the updates from";
                        if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                        {
                                int count = 0;
                                for ( int type = 0; type < 2; type++ )
                                {
                                        array <System::String ^> ^Files = nullptr;
                                        if ( type == 0 )
                                                Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
                                        else if ( type == 1 )
                                                Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
                                        else
                                                break;

                                        for ( int i = 0; i < Files->Length; i++ )
                                        {
                                                Utils::WString file = _WS(Files[i]);
                                                int error = 0;
                                                CBaseFile *p = m_pPackages->openPackage(file, &error, 0, SPKREAD_NODATA);
                                                if ( !p )
                                                        continue;

                                                Utils::WString ufile = p->createUpdateFile(_WS(fbd->SelectedPath));
                                                if ( !ufile.empty() )
                                                        ++count;
                                                delete p;
                                        }
                                }

                                if ( !count )
                                        MessageBox::Show(this, "No package files with updates found in " + fbd->SelectedPath + "\nSelect a directory that contains spk/xsp files", "No Packages", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                else
                                        MessageBox::Show(this, "Update files generated for " + count + " packages\nDirectory: " + fbd->SelectedPath, "Update File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
                        }
                }

                void GeneratePackageWebList()
                {
                        FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
                        fbd->Description = "Select the path to generate the list from";
                        if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                        {
                                Utils::WStringList filedata;
                                for ( int type = 0; type < 2; type++ )
                                {
                                        array <System::String ^> ^Files = nullptr;
                                        if ( type == 0 )
                                                Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
                                        else if ( type == 1 )
                                                Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
                                        else
                                                break;

                                        for ( int i = 0; i < Files->Length; i++ )
                                        {
                                                Utils::WString file = _WS(Files[i]);
                                                int error = 0;
                                                CBaseFile *p = m_pPackages->openPackage(file, &error, 0, SPKREAD_NODATA);
                                                if ( !p )
                                                        continue;

                                                filedata.pushBack(CPackages::FormatAvailablePackageData(p));
                                                delete p;
                                        }
                                }

                                if ( filedata.empty() )
                                        MessageBox::Show(this, "No package files found in " + fbd->SelectedPath + "\nSelect a directory that contains spk/xsp files", "No Packages", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                else
                                {
                                        CFileIO File(_WS(fbd->SelectedPath) + L"/xpackagedata.dat");
                                        if ( File.writeFile(&filedata) )
                                                MessageBox::Show(this, "Data file generated for " + filedata.size() + " packages\nDirectory: " + fbd->SelectedPath, "Web File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                        else
                                                MessageBox::Show(this, "Unable to write web data file in " + fbd->SelectedPath, "File Write Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                }
                        }
                }

                void Open(System::String ^file, bool display, bool checkExtension)
                {
                        CBaseFile *convertFile = NULL;
                        if ( checkExtension )
                        {
                                if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 && String::Compare(IO::FileInfo(file).Extension, ".sps") != 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;
                        }

                        // check if its already open
                        if ( this->IsOpen(file) )
                        {
                                if ( display )
                                        MessageBox::Show(this, "The package is currently open\n" + file, "Already Open", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                return;
                        }

                        // sps
                        if ( String::Compare(IO::FileInfo(file).Extension, ".sps") == 0 )
                        {
                                OpenPackagerScript(file);
                                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 || fileType == SPKFILE_OLD )
                        {
                                bool loaded = false;
                                if ( String::Compare(IO::FileInfo(file).Extension, ".xsp") == 0 )
                                {
                                        CXspFile *shipFile = new CXspFile;
                                        loaded = shipFile->convertOld(_WS(file));
                                        if ( loaded )
                                        {
                                                shipFile->adjustChanged(true);
                                                shipFile->setFilename(_WS(file));
                                                convertFile = shipFile;
                                        }
                                        else 
                                                delete shipFile;
                                }
                                else if ( String::Compare(IO::FileInfo(file).Extension, ".spk") == 0 )
                                {
                                        CSpkFile *spkFile = CSpkFile::convertFromOld(_WS(file));
                                        if ( spkFile ) {
                                                loaded = true;
                                                spkFile->adjustChanged(true);
                                                spkFile->setFilename(_WS(file));
                                                convertFile = spkFile;
                                        }
                                }

                                if ( !loaded )
                                {
                                        if ( display )
                                                MessageBox::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 package
                        bool loaded = false;

                        int error;
                        if ( fileType == SPKFILE_MULTI )
                        {
                                CMultiSpkFile *mspk = m_pPackages->openMultiPackage(sFile, &error);
                                if ( mspk )
                                {
                                        loaded = true;
                                        BaseForm ^childForm = this->OpenPackage(display, mspk, file, "");
                                        childForm->Text = file;
                                }
                        }
                        else
                        {
                                CBaseFile *package = (convertFile) ? convertFile : m_pPackages->openPackage(sFile, &error);
                                if ( package )
                                {
                                        loaded = true;
                                        PackageForm ^childForm = this->OpenPackage(display, package, file, "");
                                        if ( convertFile )
                                        {
                                                convertFile->adjustChanged(true);
                                                childForm->UpdateChanged();
                                        }
                                }
                        }

                        if ( loaded )
                        {
                                // adjust the loaded list
                                sFile = sFile.findReplace(L"/", L"\\").remove(9).remove('\r').remove('\n');
                                m_pLoadedList->remove(sFile, true);
                                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 NewPackage(bool ship)
                {
                         TabPage ^tp = gcnew TabPage();
                         tp->ImageIndex = 0;
                         if ( ship )
                                tp->Text = "New Ship";
                         else
                                tp->Text = "New Package";
                         ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
                         this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
                         PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
                         childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
                         tp->Parent = tabControl1;
                         tabControl1->SelectedTab = tp;

                         if ( ship )
                                childForm->CreateShip();
                         else
                                childForm->CreatePackage();

                         childForm->WindowState = FormWindowState::Maximized;
                         tp->Show();
                         childForm->Show();
                }

                void NewMultiPackage()
                {
                         TabPage ^tp = gcnew TabPage();
                         tp->ImageIndex = 0;
                         tp->Text = "New Mutli Package";
                         ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
                         this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
                         MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
                         childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
                         tp->Parent = tabControl1;
                         tabControl1->SelectedTab = tp;

                         childForm->CreatePackage();

                         childForm->WindowState = FormWindowState::Maximized;
                         tp->Show();
                         childForm->Show();

                }

                void CloseAll()
                {
                        cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                        for ( int i = 0; i < children->Length; i++ )
                        {
                                delete ((BaseForm ^)children[i])->TabPage();
                                //((BaseForm ^)children[i])->
                                delete children[i];
                        }
                        this->UpdateDisplay();
                }

                void CloseEvent(System::Object ^Sender, System::EventArgs ^E) 
                {
                        this->CloseAll();
                        this->SaveData();
                }

                void UpdateDropDownOpen()
                {
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));

                        // clear them all
                        this->toolStripSplitButton1->DropDownItems->Clear();
                        this->openToolStripMenuItem->DropDownItems->Clear();

                        System::Windows::Forms::ToolStripMenuItem ^openPackage = gcnew System::Windows::Forms::ToolStripMenuItem;
                        openPackage->Text = "Open Package";
                        openPackage->Tag = "$PACKAGE";
                        openPackage->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
                        openPackage->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
                        this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
                        this->openToolStripMenuItem->DropDownItems->Add(openPackage);

                        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);

                        // add all none open items
                        bool sep = false;
                        for ( auto itr = m_pLoadedList->begin(); itr != m_pLoadedList->end(); itr++ )
                        {
                                // check if we have it open
                                Utils::WString str = (*itr)->str;
                                System::String ^sFile = _US(str.findReplace(L"/", L"\\"));
                                if ( this->IsOpen(sFile) )
                                        continue;
                                if ( this->IsOpen(_US(str.findReplace(L"\\", L"/"))) )
                                        continue;

                                if ( !IO::File::Exists(sFile) )
                                        continue;

                                if ( !sep )
                                {
                                        sep = true;
                                        this->toolStripSplitButton1->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
                                        this->openToolStripMenuItem->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
                                }

                                // work out the type
                                float fVersion;
                                int iconType = -1;
                                int check = CBaseFile::CheckFile(str, &fVersion);
                                switch ( check )
                                {
                                        case SPKFILE_BASE:
                                                iconType = 5;
                                                break;
                                        case SPKFILE_SINGLE:
                                                iconType = 0;
                                                break;
                                        case SPKFILE_SINGLESHIP:
                                                iconType = 1;
                                                break;
                                        case SPKFILE_MULTI:
                                                iconType = 4;
                                                break;
                                }

                                // otherwise add it to the list
                                System::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);
                                if ( iconType > -1 )
                                        newItem->Image = this->imageList1->Images[iconType];
                                this->toolStripSplitButton1->DropDownItems->Add(newItem);

                                System::Windows::Forms::ToolStripMenuItem ^newItem2 = gcnew System::Windows::Forms::ToolStripMenuItem;
                                newItem2->Text = sFile;
                                newItem2->Tag = newItem->Text;
                                newItem2->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
                                if ( iconType > -1 )
                                        newItem2->Image = this->imageList1->Images[iconType];
                                this->openToolStripMenuItem->DropDownItems->Add(newItem2);
                        }
                }

                bool IsOpen(System::String ^file)
                {
                         cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                         for ( int i = 0; i < children->Length; i++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( childForm->IsClosing() )
                                         continue;
                                 if ( childForm->CheckFilename(file) )
                                         return true;
                         }

                         return false;
                }

                void Save()
                {
                         cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                         for ( int i = 0; i < children->Length; i++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
                                 {
                                         if ( childForm->GetFormType() == FORMTYPE_SINGLE )
                                                ((PackageForm ^)childForm)->Save();
                                         else if ( childForm->GetFormType() == FORMTYPE_MULTI )
                                                ((MultiForm ^)childForm)->Save();
                                         else
                                                childForm->Save();
                                         this->UpdateDropDownOpen();
                                         break;
                                 }
                         }
                }

                void SaveAs()
                {
                         cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                         for ( int i = 0; i < children->Length; i++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
                                 {
                                         if ( childForm->GetFormType() == FORMTYPE_SINGLE )
                                                ((PackageForm ^)childForm)->SaveAs();
                                         else if ( childForm->GetFormType() == FORMTYPE_MULTI )
                                                ((MultiForm ^)childForm)->SaveAs();
                                         else
                                                childForm->SaveAs();
                                         this->UpdateDropDownOpen();
                                         break;
                                 }
                         }
                }

                void PackageCreationWizard()
                {
                        MessageBox::Show(this, "The creation wizard is currently not available", "Feature Missing", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        return;

                        CreationWizard ^wizard = gcnew CreationWizard();
                        if ( wizard->ShowDialog(this) == Windows::Forms::DialogResult::OK )
                        {
                        }
                }

                void SaveData()
                {
                        System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
                        CFileIO Config(_WS(mydoc) + L"/Egosoft/creator.dat");
                        std::vector<Utils::WString> lines;

                        if ( this->WindowState == FormWindowState::Normal )
                        {
                                lines.push_back(Utils::WString(L"CreatorSize:") + Utils::WString::Number(this->Size.Width) + L" " + Utils::WString::Number(this->Size.Height));
                                lines.push_back(Utils::WString(L"CreatorPos:") + Utils::WString::Number(this->Location.X) + L" " + Utils::WString::Number(this->Location.Y));
                        }
                        else
                        {
                                lines.push_back(Utils::WString(L"CreatorPos:") + Utils::WString::Number(this->RestoreBounds.Location.X) + L" " + Utils::WString::Number(this->RestoreBounds.Location.Y));
                                lines.push_back(Utils::WString(L"CreatorSize:") + Utils::WString::Number(this->RestoreBounds.Size.Width) + L" " + Utils::WString::Number(this->RestoreBounds.Size.Height));
                        }

                        if ( this->WindowState == FormWindowState::Maximized )
                                lines.push_back(L"CreatorMax:");

                        for (auto itr = m_pLoadedList->begin(); itr != m_pLoadedList->end(); itr++)
                                lines.push_back(Utils::WString(L"Loaded:") + (*itr)->data + L" " + (*itr)->str);
                        _pGameDir->writeData(lines);
                        if ( m_settings->bGenerateUpdate )
                                lines.push_back(L"GenerateUpdate:");

                        Config.writeFileUTF(&lines);
                }

                void LoadData()
                {
                        System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
                        CFileIO Config;
                        if ( Config.open(_WS(mydoc) + L"/Egosoft/creator.dat") )
                        {
                                std::vector<Utils::WString> lines;
                                if(Config.readLines(lines))
                                {
                                        for (size_t i = 0; i < (int)lines.size(); i++ )
                                        {
                                                Utils::WString line(lines.at(i));
                                                Utils::WString start = line.token(L":", 1).toLower();
                                                Utils::WString rest = line.tokens(L":", 2).removeFirstSpace();
                                                if ( start.Compare(L"CreatorSize") )
                                                        this->Size = System::Drawing::Size(rest.token(L" ", 1).toInt(), rest.token(L" ", 2).toInt());
                                                else if ( start.Compare(L"CreatorPos") )
                                                {
                                                        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"CreatorMax") )
                                                        this->WindowState = FormWindowState::Maximized;
                                                else if ( start.Compare(L"GenerateUpdate") )
                                                        m_settings->bGenerateUpdate = true;
                                                else if ( start.Compare(L"GameDir") )
                                                        _pGameDir->parse(rest, m_pPackages);
                                        }
                                }
                        }
                }
                
                void LoadText(bool center, bool reload, CVirtualFileSystem *vfs)
                {
                        if ( !reload ) {
                                // check if the text has been updated
                                if ( vfs && vfs->isTextUpdated() ) return;
                                
                                // check if all text as been updated
                                if ( !vfs && _pGameDir->isAllTextLoaded() ) return;
                        }

                        if ( _pGameDir->isEmpty() ) return;

                        Creator::LoadText ^load = nullptr;
                        if ( vfs ) 
                                load = gcnew Creator::LoadText(vfs);
                        else 
                                load = gcnew Creator::LoadText(_pGameDir, reload);

                        if ( center )
                                load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
                        
                        load->ShowDialog(this);
                }


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->newToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->packageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->shipToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->multiPackageToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->fromPackagerScriptToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->fromArchiveToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->importShipFromModToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->importShipFromVFSToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->packageCreationWizardToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->windowsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->layoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->cascadeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->horizontalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->verticalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->configToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->modMergeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->modDiffToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator10 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->generatePackageWebListToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->PanelTab = (gcnew System::Windows::Forms::Panel());
                        this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
                        this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->button1 = (gcnew System::Windows::Forms::Button());
                        this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
                        this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
                        this->packageToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->shipToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->multiPackageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->fromPackagerScriptToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->fromArchiveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->importShipFromModToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->importShipFromVFSToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->packageCreationWizardToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSplitButton1 = (gcnew System::Windows::Forms::ToolStripSplitButton());
                        this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
                        this->toolStripSeparator8 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->toolStripDropDownButton1 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
                        this->modMergeToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->modDiffToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator9 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->generatePackageWebListToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->generatePackageUpdatesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator11 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->fileExplorerToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
                        this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
                        this->StatusFiles = (gcnew System::Windows::Forms::ToolStripStatusLabel());
                        this->imageListGames = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
                        this->imageListSmall = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->imageListLarge = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->imageListFiles = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
                        this->menuStrip1->SuspendLayout();
                        this->PanelTab->SuspendLayout();
                        this->toolStrip1->SuspendLayout();
                        this->statusStrip1->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // menuStrip1
                        // 
                        this->menuStrip1->ImageScalingSize = System::Drawing::Size(20, 20);
                        this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {
                                this->fileToolStripMenuItem,
                                        this->windowsToolStripMenuItem, this->settingsToolStripMenuItem, this->toolsToolStripMenuItem
                        });
                        this->menuStrip1->Location = System::Drawing::Point(0, 0);
                        this->menuStrip1->Name = L"menuStrip1";
                        this->menuStrip1->Padding = System::Windows::Forms::Padding(8, 2, 0, 2);
                        this->menuStrip1->Size = System::Drawing::Size(996, 28);
                        this->menuStrip1->TabIndex = 2;
                        this->menuStrip1->Text = L"menuStrip1";
                        // 
                        // fileToolStripMenuItem
                        // 
                        this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {
                                this->newToolStripMenuItem,
                                        this->openToolStripMenuItem, this->saveToolStripMenuItem, this->saveAsToolStripMenuItem, this->toolStripSeparator2, this->exitToolStripMenuItem
                        });
                        this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
                        this->fileToolStripMenuItem->Size = System::Drawing::Size(44, 24);
                        this->fileToolStripMenuItem->Text = L"&File";
                        // 
                        // newToolStripMenuItem
                        // 
                        this->newToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(10) {
                                this->packageToolStripMenuItem,
                                        this->shipToolStripMenuItem, this->multiPackageToolStripMenuItem1, this->toolStripSeparator5, this->fromPackagerScriptToolStripMenuItem1,
                                        this->fromArchiveToolStripMenuItem1, this->importShipFromModToolStripMenuItem1, this->importShipFromVFSToolStripMenuItem1, this->toolStripSeparator6,
                                        this->packageCreationWizardToolStripMenuItem
                        });
                        this->newToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"newToolStripMenuItem.Image")));
                        this->newToolStripMenuItem->Name = L"newToolStripMenuItem";
                        this->newToolStripMenuItem->Size = System::Drawing::Size(178, 26);
                        this->newToolStripMenuItem->Text = L"&New";
                        // 
                        // packageToolStripMenuItem
                        // 
                        this->packageToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"packageToolStripMenuItem.Image")));
                        this->packageToolStripMenuItem->Name = L"packageToolStripMenuItem";
                        this->packageToolStripMenuItem->Size = System::Drawing::Size(249, 26);
                        this->packageToolStripMenuItem->Text = L"Package";
                        this->packageToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packageToolStripMenuItem_Click);
                        // 
                        // shipToolStripMenuItem
                        // 
                        this->shipToolStripMenuItem->Name = L"shipToolStripMenuItem";
                        this->shipToolStripMenuItem->Size = System::Drawing::Size(249, 26);
                        this->shipToolStripMenuItem->Text = L"Ship";
                        this->shipToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::shipToolStripMenuItem_Click);
                        // 
                        // multiPackageToolStripMenuItem1
                        // 
                        this->multiPackageToolStripMenuItem1->Name = L"multiPackageToolStripMenuItem1";
                        this->multiPackageToolStripMenuItem1->Size = System::Drawing::Size(249, 26);
                        this->multiPackageToolStripMenuItem1->Text = L"Multi Package";
                        this->multiPackageToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::multiPackageToolStripMenuItem1_Click);
                        // 
                        // toolStripSeparator5
                        // 
                        this->toolStripSeparator5->Name = L"toolStripSeparator5";
                        this->toolStripSeparator5->Size = System::Drawing::Size(246, 6);
                        // 
                        // fromPackagerScriptToolStripMenuItem1
                        // 
                        this->fromPackagerScriptToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"fromPackagerScriptToolStripMenuItem1.Image")));
                        this->fromPackagerScriptToolStripMenuItem1->Name = L"fromPackagerScriptToolStripMenuItem1";
                        this->fromPackagerScriptToolStripMenuItem1->Size = System::Drawing::Size(249, 26);
                        this->fromPackagerScriptToolStripMenuItem1->Text = L"From Packager Script";
                        this->fromPackagerScriptToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::fromPackagerScriptToolStripMenuItem1_Click);
                        // 
                        // fromArchiveToolStripMenuItem1
                        // 
                        this->fromArchiveToolStripMenuItem1->Name = L"fromArchiveToolStripMenuItem1";
                        this->fromArchiveToolStripMenuItem1->Size = System::Drawing::Size(249, 26);
                        this->fromArchiveToolStripMenuItem1->Text = L"From Archive";
                        this->fromArchiveToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::fromArchiveToolStripMenuItem1_Click);
                        // 
                        // importShipFromModToolStripMenuItem1
                        // 
                        this->importShipFromModToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"importShipFromModToolStripMenuItem1.Image")));
                        this->importShipFromModToolStripMenuItem1->Name = L"importShipFromModToolStripMenuItem1";
                        this->importShipFromModToolStripMenuItem1->Size = System::Drawing::Size(249, 26);
                        this->importShipFromModToolStripMenuItem1->Text = L"Import Ship From Mod";
                        this->importShipFromModToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem1_Click);
                        // 
                        // importShipFromVFSToolStripMenuItem1
                        // 
                        this->importShipFromVFSToolStripMenuItem1->Name = L"importShipFromVFSToolStripMenuItem1";
                        this->importShipFromVFSToolStripMenuItem1->Size = System::Drawing::Size(249, 26);
                        this->importShipFromVFSToolStripMenuItem1->Text = L"Import Ship from VFS";
                        this->importShipFromVFSToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::importShipFromVFSToolStripMenuItem1_Click);
                        // 
                        // toolStripSeparator6
                        // 
                        this->toolStripSeparator6->Name = L"toolStripSeparator6";
                        this->toolStripSeparator6->Size = System::Drawing::Size(246, 6);
                        // 
                        // packageCreationWizardToolStripMenuItem
                        // 
                        this->packageCreationWizardToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"packageCreationWizardToolStripMenuItem.Image")));
                        this->packageCreationWizardToolStripMenuItem->Name = L"packageCreationWizardToolStripMenuItem";
                        this->packageCreationWizardToolStripMenuItem->Size = System::Drawing::Size(249, 26);
                        this->packageCreationWizardToolStripMenuItem->Text = L"Package Creation Wizard";
                        this->packageCreationWizardToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packageCreationWizardToolStripMenuItem_Click);
                        // 
                        // openToolStripMenuItem
                        // 
                        this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
                        this->openToolStripMenuItem->Size = System::Drawing::Size(178, 26);
                        this->openToolStripMenuItem->Text = L"&Open Package";
                        // 
                        // saveToolStripMenuItem
                        // 
                        this->saveToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"saveToolStripMenuItem.Image")));
                        this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
                        this->saveToolStripMenuItem->Size = System::Drawing::Size(178, 26);
                        this->saveToolStripMenuItem->Text = L"&Save";
                        this->saveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveToolStripMenuItem_Click);
                        // 
                        // saveAsToolStripMenuItem
                        // 
                        this->saveAsToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"saveAsToolStripMenuItem.Image")));
                        this->saveAsToolStripMenuItem->Name = L"saveAsToolStripMenuItem";
                        this->saveAsToolStripMenuItem->Size = System::Drawing::Size(178, 26);
                        this->saveAsToolStripMenuItem->Text = L"Save &As";
                        this->saveAsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveAsToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator2
                        // 
                        this->toolStripSeparator2->Name = L"toolStripSeparator2";
                        this->toolStripSeparator2->Size = System::Drawing::Size(175, 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(178, 26);
                        this->exitToolStripMenuItem->Text = L"E&xit";
                        this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
                        // 
                        // windowsToolStripMenuItem
                        // 
                        this->windowsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {
                                this->layoutToolStripMenuItem,
                                        this->toolStripSeparator1
                        });
                        this->windowsToolStripMenuItem->Name = L"windowsToolStripMenuItem";
                        this->windowsToolStripMenuItem->Size = System::Drawing::Size(82, 24);
                        this->windowsToolStripMenuItem->Text = L"&Windows";
                        // 
                        // layoutToolStripMenuItem
                        // 
                        this->layoutToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {
                                this->cascadeToolStripMenuItem,
                                        this->horizontalToolStripMenuItem, this->verticalToolStripMenuItem
                        });
                        this->layoutToolStripMenuItem->Name = L"layoutToolStripMenuItem";
                        this->layoutToolStripMenuItem->Size = System::Drawing::Size(128, 26);
                        this->layoutToolStripMenuItem->Text = L"Layout";
                        // 
                        // cascadeToolStripMenuItem
                        // 
                        this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";
                        this->cascadeToolStripMenuItem->Size = System::Drawing::Size(182, 26);
                        this->cascadeToolStripMenuItem->Text = L"Cascade";
                        this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);
                        // 
                        // horizontalToolStripMenuItem
                        // 
                        this->horizontalToolStripMenuItem->Name = L"horizontalToolStripMenuItem";
                        this->horizontalToolStripMenuItem->Size = System::Drawing::Size(182, 26);
                        this->horizontalToolStripMenuItem->Text = L"Tile Horizontal";
                        this->horizontalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::horizontalToolStripMenuItem_Click);
                        // 
                        // verticalToolStripMenuItem
                        // 
                        this->verticalToolStripMenuItem->Name = L"verticalToolStripMenuItem";
                        this->verticalToolStripMenuItem->Size = System::Drawing::Size(182, 26);
                        this->verticalToolStripMenuItem->Text = L"Tile Vertical";
                        this->verticalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::verticalToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator1
                        // 
                        this->toolStripSeparator1->Name = L"toolStripSeparator1";
                        this->toolStripSeparator1->Size = System::Drawing::Size(125, 6);
                        // 
                        // settingsToolStripMenuItem
                        // 
                        this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) { this->configToolStripMenuItem });
                        this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
                        this->settingsToolStripMenuItem->Size = System::Drawing::Size(74, 24);
                        this->settingsToolStripMenuItem->Text = L"Settings";
                        // 
                        // configToolStripMenuItem
                        // 
                        this->configToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"configToolStripMenuItem.Image")));
                        this->configToolStripMenuItem->Name = L"configToolStripMenuItem";
                        this->configToolStripMenuItem->Size = System::Drawing::Size(128, 26);
                        this->configToolStripMenuItem->Text = L"Config";
                        this->configToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::configToolStripMenuItem_Click);
                        // 
                        // toolsToolStripMenuItem
                        // 
                        this->toolsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {
                                this->modMergeToolStripMenuItem,
                                        this->modDiffToolStripMenuItem1, this->toolStripSeparator10, this->generatePackageWebListToolStripMenuItem1
                        });
                        this->toolsToolStripMenuItem->Name = L"toolsToolStripMenuItem";
                        this->toolsToolStripMenuItem->Size = System::Drawing::Size(56, 24);
                        this->toolsToolStripMenuItem->Text = L"Tools";
                        // 
                        // modMergeToolStripMenuItem
                        // 
                        this->modMergeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"modMergeToolStripMenuItem.Image")));
                        this->modMergeToolStripMenuItem->Name = L"modMergeToolStripMenuItem";
                        this->modMergeToolStripMenuItem->Size = System::Drawing::Size(262, 26);
                        this->modMergeToolStripMenuItem->Text = L"Mod Merge";
                        this->modMergeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::modMergeToolStripMenuItem_Click);
                        // 
                        // modDiffToolStripMenuItem1
                        // 
                        this->modDiffToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"modDiffToolStripMenuItem1.Image")));
                        this->modDiffToolStripMenuItem1->Name = L"modDiffToolStripMenuItem1";
                        this->modDiffToolStripMenuItem1->Size = System::Drawing::Size(262, 26);
                        this->modDiffToolStripMenuItem1->Text = L"Mod Diff";
                        this->modDiffToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::modDiffToolStripMenuItem1_Click);
                        // 
                        // toolStripSeparator10
                        // 
                        this->toolStripSeparator10->Name = L"toolStripSeparator10";
                        this->toolStripSeparator10->Size = System::Drawing::Size(259, 6);
                        // 
                        // generatePackageWebListToolStripMenuItem1
                        // 
                        this->generatePackageWebListToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"generatePackageWebListToolStripMenuItem1.Image")));
                        this->generatePackageWebListToolStripMenuItem1->Name = L"generatePackageWebListToolStripMenuItem1";
                        this->generatePackageWebListToolStripMenuItem1->Size = System::Drawing::Size(262, 26);
                        this->generatePackageWebListToolStripMenuItem1->Text = L"Generate Package Web List";
                        this->generatePackageWebListToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::generatePackageWebListToolStripMenuItem1_Click);
                        // 
                        // PanelTab
                        // 
                        this->PanelTab->Controls->Add(this->tabControl1);
                        this->PanelTab->Controls->Add(this->button1);
                        this->PanelTab->Dock = System::Windows::Forms::DockStyle::Top;
                        this->PanelTab->Location = System::Drawing::Point(0, 67);
                        this->PanelTab->Margin = System::Windows::Forms::Padding(4);
                        this->PanelTab->Name = L"PanelTab";
                        this->PanelTab->Size = System::Drawing::Size(996, 33);
                        this->PanelTab->TabIndex = 6;
                        // 
                        // tabControl1
                        // 
                        this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->tabControl1->ImageList = this->imageList1;
                        this->tabControl1->Location = System::Drawing::Point(0, 0);
                        this->tabControl1->Margin = System::Windows::Forms::Padding(4);
                        this->tabControl1->Name = L"tabControl1";
                        this->tabControl1->SelectedIndex = 0;
                        this->tabControl1->Size = System::Drawing::Size(968, 33);
                        this->tabControl1->TabIndex = 3;
                        this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::tabControl1_SelectedIndexChanged_1);
                        // 
                        // 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"ship");
                        this->imageList1->Images->SetKeyName(2, L"fake");
                        this->imageList1->Images->SetKeyName(3, L"library");
                        this->imageList1->Images->SetKeyName(4, L"multi");
                        this->imageList1->Images->SetKeyName(5, L"normal");
                        this->imageList1->Images->SetKeyName(6, L"update");
                        this->imageList1->Images->SetKeyName(7, L"patch");
                        this->imageList1->Images->SetKeyName(8, L"start");
                        // 
                        // 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(968, 0);
                        this->button1->Margin = System::Windows::Forms::Padding(4);
                        this->button1->Name = L"button1";
                        this->button1->Size = System::Drawing::Size(28, 33);
                        this->button1->TabIndex = 4;
                        this->button1->Text = L"X";
                        this->button1->UseVisualStyleBackColor = true;
                        this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
                        // 
                        // 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^  >(6) {
                                this->toolStripButton1,
                                        this->toolStripSplitButton1, this->toolStripSeparator3, this->toolStripButton2, this->toolStripSeparator8, this->toolStripDropDownButton1
                        });
                        this->toolStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
                        this->toolStrip1->Location = System::Drawing::Point(0, 28);
                        this->toolStrip1->Name = L"toolStrip1";
                        this->toolStrip1->Size = System::Drawing::Size(996, 39);
                        this->toolStrip1->TabIndex = 7;
                        this->toolStrip1->Text = L"toolStrip1";
                        // 
                        // toolStripButton1
                        // 
                        this->toolStripButton1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(10) {
                                this->packageToolStripMenuItem1,
                                        this->shipToolStripMenuItem1, this->multiPackageToolStripMenuItem, this->toolStripSeparator4, this->fromPackagerScriptToolStripMenuItem,
                                        this->fromArchiveToolStripMenuItem, this->importShipFromModToolStripMenuItem, this->importShipFromVFSToolStripMenuItem, this->toolStripSeparator7,
                                        this->packageCreationWizardToolStripMenuItem1
                        });
                        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(85, 36);
                        this->toolStripButton1->Text = L"New";
                        // 
                        // packageToolStripMenuItem1
                        // 
                        this->packageToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"packageToolStripMenuItem1.Image")));
                        this->packageToolStripMenuItem1->Name = L"packageToolStripMenuItem1";
                        this->packageToolStripMenuItem1->Size = System::Drawing::Size(261, 38);
                        this->packageToolStripMenuItem1->Text = L"Package";
                        this->packageToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::packageToolStripMenuItem1_Click);
                        // 
                        // shipToolStripMenuItem1
                        // 
                        this->shipToolStripMenuItem1->Name = L"shipToolStripMenuItem1";
                        this->shipToolStripMenuItem1->Size = System::Drawing::Size(261, 38);
                        this->shipToolStripMenuItem1->Text = L"Ship";
                        this->shipToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::shipToolStripMenuItem1_Click);
                        // 
                        // multiPackageToolStripMenuItem
                        // 
                        this->multiPackageToolStripMenuItem->Name = L"multiPackageToolStripMenuItem";
                        this->multiPackageToolStripMenuItem->Size = System::Drawing::Size(261, 38);
                        this->multiPackageToolStripMenuItem->Text = L"Multi Package";
                        this->multiPackageToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::multiPackageToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator4
                        // 
                        this->toolStripSeparator4->Name = L"toolStripSeparator4";
                        this->toolStripSeparator4->Size = System::Drawing::Size(258, 6);
                        // 
                        // fromPackagerScriptToolStripMenuItem
                        // 
                        this->fromPackagerScriptToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"fromPackagerScriptToolStripMenuItem.Image")));
                        this->fromPackagerScriptToolStripMenuItem->Name = L"fromPackagerScriptToolStripMenuItem";
                        this->fromPackagerScriptToolStripMenuItem->Size = System::Drawing::Size(261, 38);
                        this->fromPackagerScriptToolStripMenuItem->Text = L"From Packager Script";
                        this->fromPackagerScriptToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fromPackagerScriptToolStripMenuItem_Click);
                        // 
                        // fromArchiveToolStripMenuItem
                        // 
                        this->fromArchiveToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"fromArchiveToolStripMenuItem.Image")));
                        this->fromArchiveToolStripMenuItem->Name = L"fromArchiveToolStripMenuItem";
                        this->fromArchiveToolStripMenuItem->Size = System::Drawing::Size(261, 38);
                        this->fromArchiveToolStripMenuItem->Text = L"From Archive";
                        this->fromArchiveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fromArchiveToolStripMenuItem_Click);
                        // 
                        // importShipFromModToolStripMenuItem
                        // 
                        this->importShipFromModToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"importShipFromModToolStripMenuItem.Image")));
                        this->importShipFromModToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
                        this->importShipFromModToolStripMenuItem->Name = L"importShipFromModToolStripMenuItem";
                        this->importShipFromModToolStripMenuItem->Size = System::Drawing::Size(261, 38);
                        this->importShipFromModToolStripMenuItem->Text = L"Import Ship From Mod";
                        this->importShipFromModToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem_Click);
                        // 
                        // importShipFromVFSToolStripMenuItem
                        // 
                        this->importShipFromVFSToolStripMenuItem->Name = L"importShipFromVFSToolStripMenuItem";
                        this->importShipFromVFSToolStripMenuItem->Size = System::Drawing::Size(261, 38);
                        this->importShipFromVFSToolStripMenuItem->Text = L"Import Ship from VFS";
                        this->importShipFromVFSToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromVFSToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator7
                        // 
                        this->toolStripSeparator7->Name = L"toolStripSeparator7";
                        this->toolStripSeparator7->Size = System::Drawing::Size(258, 6);
                        // 
                        // packageCreationWizardToolStripMenuItem1
                        // 
                        this->packageCreationWizardToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"packageCreationWizardToolStripMenuItem1.Image")));
                        this->packageCreationWizardToolStripMenuItem1->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
                        this->packageCreationWizardToolStripMenuItem1->Name = L"packageCreationWizardToolStripMenuItem1";
                        this->packageCreationWizardToolStripMenuItem1->Size = System::Drawing::Size(261, 38);
                        this->packageCreationWizardToolStripMenuItem1->Text = L"Package Creation Wizard";
                        this->packageCreationWizardToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::packageCreationWizardToolStripMenuItem1_Click);
                        // 
                        // 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(96, 36);
                        this->toolStripSplitButton1->Text = L"Open";
                        this->toolStripSplitButton1->ToolTipText = L"Open an existing package/ship";
                        this->toolStripSplitButton1->ButtonClick += gcnew System::EventHandler(this, &Form1::toolStripSplitButton1_ButtonClick);
                        // 
                        // toolStripSeparator3
                        // 
                        this->toolStripSeparator3->Name = L"toolStripSeparator3";
                        this->toolStripSeparator3->Size = System::Drawing::Size(6, 39);
                        // 
                        // toolStripButton2
                        // 
                        this->toolStripButton2->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
                        this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"toolStripButton2.Image")));
                        this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripButton2->Name = L"toolStripButton2";
                        this->toolStripButton2->Size = System::Drawing::Size(36, 36);
                        this->toolStripButton2->Text = L"toolStripButton2";
                        this->toolStripButton2->ToolTipText = L"Open the options menu";
                        this->toolStripButton2->Click += gcnew System::EventHandler(this, &Form1::toolStripButton2_Click);
                        // 
                        // toolStripSeparator8
                        // 
                        this->toolStripSeparator8->Name = L"toolStripSeparator8";
                        this->toolStripSeparator8->Size = System::Drawing::Size(6, 39);
                        // 
                        // toolStripDropDownButton1
                        // 
                        this->toolStripDropDownButton1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(7) {
                                this->modMergeToolStripMenuItem1,
                                        this->modDiffToolStripMenuItem, this->toolStripSeparator9, this->generatePackageWebListToolStripMenuItem, this->generatePackageUpdatesToolStripMenuItem,
                                        this->toolStripSeparator11, this->fileExplorerToolStripMenuItem
                        });
                        this->toolStripDropDownButton1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"toolStripDropDownButton1.Image")));
                        this->toolStripDropDownButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
                        this->toolStripDropDownButton1->Name = L"toolStripDropDownButton1";
                        this->toolStripDropDownButton1->Size = System::Drawing::Size(90, 36);
                        this->toolStripDropDownButton1->Text = L"Tools";
                        // 
                        // modMergeToolStripMenuItem1
                        // 
                        this->modMergeToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"modMergeToolStripMenuItem1.Image")));
                        this->modMergeToolStripMenuItem1->Name = L"modMergeToolStripMenuItem1";
                        this->modMergeToolStripMenuItem1->Size = System::Drawing::Size(262, 26);
                        this->modMergeToolStripMenuItem1->Text = L"Mod Merge";
                        this->modMergeToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::modMergeToolStripMenuItem1_Click);
                        // 
                        // modDiffToolStripMenuItem
                        // 
                        this->modDiffToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"modDiffToolStripMenuItem.Image")));
                        this->modDiffToolStripMenuItem->Name = L"modDiffToolStripMenuItem";
                        this->modDiffToolStripMenuItem->Size = System::Drawing::Size(262, 26);
                        this->modDiffToolStripMenuItem->Text = L"Mod Diff";
                        this->modDiffToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::modDiffToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator9
                        // 
                        this->toolStripSeparator9->Name = L"toolStripSeparator9";
                        this->toolStripSeparator9->Size = System::Drawing::Size(259, 6);
                        // 
                        // generatePackageWebListToolStripMenuItem
                        // 
                        this->generatePackageWebListToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"generatePackageWebListToolStripMenuItem.Image")));
                        this->generatePackageWebListToolStripMenuItem->Name = L"generatePackageWebListToolStripMenuItem";
                        this->generatePackageWebListToolStripMenuItem->Size = System::Drawing::Size(262, 26);
                        this->generatePackageWebListToolStripMenuItem->Text = L"Generate Package Web List";
                        this->generatePackageWebListToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::generatePackageWebListToolStripMenuItem_Click);
                        // 
                        // generatePackageUpdatesToolStripMenuItem
                        // 
                        this->generatePackageUpdatesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"generatePackageUpdatesToolStripMenuItem.Image")));
                        this->generatePackageUpdatesToolStripMenuItem->Name = L"generatePackageUpdatesToolStripMenuItem";
                        this->generatePackageUpdatesToolStripMenuItem->Size = System::Drawing::Size(262, 26);
                        this->generatePackageUpdatesToolStripMenuItem->Text = L"Generate Package Updates";
                        this->generatePackageUpdatesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::generatePackageUpdatesToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator11
                        // 
                        this->toolStripSeparator11->Name = L"toolStripSeparator11";
                        this->toolStripSeparator11->Size = System::Drawing::Size(259, 6);
                        // 
                        // fileExplorerToolStripMenuItem
                        // 
                        this->fileExplorerToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"fileExplorerToolStripMenuItem.Image")));
                        this->fileExplorerToolStripMenuItem->Name = L"fileExplorerToolStripMenuItem";
                        this->fileExplorerToolStripMenuItem->Size = System::Drawing::Size(262, 26);
                        this->fileExplorerToolStripMenuItem->Text = L"File Explorer";
                        this->fileExplorerToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fileExplorerToolStripMenuItem_Click);
                        // 
                        // timer1
                        // 
                        this->timer1->Enabled = true;
                        this->timer1->Interval = 500;
                        this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
                        // 
                        // statusStrip1
                        // 
                        this->statusStrip1->ImageScalingSize = System::Drawing::Size(20, 20);
                        this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) { this->StatusFiles });
                        this->statusStrip1->Location = System::Drawing::Point(0, 832);
                        this->statusStrip1->Name = L"statusStrip1";
                        this->statusStrip1->Padding = System::Windows::Forms::Padding(1, 0, 19, 0);
                        this->statusStrip1->Size = System::Drawing::Size(996, 25);
                        this->statusStrip1->TabIndex = 9;
                        this->statusStrip1->Text = L"statusStrip1";
                        // 
                        // StatusFiles
                        // 
                        this->StatusFiles->Name = L"StatusFiles";
                        this->StatusFiles->Size = System::Drawing::Size(101, 20);
                        this->StatusFiles->Text = L"Files: 1 (10KB)";
                        // 
                        // imageListGames
                        // 
                        this->imageListGames->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^>(resources->GetObject(L"imageListGames.ImageStream")));
                        this->imageListGames->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageListGames->Images->SetKeyName(0, L"X2");
                        this->imageListGames->Images->SetKeyName(1, L"X3");
                        this->imageListGames->Images->SetKeyName(2, L"X3TC");
                        this->imageListGames->Images->SetKeyName(3, L"X3AP");
                        this->imageListGames->Images->SetKeyName(4, L"X3FL");
                        // 
                        // toolTip1
                        // 
                        this->toolTip1->AutomaticDelay = 1000;
                        this->toolTip1->IsBalloon = true;
                        this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
                        this->toolTip1->ToolTipTitle = L"Close All Windows";
                        // 
                        // imageListSmall
                        // 
                        this->imageListSmall->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^>(resources->GetObject(L"imageListSmall.ImageStream")));
                        this->imageListSmall->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageListSmall->Images->SetKeyName(0, L"language");
                        this->imageListSmall->Images->SetKeyName(1, L"web");
                        this->imageListSmall->Images->SetKeyName(2, L"ware");
                        this->imageListSmall->Images->SetKeyName(3, L"components");
                        this->imageListSmall->Images->SetKeyName(4, L"dummies");
                        this->imageListSmall->Images->SetKeyName(5, L"cockpit");
                        this->imageListSmall->Images->SetKeyName(6, L"cutdata");
                        this->imageListSmall->Images->SetKeyName(7, L"bodies");
                        this->imageListSmall->Images->SetKeyName(8, L"animations");
                        this->imageListSmall->Images->SetKeyName(9, L"turret");
                        this->imageListSmall->Images->SetKeyName(10, L"gun");
                        // 
                        // imageListLarge
                        // 
                        this->imageListLarge->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^>(resources->GetObject(L"imageListLarge.ImageStream")));
                        this->imageListLarge->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageListLarge->Images->SetKeyName(0, L"language");
                        this->imageListLarge->Images->SetKeyName(1, L"web");
                        this->imageListLarge->Images->SetKeyName(2, L"ware");
                        this->imageListLarge->Images->SetKeyName(3, L"turret");
                        this->imageListLarge->Images->SetKeyName(4, L"gun");
                        // 
                        // imageListFiles
                        // 
                        this->imageListFiles->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^>(resources->GetObject(L"imageListFiles.ImageStream")));
                        this->imageListFiles->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageListFiles->Images->SetKeyName(0, L"script.png");
                        this->imageListFiles->Images->SetKeyName(1, L"textfile.png");
                        this->imageListFiles->Images->SetKeyName(2, L"readme.png");
                        this->imageListFiles->Images->SetKeyName(3, L"map.png");
                        this->imageListFiles->Images->SetKeyName(4, L"mods.png");
                        this->imageListFiles->Images->SetKeyName(5, L"uninstall.png");
                        this->imageListFiles->Images->SetKeyName(6, L"sound.png");
                        this->imageListFiles->Images->SetKeyName(7, L"extras.png");
                        this->imageListFiles->Images->SetKeyName(8, L"screenshot.png");
                        this->imageListFiles->Images->SetKeyName(9, L"mission.png");
                        this->imageListFiles->Images->SetKeyName(10, L"advert.png");
                        this->imageListFiles->Images->SetKeyName(11, L"shipother.png");
                        this->imageListFiles->Images->SetKeyName(12, L"shipmodel.png");
                        this->imageListFiles->Images->SetKeyName(13, L"shipscene.png");
                        this->imageListFiles->Images->SetKeyName(14, L"cockpitscene.png");
                        this->imageListFiles->Images->SetKeyName(15, L"package");
                        this->imageListFiles->Images->SetKeyName(16, L"backup.png");
                        this->imageListFiles->Images->SetKeyName(17, L"fakepatch");
                        // 
                        // backgroundWorker1
                        // 
                        this->backgroundWorker1->WorkerReportsProgress = true;
                        this->backgroundWorker1->WorkerSupportsCancellation = true;
                        this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &Form1::backgroundWorker1_DoWork);
                        this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &Form1::backgroundWorker1_RunWorkerCompleted);
                        // 
                        // Form1
                        // 
                        this->AllowDrop = true;
                        this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(996, 857);
                        this->Controls->Add(this->statusStrip1);
                        this->Controls->Add(this->PanelTab);
                        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->Margin = System::Windows::Forms::Padding(4);
                        this->Name = L"Form1";
                        this->Text = L"Package Creator";
                        this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
                        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->PanelTab->ResumeLayout(false);
                        this->toolStrip1->ResumeLayout(false);
                        this->toolStrip1->PerformLayout();
                        this->statusStrip1->ResumeLayout(false);
                        this->statusStrip1->PerformLayout();
                        this->ResumeLayout(false);
                        this->PerformLayout();

                }
#pragma endregion
        private: System::Void cascadeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                                 this->LayoutMdi(MdiLayout::Cascade);
                         }
private: System::Void horizontalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->LayoutMdi(MdiLayout::TileHorizontal);
                 }
private: System::Void verticalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->LayoutMdi(MdiLayout::TileVertical);
                 }
private: 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++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
                                 {
                                         childForm->Select();
                                         break;
                                 }
                         }

                 }
private: System::Void packageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewPackage(false);
                 }
private: System::Void shipToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewPackage(true);
                 }
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->Close();
                 }
private: System::Void saveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->Save();
                 }
private: System::Void saveAsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->SaveAs();
                 }
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 == "$PACKAGE" )
                                this->Open();
                        else 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 openPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                        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);
                 }
        private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                                 this->CloseAll();
                         }
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
                         if ( m_bAutoClose )
                                 this->Close();
                         if ( m_iLocX != -1 && m_iLocY != -1 )
                                this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
                        this->UpdateDropDownOpen();
                 }
private: System::Void toolStripSplitButton1_ButtonClick(System::Object^  sender, System::EventArgs^  e) {
                         this->Open();
                 }
private: System::Void packageToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewPackage(false);
                 }
private: System::Void shipToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewPackage(true);
                 }
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
                         if ( IO::File::Exists(IO::Path::GetTempPath() + "\\creator_load.dat") )
                                 this->LoadFiles(IO::Path::GetTempPath() + "\\creator_load.dat");
                 }
private: System::Void tabControl1_SelectedIndexChanged_1(System::Object^  sender, System::EventArgs^  e) {
                         cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
                         for ( int i = 0; i < children->Length; i++ )
                         {
                                 BaseForm ^childForm = (BaseForm ^)children[i];
                                 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
                                 {
                                         childForm->Select();
                                         break;
                                 }
                         }
                 }
private: System::Void configToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->OpenOptionsMenu();
                 }
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->OpenOptionsMenu();
                 }
private: System::Void fromPackagerScriptToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->OpenPackagerScript();
                 }
private: System::Void fromPackagerScriptToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->OpenPackagerScript();
                 }
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 importShipFromModToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->ImportShip();
                 }
private: System::Void importShipFromModToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->ImportShip();
                 }
private: System::Void Form1_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
                         this->CloseAll();
                         e->Cancel = false;
                 }
private: System::Void packageCreationWizardToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->PackageCreationWizard();
                 }
private: System::Void packageCreationWizardToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->PackageCreationWizard();
                 }
private: System::Void multiPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewMultiPackage();
                 }
private: System::Void modMergeToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         ModMerge();
                 }
private: System::Void modMergeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         ModMerge();
                 }
private: System::Void modDiffToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         ModDiffDialog();
                 }
private: System::Void modDiffToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         ModDiffDialog();
                 }
private: System::Void generatePackageWebListToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         GeneratePackageWebList();
                 }
private: System::Void generatePackageWebListToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         GeneratePackageWebList();
                 }
private: System::Void fromArchiveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         OpenArchive();
                 }
private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
                         Threading::Thread::Sleep(500);
                         m_pConverted = m_pPackages->createFromArchive(_WS(m_sConvertFile));
                 }
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^  sender, System::ComponentModel::RunWorkerCompletedEventArgs^  e) {
                         if ( m_pWait ) 
                         {
                                 m_pWait->Close();
                                 delete m_pWait;
                                 m_pWait = nullptr;
                        }

                         if ( !m_pConverted )
                                MessageBox::Show(this, "Unable to open archive file, " + m_sConvertFile, "Unable to open", MessageBoxButtons::OK, MessageBoxIcon::Error);
                         else
                         {
                                PackageForm ^childForm = this->OpenPackage(true, m_pConverted, m_sConvertFile, "");
                                childForm->Text = _US(m_pConverted->filename());
                         }
                 }
private: System::Void generatePackageUpdatesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         GeneratePackageUpdates();
                 }
private: System::Void fileExplorerToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         OpenFileExplorer();
                 }
private: System::Void importShipFromVFSToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         ImportShipFromVFS();
                 }
private: System::Void multiPackageToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->NewMultiPackage();
                 }
private: System::Void importShipFromVFSToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         ImportShipFromVFS();
                 }
private: System::Void fromArchiveToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
                         OpenArchive();
                 }
};
}