Subversion Repositories spk

Rev

Rev 197 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

#include "SelectGame.h"

enum {FILE_NORMAL, FILE_SPK, FILE_XSP, FILE_PCK, FILE_XML, FILE_CAT, FILE_TXT, FILE_BOB, FILE_BOD, FILE_PBB, FILE_PBD, FILE_SPS};

namespace Creator {

        /// <summary>
        /// Summary for FileExplorer
        ///
        /// 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>
#pragma region Class Definintion
        public ref class FileExplorer : public System::Windows::Forms::Form
        {
        public:
                FileExplorer(System::Windows::Forms::Form ^creator, CPackages *p)
                {
                        InitializeComponent();

                        m_pCreator = creator;
                        m_pPackages = p;

                        UpdateFileSystem();
                }
#pragma endregion

#pragma region Public Functions
                bool OpenInCreator(String ^filename);

                void UpdateFileSystem()
                {
                        this->treeView1->Nodes->Clear();

                        TreeNode ^computernode = this->treeView1->Nodes->Add("Computer");
                        computernode->ImageIndex = 0;
                        computernode->SelectedImageIndex = -1;

                        cli::array<IO::DriveInfo ^> ^Drives = IO::DriveInfo::GetDrives();
                        if ( Drives && Drives->Length )
                        {
                                for ( int i = 0; i < Drives->Length; i++ )
                                {
                                        IO::DriveInfo ^info = Drives[i];
                                        if ( !info->IsReady ) continue;
                                        String ^str = info->Name;
                                        if ( str->Contains("\\") )
                                                str = str->Remove(str->Length - 1);
                                        TreeNode ^node = computernode->Nodes->Add(str);
                                        if ( info->DriveType == IO::DriveType::Fixed )
                                                node->ImageIndex = 1;
                                        else if ( info->DriveType == IO::DriveType::CDRom )
                                                node->ImageIndex = 2;
                                        else if ( info->DriveType == IO::DriveType::Removable )
                                                node->ImageIndex = 4;
                                        else if ( info->DriveType == IO::DriveType::Network )
                                                node->ImageIndex = 5;
                                        else if ( info->DriveType == IO::DriveType::Ram )
                                                node->ImageIndex = 7;
                                        node->SelectedImageIndex = node->ImageIndex;
                                        UpdateNode(node);
                                }
                        }

                        computernode->Expand();
                }

                int GetFileType(String ^file)
                {
                        String ^ext = IO::FileInfo(file).Extension->ToLower();
                        if ( ext == ".spk" ) return FILE_SPK;
                        else if ( ext == ".xsp" ) return FILE_XSP;
                        else if ( ext == ".pck" ) return FILE_PCK;
                        else if ( ext == ".xml" ) return FILE_XML;
                        else if ( ext == ".cat" ) return FILE_CAT;
                        else if ( ext == ".txt" ) return FILE_TXT;
                        else if ( ext == ".bob" ) return FILE_BOB;
                        else if ( ext == ".pbb" ) return FILE_PBB;
                        else if ( ext == ".bod" ) return FILE_BOD;
                        else if ( ext == ".pbd" ) return FILE_PBD;
                        else if ( ext == ".sps" ) return FILE_SPS;
                        return FILE_NORMAL;
                }
                int GetFileIcon(String ^file)
                {
                        String ^ext = IO::FileInfo(file).Extension->ToLower();

                        int idx = this->imageList3->Images->IndexOfKey(ext);
                        if ( idx > -1 )
                                return idx;

                        return 0;
                }

                void SetListView(Windows::Forms::View view)
                {
                        if ( view == Windows::Forms::View::Details )
                        {
                                this->listView1->Visible = false;
                                this->listView2->Visible = true;
                        }
                        else
                        {
                                this->listView1->View = view;
                                this->listView2->Visible = false;
                                this->listView1->Visible = true;
                                this->ArrangeList();
                        }
                }
                void ArrangeList()
                {
                        this->listView1->ArrangeIcons();
                        this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::ColumnContent);
                }
                void UpdateFilesList(String ^dir)
                {
                        this->listView1->Items->Clear();
                        this->listView2->Items->Clear();
                        if ( !dir ) return;
                        try {
                                cli::array<String ^> ^Files = IO::Directory::GetFiles(dir);
                                if ( Files )
                                {
                                        for (int i = 0; i < Files->Length; i++ )
                                        {
                                                if ( this->onlyShowXUniverseFilesToolStripMenuItem->Checked && !GetFileType(Files[i]) )
                                                        continue;

                                                if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden && !this->showHiddenToolStripMenuItem->Checked )
                                                        continue;
                                                ListViewItem ^item = gcnew ListViewItem(IO::FileInfo(Files[i]).Name);
                                                this->listView1->Items->Add(item);
                                                item->ImageIndex = GetFileIcon(Files[i]);
                                                item->Tag = dir;
                                                if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
                                                        item->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;

                                                ListViewItem ^item2 = gcnew ListViewItem(IO::FileInfo(Files[i]).Name);
                                                this->listView2->Items->Add(item2);
                                                item2->ImageIndex = GetFileIcon(Files[i]);
                                                item2->Tag = dir;
                                                if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
                                                        item2->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;

                                                switch (GetFileType(Files[i]))
                                                {
                                                        case FILE_XSP:
                                                                item2->SubItems->Add("Ship");
                                                                break;
                                                        case FILE_SPK:
                                                                item2->SubItems->Add("Package");
                                                                break;
                                                        case FILE_CAT:
                                                                item2->SubItems->Add("Mod/Patch");
                                                                break;
                                                        case FILE_XML:
                                                                item2->SubItems->Add("Script/Text");
                                                                break;
                                                        case FILE_TXT:
                                                                item2->SubItems->Add("T File");
                                                                break;
                                                        case FILE_PCK:
                                                                item2->SubItems->Add("Packed");
                                                                break;
                                                        case FILE_SPS:
                                                                item2->SubItems->Add("Packager Script");
                                                                break;
                                                        case FILE_PBB:
                                                        case FILE_PBD:
                                                                item2->SubItems->Add("Packed Model");
                                                                break;
                                                        case FILE_BOB:
                                                        case FILE_BOD:
                                                                item2->SubItems->Add("Model");
                                                                break;
                                                        default:
                                                                item2->SubItems->Add("");
                                                }

                                                String ^len;
                                                const int byteConversion = 1024;
                                                double bytes = Convert::ToDouble(IO::FileInfo(Files[i]).Length);
                                                if ( bytes >= System::Math::Pow(byteConversion, 3) )
                                                {
                                                        len = System::String::Concat(System::Math::Round(bytes / System::Math::Pow(byteConversion, 3), 2), " GB");
                                                }
                                                else if ( bytes >= System::Math::Pow(byteConversion, 2) )
                                                {
                                                        len = System::String::Concat(System::Math::Round(bytes / System::Math::Pow(byteConversion, 2), 2), " MB");
                                                }
                                                else if ( bytes >= byteConversion )
                                                {
                                                        len = System::String::Concat(System::Math::Round(bytes / byteConversion, 2), " KB");
                                                }
                                                else
                                                {
                                                        len = System::String::Concat(bytes, " B");
                                                }

                                                item2->SubItems->Add(len);
                                        }

                                        this->listView2->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
                                        this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::ColumnContent);
                                }
                        }
                        catch (IO::IOException ^) {}
                        catch (System::UnauthorizedAccessException ^) {}
                }

                String ^GetDirectory(TreeNode ^node)
                {
                        String ^str = node->FullPath;
                        if ( str->StartsWith("Computer\\") )
                        {
                                int pos = str->IndexOf("\\");
                                if ( pos != -1 )
                                {
                                        str = str->Remove(0, pos + 1);
                                        if ( str[str->Length - 1] != '\\' )
                                                str += "\\";
                                        return str;
                                }
                        }

                        return nullptr;
                }

                void SelectedNode(TreeNode ^node)
                {
                        this->toolStripStatusLabel1->Text = "";
                        this->listView1->Items->Clear();
                        this->listView2->Items->Clear();
                        if (!node || !node->Parent ) return;

                        String ^str = node->FullPath;
                        if ( str->StartsWith("Computer\\") )
                        {
                                int pos = str->IndexOf("\\");
                                if ( pos != -1 )
                                {
                                        str = str->Remove(0, pos + 1);
                                        if ( str[str->Length - 1] != '\\' )
                                                str += "\\";
                                        UpdateFilesList(str);
                                        try {
                                                str += " (Files: " + IO::Directory::GetFiles(str)->Length + ")";
                                        }
                                        catch (IO::IOException ^) {}
                                        catch (System::UnauthorizedAccessException ^) 
                                        {
                                                str += " (Unable to access)";
                                        }
                                        this->toolStripStatusLabel1->Text = str;
                                }
                        }
                }

                void Rename(String ^filename)
                {
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();
                        String ^baseName = IO::FileInfo(filename).Name;
                        int pos = baseName->LastIndexOf(".");
                        if ( pos != -1 )
                                baseName = baseName->Substring(0, pos);
                        InputBox ^input = gcnew InputBox("Enter the filename to rename to", baseName);
                        if ( input->ShowDialog(this) == Windows::Forms::DialogResult::OK )
                        {
                                try {
                                        IO::File::Move(filename, IO::FileInfo(filename).Directory + "\\" + input->GetInput() + IO::FileInfo(filename).Extension);
                                        this->SelectedNode(this->treeView1->SelectedNode);
                                }
                                catch (System::UnauthorizedAccessException ^)
                                {
                                        MessageBox::Show(this, "Unable to rename file:\n" + filename + "\n\nAccess Denied", "Access Denied", MessageBoxButtons::OK, MessageBoxIcon::Error);
                                }
                        }
                }

                int UnpackFiles(cli::array<String ^> ^Files, String ^dir)
                {
                        if ( !Files || !Files->Length ) return 0;

                        int count = 0;  
                        for ( int i = 0; i < Files->Length; i++ )
                        {
                                String ^file = Files[i];
                                
                                if ( m_pPackages->unPackFile(_WS(file)) )
                                        ++count;
                        }

                        return count;
                }
                void UnpackDirectory(String ^dir)
                {
                        int count = UnpackFiles(IO::Directory::GetFiles(dir, "*.pck"), dir);
                        count += UnpackFiles(IO::Directory::GetFiles(dir, "*.pbb"), dir);
                        count += UnpackFiles(IO::Directory::GetFiles(dir, "*.pbd"), dir);

                        if ( count )
                        {
                                this->SelectedNode(this->treeView1->SelectedNode);
                                MessageBox::Show(this, count + " files unpacked in " + dir, "Files Unpacked", MessageBoxButtons::OK, MessageBoxIcon::Information);
                        }
                        else
                                MessageBox::Show(this, "There were no files to unpack in " + dir, "No Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
                }

                int PackFiles(cli::array<String ^> ^Files, String ^dir)
                {
                        if ( !Files || !Files->Length ) return 0;

                        int count = 0;  
                        for ( int i = 0; i < Files->Length; i++ )
                        {
                                String ^file = Files[i];
                                
                                if ( m_pPackages->packFile(_WS(file)) )
                                        ++count;
                        }

                        return count;
                }
                void PackDirectory(String ^dir)
                {
                        int count = PackFiles(IO::Directory::GetFiles(dir, "*.txt"), dir);
                        count += PackFiles(IO::Directory::GetFiles(dir, "*.xml"), dir);
                        count += PackFiles(IO::Directory::GetFiles(dir, "*.bod"), dir);
                        count += PackFiles(IO::Directory::GetFiles(dir, "*.bob"), dir);

                        if ( count )
                        {
                                this->SelectedNode(this->treeView1->SelectedNode);
                                MessageBox::Show(this, count + " files packed in " + dir, "Files Packed", MessageBoxButtons::OK, MessageBoxIcon::Information);
                        }
                        else
                                MessageBox::Show(this, "There were no files to pack in " + dir, "No Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
                }
                void UnPack(ListViewItem ^item)
                {
                        if ( !item ) return;
                        UnPack(System::Convert::ToString(item->Tag) + item->Text);
                }
                void UnPack(String ^filename)
                {
                         if ( m_pPackages->unPackFile(_WS(filename)) )
                         {
                                 MessageBox::Show(this, "File: " + filename + "\nHas been unpacked", "File UnPacked", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                 this->SelectedNode(this->treeView1->SelectedNode);
                         }
                }
                void Pack(ListViewItem ^item)
                {
                        if ( !item ) return;
                        Pack(System::Convert::ToString(item->Tag) + item->Text);
                }
                void Pack(String ^filename)
                {
                         if ( m_pPackages->packFile(_WS(filename)) )
                         {
                                 MessageBox::Show(this, "File: " + filename + "\nHas been packed", "File Packed", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                 this->UpdateFiles();
                         }
                }

                void UpdateFiles() { this->SelectedNode(this->treeView1->SelectedNode); }
                void Extract(ListViewItem ^item)
                {
                        if ( !item ) return;
                        Extract(System::Convert::ToString(item->Tag) + item->Text);
                }
                void Extract(String ^filename)
                {
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();

                        FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
                        fbd->Description = "Select the path to extract files to";
                        fbd->ShowNewFolderButton = true;
                        fbd->SelectedPath = IO::FileInfo(filename).DirectoryName;
                        if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
                        {
                                bool extracted = false;

                                if ( ext == ".xsp" || ext == ".spk" )
                                {
                                        int error;
                                        int type = CSpkFile::CheckFile(_WS(filename));
                                        if ( type == SPKFILE_BASE || type == SPKFILE_SINGLE || type == SPKFILE_SINGLESHIP )
                                        {
                                                CBaseFile *package = m_pPackages->openPackage(_WS(filename), &error, 0, SPKREAD_ALL);
                                                if ( package )
                                                {
                                                        int game = 0;
                                                        if ( package->IsMultipleGamesInPackage() ) {
                                                                SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + filename, m_pPackages);
                                                                if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
                                                                        game = selGame->GetGame() + 1;
                                                                }
                                                                else
                                                                        return;
                                                        }
                                                        else if ( package->IsAnyGameInPackage() ) {
                                                                game = package->FindFirstGameInPackage();
                                                        }
                                                        if(m_pPackages->extractAll(package, _S(fbd->SelectedPath), game, true))
                                                                extracted = true;
                                                }
                                        }
                                        else if ( type == SPKFILE_MULTI )
                                        {
                                                CMultiSpkFile *multispk = m_pPackages->openMultiPackage(_WS(filename), &error);
                                                if ( multispk )
                                                {
                                                        if ( multispk->extractAll(_S(fbd->SelectedPath)) )
                                                                extracted = true;
                                                }
                                        }
                                        else
                                        {
                                                MessageBox::Show(this, "Invalid package file: " + filename + "\n\nUnable to extract", "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Warning);
                                                return;
                                        }
                                }
                                else if ( ext == ".cat" )
                                {
                                        CCatFile catfile;
                                        if ( catfile.open(_WS(filename), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
                                        {
                                                if ( catfile.extractAll(_WS(fbd->SelectedPath)) )
                                                        extracted = true;
                                        }
                                }
                                else
                                        return;

                                if ( extracted )
                                {
                                        UpdateFiles();
                                        MessageBox::Show(this, "File: " + filename + "\nHas been extracted (" + fbd->SelectedPath + ")", "Extracted", MessageBoxButtons::OK, MessageBoxIcon::Information);
                                }
                                else
                                        MessageBox::Show(this, "Unable to extract: " + filename, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                }

                void Rename(ListViewItem ^item)
                {
                        if ( !item ) return;
                        Rename(System::Convert::ToString(item->Tag) + item->Text);
                }
                void Open(ListViewItem ^item)
                {
                        if ( !item ) return;

                        String ^filename = System::Convert::ToString(item->Tag) + item->Text;
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();

                        if ( (ext == ".xsp" || ext == ".spk" || ext == ".sps") && m_pCreator )
                        {
                                if ( OpenInCreator(filename) )
                                        return;
                        }

                        Diagnostics::Process ^process = gcnew Diagnostics::Process();
                        try {
                                process->StartInfo->WorkingDirectory = System::Convert::ToString(item->Tag);
                                process->StartInfo->FileName = filename;

                                // open in creator
                                if ( ext == ".xsp" || ext == ".spk" || ext == ".sps" )
                                {
                                        process->StartInfo->FileName = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName + "\\Creator.exe";
                                        process->StartInfo->Arguments = "\"" + filename + "\"";
                                }

                                if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
                                {
                                        process->StartInfo->CreateNoWindow = true;
                                        process->Start();
                                }
                        }
                        catch (System::Exception ^E) 
                        {
                                MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                }

                void Explore(ListViewItem ^item)
                {
                        String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();

                        Diagnostics::Process ^process = gcnew Diagnostics::Process();
                        try {
                                process->StartInfo->WorkingDirectory = System::Convert::ToString(m_pSelectedItem->Tag);

                                // open in creator
                                if ( ext == ".xsp" || ext == ".spk" )
                                {
                                        process->StartInfo->FileName = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName + "\\SpkExplorer.exe";
                                        process->StartInfo->Arguments = "\"" + filename + "\"";
                                }

                                if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
                                {
                                        process->StartInfo->CreateNoWindow = true;
                                        process->Start();
                                }
                        }
                        catch (System::Exception ^E) 
                        {
                                MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                }
#pragma endregion
#pragma region Protected/Private functions
        protected:
                void UpdateNextNodes(TreeNode ^node)
                {
                        for ( int i = 0; i < node->Nodes->Count; i++ )
                                UpdateNode(node->Nodes[i]);
                }

                void UpdateNode(TreeNode ^node)
                {
                        System::String ^str = node->FullPath;
                        if ( !node->Nodes->Count && str->StartsWith("Computer\\") )
                        {
                                int pos = str->IndexOf("\\");
                                if ( pos != -1 )
                                {
                                        str = str->Remove(0, pos + 1);
                                        try {
                                                if ( str[str->Length - 1] != '\\' )
                                                        str += "\\";
                                                cli::array<System::String ^> ^Dirs = IO::Directory::GetDirectories(str);
                                                if ( Dirs )
                                                {
                                                        for ( int i = 0; i < Dirs->Length; i++ )
                                                        {
                                                                IO::DirectoryInfo ^info = gcnew IO::DirectoryInfo(Dirs[i]);
                                                                bool hidden = false;
                                                                if ( (IO::File::GetAttributes(Dirs[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
                                                                        hidden = true;

                                                                if ( !this->showHiddenToolStripMenuItem->Checked && hidden )
                                                                        continue;
                                                                TreeNode ^newnode = node->Nodes->Add(info->Name);

                                                                if ( hidden )
                                                                {
                                                                        newnode->Tag = 1;
                                                                        newnode->ImageIndex = 10;
                                                                        newnode->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;
                                                                }
                                                                else
                                                                {
                                                                        newnode->ImageIndex = 9;
                                                                        newnode->Tag = System::Convert::ToInt32(0);
                                                                }
                                                                newnode->SelectedImageIndex = newnode->ImageIndex;
                                                        }
                                                }
                                        }
                                        catch(IO::IOException ^) {}
                                        catch(System::UnauthorizedAccessException ^) {}
                                }
                        }
                }

                void UnselectAllViews()
                {
                        this->tileToolStripMenuItem->Checked = false;
                        this->largeIconToolStripMenuItem->Checked = false;
                        this->smallIconsToolStripMenuItem->Checked = false;
                        this->listToolStripMenuItem->Checked = false;
                        this->detailsToolStripMenuItem->Checked = false;
                }
#pragma endregion

#pragma region Defined Variables
protected: 
                Windows::Forms::ContextMenuStrip ^m_pContext;
                Windows::Forms::ListViewItem    ^m_pSelectedItem;
                Windows::Forms::TreeNode                ^m_pSelectedNode;
                Windows::Forms::Form                    ^m_pCreator;
private: System::Windows::Forms::ToolStripMenuItem^  createPackageToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  editToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
private: System::Windows::Forms::ToolStripMenuItem^  generateUpdateFilesToolStripMenuItem;
protected: 
        CPackages                                               *m_pPackages;
#pragma endregion

                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~FileExplorer()
                {
                        if (components)
                        {
                                delete components;
                        }
                }

#pragma region Builtin Variables
        private:
                /// <summary>
                /// Required designer variable.
                /// </summary>

private: System::Windows::Forms::ToolStripMenuItem^  renameToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  showHiddenToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  onlyShowXUniverseFilesToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  packToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  unpackToolStripMenuItem;
private: System::Windows::Forms::ImageList^  imageList2;
private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  largeIconToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  updateToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
private: System::Windows::Forms::ToolStripMenuItem^  tileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  smallIconsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  listToolStripMenuItem;
private: System::Windows::Forms::ColumnHeader^  columnHeader1;
private: System::Windows::Forms::ColumnHeader^  columnHeader2;
private: System::Windows::Forms::ColumnHeader^  columnHeader3;
private: System::Windows::Forms::ListView^  listView2;
private: System::Windows::Forms::ToolStripMenuItem^  detailsToolStripMenuItem;
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip2;
private: System::Windows::Forms::ToolStripMenuItem^  packDirectoryToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  unpackDirectoryToolStripMenuItem;
        private: System::Windows::Forms::StatusStrip^  statusStrip1;
        private: System::Windows::Forms::MenuStrip^  menuStrip1;
        private: System::Windows::Forms::SplitContainer^  splitContainer1;
        private: System::Windows::Forms::TreeView^  treeView1;
        private: System::Windows::Forms::ImageList^  imageList1;
        private: System::Windows::Forms::ToolStripStatusLabel^  toolStripStatusLabel1;
private: System::Windows::Forms::ListView^  listView1;
private: System::Windows::Forms::ImageList^  imageList3;
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^  exploreToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  extractToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^  installToolStripMenuItem;

        private: System::ComponentModel::IContainer^  components;
#pragma endregion

#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(FileExplorer::typeid));
                        this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
                        this->toolStripStatusLabel1 = (gcnew System::Windows::Forms::ToolStripStatusLabel());
                        this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
                        this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->updateToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->showHiddenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->onlyShowXUniverseFilesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->largeIconToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->tileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->smallIconsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->listToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->detailsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());
                        this->treeView1 = (gcnew System::Windows::Forms::TreeView());
                        this->contextMenuStrip2 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
                        this->packDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->unpackDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->listView2 = (gcnew System::Windows::Forms::ListView());
                        this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
                        this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
                        this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
                        this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
                        this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->installToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->exploreToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->createPackageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->editToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->extractToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->renameToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->packToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->unpackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->imageList3 = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->imageList2 = (gcnew System::Windows::Forms::ImageList(this->components));
                        this->listView1 = (gcnew System::Windows::Forms::ListView());
                        this->generateUpdateFilesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                        this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
                        this->statusStrip1->SuspendLayout();
                        this->menuStrip1->SuspendLayout();
                        this->splitContainer1->Panel1->SuspendLayout();
                        this->splitContainer1->Panel2->SuspendLayout();
                        this->splitContainer1->SuspendLayout();
                        this->contextMenuStrip2->SuspendLayout();
                        this->contextMenuStrip1->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // statusStrip1
                        // 
                        this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->toolStripStatusLabel1});
                        this->statusStrip1->Location = System::Drawing::Point(0, 595);
                        this->statusStrip1->Name = L"statusStrip1";
                        this->statusStrip1->Size = System::Drawing::Size(696, 22);
                        this->statusStrip1->TabIndex = 0;
                        this->statusStrip1->Text = L"statusStrip1";
                        // 
                        // toolStripStatusLabel1
                        // 
                        this->toolStripStatusLabel1->Name = L"toolStripStatusLabel1";
                        this->toolStripStatusLabel1->Size = System::Drawing::Size(0, 17);
                        // 
                        // menuStrip1
                        // 
                        this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
                                this->settingsToolStripMenuItem, this->viewToolStripMenuItem});
                        this->menuStrip1->Location = System::Drawing::Point(0, 0);
                        this->menuStrip1->Name = L"menuStrip1";
                        this->menuStrip1->Size = System::Drawing::Size(696, 24);
                        this->menuStrip1->TabIndex = 1;
                        this->menuStrip1->Text = L"menuStrip1";
                        // 
                        // fileToolStripMenuItem
                        // 
                        this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->updateToolStripMenuItem, 
                                this->toolStripSeparator2, this->exitToolStripMenuItem});
                        this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
                        this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
                        this->fileToolStripMenuItem->Text = L"File";
                        // 
                        // updateToolStripMenuItem
                        // 
                        this->updateToolStripMenuItem->Name = L"updateToolStripMenuItem";
                        this->updateToolStripMenuItem->Size = System::Drawing::Size(112, 22);
                        this->updateToolStripMenuItem->Text = L"Update";
                        this->updateToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::updateToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator2
                        // 
                        this->toolStripSeparator2->Name = L"toolStripSeparator2";
                        this->toolStripSeparator2->Size = System::Drawing::Size(109, 6);
                        // 
                        // exitToolStripMenuItem
                        // 
                        this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
                        this->exitToolStripMenuItem->Size = System::Drawing::Size(112, 22);
                        this->exitToolStripMenuItem->Text = L"Exit";
                        this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::exitToolStripMenuItem_Click);
                        // 
                        // settingsToolStripMenuItem
                        // 
                        this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->showHiddenToolStripMenuItem, 
                                this->onlyShowXUniverseFilesToolStripMenuItem});
                        this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
                        this->settingsToolStripMenuItem->Size = System::Drawing::Size(61, 20);
                        this->settingsToolStripMenuItem->Text = L"Settings";
                        // 
                        // showHiddenToolStripMenuItem
                        // 
                        this->showHiddenToolStripMenuItem->CheckOnClick = true;
                        this->showHiddenToolStripMenuItem->Name = L"showHiddenToolStripMenuItem";
                        this->showHiddenToolStripMenuItem->Size = System::Drawing::Size(211, 22);
                        this->showHiddenToolStripMenuItem->Text = L"Show Hidden";
                        this->showHiddenToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::showHiddenToolStripMenuItem_Click);
                        // 
                        // onlyShowXUniverseFilesToolStripMenuItem
                        // 
                        this->onlyShowXUniverseFilesToolStripMenuItem->CheckOnClick = true;
                        this->onlyShowXUniverseFilesToolStripMenuItem->Name = L"onlyShowXUniverseFilesToolStripMenuItem";
                        this->onlyShowXUniverseFilesToolStripMenuItem->Size = System::Drawing::Size(211, 22);
                        this->onlyShowXUniverseFilesToolStripMenuItem->Text = L"Hide Non X-Universe Files";
                        this->onlyShowXUniverseFilesToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::onlyShowXUniverseFilesToolStripMenuItem_Click);
                        // 
                        // viewToolStripMenuItem
                        // 
                        this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->largeIconToolStripMenuItem, 
                                this->tileToolStripMenuItem, this->smallIconsToolStripMenuItem, this->listToolStripMenuItem, this->detailsToolStripMenuItem});
                        this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
                        this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
                        this->viewToolStripMenuItem->Text = L"View";
                        // 
                        // largeIconToolStripMenuItem
                        // 
                        this->largeIconToolStripMenuItem->Checked = true;
                        this->largeIconToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Checked;
                        this->largeIconToolStripMenuItem->Name = L"largeIconToolStripMenuItem";
                        this->largeIconToolStripMenuItem->Size = System::Drawing::Size(134, 22);
                        this->largeIconToolStripMenuItem->Text = L"Large Icon";
                        this->largeIconToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::largeIconToolStripMenuItem_Click);
                        // 
                        // tileToolStripMenuItem
                        // 
                        this->tileToolStripMenuItem->Name = L"tileToolStripMenuItem";
                        this->tileToolStripMenuItem->Size = System::Drawing::Size(134, 22);
                        this->tileToolStripMenuItem->Text = L"Tile";
                        this->tileToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::tileToolStripMenuItem_Click);
                        // 
                        // smallIconsToolStripMenuItem
                        // 
                        this->smallIconsToolStripMenuItem->Name = L"smallIconsToolStripMenuItem";
                        this->smallIconsToolStripMenuItem->Size = System::Drawing::Size(134, 22);
                        this->smallIconsToolStripMenuItem->Text = L"Small Icons";
                        this->smallIconsToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::smallIconsToolStripMenuItem_Click);
                        // 
                        // listToolStripMenuItem
                        // 
                        this->listToolStripMenuItem->Name = L"listToolStripMenuItem";
                        this->listToolStripMenuItem->Size = System::Drawing::Size(134, 22);
                        this->listToolStripMenuItem->Text = L"List";
                        this->listToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::listToolStripMenuItem_Click);
                        // 
                        // detailsToolStripMenuItem
                        // 
                        this->detailsToolStripMenuItem->Name = L"detailsToolStripMenuItem";
                        this->detailsToolStripMenuItem->Size = System::Drawing::Size(134, 22);
                        this->detailsToolStripMenuItem->Text = L"Details";
                        this->detailsToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::detailsToolStripMenuItem_Click);
                        // 
                        // splitContainer1
                        // 
                        this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->splitContainer1->Location = System::Drawing::Point(0, 24);
                        this->splitContainer1->Name = L"splitContainer1";
                        // 
                        // splitContainer1.Panel1
                        // 
                        this->splitContainer1->Panel1->Controls->Add(this->treeView1);
                        // 
                        // splitContainer1.Panel2
                        // 
                        this->splitContainer1->Panel2->Controls->Add(this->listView2);
                        this->splitContainer1->Panel2->Controls->Add(this->listView1);
                        this->splitContainer1->Size = System::Drawing::Size(696, 571);
                        this->splitContainer1->SplitterDistance = 280;
                        this->splitContainer1->TabIndex = 2;
                        // 
                        // treeView1
                        // 
                        this->treeView1->ContextMenuStrip = this->contextMenuStrip2;
                        this->treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->treeView1->HideSelection = false;
                        this->treeView1->ImageIndex = 8;
                        this->treeView1->ImageList = this->imageList1;
                        this->treeView1->Location = System::Drawing::Point(0, 0);
                        this->treeView1->Name = L"treeView1";
                        this->treeView1->SelectedImageIndex = 0;
                        this->treeView1->Size = System::Drawing::Size(280, 571);
                        this->treeView1->TabIndex = 0;
                        this->treeView1->BeforeExpand += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &FileExplorer::treeView1_BeforeExpand);
                        this->treeView1->NodeMouseClick += gcnew System::Windows::Forms::TreeNodeMouseClickEventHandler(this, &FileExplorer::treeView1_NodeMouseClick);
                        this->treeView1->BeforeCheck += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &FileExplorer::treeView1_BeforeCheck);
                        // 
                        // contextMenuStrip2
                        // 
                        this->contextMenuStrip2->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->packDirectoryToolStripMenuItem, 
                                this->unpackDirectoryToolStripMenuItem, this->toolStripSeparator3, this->generateUpdateFilesToolStripMenuItem});
                        this->contextMenuStrip2->Name = L"contextMenuStrip2";
                        this->contextMenuStrip2->Size = System::Drawing::Size(189, 98);
                        this->contextMenuStrip2->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &FileExplorer::contextMenuStrip2_Opening);
                        // 
                        // packDirectoryToolStripMenuItem
                        // 
                        this->packDirectoryToolStripMenuItem->Name = L"packDirectoryToolStripMenuItem";
                        this->packDirectoryToolStripMenuItem->Size = System::Drawing::Size(188, 22);
                        this->packDirectoryToolStripMenuItem->Text = L"Pack Directory";
                        this->packDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::packDirectoryToolStripMenuItem_Click);
                        // 
                        // unpackDirectoryToolStripMenuItem
                        // 
                        this->unpackDirectoryToolStripMenuItem->Name = L"unpackDirectoryToolStripMenuItem";
                        this->unpackDirectoryToolStripMenuItem->Size = System::Drawing::Size(188, 22);
                        this->unpackDirectoryToolStripMenuItem->Text = L"Unpack Directory";
                        this->unpackDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::unpackDirectoryToolStripMenuItem_Click);
                        // 
                        // 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"computer");
                        this->imageList1->Images->SetKeyName(1, L"harddrive");
                        this->imageList1->Images->SetKeyName(2, L"cdrom");
                        this->imageList1->Images->SetKeyName(3, L"dvd");
                        this->imageList1->Images->SetKeyName(4, L"floppy");
                        this->imageList1->Images->SetKeyName(5, L"network");
                        this->imageList1->Images->SetKeyName(6, L"web");
                        this->imageList1->Images->SetKeyName(7, L"ram");
                        this->imageList1->Images->SetKeyName(8, L"next.png");
                        this->imageList1->Images->SetKeyName(9, L"gnome-folder.png");
                        this->imageList1->Images->SetKeyName(10, L"file-types-properties.png");
                        // 
                        // listView2
                        // 
                        this->listView2->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(3) {this->columnHeader1, this->columnHeader2, 
                                this->columnHeader3});
                        this->listView2->ContextMenuStrip = this->contextMenuStrip1;
                        this->listView2->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->listView2->FullRowSelect = true;
                        this->listView2->LargeImageList = this->imageList3;
                        this->listView2->Location = System::Drawing::Point(0, 0);
                        this->listView2->MultiSelect = false;
                        this->listView2->Name = L"listView2";
                        this->listView2->Size = System::Drawing::Size(412, 571);
                        this->listView2->SmallImageList = this->imageList2;
                        this->listView2->TabIndex = 1;
                        this->listView2->UseCompatibleStateImageBehavior = false;
                        this->listView2->View = System::Windows::Forms::View::Details;
                        this->listView2->Visible = false;
                        this->listView2->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FileExplorer::listView2_MouseDoubleClick);
                        // 
                        // columnHeader1
                        // 
                        this->columnHeader1->Text = L"File";
                        // 
                        // columnHeader2
                        // 
                        this->columnHeader2->Text = L"Type";
                        // 
                        // columnHeader3
                        // 
                        this->columnHeader3->Text = L"Size";
                        // 
                        // contextMenuStrip1
                        // 
                        this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(10) {this->openToolStripMenuItem, 
                                this->installToolStripMenuItem, this->exploreToolStripMenuItem, this->createPackageToolStripMenuItem, this->editToolStripMenuItem, 
                                this->toolStripSeparator1, this->extractToolStripMenuItem, this->renameToolStripMenuItem, this->packToolStripMenuItem, this->unpackToolStripMenuItem});
                        this->contextMenuStrip1->Name = L"contextMenuStrip1";
                        this->contextMenuStrip1->Size = System::Drawing::Size(156, 208);
                        this->contextMenuStrip1->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &FileExplorer::contextMenuStrip1_Opening);
                        // 
                        // openToolStripMenuItem
                        // 
                        this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
                        this->openToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->openToolStripMenuItem->Text = L"Open";
                        this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::openToolStripMenuItem_Click);
                        // 
                        // installToolStripMenuItem
                        // 
                        this->installToolStripMenuItem->Name = L"installToolStripMenuItem";
                        this->installToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->installToolStripMenuItem->Text = L"Install";
                        this->installToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::installToolStripMenuItem_Click);
                        // 
                        // exploreToolStripMenuItem
                        // 
                        this->exploreToolStripMenuItem->Name = L"exploreToolStripMenuItem";
                        this->exploreToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->exploreToolStripMenuItem->Text = L"Explore";
                        this->exploreToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::exploreToolStripMenuItem_Click);
                        // 
                        // createPackageToolStripMenuItem
                        // 
                        this->createPackageToolStripMenuItem->Name = L"createPackageToolStripMenuItem";
                        this->createPackageToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->createPackageToolStripMenuItem->Text = L"Create Package";
                        this->createPackageToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::createPackageToolStripMenuItem_Click);
                        // 
                        // editToolStripMenuItem
                        // 
                        this->editToolStripMenuItem->Name = L"editToolStripMenuItem";
                        this->editToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->editToolStripMenuItem->Text = L"Edit";
                        this->editToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::editToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator1
                        // 
                        this->toolStripSeparator1->Name = L"toolStripSeparator1";
                        this->toolStripSeparator1->Size = System::Drawing::Size(152, 6);
                        // 
                        // extractToolStripMenuItem
                        // 
                        this->extractToolStripMenuItem->Name = L"extractToolStripMenuItem";
                        this->extractToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->extractToolStripMenuItem->Text = L"Extract";
                        this->extractToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::extractToolStripMenuItem_Click);
                        // 
                        // renameToolStripMenuItem
                        // 
                        this->renameToolStripMenuItem->Name = L"renameToolStripMenuItem";
                        this->renameToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->renameToolStripMenuItem->Text = L"Rename";
                        this->renameToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::renameToolStripMenuItem_Click);
                        // 
                        // packToolStripMenuItem
                        // 
                        this->packToolStripMenuItem->Name = L"packToolStripMenuItem";
                        this->packToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->packToolStripMenuItem->Text = L"Pack";
                        this->packToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::packToolStripMenuItem_Click);
                        // 
                        // unpackToolStripMenuItem
                        // 
                        this->unpackToolStripMenuItem->Name = L"unpackToolStripMenuItem";
                        this->unpackToolStripMenuItem->Size = System::Drawing::Size(155, 22);
                        this->unpackToolStripMenuItem->Text = L"Unpack";
                        this->unpackToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::unpackToolStripMenuItem_Click);
                        // 
                        // imageList3
                        // 
                        this->imageList3->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList3.ImageStream")));
                        this->imageList3->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageList3->Images->SetKeyName(0, L"gnome-library.png");
                        this->imageList3->Images->SetKeyName(1, L".spk");
                        this->imageList3->Images->SetKeyName(2, L".xsp");
                        this->imageList3->Images->SetKeyName(3, L".xml");
                        this->imageList3->Images->SetKeyName(4, L".cat");
                        this->imageList3->Images->SetKeyName(5, L".pck");
                        this->imageList3->Images->SetKeyName(6, L".txt");
                        // 
                        // imageList2
                        // 
                        this->imageList2->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList2.ImageStream")));
                        this->imageList2->TransparentColor = System::Drawing::Color::Transparent;
                        this->imageList2->Images->SetKeyName(0, L"gnome-library.png");
                        this->imageList2->Images->SetKeyName(1, L".spk");
                        this->imageList2->Images->SetKeyName(2, L".xsp");
                        this->imageList2->Images->SetKeyName(3, L".xml");
                        this->imageList2->Images->SetKeyName(4, L".cat");
                        this->imageList2->Images->SetKeyName(5, L".pck");
                        this->imageList2->Images->SetKeyName(6, L".txt");
                        // 
                        // listView1
                        // 
                        this->listView1->ContextMenuStrip = this->contextMenuStrip1;
                        this->listView1->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->listView1->FullRowSelect = true;
                        this->listView1->LargeImageList = this->imageList3;
                        this->listView1->Location = System::Drawing::Point(0, 0);
                        this->listView1->MultiSelect = false;
                        this->listView1->Name = L"listView1";
                        this->listView1->Size = System::Drawing::Size(412, 571);
                        this->listView1->SmallImageList = this->imageList2;
                        this->listView1->TabIndex = 0;
                        this->listView1->UseCompatibleStateImageBehavior = false;
                        this->listView1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FileExplorer::listView1_MouseDoubleClick);
                        // 
                        // generateUpdateFilesToolStripMenuItem
                        // 
                        this->generateUpdateFilesToolStripMenuItem->Name = L"generateUpdateFilesToolStripMenuItem";
                        this->generateUpdateFilesToolStripMenuItem->Size = System::Drawing::Size(188, 22);
                        this->generateUpdateFilesToolStripMenuItem->Text = L"Generate Update Files";
                        this->generateUpdateFilesToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::generateUpdateFilesToolStripMenuItem_Click);
                        // 
                        // toolStripSeparator3
                        // 
                        this->toolStripSeparator3->Name = L"toolStripSeparator3";
                        this->toolStripSeparator3->Size = System::Drawing::Size(185, 6);
                        // 
                        // FileExplorer
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(696, 617);
                        this->Controls->Add(this->splitContainer1);
                        this->Controls->Add(this->statusStrip1);
                        this->Controls->Add(this->menuStrip1);
                        this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
                        this->MainMenuStrip = this->menuStrip1;
                        this->Name = L"FileExplorer";
                        this->Text = L"File Explorer";
                        this->statusStrip1->ResumeLayout(false);
                        this->statusStrip1->PerformLayout();
                        this->menuStrip1->ResumeLayout(false);
                        this->menuStrip1->PerformLayout();
                        this->splitContainer1->Panel1->ResumeLayout(false);
                        this->splitContainer1->Panel2->ResumeLayout(false);
                        this->splitContainer1->ResumeLayout(false);
                        this->contextMenuStrip2->ResumeLayout(false);
                        this->contextMenuStrip1->ResumeLayout(false);
                        this->ResumeLayout(false);
                        this->PerformLayout();

                }
