Subversion Repositories spk

Rev

Rev 36 | 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:
                Form1(array<System::String ^> ^args);

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

                int GetHighestGame()
                {
                        int highest = 1;
                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                        {
                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                if ( checkgame > highest )
                                        highest = checkgame;
                        }
                        return highest;
                }

                void ModMerge()
                {
                        ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
                        merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
                        merge->TopMost = true;
                        if ( !m_pGameDir->empty() )
                                merge->SetGameDir(-1, SystemStringFromCyString(m_pGameDir->Front()->Data()->sDir));
                        merge->ShowDialog(this);
                }

                void ModDiffDialog()
                {
                        ModDiff ^diff = gcnew ModDiff(m_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);
                        }
                }

                CyStringList *FindLasersList(int game)
                {
                        // return the list
                        if ( game < m_pLasers->size() )
                        {
                                if ( !m_pLasers->Get(game)->Empty() )
                                        return m_pLasers->Get(game);
                        }

                        // other wise create the list we need
                        // first we need to create entries for the ones we are not using
                        while ( m_pLasers->size() < game )
                                m_pLasers->push_back(new CyStringList);

                        CyStringList *list = new CyStringList;
                        m_pLasers->push_back(list);

                        return list;
                }

                CyStringList *GetLasers(int game)
                {
                        CyStringList *list = FindLasersList(game);
                        if ( !list ) return NULL;

                        if ( list->Empty() )
                        {
                                for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                {
                                        int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                        if ( checkgame != game )
                                                continue;
                                        int e = m_pPackages->ExtractGameFile("types\\TLaser.pck", m_pPackages->GetTempDirectory() + "/TLaser.txt", gd->sDir);
                                        if ( e )
                                        {
                                                CFileIO File((e == -1) ? "TLaser.txt" : m_pPackages->GetTempDirectory() + "/TLaser.txt");
                                                CyStringList *lines = File.ReadLinesStr();
                                                if ( lines )
                                                {
                                                        int itemsRemaining = -1;
                                                        for ( SStringList *str = lines->Head(); str; str = str->next )
                                                        {
                                                                str->str.RemoveChar('\r');
                                                                str->str.RemoveChar(9);
                                                                str->str.RemoveFirstSpace();

                                                                if ( str->str.Empty() )
                                                                        continue;
                                                                if ( str->str[0] == '/' )
                                                                        continue;

                                                                if ( itemsRemaining == -1 )
                                                                        itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                else
                                                                {
                                                                        list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
                                                                        --itemsRemaining;
                                                                }
                                                        }

                                                        delete lines;
                                                        return list;
                                                }
                                        }
                                }
                        }

                        return list;
                }

                CyStringList *GetMissiles(int game)
                {
                        // return the list
                        if ( game < m_pMissiles->size() )
                        {
                                if ( !m_pMissiles->Get(game)->Empty() )
                                        return m_pMissiles->Get(game);
                        }

                        // other wise create the list we need
                        // first we need to create entries for the ones we are not using
                        while ( m_pMissiles->size() < game )
                                m_pMissiles->push_back(new CyStringList);

                        CyStringList *list = new CyStringList;
                        m_pMissiles->push_back(list);

                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                        {
                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                if ( checkgame != game )
                                        continue;
                                int e = m_pPackages->ExtractGameFile("types\\TMissiles.pck", m_pPackages->GetTempDirectory() + "/TMissiles.txt", gd->sDir);
                                if ( e )
                                {
                                        CFileIO File((e == -1) ? "TMissiles.txt" : m_pPackages->GetTempDirectory() + "/TMissiles.txt");
                                        CyStringList *lines = File.ReadLinesStr();
                                        if ( lines )
                                        {
                                                int itemsRemaining = -1;
                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                {
                                                        str->str.RemoveChar('\r');
                                                        str->str.RemoveChar(9);
                                                        str->str.RemoveFirstSpace();

                                                        if ( str->str.Empty() )
                                                                continue;
                                                        if ( str->str[0] == '/' )
                                                                continue;

                                                        if ( itemsRemaining == -1 )
                                                                itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                        else
                                                        {
                                                                list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
                                                                --itemsRemaining;
                                                        }
                                                }

                                                delete lines;
                                                return list;
                                        }
                                }
                        }

                        return list;
                }

                CyStringList *GetShields()
                {
                        if ( !m_pShields )
                        {
                                bool found = false;
                                for ( int game = 2; game >= 0; game-- )
                                {
                                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                        {
                                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                                if ( checkgame != game )
                                                        continue;
                                                if ( m_pPackages->ExtractGameFile("types\\TShields.pck", m_pPackages->GetTempDirectory() + "/TShields.txt", gd->sDir) )
                                                {
                                                        if ( !m_pShields )
                                                                m_pShields = new CyStringList;

                                                        CFileIO File(m_pPackages->GetTempDirectory() + "/TShields.txt");
                                                        CyStringList *lines = File.ReadLinesStr();
                                                        if ( lines )
                                                        {
                                                                int itemsRemaining = -1;
                                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                                {
                                                                        str->str.RemoveChar('\r');
                                                                        str->str.RemoveChar(9);
                                                                        str->str.RemoveFirstSpace();

                                                                        if ( str->str.Empty() )
                                                                                continue;
                                                                        if ( str->str[0] == '/' )
                                                                                continue;

                                                                        if ( itemsRemaining == -1 )
                                                                                itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                        else
                                                                        {
                                                                                m_pShields->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
                                                                                --itemsRemaining;
                                                                        }
                                                                }

                                                                delete lines;
                                                                found = true;
                                                                break;
                                                        }
                                                }
                                        }

                                        if ( found )
                                                break;
                                }
                        }

                        return m_pShields;
                }

                CyStringList *GetCockpits(int game)
                {
                        // return the list
                        if ( game < m_pCockpits->size() )
                        {
                                if ( !m_pCockpits->Get(game)->Empty() )
                                        return m_pCockpits->Get(game);
                        }

                        // other wise create the list we need
                        // first we need to create entries for the ones we are not using
                        while ( m_pCockpits->size() < game )
                                m_pCockpits->push_back(new CyStringList);

                        CyStringList *list = new CyStringList;
                        m_pCockpits->push_back(list);

                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                        {
                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                if ( checkgame != game )
                                        continue;
                                if ( m_pPackages->ExtractGameFile("types\\TCockpits.pck", m_pPackages->GetTempDirectory() + "/TCockpits.txt", gd->sDir) )
                                {
                                        CFileIO File(m_pPackages->GetTempDirectory() + "/TCockpits.txt");
                                        CyStringList *lines = File.ReadLinesStr();
                                        if ( lines )
                                        {
                                                int itemsRemaining = -1;
                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                {
                                                        str->str.RemoveChar('\r');
                                                        str->str.RemoveChar(9);
                                                        str->str.RemoveFirstSpace();

                                                        if ( str->str.Empty() )
                                                                continue;
                                                        if ( str->str[0] == '/' )
                                                                continue;

                                                        if ( itemsRemaining == -1 )
                                                                itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                        else
                                                        {
                                                                list->PushBack(str->str, str->str.GetToken(";", 19, 19));
                                                                --itemsRemaining;
                                                        }
                                                }

                                                delete lines;
                                                File.Remove();
                                                return list;
                                        }
                                        File.Remove();
                                }
                        }
                        return list;
                }

                CyStringList *GetComponentSections()
                {
                        // need to load data
                        if ( !m_pComponents )
                        {
                                bool found = false;
                                for ( int game = 2; game >= 0; game-- )
                                {
                                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                        {
                                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                                if ( checkgame != game )
                                                        continue;
                                                if ( m_pPackages->ExtractGameFile("types\\Components.pck", m_pPackages->GetTempDirectory() + "/components.txt", gd->sDir) )
                                                {
                                                        if ( !m_pComponents )
                                                                m_pComponents = new CyStringList;
                                                        CFileIO File(m_pPackages->GetTempDirectory() + "/components.txt");
                                                        CyStringList *lines = File.ReadLinesStr();
                                                        if ( lines )
                                                        {
                                                                int sectionRemaining = 0;
                                                                int itemsRemaining = 0;
                                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                                {
                                                                        str->str.RemoveChar('\r');
                                                                        str->str.RemoveChar(9);
                                                                        str->str.RemoveFirstSpace();

                                                                        if ( str->str.Empty() )
                                                                                continue;
                                                                        if ( str->str[0] == '/' )
                                                                                continue;

                                                                        if ( itemsRemaining )
                                                                                --itemsRemaining;
                                                                        else if ( !sectionRemaining )
                                                                        {
                                                                                sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                                CyString sec = str->str.GetToken(";", 1, 1);
                                                                                if ( !sec.Empty() )
                                                                                        m_pComponents->PushBack(sec);
                                                                        }
                                                                        else if ( !itemsRemaining )
                                                                        {
                                                                                itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                                --sectionRemaining;
                                                                        }
                                                                }

                                                                delete lines;
                                                                found = true;
                                                                break;
                                                        }
                                                }
                                        }

                                        if ( found )
                                                break;
                                }

                                // still empty
                                if ( !m_pComponents )
                                        m_pComponents = new CyStringList;
                                if ( m_pComponents->Empty() )
                                {
                                        m_pComponents->PushBack("SCTYPE_LASER");
                                        m_pComponents->PushBack("SCTYPE_COCKPIT");
                                        m_pComponents->PushBack("SCTYPE_DOCKING");
                                }
                        }
                        return m_pComponents;
                }
                
                CyStringList *GetDummySections()
                {
                        if ( !m_pDummies )
                        {
                                bool found = false;
                                for ( int game = 2; game >= 0; game-- )
                                {
                                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                        {
                                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                                if ( checkgame != game )
                                                        continue;
                                                if ( m_pPackages->ExtractGameFile("types\\Dummies.pck", m_pPackages->GetTempDirectory() + "/Dummies.txt", gd->sDir) )
                                                {
                                                        if ( !m_pDummies )
                                                                m_pDummies = new CyStringList;
                                                        CFileIO File(m_pPackages->GetTempDirectory() + "/Dummies.txt");
                                                        CyStringList *lines = File.ReadLinesStr();
                                                        if ( lines )
                                                        {
                                                                int sectionRemaining = 0;
                                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                                {
                                                                        str->str.RemoveChar('\r');
                                                                        str->str.RemoveChar(9);
                                                                        str->str.RemoveFirstSpace();

                                                                        if ( str->str.Empty() )
                                                                                continue;
                                                                        if ( str->str[0] == '/' )
                                                                                continue;

                                                                        if ( !sectionRemaining )
                                                                        {
                                                                                sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                                CyString sec = str->str.GetToken(";", 1, 1);
                                                                                if ( !sec.Empty() )
                                                                                        m_pDummies->PushBack(sec);
                                                                        }
                                                                        else
                                                                                --sectionRemaining;
                                                                }

                                                                delete lines;
                                                                found = true;
                                                                break;
                                                        }
                                                }
                                        }

                                        if ( found )
                                                break;
                                }
                                // still empty
                                if ( !m_pDummies )
                                        m_pDummies = new CyStringList;
                                if ( m_pDummies->Empty() )
                                {
                                        m_pDummies->PushBack("SDTYPE_ANIMATED");
                                        m_pDummies->PushBack("SDTYPE_DOCK");
                                        m_pDummies->PushBack("SDTYPE_DOORWAY");
                                        m_pDummies->PushBack("SDTYPE_GUN");
                                        m_pDummies->PushBack("SDTYPE_CONNTECTION");
                                }
                        }
                        return m_pDummies;
                }

                CyStringList *GetBodiesSections()
                {
                        if ( !m_pBodies )
                        {
                                bool found = false;
                                for ( int game = 2; game >= 0; game-- )
                                {
                                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                        {
                                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                                if ( checkgame != game )
                                                        continue;
                                                if ( m_pPackages->ExtractGameFile("types\\Bodies.pck", m_pPackages->GetTempDirectory() + "/Bodies.txt", gd->sDir) )
                                                {
                                                        if ( !m_pBodies )
                                                                m_pBodies = new CyStringList;
                                                        CFileIO File(m_pPackages->GetTempDirectory() + "/Bodies.txt");
                                                        CyStringList *lines = File.ReadLinesStr();
                                                        if ( lines )
                                                        {
                                                                int sectionRemaining = 0;
                                                                for ( SStringList *str = lines->Head(); str; str = str->next )
                                                                {
                                                                        str->str.RemoveChar('\r');
                                                                        str->str.RemoveChar(9);
                                                                        str->str.RemoveFirstSpace();

                                                                        if ( str->str.Empty() )
                                                                                continue;
                                                                        if ( str->str[0] == '/' )
                                                                                continue;

                                                                        if ( !sectionRemaining )
                                                                        {
                                                                                sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
                                                                                CyString sec = str->str.GetToken(";", 1, 1);
                                                                                if ( !sec.Empty() )
                                                                                        m_pBodies->PushBack(sec);
                                                                        }
                                                                        else
                                                                        {
                                                                                sectionRemaining -= (str->str.NumToken(";") - 1);
                                                                        }
                                                                }

                                                                delete lines;
                                                                found = true;
                                                                break;
                                                        }
                                                }
                                        }

                                        if ( found )
                                                break;
                                }
                                // still empty
                                if ( !m_pBodies )
                                        m_pBodies = new CyStringList;
                                if ( m_pBodies->Empty() )
                                {
                                        m_pBodies->PushBack("SBTYPE_2D");
                                        m_pBodies->PushBack("SBTYPE_FACECAMERA");
                                        m_pBodies->PushBack("SBTYPE_2D2");
                                        m_pBodies->PushBack("SBTYPE_2DY");
                                        m_pBodies->PushBack("SBTYPE_LOGO");
                                        m_pBodies->PushBack("SBTYPE_FC");
                                        m_pBodies->PushBack("SBTYPE_TURRET");
                                        m_pBodies->PushBack("SBTYPE_JET");
                                        m_pBodies->PushBack("SBTYPE_RADAR");
                                        m_pBodies->PushBack("SBTYPE_CONTAINER");
                                        m_pBodies->PushBack("SBTYPE_DISPLAY");
                                        m_pBodies->PushBack("SBTYPE_DOCKPOINT");
                                        m_pBodies->PushBack("SBTYPE_SMALLJET");
                                }
                        }
                        return m_pBodies;
                }

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

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

                                        int commaPos = t->IndexOf(',', pos);
                                        if ( commaPos > -1 )
                                        {
                                                page = Convert::ToInt32(t->Substring(pos + 1, commaPos - (pos + 1)));
                                                int endPos = t->IndexOf('}', 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;
                }

                SGameDir *findGameDir(int iGame)
                {
                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
                                int checkgame = gd->sGame.GetToken(" ", 1, 1).ToInt();
                                if ( checkgame == iGame ) return gd;
                        }

                        return NULL;
                }

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

                        String ^text;
                        if ( game == -1 ) {
                                for ( int game = (GAME_MAX - 1); game >= 0; game-- ) {
                                        SGameDir *gd = findGameDir(game - 1);
                                        if ( !gd ) continue;
                                        if ( gd->pVfs->textExists(44, page, id) ) {
                                                text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
                                                break;
                                        }
                                }
                        }
                        else
                        {
                                SGameDir *gd = findGameDir(game);
                                if ( gd ) {
                                        if ( gd->pVfs->textExists(44, page, id) ) {
                                                text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
                                        }
                                }
                        }

                        return text;
                }

                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->GetFileList()->size() + " (" + SystemStringFromCyString(activePackage->GetFullFileSizeString()) + ")";
                        }
                        else if ( active && active->GetFormType() == FORMTYPE_MULTI )
                        {
                                CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
                                if ( !activePackage )
                                        e = false;
                                else
                                        this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + SystemStringFromCyString(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_pLoadedList;
                        delete m_pPackages;
                        m_pGameDir->MemoryClear();
                        delete m_pGameDir;

                        for ( CyStringList *list = m_pLasers->First(); list; list = m_pLasers->Next() )
                                delete list;
                        for ( CyStringList *list = m_pMissiles->First(); list; list = m_pMissiles->Next() )
                                delete list;
                        for ( CyStringList *list = m_pCockpits->First(); list; list = m_pCockpits->Next() )
                                delete list;
                        delete m_pLasers;
                        delete m_pMissiles;
                        delete m_pCockpits;
                        if ( m_pShields )
                                delete m_pShields;
                        if ( m_pComponents )
                                delete m_pComponents;
                        if ( m_pDummies )
                                delete m_pDummies;
                        if ( m_pBodies )
                                delete m_pBodies;
                        delete m_settings;
                }

        protected: 
                bool                     m_bAutoClose;
                int                              m_iLocX;
                int                              m_iLocY;
                CLinkList<CyStringList> *m_pLasers;
                CLinkList<CyStringList> *m_pMissiles;
                CLinkList<CyStringList> *m_pCockpits;
                CyStringList    *m_pShields;
                CyStringList    *m_pLoadedList;
                CPackages *m_pPackages;
                CLinkList<SGameDir>     *m_pGameDir;
                CyStringList    *m_pComponents;
                CyStringList    *m_pDummies;
                CyStringList    *m_pBodies;
                SSettings               *m_settings;
                bool                     m_bTextLoaded;
                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^  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);


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

                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 )
                                {
                                        CyString strLines = CyStringFromSystemString(lines);
                                        int num;
                                        CyString *aLines = strLines.SplitToken("\n", &num);
                                        if ( num && aLines )
                                        {
                                                ArrayList ^list = gcnew ArrayList();
                                                for ( int i = 0; i < num; i++ )
                                                {
                                                        CyString l = aLines[i];
                                                        l = l.Remove("\r");
                                                        CyString first = l.GetToken(":", 1, 1);
                                                        CyString rest = l.GetToken(":", 2);
                                                        rest.RemoveFirstSpace();

                                                        if ( first.Compare("File") )
                                                                list->Add(SystemStringFromCyString(rest));
                                                }

                                                CLEANSPLIT(aLines, num)

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

                                }
                        }                       
                }

                void ExportPackage(String ^file)
                {
                        CyString sFile = CyStringFromSystemString(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 ) {
                                        CyString exportFilename = CFileIO(sFile).ChangeFileExtension("zip");
                                        if ( game ) {
                                                exportFilename = CFileIO(exportFilename).GetDir() + "/" + CFileIO(exportFilename).GetBaseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
                                        }
                                        if ( p->SaveToArchive(exportFilename, game) ) {
                                                String ^message = "Export: " + file + "\nTo: " + SystemStringFromCyString(CFileIO(exportFilename).GetFilename());
                                                if ( game ) {
                                                        message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
                                                }
                                                MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                        }
                                        else {
                                                MessageBox::Show(this, "Error: Unable to export to:\n" + SystemStringFromCyString(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                        }
                                }
                        }
                }

                void ExtractPackage(String ^file, bool here)
                {
                        CyString sFile = CyStringFromSystemString(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 ( p->ExtractAll(CyStringFromSystemString(to), game, true) ) {
                                                        String ^message = "Extracted: " + file + "\nTo: " + to;
                                                        if ( game ) {
                                                                message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(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)
                {
                        CyString sFile = CyStringFromSystemString(file);
                        CyStringList malformed, unknown;
                        CBaseFile *package = m_pPackages->LoadPackagerScript(sFile, -1, NULL, &malformed, &unknown);
                        if ( package )
                        {
                                CyString saveto = package->GetFilename();
                                saveto = saveto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
                                saveto = saveto.FindReplace("$PATH", CFileIO(sFile).GetDir());
                                saveto = saveto.FindReplace("\\", "/");
                                saveto = saveto.FindReplace("//", "/");
                                if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
                                        saveto += ".spk";
                                else if ( !saveto.Right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
                                        saveto += ".xsp";
                                // write script
                                if ( package->WriteFile(saveto) ) {
                                        String ^message = "Package: " + SystemStringFromCyString(saveto) + " has been created\n";
                                        if ( package->AutoGenerateUpdateFile() )
                                                package->CreateUpdateFile(CFileIO(saveto).GetDir());
                                        CyString exportto = package->GetExportFilename();
                                        if ( !exportto.Empty() ) {
                                                exportto = exportto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
                                                exportto = exportto.FindReplace("$PATH", CFileIO(sFile).GetDir());
                                                exportto = exportto.FindReplace("\\", "/");
                                                exportto = exportto.FindReplace("//", "/");
                                                if ( package->SaveToArchive(exportto, 0) ) {
                                                        message += "\nExported to:\n" + SystemStringFromCyString(exportto) + "\n";
                                                        if ( package->IsAnyGameInPackage() ) {
                                                                for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ ) {
                                                                        if ( package->IsGameInPackage(i + 1) ) {
                                                                                CyString exportFile = CFileIO(saveto).GetDir() + "/" + CFileIO(saveto).GetBaseName() + "_" + CBaseFile::ConvertGameToString(i + 1) + "." + CFileIO(exportto).GetFileExtension();
                                                                                if ( package->SaveToArchive(exportFile, i + 1) ) {
                                                                                        message += SystemStringFromCyString(CFileIO(exportFile).GetFilename()) + "\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)
                {
                        CyStringList malformed, unknown;
                        CBaseFile *package = m_pPackages->LoadPackagerScript(CyStringFromSystemString(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
                        if ( package )
                        {
                                package->SetDataCompression(SPKCOMPRESS_7ZIP);
                                PackageForm ^childForm = this->OpenPackage(true, package, file, "");
                                childForm->Text = SystemStringFromCyString(package->GetFilename());
                        }
                }
                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)
                {
                        CyString sFile = CyStringFromSystemString(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);

                        return childForm;
                }
                PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
                {
                        CyString sFile = CyStringFromSystemString(file);

                        if ( this->imageList1->Images->IndexOfKey(file) == -1 )
                        {
                                if ( package->GetIcon() )
                                {
                                        package->ReadIconFileToMemory();
                                        CyString sIconFile = CyStringFromSystemString(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).GetBaseName() + "." + package->GetIconExt();
                                        if ( package->ExtractFile(package->GetIcon(), CFileIO(sIconFile).GetFullFilename(), false) )
                                        {
                                                String ^iconFile = SystemStringFromCyString(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++ )
                                        {
                                                CyString file = CyStringFromSystemString(Files[i]);
                                                int error = 0;
                                                CBaseFile *p = m_pPackages->OpenPackage(file, &error, 0, SPKREAD_NODATA);
                                                if ( !p )
                                                        continue;

                                                CyString ufile = p->CreateUpdateFile(CyStringFromSystemString(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 )
                        {
                                CyStringList 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++ )
                                        {
                                                CyString file = CyStringFromSystemString(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(CyStringFromSystemString(fbd->SelectedPath) + "/xpackagedata.dat");
                                        if ( File.WriteFile(&filedata) )
                                                MessageBox::Show(this, "Data file generated for " + filedata.Count() + " 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;
                        CyString sFile = CyStringFromSystemString(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(CyStringFromSystemString(file));
                                        if ( loaded )
                                        {
                                                shipFile->SetChanged(true);
                                                shipFile->SetFilename(CyStringFromSystemString(file));
                                                convertFile = shipFile;
                                        }
                                        else 
                                                delete shipFile;
                                }
                                else if ( String::Compare(IO::FileInfo(file).Extension, ".spk") == 0 )
                                {
                                        CSpkFile *spkFile = CSpkFile::convertFromOld(CyStringFromSystemString(file).ToString());
                                        if ( spkFile ) {
                                                loaded = true;
                                                spkFile->SetChanged(true);
                                                spkFile->SetFilename(CyStringFromSystemString(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->SetChanged(true);
                                                childForm->UpdateChanged();
                                        }
                                }
                        }

                        if ( loaded )
                        {
                                // adjust the loaded list
                                sFile.FindReplace("/", "\\");
                                sFile.RemoveChar(9);
                                sFile.RemoveChar('\r');
                                sFile.RemoveChar('\n');
                                m_pLoadedList->Remove(sFile, true);
                                m_pLoadedList->PushFront(sFile);

                                while ( m_pLoadedList->Count() > 15 )
                                        m_pLoadedList->PopBack();

                                this->SaveData();

                                this->UpdateDropDownOpen();
                        }       
                        else
                        {
                                if ( display )
                                {
                                        System::String ^sError = "Unknown Error (" + SystemStringFromCyString(CyString::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 ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
                        {
                                // check if we have it open
                                System::String ^sFile = SystemStringFromCyString(str->str.findreplace("/", "\\"));
                                if ( this->IsOpen(sFile) )
                                        continue;
                                if ( this->IsOpen(SystemStringFromCyString(str->str.findreplace("\\", "/"))) )
                                        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->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(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat");
                        CyStringList lines;

                        if ( this->WindowState == FormWindowState::Normal )
                        {
                                lines.PushBack(CyString("CreatorSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
                                lines.PushBack(CyString("CreatorPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
                        }
                        else
                        {
                                lines.PushBack(CyString("CreatorPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
                                lines.PushBack(CyString("CreatorSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
                        }

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

                        for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
                                lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
                        for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
                                lines.PushBack(CyString("GameDir:") + gd->sDir + ";" + gd->sGame + ((gd->bLoad) ? ";1" : ";0"));
                        if ( m_settings->bGenerateUpdate )
                                lines.PushBack("GenerateUpdate:");

                        Config.WriteFile(&lines);
                }

                void LoadData()
                {
                        System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
                        CFileIO Config;
                        if ( Config.Open(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat") )
                        {
                                std::vector<CyString> *lines = Config.ReadLines();
                                if ( lines )
                                {
                                        for ( int i = 0; i < (int)lines->size(); i++ )
                                        {
                                                CyString line(lines->at(i));
                                                CyString start = line.GetToken(":", 1, 1).ToLower();
                                                CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
                                                if ( start.Compare("CreatorSize") )
                                                        this->Size = System::Drawing::Size(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
                                                else if ( start.Compare("CreatorPos") )
                                                {
                                                        m_iLocX = rest.GetToken(" ", 1, 1).ToInt();
                                                        m_iLocY = rest.GetToken(" ", 2, 2).ToInt();
                                                }
                                                else if ( start.Compare("Loaded") )
                                                        m_pLoadedList->PushBack(rest);
                                                else if ( start.Compare("CreatorMax") )
                                                        this->WindowState = FormWindowState::Maximized;
                                                else if ( start.Compare("GenerateUpdate") )
                                                        m_settings->bGenerateUpdate = true;
                                                else if ( start.Compare("GameDir") )
                                                {
                                                        SGameDir *gd = new SGameDir;
                                                        gd->sDir = rest.GetToken(";", 1, 1);
                                                        gd->sGame = rest.GetToken(";", 2, 2);
                                                        gd->iGame = gd->sGame.GetToken(" ", 1, 1).ToInt();

                                                        SGameExe *exe = m_pPackages->GetGameExe()->GetGame(gd->iGame);

                                                        gd->bLoad = rest.GetToken(";", 3, 3).ToBool();
                                                        gd->pVfs = new CVirtualFileSystem();
                                                        gd->pVfs->setLanguage(44);
                                                        gd->pVfs->LoadFilesystem(gd->sDir.ToString());
                                                        if ( exe ) {
                                                                gd->pVfs->SetAddon(exe->sAddon.ToString());
                                                        }
                                                        m_pGameDir->push_back(gd);
                                                }
                                        }

                                        delete lines;
                                }
                        }
                }


                void LoadText(bool center, bool reload)
                {
                        if ( m_bTextLoaded && !reload )
                                return;
                        m_bTextLoaded = true;

                        if ( m_pGameDir->empty() )
                                return;

                        Creator::LoadText ^load = gcnew Creator::LoadText(m_pGameDir, m_pPackages);
                        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->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->fromPackagerScriptToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->importShipFromModToolStripMenuItem1 = (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->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->importShipFromVFSToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->menuStrip1->SuspendLayout();
                        this->PanelTab->SuspendLayout();
                        this->toolStrip1->SuspendLayout();
                        this->statusStrip1->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // menuStrip1
                        // 
                        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->Size = System::Drawing::Size(747, 24);
                        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(37, 20);
                        this->fileToolStripMenuItem->Text = L"&File";
                        // 
                        // newToolStripMenuItem
                        // 
                        this->newToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(7) {this->packageToolStripMenuItem, 
                                this->shipToolStripMenuItem, this->toolStripSeparator5, this->fromPackagerScriptToolStripMenuItem1, this->importShipFromModToolStripMenuItem1, 
                                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(150, 22);
                        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(205, 22);
                        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(205, 22);
                        this->shipToolStripMenuItem->Text = L"Ship";
                        this->shipToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::shipToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator5
                        // 
                        this->toolStripSeparator5->Name = L"toolStripSeparator5";
                        this->toolStripSeparator5->Size = System::Drawing::Size(202, 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(205, 22);
                        this->fromPackagerScriptToolStripMenuItem1->Text = L"From Packager Script";
                        this->fromPackagerScriptToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::fromPackagerScriptToolStripMenuItem1_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(205, 22);
                        this->importShipFromModToolStripMenuItem1->Text = L"Import Ship From Mod";
                        this->importShipFromModToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem1_Click);
                        // 
                        // toolStripSeparator6
                        // 
                        this->toolStripSeparator6->Name = L"toolStripSeparator6";
                        this->toolStripSeparator6->Size = System::Drawing::Size(202, 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(205, 22);
                        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(150, 22);
                        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(150, 22);
                        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(150, 22);
                        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(147, 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(150, 22);
                        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(68, 20);
                        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(110, 22);
                        this->layoutToolStripMenuItem->Text = L"Layout";
                        // 
                        // cascadeToolStripMenuItem
                        // 
                        this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";
                        this->cascadeToolStripMenuItem->Size = System::Drawing::Size(151, 22);
                        this->cascadeToolStripMenuItem->Text = L"Cascade";
                        this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);
                        // 
                        // horizontalToolStripMenuItem
                        // 
                        this->horizontalToolStripMenuItem->Name = L"horizontalToolStripMenuItem";
                        this->horizontalToolStripMenuItem->Size = System::Drawing::Size(151, 22);
                        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(151, 22);
                        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(107, 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(61, 20);
                        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(110, 22);
                        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(48, 20);
                        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(216, 22);
                        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(216, 22);
                        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(213, 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(216, 22);
                        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, 63);
                        this->PanelTab->Name = L"PanelTab";
                        this->PanelTab->Size = System::Drawing::Size(747, 27);
                        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->Name = L"tabControl1";
                        this->tabControl1->SelectedIndex = 0;
                        this->tabControl1->Size = System::Drawing::Size(726, 27);
                        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(726, 0);
                        this->button1->Name = L"button1";
                        this->button1->Size = System::Drawing::Size(21, 27);
                        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, 24);
                        this->toolStrip1->Name = L"toolStrip1";
                        this->toolStrip1->Size = System::Drawing::Size(747, 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(76, 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(221, 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(221, 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(221, 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(218, 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(221, 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(221, 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(221, 38);
                        this->importShipFromModToolStripMenuItem->Text = L"Import Ship From Mod";
                        this->importShipFromModToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator7
                        // 
                        this->toolStripSeparator7->Name = L"toolStripSeparator7";
                        this->toolStripSeparator7->Size = System::Drawing::Size(218, 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(221, 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(84, 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(81, 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(216, 22);
                        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(216, 22);
                        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(213, 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(216, 22);
                        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(216, 22);
                        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(213, 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(216, 22);
                        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->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->StatusFiles});
                        this->statusStrip1->Location = System::Drawing::Point(0, 674);
                        this->statusStrip1->Name = L"statusStrip1";
                        this->statusStrip1->Size = System::Drawing::Size(747, 22);
                        this->statusStrip1->TabIndex = 9;
                        this->statusStrip1->Text = L"statusStrip1";
                        // 
                        // StatusFiles
                        // 
                        this->StatusFiles->Name = L"StatusFiles";
                        this->StatusFiles->Size = System::Drawing::Size(79, 17);
                        this->StatusFiles->Text = L"Files: 1 (10KB)";
                        // 
                        // 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");
                        // 
                        // 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);
                        // 
                        // importShipFromVFSToolStripMenuItem
                        // 
                        this->importShipFromVFSToolStripMenuItem->Name = L"importShipFromVFSToolStripMenuItem";
                        this->importShipFromVFSToolStripMenuItem->Size = System::Drawing::Size(221, 38);
                        this->importShipFromVFSToolStripMenuItem->Text = L"Import Ship from VFS";
                        this->importShipFromVFSToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromVFSToolStripMenuItem_Click);
                        // 
                        // Form1
                        // 
                        this->AllowDrop = true;
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(747, 696);
                        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->Name = L"Form1";
                        this->Text = L"Package Creator";
                        this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
                        this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragDrop);
                        this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
                        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(CyStringFromSystemString(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 = SystemStringFromCyString(m_pConverted->GetFilename());
                         }
                 }
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();
                 }
};
}