#pragma endregion
#pragma region Designer object functions
        private: System::Void treeView1_BeforeExpand(System::Object^  sender, System::Windows::Forms::TreeViewCancelEventArgs^  e) {
                                 UpdateNextNodes(e->Node);
                         }
private: System::Void treeView1_BeforeCheck(System::Object^  sender, System::Windows::Forms::TreeViewCancelEventArgs^  e) {
                 }
private: System::Void treeView1_NodeMouseClick(System::Object^  sender, System::Windows::Forms::TreeNodeMouseClickEventArgs^  e) {
                         SelectedNode(e->Node);
                 }
private: System::Void exploreToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Explore(m_pSelectedItem);
                 }
private: System::Void contextMenuStrip1_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
                         ListView ^list = this->listView1;
                         if ( this->listView2->Visible )
                                 list = this->listView2;
                         Point ^mousePoint = list->PointToClient(this->contextMenuStrip1->MousePosition);
                         ListViewItem ^item = list->GetItemAt(mousePoint->X, mousePoint->Y);

                         m_pSelectedItem = item;

                         bool open = false;
                         if ( item ) // only display for certain file types
                         {
                                String ^filename = System::Convert::ToString(item->Tag) + item->Text;
                                String ^ext = IO::FileInfo(filename).Extension->ToLower();
                                
                                bool script = (ext == ".xsp" || ext == ".spk") ? true : false;

                                this->extractToolStripMenuItem->Visible = (ext == ".xsp" || ext == ".spk" || ext == ".cat") ? true : false;
                                this->installToolStripMenuItem->Visible = script;
                                this->exploreToolStripMenuItem->Visible = script;
                                this->unpackToolStripMenuItem->Visible  = (ext == ".pck" || ext == ".pbb" || ext == ".pbd") ? true : false;
                                this->packToolStripMenuItem->Visible = (ext == ".xml" || ext == ".bob" || ext == ".bod" || ext == ".txt") ? true : false;
                                this->createPackageToolStripMenuItem->Visible = (ext == ".sps") ? true : false;
                                this->editToolStripMenuItem->Visible = (ext == ".sps") ? true : false;

                                open = true;
                         }

                         if ( !open )
                                 e->Cancel = true;
                 }
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Open(m_pSelectedItem);
                }
private: System::Void installToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                        String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();

                        if ( ext == ".xsp" || ext == ".spk" )
                                Open(m_pSelectedItem);
                 }
private: System::Void listView1_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
                         Open(this->listView1->GetItemAt(e->Location.X, e->Location.Y));
                 }
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Close();
                 }
private: System::Void showHiddenToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UpdateFileSystem();
                         UpdateFilesList(nullptr);
                 }
private: System::Void onlyShowXUniverseFilesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                        SelectedNode(this->treeView1->SelectedNode);
                 }
private: System::Void renameToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Rename(m_pSelectedItem);
                 }
private: System::Void extractToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Extract(m_pSelectedItem);
                 }
private: System::Void updateToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->UpdateFileSystem();
                         UpdateFilesList(nullptr);
                 }
private: System::Void largeIconToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnselectAllViews();
                         this->largeIconToolStripMenuItem->Checked = true;
                         SetListView(System::Windows::Forms::View::LargeIcon);
                 }
private: System::Void tileToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnselectAllViews();
                         this->tileToolStripMenuItem->Checked = true;
                         SetListView(System::Windows::Forms::View::Tile);
                 }
private: System::Void smallIconsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnselectAllViews();
                         this->smallIconsToolStripMenuItem->Checked = true;
                         SetListView(System::Windows::Forms::View::SmallIcon);
                 }
private: System::Void listToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnselectAllViews();
                         this->listToolStripMenuItem->Checked = true;
                         SetListView(System::Windows::Forms::View::List);
                 }
private: System::Void listView2_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
                         Open(this->listView2->GetItemAt(e->Location.X, e->Location.Y));
                 }
private: System::Void detailsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnselectAllViews();
                         this->detailsToolStripMenuItem->Checked = true;
                         SetListView(System::Windows::Forms::View::Details);
                 }
private: System::Void packToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         Pack(m_pSelectedItem);
                 }
private: System::Void unpackToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnPack(m_pSelectedItem);
                 }
private: System::Void packDirectoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         PackDirectory(GetDirectory(m_pSelectedNode));
                 }
private: System::Void unpackDirectoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         UnpackDirectory(GetDirectory(m_pSelectedNode));
                 }
private: System::Void contextMenuStrip2_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
                         Point ^mousePoint = this->treeView1->PointToClient(this->contextMenuStrip2->MousePosition);
                         m_pSelectedNode = this->treeView1->GetNodeAt(mousePoint->X, mousePoint->Y);
                 }
private: System::Void createPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                        String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
                        Utils::WString saved = CPackages::CreateFromPackagerScript(m_pPackages, _WS(filename));
                        if ( !saved.empty() )
                        {
                                this->UpdateFiles();
                                MessageBox::Show(this, "Package: " + _US(saved) + "\nhas been created from packager script", "Package Created", MessageBoxButtons::OK, MessageBoxIcon::Information);
                        }
                        else
                                MessageBox::Show(this, "Unable to create package from script\n" + filename, "Package Creation Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
                 }
private: System::Void editToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                        String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
                        String ^ext = IO::FileInfo(filename).Extension->ToLower();

                        Diagnostics::Process ^process = gcnew Diagnostics::Process();
                        try {
                                process->StartInfo->WorkingDirectory = System::Convert::ToString(m_pSelectedItem->Tag);
                                // open in creator
                                if ( ext == ".sps" )
                                {
                                        process->StartInfo->FileName = "notepad.exe";
                                        process->StartInfo->Arguments = "\"" + filename + "\"";
                                }

                                if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
                                {
                                        process->StartInfo->CreateNoWindow = true;
                                        process->Start();
                                }
                        }
                        catch (System::Exception ^E) 
                        {
                                MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
                        }
                 }
private: System::Void generateUpdateFilesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                         int packages = CPackages::GeneratePackageUpdateData(_WS(GetDirectory(m_pSelectedNode)), true);
                         if ( packages )
                         {
                                 this->UpdateFiles();
                                 MessageBox::Show(this, "Package Update files generated in " + GetDirectory(m_pSelectedNode) + "\n" + packages + " packages found", "Update Files generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
                         }
                 }
};
#pragma endregion
}