| 1 | 
           cycrow | 
           1 | 
           #pragma once
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           #include <spk.h>
  | 
        
        
            | 
            | 
           4 | 
              | 
        
        
            | 
            | 
           5 | 
           #define VERSION 1.30
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
           #undef GetTempPath
  | 
        
        
            | 
            | 
           8 | 
              | 
        
        
            | 
            | 
           9 | 
           namespace XspConvert {
  | 
        
        
            | 
            | 
           10 | 
              | 
        
        
            | 
            | 
           11 | 
           	using namespace System;
  | 
        
        
            | 
            | 
           12 | 
           	using namespace System::ComponentModel;
  | 
        
        
            | 
            | 
           13 | 
           	using namespace System::Collections;
  | 
        
        
            | 
            | 
           14 | 
           	using namespace System::Windows::Forms;
  | 
        
        
            | 
            | 
           15 | 
           	using namespace System::Data;
  | 
        
        
            | 
            | 
           16 | 
           	using namespace System::Drawing;
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           	/// <summary>
  | 
        
        
            | 
            | 
           19 | 
           	/// Summary for Form1
  | 
        
        
            | 
            | 
           20 | 
           	///
  | 
        
        
            | 
            | 
           21 | 
           	/// WARNING: If you change the name of this class, you will need to change the
  | 
        
        
            | 
            | 
           22 | 
           	///          'Resource File Name' property for the managed resource compiler tool
  | 
        
        
            | 
            | 
           23 | 
           	///          associated with all .resx files this class depends on.  Otherwise,
  | 
        
        
            | 
            | 
           24 | 
           	///          the designers will not be able to interact properly with localized
  | 
        
        
            | 
            | 
           25 | 
           	///          resources associated with this form.
  | 
        
        
            | 
            | 
           26 | 
           	/// </summary>
  | 
        
        
            | 
            | 
           27 | 
           	public ref class Form1 : public System::Windows::Forms::Form
  | 
        
        
            | 
            | 
           28 | 
           	{
  | 
        
        
            | 
            | 
           29 | 
           	public:
  | 
        
        
            | 
            | 
           30 | 
           		Form1(System::String ^open)
  | 
        
        
            | 
            | 
           31 | 
           		{
  | 
        
        
            | 
            | 
           32 | 
           			InitializeComponent();
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
           			m_bLoading = false;
  | 
        
        
            | 
            | 
           37 | 
           			m_bDontChange = false;
  | 
        
        
            | 
            | 
           38 | 
           			m_bDontUpdate = false;
  | 
        
        
            | 
            | 
           39 | 
           			m_bChanged = false;
  | 
        
        
            | 
            | 
           40 | 
           			m_bReadText = false;
  | 
        
        
            | 
            | 
           41 | 
           			m_pLoadedShip = NULL;
  | 
        
        
            | 
            | 
           42 | 
           			m_pDirList = new CyStringList;
  | 
        
        
            | 
            | 
           43 | 
           			m_pTextList = new CLinkList<CyStringList>;
  | 
        
        
            | 
            | 
           44 | 
           			m_pLaserList = new CLinkList<CyStringList>;
  | 
        
        
            | 
            | 
           45 | 
           			m_pMissileList = new CLinkList<CyStringList>;
  | 
        
        
            | 
            | 
           46 | 
           			m_pCockpit = NULL;
  | 
        
        
            | 
            | 
           47 | 
           			this->PanelMain->Hide();
  | 
        
        
            | 
            | 
           48 | 
           			this->PanelNotLoaded->Show();
  | 
        
        
            | 
            | 
           49 | 
              | 
        
        
            | 
            | 
           50 | 
           			m_iOldGame = -1;
  | 
        
        
            | 
            | 
           51 | 
              | 
        
        
            | 
            | 
           52 | 
           			this->Setup();
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
           			if ( open )
  | 
        
        
            | 
            | 
           55 | 
           				m_sOpenFile = open;
  | 
        
        
            | 
            | 
           56 | 
           		}
  | 
        
        
            | 
            | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
           	protected:
  | 
        
        
            | 
            | 
           59 | 
           		/// <summary>
  | 
        
        
            | 
            | 
           60 | 
           		/// Clean up any resources being used.
  | 
        
        
            | 
            | 
           61 | 
           		/// </summary>
  | 
        
        
            | 
            | 
           62 | 
           		~Form1()
  | 
        
        
            | 
            | 
           63 | 
           		{
  | 
        
        
            | 
            | 
           64 | 
           			if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           65 | 
           				delete m_pLoadedShip;
  | 
        
        
            | 
            | 
           66 | 
           			if ( m_pDirList )
  | 
        
        
            | 
            | 
           67 | 
           				delete m_pDirList;
  | 
        
        
            | 
            | 
           68 | 
           			if ( m_pTextList )
  | 
        
        
            | 
            | 
           69 | 
           				delete m_pTextList;
  | 
        
        
            | 
            | 
           70 | 
           			if ( m_pLaserList )
  | 
        
        
            | 
            | 
           71 | 
           				delete m_pLaserList;
  | 
        
        
            | 
            | 
           72 | 
           			if ( m_pMissileList )
  | 
        
        
            | 
            | 
           73 | 
           				delete m_pMissileList;
  | 
        
        
            | 
            | 
           74 | 
              | 
        
        
            | 
            | 
           75 | 
           			if (components)
  | 
        
        
            | 
            | 
           76 | 
           			{
  | 
        
        
            | 
            | 
           77 | 
           				delete components;
  | 
        
        
            | 
            | 
           78 | 
           			}
  | 
        
        
            | 
            | 
           79 | 
           		}
  | 
        
        
            | 
            | 
           80 | 
           	private: System::Windows::Forms::MenuStrip^  menuStrip1;
  | 
        
        
            | 
            | 
           81 | 
           	protected: 
  | 
        
        
            | 
            | 
           82 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
  | 
        
        
            | 
            | 
           83 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
  | 
        
        
            | 
            | 
           84 | 
           	private: System::Windows::Forms::Panel^  panel1;
  | 
        
        
            | 
            | 
           85 | 
           	private: System::Windows::Forms::Button^  ButExit;
  | 
        
        
            | 
            | 
           86 | 
           	private: System::Windows::Forms::Panel^  PanelMain;
  | 
        
        
            | 
            | 
           87 | 
              | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
           	private:
  | 
        
        
            | 
            | 
           90 | 
           		bool		m_bLoading;
  | 
        
        
            | 
            | 
           91 | 
           		bool		m_bDontUpdate;
  | 
        
        
            | 
            | 
           92 | 
           		bool		m_bChanged;
  | 
        
        
            | 
            | 
           93 | 
           		bool		m_bReadText;
  | 
        
        
            | 
            | 
           94 | 
           		bool		m_bDontChange;
  | 
        
        
            | 
            | 
           95 | 
           		CyStringList *m_pDirList;
  | 
        
        
            | 
            | 
           96 | 
           		CLinkList<CyStringList> *m_pTextList;
  | 
        
        
            | 
            | 
           97 | 
           		CLinkList<CyStringList> *m_pLaserList;
  | 
        
        
            | 
            | 
           98 | 
           		CLinkList<CyStringList> *m_pMissileList;
  | 
        
        
            | 
            | 
           99 | 
           		CXspFile	*m_pLoadedShip;
  | 
        
        
            | 
            | 
           100 | 
           		int			 m_iOldGame;
  | 
        
        
            | 
            | 
           101 | 
           		array<System::Windows::Forms::ToolStripMenuItem^> ^m_aTools;
  | 
        
        
            | 
            | 
           102 | 
           		System::String ^m_sOpenFile;
  | 
        
        
            | 
            | 
           103 | 
           		SCockpit	*m_pCockpit;
  | 
        
        
            | 
            | 
           104 | 
              | 
        
        
            | 
            | 
           105 | 
           		int			m_iLoadedLaserMask;
  | 
        
        
            | 
            | 
           106 | 
           		int			m_iLoadedMissileMask;
  | 
        
        
            | 
            | 
           107 | 
           		int			m_iLaserMask;
  | 
        
        
            | 
            | 
           108 | 
           		int			m_iMissileMask;
  | 
        
        
            | 
            | 
           109 | 
              | 
        
        
            | 
            | 
           110 | 
           	private: System::Windows::Forms::Panel^  PanelNotLoaded;
  | 
        
        
            | 
            | 
           111 | 
           	private: System::Windows::Forms::Label^  LabelNotLoaded;
  | 
        
        
            | 
            | 
           112 | 
           	private: System::Windows::Forms::ComboBox^  ComboGame;
  | 
        
        
            | 
            | 
           113 | 
              | 
        
        
            | 
            | 
           114 | 
           	private: System::Windows::Forms::Panel^  panel2;
  | 
        
        
            | 
            | 
           115 | 
           	private: System::Windows::Forms::Label^  label1;
  | 
        
        
            | 
            | 
           116 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
  | 
        
        
            | 
            | 
           117 | 
           	private: System::Windows::Forms::CheckedListBox^  WeaponList;
  | 
        
        
            | 
            | 
           118 | 
              | 
        
        
            | 
            | 
           119 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
  | 
        
        
            | 
            | 
           120 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  gamesToolStripMenuItem;
  | 
        
        
            | 
            | 
           121 | 
           	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
  | 
        
        
            | 
            | 
           122 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  updateGameDataToolStripMenuItem;
  | 
        
        
            | 
            | 
           123 | 
           	private: System::Windows::Forms::TabControl^  tabControl1;
  | 
        
        
            | 
            | 
           124 | 
           	private: System::Windows::Forms::TabPage^  tabPage1;
  | 
        
        
            | 
            | 
           125 | 
           	private: System::Windows::Forms::TabPage^  tabPage2;
  | 
        
        
            | 
            | 
           126 | 
           	private: System::Windows::Forms::CheckedListBox^  MissileList;
  | 
        
        
            | 
            | 
           127 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  loadGameTextToolStripMenuItem;
  | 
        
        
            | 
            | 
           128 | 
           	private: System::Windows::Forms::ToolStripMenuItem^  saveAsToolStripMenuItem;
  | 
        
        
            | 
            | 
           129 | 
           	private: System::Windows::Forms::TabPage^  tabPage3;
  | 
        
        
            | 
            | 
           130 | 
           	private: System::Windows::Forms::CheckedListBox^  CockpitWeapons;
  | 
        
        
            | 
            | 
           131 | 
           	private: System::Windows::Forms::ComboBox^  ComboCockpits;
  | 
        
        
            | 
            | 
           132 | 
              | 
        
        
            | 
            | 
           133 | 
              | 
        
        
            | 
            | 
           134 | 
           		/// <summary>
  | 
        
        
            | 
            | 
           135 | 
           		/// Required designer variable.
  | 
        
        
            | 
            | 
           136 | 
           		/// </summary>
  | 
        
        
            | 
            | 
           137 | 
           		System::ComponentModel::Container ^components;
  | 
        
        
            | 
            | 
           138 | 
              | 
        
        
            | 
            | 
           139 | 
           #pragma region Windows Form Designer generated code
  | 
        
        
            | 
            | 
           140 | 
           		/// <summary>
  | 
        
        
            | 
            | 
           141 | 
           		/// Required method for Designer support - do not modify
  | 
        
        
            | 
            | 
           142 | 
           		/// the contents of this method with the code editor.
  | 
        
        
            | 
            | 
           143 | 
           		/// </summary>
  | 
        
        
            | 
            | 
           144 | 
           		void Setup()
  | 
        
        
            | 
            | 
           145 | 
           		{
  | 
        
        
            | 
            | 
           146 | 
           			this->Closed += gcnew System::EventHandler(this, &Form1::CloseEvent);
  | 
        
        
            | 
            | 
           147 | 
           			this->CockpitWeapons->ItemCheck += gcnew ItemCheckEventHandler(this, &Form1::Event_Changed);
  | 
        
        
            | 
            | 
           148 | 
              | 
        
        
            | 
            | 
           149 | 
           			// read data file
  | 
        
        
            | 
            | 
           150 | 
           			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
  | 
        
        
            | 
            | 
           151 | 
           			CFileIO Config;
  | 
        
        
           | 118 | 
           cycrow | 
           152 | 
           			if ( Config.open(_S(mydoc) + "/Egosoft/xspconvert.dat") )
  | 
        
        
           | 1 | 
           cycrow | 
           153 | 
           			{
  | 
        
        
            | 
            | 
           154 | 
           				std::vector<CyString> *lines = Config.ReadLines();
  | 
        
        
            | 
            | 
           155 | 
           				if ( lines )
  | 
        
        
            | 
            | 
           156 | 
           				{
  | 
        
        
            | 
            | 
           157 | 
           					for ( int i = 0; i < (int)lines->size(); i++ )
  | 
        
        
            | 
            | 
           158 | 
           					{
  | 
        
        
            | 
            | 
           159 | 
           						CyString line(lines->at(i));
  | 
        
        
            | 
            | 
           160 | 
           						CyString start = line.GetToken(":", 1, 1).ToLower();
  | 
        
        
            | 
            | 
           161 | 
           						CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
  | 
        
        
            | 
            | 
           162 | 
           						if ( start.Compare("Dir") )
  | 
        
        
            | 
            | 
           163 | 
           						{
  | 
        
        
            | 
            | 
           164 | 
           							CyString game = rest.GetToken(" ", 1, 1);
  | 
        
        
            | 
            | 
           165 | 
           							CyString dir = rest.GetToken(" ", 2);
  | 
        
        
            | 
            | 
           166 | 
           							SStringList *str = m_pDirList->FindData(game);
  | 
        
        
            | 
            | 
           167 | 
           							if ( str )
  | 
        
        
            | 
            | 
           168 | 
           								str->str = dir;
  | 
        
        
            | 
            | 
           169 | 
           							else
  | 
        
        
            | 
            | 
           170 | 
           								m_pDirList->PushBack(dir, game);
  | 
        
        
            | 
            | 
           171 | 
           						}
  | 
        
        
            | 
            | 
           172 | 
           						else if ( line.Compare("ReadText") )
  | 
        
        
            | 
            | 
           173 | 
           							m_bReadText = true;
  | 
        
        
            | 
            | 
           174 | 
           					}
  | 
        
        
            | 
            | 
           175 | 
           				}
  | 
        
        
            | 
            | 
           176 | 
           			}
  | 
        
        
            | 
            | 
           177 | 
              | 
        
        
            | 
            | 
           178 | 
           			this->UpdateGames();
  | 
        
        
            | 
            | 
           179 | 
              | 
        
        
            | 
            | 
           180 | 
           			this->loadGameTextToolStripMenuItem->Checked = m_bReadText;
  | 
        
        
            | 
            | 
           181 | 
           		}
  | 
        
        
            | 
            | 
           182 | 
              | 
        
        
            | 
            | 
           183 | 
           		void UpdateGames()
  | 
        
        
            | 
            | 
           184 | 
           		{
  | 
        
        
            | 
            | 
           185 | 
           			this->gamesToolStripMenuItem->DropDownItems->Clear();
  | 
        
        
            | 
            | 
           186 | 
           			this->ComboGame->Items->Clear();
  | 
        
        
            | 
            | 
           187 | 
              | 
        
        
            | 
            | 
           188 | 
           			CPackages p;
  | 
        
        
            | 
            | 
           189 | 
           			p.Startup(".", ".", ".");
  | 
        
        
            | 
            | 
           190 | 
           			// start at 1 to skip X2
  | 
        
        
            | 
            | 
           191 | 
           			for ( int i = 1; i < p.GetGameExe()->GetNumGames(); i++ )
  | 
        
        
            | 
            | 
           192 | 
           			{
  | 
        
        
            | 
            | 
           193 | 
           				bool added = false;
  | 
        
        
            | 
            | 
           194 | 
           				if ( m_pDirList->FindData(CyString::Number(i)) )
  | 
        
        
            | 
            | 
           195 | 
           				{
  | 
        
        
            | 
            | 
           196 | 
           					if ( m_pDirList->FindData(CyString::Number(i))->str != "-1" )
  | 
        
        
            | 
            | 
           197 | 
           						added = true;
  | 
        
        
            | 
            | 
           198 | 
           				}
  | 
        
        
            | 
            | 
           199 | 
              | 
        
        
            | 
            | 
           200 | 
           				SGameExe *exe = p.GetGameExe()->GetGame(i);
  | 
        
        
            | 
            | 
           201 | 
           				this->ComboGame->Items->Add(SystemStringFromCyString(exe->sName));
  | 
        
        
            | 
            | 
           202 | 
           				System::Windows::Forms::ToolStripMenuItem ^newMenu = gcnew System::Windows::Forms::ToolStripMenuItem;
  | 
        
        
            | 
            | 
           203 | 
           				newMenu->Text = SystemStringFromCyString(exe->sName);
  | 
        
        
            | 
            | 
           204 | 
           				this->gamesToolStripMenuItem->DropDownItems->Add(newMenu);
  | 
        
        
            | 
            | 
           205 | 
           				System::Windows::Forms::ToolStripMenuItem ^newMenuDir = gcnew System::Windows::Forms::ToolStripMenuItem;
  | 
        
        
            | 
            | 
           206 | 
           				if ( added )
  | 
        
        
            | 
            | 
           207 | 
           					newMenuDir->Text = SystemStringFromCyString(m_pDirList->FindData(CyString::Number(i))->str);
  | 
        
        
            | 
            | 
           208 | 
           				else
  | 
        
        
            | 
            | 
           209 | 
           					newMenuDir->Text = "No Directory";
  | 
        
        
            | 
            | 
           210 | 
           				newMenuDir->Enabled = false;
  | 
        
        
            | 
            | 
           211 | 
           				newMenu->DropDownItems->Add(newMenuDir);
  | 
        
        
            | 
            | 
           212 | 
           				newMenu->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator);
  | 
        
        
            | 
            | 
           213 | 
           				System::Windows::Forms::ToolStripMenuItem ^newMenuChange = gcnew System::Windows::Forms::ToolStripMenuItem;
  | 
        
        
            | 
            | 
           214 | 
           				newMenuChange->Text = "Set Directory";
  | 
        
        
            | 
            | 
           215 | 
           				newMenuChange->Tag = SystemStringFromCyString(CyString::Number(i)) + " " + SystemStringFromCyString(exe->sName);
  | 
        
        
            | 
            | 
           216 | 
           				newMenuChange->Click += gcnew System::EventHandler(this, &Form1::Event_ChangeDirectory);
  | 
        
        
            | 
            | 
           217 | 
           				newMenu->DropDownItems->Add(newMenuChange);
  | 
        
        
            | 
            | 
           218 | 
              | 
        
        
            | 
            | 
           219 | 
           				if ( added )
  | 
        
        
            | 
            | 
           220 | 
           				{
  | 
        
        
            | 
            | 
           221 | 
           					System::Windows::Forms::ToolStripMenuItem ^newMenuRemove = gcnew System::Windows::Forms::ToolStripMenuItem;
  | 
        
        
            | 
            | 
           222 | 
           					newMenu->DropDownItems->Add(newMenuRemove);
  | 
        
        
            | 
            | 
           223 | 
           					newMenuRemove->Text = "Remove Directory";
  | 
        
        
            | 
            | 
           224 | 
           					newMenuRemove->Tag = SystemStringFromCyString(CyString::Number(i)) + " " + SystemStringFromCyString(exe->sName);
  | 
        
        
            | 
            | 
           225 | 
           					newMenuRemove->Click += gcnew System::EventHandler(this, &Form1::Event_RemoveDirectory);
  | 
        
        
            | 
            | 
           226 | 
           				}
  | 
        
        
            | 
            | 
           227 | 
           			}
  | 
        
        
            | 
            | 
           228 | 
           		}
  | 
        
        
            | 
            | 
           229 | 
              | 
        
        
            | 
            | 
           230 | 
           		void UpdateTitle()
  | 
        
        
            | 
            | 
           231 | 
           		{
  | 
        
        
            | 
            | 
           232 | 
           			System::String ^title = "XSP Convertor V" + SystemStringFromCyString(CyString::CreateFromFloat((float)VERSION, 2));
  | 
        
        
            | 
            | 
           233 | 
           			if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           234 | 
           			{
  | 
        
        
           | 50 | 
           cycrow | 
           235 | 
           				if ( m_bChanged || m_pLoadedShip->hasChanged() )
  | 
        
        
            | 
            | 
           236 | 
           					this->Text = title + " [*" + _US(m_pLoadedShip->filename()) + "]";
  | 
        
        
           | 1 | 
           cycrow | 
           237 | 
           				else
  | 
        
        
           | 50 | 
           cycrow | 
           238 | 
           					this->Text = title + " [" + _US(m_pLoadedShip->filename()) + "]";
  | 
        
        
           | 1 | 
           cycrow | 
           239 | 
           			}
  | 
        
        
            | 
            | 
           240 | 
           			else
  | 
        
        
            | 
            | 
           241 | 
           				this->Text = title;
  | 
        
        
            | 
            | 
           242 | 
           		}
  | 
        
        
            | 
            | 
           243 | 
              | 
        
        
            | 
            | 
           244 | 
           		void SaveShip()
  | 
        
        
            | 
            | 
           245 | 
           		{
  | 
        
        
            | 
            | 
           246 | 
           			if ( !m_pLoadedShip )
  | 
        
        
            | 
            | 
           247 | 
           				MessageBox::Show(this, "There is currently no ship loaded to convert", "Ship Save", MessageBoxButtons::OK, MessageBoxIcon::Warning);
  | 
        
        
            | 
            | 
           248 | 
           			else
  | 
        
        
            | 
            | 
           249 | 
           			{
  | 
        
        
            | 
            | 
           250 | 
           				this->SaveMasks();
  | 
        
        
           | 50 | 
           cycrow | 
           251 | 
           				if ( m_pLoadedShip->WriteFile(m_pLoadedShip->filename()) )
  | 
        
        
           | 1 | 
           cycrow | 
           252 | 
           				{
  | 
        
        
           | 50 | 
           cycrow | 
           253 | 
           					MessageBox::Show(this, "Ship File: " + _US(m_pLoadedShip->filename()) + "\n\nHas been written", "Ship Saved", MessageBoxButtons::OK, MessageBoxIcon::Information);
  | 
        
        
           | 1 | 
           cycrow | 
           254 | 
           					m_bChanged = false;
  | 
        
        
            | 
            | 
           255 | 
           				}
  | 
        
        
            | 
            | 
           256 | 
           			}
  | 
        
        
            | 
            | 
           257 | 
              | 
        
        
            | 
            | 
           258 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           259 | 
           		}
  | 
        
        
            | 
            | 
           260 | 
              | 
        
        
            | 
            | 
           261 | 
           		void SaveShipAs()
  | 
        
        
            | 
            | 
           262 | 
           		{
  | 
        
        
            | 
            | 
           263 | 
           			if ( !m_pLoadedShip )
  | 
        
        
            | 
            | 
           264 | 
           				MessageBox::Show(this, "There is currently no ship loaded to convert", "Ship Save", MessageBoxButtons::OK, MessageBoxIcon::Warning);
  | 
        
        
            | 
            | 
           265 | 
           			else
  | 
        
        
            | 
            | 
           266 | 
           			{
  | 
        
        
            | 
            | 
           267 | 
           				SaveFileDialog ^ofd = gcnew SaveFileDialog();
  | 
        
        
            | 
            | 
           268 | 
           				ofd->Filter = "Ship Files (*.xsp)|*.xsp";
  | 
        
        
            | 
            | 
           269 | 
           				ofd->FilterIndex = 1;
  | 
        
        
            | 
            | 
           270 | 
           				ofd->RestoreDirectory = true;
  | 
        
        
            | 
            | 
           271 | 
           				if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
  | 
        
        
            | 
            | 
           272 | 
           				{
  | 
        
        
            | 
            | 
           273 | 
           					this->SaveMasks();
  | 
        
        
            | 
            | 
           274 | 
           					if ( m_pLoadedShip->WriteFile(CyStringFromSystemString(ofd->FileName)) )
  | 
        
        
            | 
            | 
           275 | 
           					{
  | 
        
        
            | 
            | 
           276 | 
           						MessageBox::Show(this, "Ship File: " + ofd->FileName + "\n\nHas been written", "Ship Saved", MessageBoxButtons::OK, MessageBoxIcon::Information);
  | 
        
        
            | 
            | 
           277 | 
           						m_bChanged = false;
  | 
        
        
            | 
            | 
           278 | 
           					}
  | 
        
        
            | 
            | 
           279 | 
           				}
  | 
        
        
            | 
            | 
           280 | 
           			}
  | 
        
        
            | 
            | 
           281 | 
              | 
        
        
            | 
            | 
           282 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           283 | 
           		}
  | 
        
        
            | 
            | 
           284 | 
              | 
        
        
            | 
            | 
           285 | 
           		CyString GetObjectString(int desc, CyString idText)
  | 
        
        
            | 
            | 
           286 | 
           		{
  | 
        
        
            | 
            | 
           287 | 
           			if ( m_bReadText )
  | 
        
        
            | 
            | 
           288 | 
           			{
  | 
        
        
            | 
            | 
           289 | 
           				if ( this->ComboGame->SelectedIndex < m_pMissileList->size() )
  | 
        
        
            | 
            | 
           290 | 
           				{
  | 
        
        
            | 
            | 
           291 | 
           					CyStringList *textList = m_pTextList->Get(this->ComboGame->SelectedIndex);
  | 
        
        
            | 
            | 
           292 | 
           					if ( textList )
  | 
        
        
            | 
            | 
           293 | 
           					{
  | 
        
        
            | 
            | 
           294 | 
           						SStringList *str = textList->FindData(CyString::Number(desc));
  | 
        
        
            | 
            | 
           295 | 
           						if ( str )
  | 
        
        
            | 
            | 
           296 | 
           						{
  | 
        
        
            | 
            | 
           297 | 
           							// perform recursive lookup
  | 
        
        
            | 
            | 
           298 | 
           							CyString s = str->str;
  | 
        
        
            | 
            | 
           299 | 
           							while (s.IsIn("{17,") && s.IsIn("}"))
  | 
        
        
            | 
            | 
           300 | 
           							{
  | 
        
        
            | 
            | 
           301 | 
           								int pos = s.FindPos("{17,");
  | 
        
        
            | 
            | 
           302 | 
           								pos += 4;
  | 
        
        
            | 
            | 
           303 | 
           								CyString check = s.Right(-pos);
  | 
        
        
            | 
            | 
           304 | 
           								check = check.GetToken("}", 1, 1);
  | 
        
        
            | 
            | 
           305 | 
           								int num = check.ToInt();
  | 
        
        
            | 
            | 
           306 | 
           								CyString newDesc = this->GetObjectString(num, CyString("#") + check + "#");
  | 
        
        
            | 
            | 
           307 | 
           								s = s.FindReplace(CyString("{17,") + check + "}", newDesc);
  | 
        
        
            | 
            | 
           308 | 
           							}
  | 
        
        
            | 
            | 
           309 | 
              | 
        
        
            | 
            | 
           310 | 
           							// remove anything in brackets
  | 
        
        
            | 
            | 
           311 | 
           							while(s.IsIn("(") && s.IsIn(")"))
  | 
        
        
            | 
            | 
           312 | 
           							{
  | 
        
        
            | 
            | 
           313 | 
           								int pos = s.FindPos("(");
  | 
        
        
            | 
            | 
           314 | 
           								s.Erase(pos, (s.FindPos(")", pos) + 1) - pos);
  | 
        
        
            | 
            | 
           315 | 
           							}
  | 
        
        
            | 
            | 
           316 | 
           							return s;
  | 
        
        
            | 
            | 
           317 | 
           						}
  | 
        
        
            | 
            | 
           318 | 
           					}
  | 
        
        
            | 
            | 
           319 | 
           				}
  | 
        
        
            | 
            | 
           320 | 
           			}
  | 
        
        
            | 
            | 
           321 | 
           			return idText;
  | 
        
        
            | 
            | 
           322 | 
           		}
  | 
        
        
            | 
            | 
           323 | 
              | 
        
        
            | 
            | 
           324 | 
           		void UpdateNames()
  | 
        
        
            | 
            | 
           325 | 
           		{
  | 
        
        
            | 
            | 
           326 | 
           			this->WeaponList->Items->Clear();
  | 
        
        
            | 
            | 
           327 | 
           			this->MissileList->Items->Clear();
  | 
        
        
            | 
            | 
           328 | 
           			this->CockpitWeapons->Items->Clear();
  | 
        
        
            | 
            | 
           329 | 
           			bool addedLaser = false;
  | 
        
        
            | 
            | 
           330 | 
           			bool addedMissile = false;
  | 
        
        
            | 
            | 
           331 | 
              | 
        
        
            | 
            | 
           332 | 
           			CyStringList missiles;
  | 
        
        
            | 
            | 
           333 | 
           			if ( this->ComboGame->SelectedIndex < m_pMissileList->size() )
  | 
        
        
            | 
            | 
           334 | 
           			{
  | 
        
        
            | 
            | 
           335 | 
           				CyStringList *missileList = m_pMissileList->Get(this->ComboGame->SelectedIndex);
  | 
        
        
            | 
            | 
           336 | 
           				if ( missileList )
  | 
        
        
            | 
            | 
           337 | 
           				{
  | 
        
        
            | 
            | 
           338 | 
           					for ( SStringList *strNode = missileList->Head(); strNode; strNode = strNode->next )
  | 
        
        
            | 
            | 
           339 | 
           					{
  | 
        
        
            | 
            | 
           340 | 
           						CyString id = strNode->str.GetToken(";", 6, 6);
  | 
        
        
            | 
            | 
           341 | 
           						SStringList *found = missiles.FindString(id);
  | 
        
        
            | 
            | 
           342 | 
           						CyString str = this->GetObjectString(strNode->str.GetToken(";", 7, 7).ToInt(), strNode->str.GetToken(";", 37, 37));
  | 
        
        
            | 
            | 
           343 | 
           						if ( found )
  | 
        
        
            | 
            | 
           344 | 
           						{
  | 
        
        
            | 
            | 
           345 | 
           							found->data += ", ";
  | 
        
        
            | 
            | 
           346 | 
           							found->data += str;
  | 
        
        
            | 
            | 
           347 | 
           						}
  | 
        
        
            | 
            | 
           348 | 
           						else
  | 
        
        
            | 
            | 
           349 | 
           							missiles.PushBack(id, str);
  | 
        
        
            | 
            | 
           350 | 
           					}
  | 
        
        
            | 
            | 
           351 | 
           				}
  | 
        
        
            | 
            | 
           352 | 
           			}
  | 
        
        
            | 
            | 
           353 | 
              | 
        
        
            | 
            | 
           354 | 
           			CyStringList lasers;
  | 
        
        
            | 
            | 
           355 | 
           			if ( this->ComboGame->SelectedIndex < m_pLaserList->size() )
  | 
        
        
            | 
            | 
           356 | 
           			{
  | 
        
        
            | 
            | 
           357 | 
           				CyStringList *laserList = m_pLaserList->Get(this->ComboGame->SelectedIndex);
  | 
        
        
            | 
            | 
           358 | 
           				if ( laserList )
  | 
        
        
            | 
            | 
           359 | 
           				{
  | 
        
        
            | 
            | 
           360 | 
           					for ( SStringList *strNode = laserList->Head(); strNode; strNode = strNode->next )
  | 
        
        
            | 
            | 
           361 | 
           					{
  | 
        
        
            | 
            | 
           362 | 
           						CyString id = strNode->str.GetToken(";", 6, 6);
  | 
        
        
            | 
            | 
           363 | 
           						SStringList *found = lasers.FindString(id);
  | 
        
        
            | 
            | 
           364 | 
           						CyString str = this->GetObjectString(strNode->str.GetToken(";", 7, 7).ToInt(), strNode->str.GetToken(";", 23, 23));
  | 
        
        
            | 
            | 
           365 | 
           						if ( found )
  | 
        
        
            | 
            | 
           366 | 
           						{
  | 
        
        
            | 
            | 
           367 | 
           							found->data += ", ";
  | 
        
        
            | 
            | 
           368 | 
           							found->data += str;
  | 
        
        
            | 
            | 
           369 | 
           						}
  | 
        
        
            | 
            | 
           370 | 
           						else
  | 
        
        
            | 
            | 
           371 | 
           							lasers.PushBack(id, str);
  | 
        
        
            | 
            | 
           372 | 
           					}
  | 
        
        
            | 
            | 
           373 | 
           				}
  | 
        
        
            | 
            | 
           374 | 
           			}
  | 
        
        
            | 
            | 
           375 | 
              | 
        
        
            | 
            | 
           376 | 
           			for ( int i = 0; i < 32; i++ )
  | 
        
        
            | 
            | 
           377 | 
           			{
  | 
        
        
            | 
            | 
           378 | 
           				if ( lasers.Count() > i )
  | 
        
        
            | 
            | 
           379 | 
           				{
  | 
        
        
            | 
            | 
           380 | 
           					this->WeaponList->Items->Add(SystemStringFromCyString(lasers.GetAt(i)->data));
  | 
        
        
            | 
            | 
           381 | 
           					this->CockpitWeapons->Items->Add(SystemStringFromCyString(lasers.GetAt(i)->data));
  | 
        
        
            | 
            | 
           382 | 
           					addedLaser = true;
  | 
        
        
            | 
            | 
           383 | 
           				}
  | 
        
        
            | 
            | 
           384 | 
              | 
        
        
            | 
            | 
           385 | 
           				if ( missiles.Count() > i )
  | 
        
        
            | 
            | 
           386 | 
           				{
  | 
        
        
            | 
            | 
           387 | 
           					this->MissileList->Items->Add(SystemStringFromCyString(missiles.GetAt(i)->data));
  | 
        
        
            | 
            | 
           388 | 
           					addedMissile = true;
  | 
        
        
            | 
            | 
           389 | 
           				}
  | 
        
        
            | 
            | 
           390 | 
              | 
        
        
            | 
            | 
           391 | 
           				if ( !addedLaser )
  | 
        
        
            | 
            | 
           392 | 
           				{
  | 
        
        
            | 
            | 
           393 | 
           					this->WeaponList->Items->Add(SystemStringFromCyString(CyString::Number(i + 1)));
  | 
        
        
            | 
            | 
           394 | 
           					this->CockpitWeapons->Items->Add(SystemStringFromCyString(CyString::Number(i + 1)));
  | 
        
        
            | 
            | 
           395 | 
           				}
  | 
        
        
            | 
            | 
           396 | 
           				if ( !addedMissile )
  | 
        
        
            | 
            | 
           397 | 
           					this->MissileList->Items->Add(SystemStringFromCyString(CyString::Number(i + 1)));
  | 
        
        
            | 
            | 
           398 | 
           			}
  | 
        
        
            | 
            | 
           399 | 
           		}
  | 
        
        
            | 
            | 
           400 | 
              | 
        
        
            | 
            | 
           401 | 
           		void OpenFile(System::String ^open)
  | 
        
        
            | 
            | 
           402 | 
           		{
  | 
        
        
            | 
            | 
           403 | 
           				CXspFile *shipFile = new CXspFile;
  | 
        
        
            | 
            | 
           404 | 
           				int check = CSpkFile::CheckFile(CyStringFromSystemString(open));
  | 
        
        
            | 
            | 
           405 | 
           				bool loaded = false;
  | 
        
        
            | 
            | 
           406 | 
              | 
        
        
            | 
            | 
           407 | 
           				m_bChanged = false;
  | 
        
        
            | 
            | 
           408 | 
              | 
        
        
            | 
            | 
           409 | 
           				if ( check == SPKFILE_SINGLESHIP )
  | 
        
        
            | 
            | 
           410 | 
           					loaded = shipFile->ReadFile(CyStringFromSystemString(open));
  | 
        
        
            | 
            | 
           411 | 
           				else if ( check == SPKFILE_INVALID )
  | 
        
        
            | 
            | 
           412 | 
           				{
  | 
        
        
           | 39 | 
           cycrow | 
           413 | 
           					loaded = shipFile->ConvertOld(_S(open));
  | 
        
        
           | 1 | 
           cycrow | 
           414 | 
           					if ( loaded )
  | 
        
        
            | 
            | 
           415 | 
           						m_bChanged = true;
  | 
        
        
            | 
            | 
           416 | 
           				}
  | 
        
        
            | 
            | 
           417 | 
              | 
        
        
            | 
            | 
           418 | 
           				this->ComboCockpits->Items->Clear();
  | 
        
        
            | 
            | 
           419 | 
              | 
        
        
            | 
            | 
           420 | 
           				m_pCockpit = NULL;
  | 
        
        
            | 
            | 
           421 | 
              | 
        
        
            | 
            | 
           422 | 
           				if ( loaded )
  | 
        
        
            | 
            | 
           423 | 
           				{
  | 
        
        
            | 
            | 
           424 | 
           					m_bLoading = true;
  | 
        
        
            | 
            | 
           425 | 
           					if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           426 | 
           						delete m_pLoadedShip;
  | 
        
        
            | 
            | 
           427 | 
           					m_pLoadedShip = shipFile;
  | 
        
        
           | 50 | 
           cycrow | 
           428 | 
           					m_pLoadedShip->setFilename(_S(open));
  | 
        
        
           | 1 | 
           cycrow | 
           429 | 
              | 
        
        
            | 
            | 
           430 | 
           					this->PanelMain->Show();
  | 
        
        
            | 
            | 
           431 | 
           					this->PanelNotLoaded->Hide();
  | 
        
        
            | 
            | 
           432 | 
              | 
        
        
            | 
            | 
           433 | 
           					m_iOldGame = -1;
  | 
        
        
            | 
            | 
           434 | 
              | 
        
        
            | 
            | 
           435 | 
           					if ( m_pLoadedShip->AnyCockpits() )
  | 
        
        
            | 
            | 
           436 | 
           					{
  | 
        
        
            | 
            | 
           437 | 
           						for ( SCockpit *c = m_pLoadedShip->GetCockpits()->First(); c; c = m_pLoadedShip->GetCockpits()->Next() )
  | 
        
        
           | 39 | 
           cycrow | 
           438 | 
           							this->ComboCockpits->Items->Add(_US(c->sCockpit.token(";", 19)));
  | 
        
        
           | 1 | 
           cycrow | 
           439 | 
           						this->CockpitWeapons->Show();
  | 
        
        
            | 
            | 
           440 | 
           						this->ComboCockpits->Enabled = true;
  | 
        
        
            | 
            | 
           441 | 
           						//m_pCockpit = m_pLoadedShip->GetCockpits()->First();
  | 
        
        
            | 
            | 
           442 | 
           					}
  | 
        
        
            | 
            | 
           443 | 
           					else
  | 
        
        
            | 
            | 
           444 | 
           					{
  | 
        
        
            | 
            | 
           445 | 
           						this->CockpitWeapons->Hide();
  | 
        
        
            | 
            | 
           446 | 
           						this->ComboCockpits->Enabled = false;
  | 
        
        
            | 
            | 
           447 | 
           					}
  | 
        
        
            | 
            | 
           448 | 
              | 
        
        
            | 
            | 
           449 | 
           					this->ComboGame->SelectedIndex = 0;
  | 
        
        
            | 
            | 
           450 | 
           					if ( this->ComboCockpits->Items->Count )
  | 
        
        
            | 
            | 
           451 | 
           						this->ComboCockpits->SelectedIndex = 0;
  | 
        
        
            | 
            | 
           452 | 
              | 
        
        
            | 
            | 
           453 | 
           					m_bChanged = false;
  | 
        
        
            | 
            | 
           454 | 
           					this->UpdateTitle();
  | 
        
        
            | 
            | 
           455 | 
              | 
        
        
            | 
            | 
           456 | 
           					MessageBox::Show(this, "Ship File: " + open + "\nHas been loaded", "Ship Loaded", MessageBoxButtons::OK, MessageBoxIcon::Information);
  | 
        
        
            | 
            | 
           457 | 
           				}
  | 
        
        
            | 
            | 
           458 | 
           				else
  | 
        
        
            | 
            | 
           459 | 
           				{
  | 
        
        
            | 
            | 
           460 | 
           					delete shipFile;
  | 
        
        
            | 
            | 
           461 | 
           					if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           462 | 
           					{
  | 
        
        
            | 
            | 
           463 | 
           						this->PanelMain->Hide();
  | 
        
        
            | 
            | 
           464 | 
           						this->PanelNotLoaded->Show();
  | 
        
        
            | 
            | 
           465 | 
           					}
  | 
        
        
            | 
            | 
           466 | 
           					else
  | 
        
        
            | 
            | 
           467 | 
           					{
  | 
        
        
            | 
            | 
           468 | 
           						this->PanelMain->Show();
  | 
        
        
            | 
            | 
           469 | 
           						this->PanelNotLoaded->Hide();
  | 
        
        
            | 
            | 
           470 | 
           					}
  | 
        
        
            | 
            | 
           471 | 
              | 
        
        
            | 
            | 
           472 | 
           					MessageBox::Show(this, "Ship File: " + open + "\nHas failed to load", "Ship Failed", MessageBoxButtons::OK, MessageBoxIcon::Information);
  | 
        
        
            | 
            | 
           473 | 
           				}
  | 
        
        
            | 
            | 
           474 | 
              | 
        
        
            | 
            | 
           475 | 
           				m_bLoading = false;
  | 
        
        
            | 
            | 
           476 | 
           		}
  | 
        
        
            | 
            | 
           477 | 
              | 
        
        
            | 
            | 
           478 | 
           		void CheckSave()
  | 
        
        
            | 
            | 
           479 | 
           		{
  | 
        
        
           | 50 | 
           cycrow | 
           480 | 
           			 if ( (m_pLoadedShip && m_pLoadedShip->hasChanged()) || m_bChanged )
  | 
        
        
           | 1 | 
           cycrow | 
           481 | 
           			 {
  | 
        
        
            | 
            | 
           482 | 
           				 if ( MessageBox::Show(this, "The current ship has been modified, do you wish to save it?", "Save Ship", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes )
  | 
        
        
            | 
            | 
           483 | 
           					 this->SaveShip();				 
  | 
        
        
            | 
            | 
           484 | 
           			 }
  | 
        
        
            | 
            | 
           485 | 
           		}
  | 
        
        
            | 
            | 
           486 | 
           		void OpenFile()
  | 
        
        
            | 
            | 
           487 | 
           		{
  | 
        
        
            | 
            | 
           488 | 
           			// check if we need to save
  | 
        
        
            | 
            | 
           489 | 
           			this->CheckSave();
  | 
        
        
            | 
            | 
           490 | 
              | 
        
        
            | 
            | 
           491 | 
           			OpenFileDialog ^ofd = gcnew OpenFileDialog();
  | 
        
        
            | 
            | 
           492 | 
           			ofd->Filter = "Ship Files (*.xsp)|*.xsp";
  | 
        
        
            | 
            | 
           493 | 
           			ofd->FilterIndex = 1;
  | 
        
        
            | 
            | 
           494 | 
           			ofd->RestoreDirectory = true;
  | 
        
        
            | 
            | 
           495 | 
              | 
        
        
            | 
            | 
           496 | 
           			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
  | 
        
        
            | 
            | 
           497 | 
           				this->OpenFile(ofd->FileName);
  | 
        
        
            | 
            | 
           498 | 
              | 
        
        
            | 
            | 
           499 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           500 | 
           		}
  | 
        
        
            | 
            | 
           501 | 
              | 
        
        
            | 
            | 
           502 | 
           		void LoadGameData()
  | 
        
        
            | 
            | 
           503 | 
           		{
  | 
        
        
            | 
            | 
           504 | 
           			m_pLaserList->MemoryClear();
  | 
        
        
            | 
            | 
           505 | 
           			m_pMissileList->MemoryClear();
  | 
        
        
            | 
            | 
           506 | 
           			m_pTextList->MemoryClear();
  | 
        
        
            | 
            | 
           507 | 
              | 
        
        
            | 
            | 
           508 | 
           			System::String ^tempDir = System::IO::Path::GetTempPath();
  | 
        
        
            | 
            | 
           509 | 
           			CyString sTempDir = CyStringFromSystemString(tempDir);
  | 
        
        
            | 
            | 
           510 | 
              | 
        
        
            | 
            | 
           511 | 
           			CPackages p;
  | 
        
        
            | 
            | 
           512 | 
           			bool tcText = false;
  | 
        
        
            | 
            | 
           513 | 
           			for ( SStringList *strNode = m_pDirList->Head(); strNode; strNode = strNode->next )
  | 
        
        
            | 
            | 
           514 | 
           			{
  | 
        
        
            | 
            | 
           515 | 
           				CyStringList *laserList = new CyStringList;
  | 
        
        
            | 
            | 
           516 | 
           				m_pLaserList->push_back(laserList);
  | 
        
        
            | 
            | 
           517 | 
           				CyStringList *missileList = new CyStringList;
  | 
        
        
            | 
            | 
           518 | 
           				m_pMissileList->push_back(missileList);
  | 
        
        
            | 
            | 
           519 | 
           				CyStringList *textList = new CyStringList;
  | 
        
        
            | 
            | 
           520 | 
           				m_pTextList->push_back(textList);
  | 
        
        
            | 
            | 
           521 | 
              | 
        
        
            | 
            | 
           522 | 
           				if ( p.ExtractGameFile("types/TLaser.pck", sTempDir + "/TLaser.txt", strNode->str) )
  | 
        
        
            | 
            | 
           523 | 
           				{
  | 
        
        
            | 
            | 
           524 | 
           					CFileIO Open(sTempDir + "/TLaser.txt");
  | 
        
        
            | 
            | 
           525 | 
           					std::vector<CyString> *lines = Open.ReadLines();
  | 
        
        
            | 
            | 
           526 | 
           					if ( lines )
  | 
        
        
            | 
            | 
           527 | 
           					{
  | 
        
        
            | 
            | 
           528 | 
           						bool first = false;
  | 
        
        
            | 
            | 
           529 | 
           						for ( int j = 0; j < (int)lines->size(); j++ )
  | 
        
        
            | 
            | 
           530 | 
           						{
  | 
        
        
            | 
            | 
           531 | 
           							CyString line(lines->at(j));			
  | 
        
        
            | 
            | 
           532 | 
           							if ( line[0] == '/' )
  | 
        
        
            | 
            | 
           533 | 
           								continue;
  | 
        
        
            | 
            | 
           534 | 
           							line.RemoveChar('\r');
  | 
        
        
            | 
            | 
           535 | 
           							line = line.RemoveFirstSpace();
  | 
        
        
            | 
            | 
           536 | 
           							line = line.RemoveEndSpace();
  | 
        
        
            | 
            | 
           537 | 
           							if ( line.Empty() )
  | 
        
        
            | 
            | 
           538 | 
           								continue;
  | 
        
        
            | 
            | 
           539 | 
           							if ( !first )
  | 
        
        
            | 
            | 
           540 | 
           							{
  | 
        
        
            | 
            | 
           541 | 
           								first = true;
  | 
        
        
            | 
            | 
           542 | 
           								continue;
  | 
        
        
            | 
            | 
           543 | 
           							}
  | 
        
        
            | 
            | 
           544 | 
              | 
        
        
            | 
            | 
           545 | 
           							laserList->PushBack(line);
  | 
        
        
            | 
            | 
           546 | 
           						}
  | 
        
        
            | 
            | 
           547 | 
           					}
  | 
        
        
            | 
            | 
           548 | 
              | 
        
        
           | 52 | 
           cycrow | 
           549 | 
           					Open.remove();
  | 
        
        
           | 1 | 
           cycrow | 
           550 | 
           				}
  | 
        
        
            | 
            | 
           551 | 
              | 
        
        
            | 
            | 
           552 | 
           				if ( p.ExtractGameFile("types/TMissiles.pck", sTempDir + "/TMissiles.txt", strNode->str) )
  | 
        
        
            | 
            | 
           553 | 
           				{
  | 
        
        
            | 
            | 
           554 | 
           					CFileIO Open(sTempDir + "/TMissiles.txt");
  | 
        
        
            | 
            | 
           555 | 
           					std::vector<CyString> *lines = Open.ReadLines();
  | 
        
        
            | 
            | 
           556 | 
           					if ( lines )
  | 
        
        
            | 
            | 
           557 | 
           					{
  | 
        
        
            | 
            | 
           558 | 
           						bool first = false;
  | 
        
        
            | 
            | 
           559 | 
           						for ( int j = 0; j < (int)lines->size(); j++ )
  | 
        
        
            | 
            | 
           560 | 
           						{
  | 
        
        
            | 
            | 
           561 | 
           							CyString line(lines->at(j));			
  | 
        
        
            | 
            | 
           562 | 
           							if ( line[0] == '/' )
  | 
        
        
            | 
            | 
           563 | 
           								continue;
  | 
        
        
            | 
            | 
           564 | 
           							line.RemoveChar('\r');
  | 
        
        
            | 
            | 
           565 | 
           							line = line.RemoveFirstSpace();
  | 
        
        
            | 
            | 
           566 | 
           							line = line.RemoveEndSpace();
  | 
        
        
            | 
            | 
           567 | 
           							if ( line.Empty() )
  | 
        
        
            | 
            | 
           568 | 
           								continue;
  | 
        
        
            | 
            | 
           569 | 
           							if ( !first )
  | 
        
        
            | 
            | 
           570 | 
           							{
  | 
        
        
            | 
            | 
           571 | 
           								first = true;
  | 
        
        
            | 
            | 
           572 | 
           								continue;
  | 
        
        
            | 
            | 
           573 | 
           							}
  | 
        
        
            | 
            | 
           574 | 
              | 
        
        
            | 
            | 
           575 | 
           							missileList->PushBack(line);
  | 
        
        
            | 
            | 
           576 | 
           						}
  | 
        
        
            | 
            | 
           577 | 
           					}
  | 
        
        
            | 
            | 
           578 | 
              | 
        
        
           | 52 | 
           cycrow | 
           579 | 
           					Open.remove();
  | 
        
        
           | 1 | 
           cycrow | 
           580 | 
           				}
  | 
        
        
            | 
            | 
           581 | 
              | 
        
        
            | 
            | 
           582 | 
           				if ( !m_bReadText )
  | 
        
        
            | 
            | 
           583 | 
           					continue;
  | 
        
        
            | 
            | 
           584 | 
              | 
        
        
            | 
            | 
           585 | 
           				// load the text file
  | 
        
        
            | 
            | 
           586 | 
           				CyString textFormat;
  | 
        
        
            | 
            | 
           587 | 
           				if ( tcText )
  | 
        
        
            | 
            | 
           588 | 
           					textFormat = "0001-L044";
  | 
        
        
            | 
            | 
           589 | 
           				else
  | 
        
        
            | 
            | 
           590 | 
           					textFormat = "440001";
  | 
        
        
            | 
            | 
           591 | 
              | 
        
        
            | 
            | 
           592 | 
           				if ( p.ExtractGameFile(CyString("t/") + textFormat + ".pck", sTempDir + "/" + textFormat + ".xml", strNode->str) )
  | 
        
        
            | 
            | 
           593 | 
           				{
  | 
        
        
            | 
            | 
           594 | 
           					CFileIO Open(sTempDir + textFormat + ".xml");
  | 
        
        
           | 82 | 
           cycrow | 
           595 | 
           					if ( Open.startRead() )
  | 
        
        
           | 1 | 
           cycrow | 
           596 | 
           					{
  | 
        
        
            | 
            | 
           597 | 
           						int donePage = (tcText) ? 3 : 2;
  | 
        
        
            | 
            | 
           598 | 
           						int inPage = 0;
  | 
        
        
           | 82 | 
           cycrow | 
           599 | 
           						while ( !Open.atEnd() )
  | 
        
        
           | 1 | 
           cycrow | 
           600 | 
           						{
  | 
        
        
           | 52 | 
           cycrow | 
           601 | 
           							CyString line = Open.readEndOfLine();
  | 
        
        
           | 1 | 
           cycrow | 
           602 | 
           							if ( line.Empty() )
  | 
        
        
            | 
            | 
           603 | 
           								continue;
  | 
        
        
            | 
            | 
           604 | 
           							line = line.RemoveFirstSpace();
  | 
        
        
            | 
            | 
           605 | 
           							line = line.Remove('\t');
  | 
        
        
            | 
            | 
           606 | 
           							if ( !inPage )
  | 
        
        
            | 
            | 
           607 | 
           							{
  | 
        
        
            | 
            | 
           608 | 
           								if ( line.Left(5).Compare("<page") )
  | 
        
        
            | 
            | 
           609 | 
           								{
  | 
        
        
            | 
            | 
           610 | 
           									int pos = line.FindPos(" id=\"");
  | 
        
        
            | 
            | 
           611 | 
           									if ( pos != -1 )
  | 
        
        
            | 
            | 
           612 | 
           									{
  | 
        
        
            | 
            | 
           613 | 
           										int endpos = line.FindPos("\"", pos + 5);
  | 
        
        
            | 
            | 
           614 | 
           										if ( endpos != -1 )
  | 
        
        
            | 
            | 
           615 | 
           										{
  | 
        
        
            | 
            | 
           616 | 
           											CyString check = line.Mid(pos + 6, endpos - pos - 5);
  | 
        
        
            | 
            | 
           617 | 
           											int iPage = check.ToInt();
  | 
        
        
            | 
            | 
           618 | 
           											if ( iPage == 17 || iPage == 300017 || iPage == 350017 )
  | 
        
        
            | 
            | 
           619 | 
           												inPage = iPage;
  | 
        
        
            | 
            | 
           620 | 
           										}
  | 
        
        
            | 
            | 
           621 | 
           									}
  | 
        
        
            | 
            | 
           622 | 
           								}
  | 
        
        
            | 
            | 
           623 | 
           							}
  | 
        
        
            | 
            | 
           624 | 
           							else
  | 
        
        
            | 
            | 
           625 | 
           							{
  | 
        
        
            | 
            | 
           626 | 
           								if ( line.Left(6).Compare("</page") )
  | 
        
        
            | 
            | 
           627 | 
           								{
  | 
        
        
            | 
            | 
           628 | 
           									inPage = 0;
  | 
        
        
            | 
            | 
           629 | 
           									--donePage;
  | 
        
        
            | 
            | 
           630 | 
              | 
        
        
            | 
            | 
           631 | 
           									if ( donePage <= 0 )
  | 
        
        
            | 
            | 
           632 | 
           										break;
  | 
        
        
            | 
            | 
           633 | 
           								}
  | 
        
        
            | 
            | 
           634 | 
           								else
  | 
        
        
            | 
            | 
           635 | 
           								{
  | 
        
        
            | 
            | 
           636 | 
           									int pos = line.FindPos("t id=\"");
  | 
        
        
            | 
            | 
           637 | 
           									if ( pos != -1 )
  | 
        
        
            | 
            | 
           638 | 
           									{
  | 
        
        
            | 
            | 
           639 | 
           										int endpos = line.FindPos("\"", pos + 6);
  | 
        
        
            | 
            | 
           640 | 
           										if ( endpos != -1 )
  | 
        
        
            | 
            | 
           641 | 
           										{
  | 
        
        
            | 
            | 
           642 | 
           											CyString check = line.Mid(pos + 7, endpos - pos - 6);
  | 
        
        
            | 
            | 
           643 | 
              | 
        
        
            | 
            | 
           644 | 
           											CyString data;
  | 
        
        
            | 
            | 
           645 | 
           											int pos = line.FindPos(">", endpos);
  | 
        
        
            | 
            | 
           646 | 
           											if ( pos != -1 )
  | 
        
        
            | 
            | 
           647 | 
           											{
  | 
        
        
            | 
            | 
           648 | 
           												endpos = line.FindPos("</", pos);
  | 
        
        
            | 
            | 
           649 | 
           												if ( endpos != -1 )
  | 
        
        
            | 
            | 
           650 | 
           													data = line.Mid(pos + 2, endpos - pos - 1);
  | 
        
        
            | 
            | 
           651 | 
           											}
  | 
        
        
            | 
            | 
           652 | 
           											SStringList *str = textList->FindData(check);
  | 
        
        
            | 
            | 
           653 | 
           											if ( str )
  | 
        
        
            | 
            | 
           654 | 
           												str->str = data;
  | 
        
        
            | 
            | 
           655 | 
           											else
  | 
        
        
            | 
            | 
           656 | 
           												textList->PushBack(data, check);
  | 
        
        
            | 
            | 
           657 | 
           										}
  | 
        
        
            | 
            | 
           658 | 
           									}
  | 
        
        
            | 
            | 
           659 | 
           								}
  | 
        
        
            | 
            | 
           660 | 
           							}
  | 
        
        
            | 
            | 
           661 | 
           						}
  | 
        
        
            | 
            | 
           662 | 
              | 
        
        
           | 82 | 
           cycrow | 
           663 | 
           						Open.close();
  | 
        
        
           | 1 | 
           cycrow | 
           664 | 
           					}
  | 
        
        
            | 
            | 
           665 | 
           				}
  | 
        
        
            | 
            | 
           666 | 
              | 
        
        
            | 
            | 
           667 | 
           				tcText = true;
  | 
        
        
            | 
            | 
           668 | 
           			}
  | 
        
        
            | 
            | 
           669 | 
           		}
  | 
        
        
            | 
            | 
           670 | 
              | 
        
        
            | 
            | 
           671 | 
           		void LoadGameDirectory()
  | 
        
        
            | 
            | 
           672 | 
           		{
  | 
        
        
            | 
            | 
           673 | 
           			CPackages p;
  | 
        
        
            | 
            | 
           674 | 
           			p.Startup(".", ".", ".");
  | 
        
        
            | 
            | 
           675 | 
              | 
        
        
            | 
            | 
           676 | 
           			for ( int i = 1; i < p.GetGameExe()->GetNumGames(); i++ )
  | 
        
        
            | 
            | 
           677 | 
           			{
  | 
        
        
            | 
            | 
           678 | 
           				SGameExe *exe = p.GetGameExe()->GetGame(i);
  | 
        
        
            | 
            | 
           679 | 
           				if ( !m_pDirList->FindData(CyString::Number(i)) )
  | 
        
        
            | 
            | 
           680 | 
           				{
  | 
        
        
           | 125 | 
           cycrow | 
           681 | 
           					if ( MessageBox::Show(this, "You have no directories set for " + _US(exe->sName) + "\n\nWould you like to set it now?", "Game Directory", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes )
  | 
        
        
           | 1 | 
           cycrow | 
           682 | 
           					{
  | 
        
        
            | 
            | 
           683 | 
           						FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
  | 
        
        
           | 125 | 
           cycrow | 
           684 | 
           						fbd->Description = "Select the path for " + _US(exe->sName);
  | 
        
        
           | 1 | 
           cycrow | 
           685 | 
           						if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
  | 
        
        
            | 
            | 
           686 | 
           						{
  | 
        
        
           | 125 | 
           cycrow | 
           687 | 
           							CDirIO Dir(_S(fbd->SelectedPath));
  | 
        
        
            | 
            | 
           688 | 
           							if ( !Dir.exists(exe->sExe) )
  | 
        
        
           | 1 | 
           cycrow | 
           689 | 
           								MessageBox::Show(this, "Unable to find " + SystemStringFromCyString(exe->sExe) + " in " + fbd->SelectedPath, "Game Directory", MessageBoxButtons::OK, MessageBoxIcon::Warning);
  | 
        
        
            | 
            | 
           690 | 
           							else
  | 
        
        
            | 
            | 
           691 | 
           								m_pDirList->PushBack(CyStringFromSystemString(fbd->SelectedPath), CyString::Number(i));
  | 
        
        
            | 
            | 
           692 | 
           						}
  | 
        
        
            | 
            | 
           693 | 
           					}
  | 
        
        
            | 
            | 
           694 | 
           					else
  | 
        
        
            | 
            | 
           695 | 
           						m_pDirList->PushBack("-1", CyString::Number(i));
  | 
        
        
            | 
            | 
           696 | 
           				}
  | 
        
        
            | 
            | 
           697 | 
           			}
  | 
        
        
            | 
            | 
           698 | 
              | 
        
        
            | 
            | 
           699 | 
           			if ( !m_pDirList->Empty() )
  | 
        
        
            | 
            | 
           700 | 
           			{
  | 
        
        
            | 
            | 
           701 | 
           				if ( MessageBox::Show(this, "Would you like to load the game data?", "Load Game Data", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes )
  | 
        
        
            | 
            | 
           702 | 
           					this->LoadGameData();
  | 
        
        
            | 
            | 
           703 | 
           			}
  | 
        
        
            | 
            | 
           704 | 
              | 
        
        
            | 
            | 
           705 | 
           			this->UpdateGames();
  | 
        
        
            | 
            | 
           706 | 
           		}
  | 
        
        
            | 
            | 
           707 | 
              | 
        
        
            | 
            | 
           708 | 
           		void CloseDialog()
  | 
        
        
            | 
            | 
           709 | 
           		{
  | 
        
        
            | 
            | 
           710 | 
           			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
  | 
        
        
            | 
            | 
           711 | 
           			CFileIO Config(CyStringFromSystemString(mydoc) + "/Egosoft/xspconvert.dat");
  | 
        
        
            | 
            | 
           712 | 
           			std::vector<CyString> lines;
  | 
        
        
            | 
            | 
           713 | 
           			for ( SStringList *str = m_pDirList->Head(); str; str = str->next )
  | 
        
        
            | 
            | 
           714 | 
           				lines.push_back(CyString("Dir:") + str->data + " " + str->str);
  | 
        
        
            | 
            | 
           715 | 
           			if ( m_bReadText )
  | 
        
        
            | 
            | 
           716 | 
           				lines.push_back("ReadText");
  | 
        
        
            | 
            | 
           717 | 
           			Config.WriteFile(&lines);
  | 
        
        
            | 
            | 
           718 | 
           		}
  | 
        
        
            | 
            | 
           719 | 
              | 
        
        
            | 
            | 
           720 | 
           		void CheckListChanged()
  | 
        
        
            | 
            | 
           721 | 
           		{
  | 
        
        
            | 
            | 
           722 | 
           			if ( m_bDontUpdate )
  | 
        
        
            | 
            | 
           723 | 
           				return;
  | 
        
        
            | 
            | 
           724 | 
              | 
        
        
            | 
            | 
           725 | 
           			if ( m_bDontChange )
  | 
        
        
            | 
            | 
           726 | 
           				return;
  | 
        
        
            | 
            | 
           727 | 
              | 
        
        
            | 
            | 
           728 | 
           			if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           729 | 
           				m_bChanged = true;
  | 
        
        
            | 
            | 
           730 | 
              | 
        
        
            | 
            | 
           731 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           732 | 
           		}
  | 
        
        
            | 
            | 
           733 | 
              | 
        
        
            | 
            | 
           734 | 
           		int GetMask(CheckedListBox ^list)
  | 
        
        
            | 
            | 
           735 | 
           		{
  | 
        
        
            | 
            | 
           736 | 
           			int oldMask = 0;
  | 
        
        
            | 
            | 
           737 | 
           			// First show the index and check state of all selected items.
  | 
        
        
            | 
            | 
           738 | 
           			IEnumerator^ myEnum1 = list->CheckedIndices->GetEnumerator();
  | 
        
        
            | 
            | 
           739 | 
           			while ( myEnum1->MoveNext() )
  | 
        
        
            | 
            | 
           740 | 
           			{
  | 
        
        
            | 
            | 
           741 | 
           				int indexChecked =  *safe_cast<int^>(myEnum1->Current);
  | 
        
        
            | 
            | 
           742 | 
           				oldMask |= (1 << indexChecked);
  | 
        
        
            | 
            | 
           743 | 
           			}
  | 
        
        
            | 
            | 
           744 | 
              | 
        
        
            | 
            | 
           745 | 
           			return oldMask;
  | 
        
        
            | 
            | 
           746 | 
           		}
  | 
        
        
            | 
            | 
           747 | 
              | 
        
        
            | 
            | 
           748 | 
           		void SaveMasks()
  | 
        
        
            | 
            | 
           749 | 
           		{
  | 
        
        
            | 
            | 
           750 | 
           			if ( m_pLoadedShip )
  | 
        
        
            | 
            | 
           751 | 
           			{
  | 
        
        
            | 
            | 
           752 | 
           				if ( m_iOldGame != -1 )
  | 
        
        
            | 
            | 
           753 | 
           				{
  | 
        
        
            | 
            | 
           754 | 
           					m_pLoadedShip->SetLaserMask(m_iOldGame, m_iLaserMask);
  | 
        
        
            | 
            | 
           755 | 
           					m_pLoadedShip->SetMissileMask(m_iOldGame, m_iMissileMask);
  | 
        
        
            | 
            | 
           756 | 
           				}
  | 
        
        
            | 
            | 
           757 | 
           				if ( m_pCockpit )
  | 
        
        
            | 
            | 
           758 | 
           					m_pLoadedShip->AddCockpit(m_pCockpit->sCockpit, (m_iOldGame == -1) ? (this->ComboGame->SelectedIndex + 2) : m_iOldGame, this->GetMask(this->CockpitWeapons));
  | 
        
        
            | 
            | 
           759 | 
           			}
  | 
        
        
            | 
            | 
           760 | 
           		}
  | 
        
        
            | 
            | 
           761 | 
              | 
        
        
            | 
            | 
           762 | 
           		void ChangeGame()
  | 
        
        
            | 
            | 
           763 | 
           		{
  | 
        
        
            | 
            | 
           764 | 
           			if ( !m_pLoadedShip )
  | 
        
        
            | 
            | 
           765 | 
           				return;
  | 
        
        
            | 
            | 
           766 | 
              | 
        
        
           | 50 | 
           cycrow | 
           767 | 
           			bool oldChanged = m_pLoadedShip->hasChanged();
  | 
        
        
           | 1 | 
           cycrow | 
           768 | 
           			m_bDontUpdate = true;
  | 
        
        
            | 
            | 
           769 | 
           			// save old mask
  | 
        
        
            | 
            | 
           770 | 
           			if ( !m_bLoading )
  | 
        
        
            | 
            | 
           771 | 
           				this->SaveMasks();
  | 
        
        
            | 
            | 
           772 | 
              | 
        
        
            | 
            | 
           773 | 
           			m_iOldGame = this->ComboGame->SelectedIndex + 2;
  | 
        
        
            | 
            | 
           774 | 
              | 
        
        
            | 
            | 
           775 | 
           			this->UpdateNames();
  | 
        
        
            | 
            | 
           776 | 
              | 
        
        
            | 
            | 
           777 | 
           			int mask = m_pLoadedShip->GetLaserMask(this->ComboGame->SelectedIndex + 2, true);
  | 
        
        
            | 
            | 
           778 | 
           			for ( int i = 0; i < this->WeaponList->Items->Count; i++ )
  | 
        
        
            | 
            | 
           779 | 
           				this->WeaponList->SetItemChecked(i, (mask & (1 << i)) ? true : false);
  | 
        
        
            | 
            | 
           780 | 
           			m_iLaserMask = m_iLoadedLaserMask = mask;
  | 
        
        
            | 
            | 
           781 | 
              | 
        
        
            | 
            | 
           782 | 
           			mask = m_pLoadedShip->GetMissileMask(this->ComboGame->SelectedIndex + 2, true);
  | 
        
        
            | 
            | 
           783 | 
           			for ( int i = 0; i < this->MissileList->Items->Count; i++ )
  | 
        
        
            | 
            | 
           784 | 
           				this->MissileList->SetItemChecked(i, (mask & (1 << i)) ? true : false);
  | 
        
        
            | 
            | 
           785 | 
           			m_iMissileMask = m_iLoadedMissileMask = mask;
  | 
        
        
            | 
            | 
           786 | 
              | 
        
        
            | 
            | 
           787 | 
           			if ( this->ComboCockpits->Items->Count )
  | 
        
        
            | 
            | 
           788 | 
           			{
  | 
        
        
            | 
            | 
           789 | 
           				if ( this->ComboCockpits->SelectedIndex < 0 )
  | 
        
        
            | 
            | 
           790 | 
           					this->ComboCockpits->SelectedIndex = 0;
  | 
        
        
            | 
            | 
           791 | 
           				else
  | 
        
        
            | 
            | 
           792 | 
           					this->UpdateCockpitList();
  | 
        
        
            | 
            | 
           793 | 
           			}
  | 
        
        
            | 
            | 
           794 | 
              | 
        
        
           | 50 | 
           cycrow | 
           795 | 
           			m_pLoadedShip->adjustChanged(oldChanged);
  | 
        
        
           | 1 | 
           cycrow | 
           796 | 
              | 
        
        
            | 
            | 
           797 | 
           			m_bDontUpdate = false;
  | 
        
        
            | 
            | 
           798 | 
              | 
        
        
            | 
            | 
           799 | 
           			this->UpdateTitle();
  | 
        
        
            | 
            | 
           800 | 
           		}
  | 
        
        
            | 
            | 
           801 | 
              | 
        
        
            | 
            | 
           802 | 
           		void Event_RemoveDirectory(System::Object ^sender, System::EventArgs ^E)
  | 
        
        
            | 
            | 
           803 | 
           		{
  | 
        
        
            | 
            | 
           804 | 
           			System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);
  | 
        
        
            | 
            | 
           805 | 
           			if ( item )
  | 
        
        
            | 
            | 
           806 | 
           			{
  | 
        
        
            | 
            | 
           807 | 
           				CyString game = CyStringFromSystemString(cli::safe_cast<System::String ^>(item->Tag));
  | 
        
        
            | 
            | 
           808 | 
           				game = game.GetToken(" ", 1, 1);
  | 
        
        
            | 
            | 
           809 | 
           				if ( m_pDirList->FindData(game) )
  | 
        
        
            | 
            | 
           810 | 
           				{
  | 
        
        
            | 
            | 
           811 | 
           					m_pDirList->FindData(game)->str = "-1";
  | 
        
        
            | 
            | 
           812 | 
           					this->UpdateGames();
  | 
        
        
            | 
            | 
           813 | 
           				}
  | 
        
        
            | 
            | 
           814 | 
           			}
  | 
        
        
            | 
            | 
           815 | 
           		}
  | 
        
        
            | 
            | 
           816 | 
              | 
        
        
            | 
            | 
           817 | 
           		void Event_ChangeDirectory(System::Object ^sender, System::EventArgs ^E)
  | 
        
        
            | 
            | 
           818 | 
           		{
  | 
        
        
            | 
            | 
           819 | 
           			System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);
  | 
        
        
            | 
            | 
           820 | 
           			if ( item )
  | 
        
        
            | 
            | 
           821 | 
           			{
  | 
        
        
            | 
            | 
           822 | 
           				CyString tag = CyStringFromSystemString(cli::safe_cast<System::String ^>(item->Tag));
  | 
        
        
            | 
            | 
           823 | 
           				CyString game = tag.GetToken(" ", 1, 1);
  | 
        
        
            | 
            | 
           824 | 
           				if ( m_pDirList->FindData(game) )
  | 
        
        
            | 
            | 
           825 | 
           				{
  | 
        
        
            | 
            | 
           826 | 
           					FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
  | 
        
        
            | 
            | 
           827 | 
           					fbd->Description = "Select the path for " + SystemStringFromCyString(tag.GetToken(" ", 2));
  | 
        
        
            | 
            | 
           828 | 
           					if ( fbd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
  | 
        
        
            | 
            | 
           829 | 
           					{
  | 
        
        
            | 
            | 
           830 | 
           						m_pDirList->FindData(game)->str = CyStringFromSystemString(fbd->SelectedPath);
  | 
        
        
            | 
            | 
           831 | 
           						this->UpdateGames();
  | 
        
        
            | 
            | 
           832 | 
           					}					
  | 
        
        
            | 
            | 
           833 | 
           				}
  | 
        
        
            | 
            | 
           834 | 
           			}
  | 
        
        
            | 
            | 
           835 | 
           		}
  | 
        
        
            | 
            | 
           836 | 
              | 
        
        
            | 
            | 
           837 | 
           		void UpdateCockpitList()
  | 
        
        
            | 
            | 
           838 | 
           		{
  | 
        
        
            | 
            | 
           839 | 
           			if ( !m_pLoadedShip )
  | 
        
        
            | 
            | 
           840 | 
           				return;
  | 
        
        
            | 
            | 
           841 | 
              | 
        
        
            | 
            | 
           842 | 
           			m_bDontChange = true;
  | 
        
        
            | 
            | 
           843 | 
              | 
        
        
            | 
            | 
           844 | 
           			if ( !m_bDontUpdate && m_pCockpit )
  | 
        
        
            | 
            | 
           845 | 
           				m_pLoadedShip->AddCockpit(m_pCockpit->sCockpit, (m_iOldGame == -1) ? (this->ComboGame->SelectedIndex + 2) : m_iOldGame, this->GetMask(this->CockpitWeapons));
  | 
        
        
            | 
            | 
           846 | 
              | 
        
        
            | 
            | 
           847 | 
           			m_pCockpit = NULL;
  | 
        
        
            | 
            | 
           848 | 
              | 
        
        
            | 
            | 
           849 | 
           			// find the cockpit pointer
  | 
        
        
            | 
            | 
           850 | 
           			m_pCockpit = m_pLoadedShip->GetCockpits()->Get(this->ComboCockpits->SelectedIndex);
  | 
        
        
            | 
            | 
           851 | 
              | 
        
        
            | 
            | 
           852 | 
           			int mask = 0;
  | 
        
        
            | 
            | 
           853 | 
           			if ( m_pCockpit )
  | 
        
        
            | 
            | 
           854 | 
           			{
  | 
        
        
           | 39 | 
           cycrow | 
           855 | 
           				mask = m_pCockpit->sCockpit.token(";", 9);
  | 
        
        
           | 1 | 
           cycrow | 
           856 | 
           				for ( SWeaponMask *wm = m_pCockpit->lWeaponMask.First(); wm; wm = m_pCockpit->lWeaponMask.Next() )
  | 
        
        
            | 
            | 
           857 | 
           				{
  | 
        
        
            | 
            | 
           858 | 
           					if ( wm->iGame == (this->ComboGame->SelectedIndex + 2) )
  | 
        
        
            | 
            | 
           859 | 
           					{
  | 
        
        
            | 
            | 
           860 | 
           						mask = wm->iMask;
  | 
        
        
            | 
            | 
           861 | 
           						break;
  | 
        
        
            | 
            | 
           862 | 
           					}
  | 
        
        
            | 
            | 
           863 | 
           				}
  | 
        
        
            | 
            | 
           864 | 
           			}
  | 
        
        
            | 
            | 
           865 | 
              | 
        
        
            | 
            | 
           866 | 
           			for ( int i = 0; i < this->CockpitWeapons->Items->Count; i++ )
  | 
        
        
            | 
            | 
           867 | 
           				this->CockpitWeapons->SetItemChecked(i, (mask & (1 << i)) ? true : false);
  | 
        
        
            | 
            | 
           868 | 
              | 
        
        
            | 
            | 
           869 | 
           			m_bDontChange = false;
  | 
        
        
            | 
            | 
           870 | 
           		}
  | 
        
        
            | 
            | 
           871 | 
              | 
        
        
            | 
            | 
           872 | 
              | 
        
        
            | 
            | 
           873 | 
           		void InitializeComponent(void)
  | 
        
        
            | 
            | 
           874 | 
           		{
  | 
        
        
            | 
            | 
           875 | 
           			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
  | 
        
        
            | 
            | 
           876 | 
           			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
  | 
        
        
            | 
            | 
           877 | 
           			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           878 | 
           			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           879 | 
           			this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           880 | 
           			this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           881 | 
           			this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           882 | 
           			this->gamesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           883 | 
           			this->loadGameTextToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           884 | 
           			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
  | 
        
        
            | 
            | 
           885 | 
           			this->updateGameDataToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  | 
        
        
            | 
            | 
           886 | 
           			this->panel1 = (gcnew System::Windows::Forms::Panel());
  | 
        
        
            | 
            | 
           887 | 
           			this->ButExit = (gcnew System::Windows::Forms::Button());
  | 
        
        
            | 
            | 
           888 | 
           			this->PanelMain = (gcnew System::Windows::Forms::Panel());
  | 
        
        
            | 
            | 
           889 | 
           			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
  | 
        
        
            | 
            | 
           890 | 
           			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
  | 
        
        
            | 
            | 
           891 | 
           			this->WeaponList = (gcnew System::Windows::Forms::CheckedListBox());
  | 
        
        
            | 
            | 
           892 | 
           			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
  | 
        
        
            | 
            | 
           893 | 
           			this->MissileList = (gcnew System::Windows::Forms::CheckedListBox());
  | 
        
        
            | 
            | 
           894 | 
           			this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
  | 
        
        
            | 
            | 
           895 | 
           			this->CockpitWeapons = (gcnew System::Windows::Forms::CheckedListBox());
  | 
        
        
            | 
            | 
           896 | 
           			this->ComboCockpits = (gcnew System::Windows::Forms::ComboBox());
  | 
        
        
            | 
            | 
           897 | 
           			this->panel2 = (gcnew System::Windows::Forms::Panel());
  | 
        
        
            | 
            | 
           898 | 
           			this->ComboGame = (gcnew System::Windows::Forms::ComboBox());
  | 
        
        
            | 
            | 
           899 | 
           			this->label1 = (gcnew System::Windows::Forms::Label());
  | 
        
        
            | 
            | 
           900 | 
           			this->PanelNotLoaded = (gcnew System::Windows::Forms::Panel());
  | 
        
        
            | 
            | 
           901 | 
           			this->LabelNotLoaded = (gcnew System::Windows::Forms::Label());
  | 
        
        
            | 
            | 
           902 | 
           			this->menuStrip1->SuspendLayout();
  | 
        
        
            | 
            | 
           903 | 
           			this->panel1->SuspendLayout();
  | 
        
        
            | 
            | 
           904 | 
           			this->PanelMain->SuspendLayout();
  | 
        
        
            | 
            | 
           905 | 
           			this->tabControl1->SuspendLayout();
  | 
        
        
            | 
            | 
           906 | 
           			this->tabPage1->SuspendLayout();
  | 
        
        
            | 
            | 
           907 | 
           			this->tabPage2->SuspendLayout();
  | 
        
        
            | 
            | 
           908 | 
           			this->tabPage3->SuspendLayout();
  | 
        
        
            | 
            | 
           909 | 
           			this->panel2->SuspendLayout();
  | 
        
        
            | 
            | 
           910 | 
           			this->PanelNotLoaded->SuspendLayout();
  | 
        
        
            | 
            | 
           911 | 
           			this->SuspendLayout();
  | 
        
        
            | 
            | 
           912 | 
           			// 
  | 
        
        
            | 
            | 
           913 | 
           			// menuStrip1
  | 
        
        
            | 
            | 
           914 | 
           			// 
  | 
        
        
            | 
            | 
           915 | 
           			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->fileToolStripMenuItem, 
  | 
        
        
            | 
            | 
           916 | 
           				this->settingsToolStripMenuItem});
  | 
        
        
            | 
            | 
           917 | 
           			this->menuStrip1->Location = System::Drawing::Point(0, 0);
  | 
        
        
            | 
            | 
           918 | 
           			this->menuStrip1->Name = L"menuStrip1";
  | 
        
        
            | 
            | 
           919 | 
           			this->menuStrip1->Size = System::Drawing::Size(416, 24);
  | 
        
        
            | 
            | 
           920 | 
           			this->menuStrip1->TabIndex = 0;
  | 
        
        
            | 
            | 
           921 | 
           			this->menuStrip1->Text = L"menuStrip1";
  | 
        
        
            | 
            | 
           922 | 
           			// 
  | 
        
        
            | 
            | 
           923 | 
           			// fileToolStripMenuItem
  | 
        
        
            | 
            | 
           924 | 
           			// 
  | 
        
        
            | 
            | 
           925 | 
           			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->openToolStripMenuItem, 
  | 
        
        
            | 
            | 
           926 | 
           				this->saveToolStripMenuItem, this->saveAsToolStripMenuItem});
  | 
        
        
            | 
            | 
           927 | 
           			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
  | 
        
        
            | 
            | 
           928 | 
           			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
  | 
        
        
            | 
            | 
           929 | 
           			this->fileToolStripMenuItem->Text = L"&File";
  | 
        
        
            | 
            | 
           930 | 
           			// 
  | 
        
        
            | 
            | 
           931 | 
           			// openToolStripMenuItem
  | 
        
        
            | 
            | 
           932 | 
           			// 
  | 
        
        
            | 
            | 
           933 | 
           			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
  | 
        
        
            | 
            | 
           934 | 
           			this->openToolStripMenuItem->Size = System::Drawing::Size(114, 22);
  | 
        
        
            | 
            | 
           935 | 
           			this->openToolStripMenuItem->Text = L"&Open";
  | 
        
        
            | 
            | 
           936 | 
           			this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);
  | 
        
        
            | 
            | 
           937 | 
           			// 
  | 
        
        
            | 
            | 
           938 | 
           			// saveToolStripMenuItem
  | 
        
        
            | 
            | 
           939 | 
           			// 
  | 
        
        
            | 
            | 
           940 | 
           			this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
  | 
        
        
            | 
            | 
           941 | 
           			this->saveToolStripMenuItem->Size = System::Drawing::Size(114, 22);
  | 
        
        
            | 
            | 
           942 | 
           			this->saveToolStripMenuItem->Text = L"&Save";
  | 
        
        
            | 
            | 
           943 | 
           			this->saveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveToolStripMenuItem_Click);
  | 
        
        
            | 
            | 
           944 | 
           			// 
  | 
        
        
            | 
            | 
           945 | 
           			// saveAsToolStripMenuItem
  | 
        
        
            | 
            | 
           946 | 
           			// 
  | 
        
        
            | 
            | 
           947 | 
           			this->saveAsToolStripMenuItem->Name = L"saveAsToolStripMenuItem";
  | 
        
        
            | 
            | 
           948 | 
           			this->saveAsToolStripMenuItem->Size = System::Drawing::Size(114, 22);
  | 
        
        
            | 
            | 
           949 | 
           			this->saveAsToolStripMenuItem->Text = L"Save &As";
  | 
        
        
            | 
            | 
           950 | 
           			this->saveAsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveAsToolStripMenuItem_Click);
  | 
        
        
            | 
            | 
           951 | 
           			// 
  | 
        
        
            | 
            | 
           952 | 
           			// settingsToolStripMenuItem
  | 
        
        
            | 
            | 
           953 | 
           			// 
  | 
        
        
            | 
            | 
           954 | 
           			this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->gamesToolStripMenuItem, 
  | 
        
        
            | 
            | 
           955 | 
           				this->loadGameTextToolStripMenuItem, this->toolStripSeparator1, this->updateGameDataToolStripMenuItem});
  | 
        
        
            | 
            | 
           956 | 
           			this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
  | 
        
        
            | 
            | 
           957 | 
           			this->settingsToolStripMenuItem->Size = System::Drawing::Size(61, 20);
  | 
        
        
            | 
            | 
           958 | 
           			this->settingsToolStripMenuItem->Text = L"Settings";
  | 
        
        
            | 
            | 
           959 | 
           			// 
  | 
        
        
            | 
            | 
           960 | 
           			// gamesToolStripMenuItem
  | 
        
        
            | 
            | 
           961 | 
           			// 
  | 
        
        
            | 
            | 
           962 | 
           			this->gamesToolStripMenuItem->Name = L"gamesToolStripMenuItem";
  | 
        
        
            | 
            | 
           963 | 
           			this->gamesToolStripMenuItem->Size = System::Drawing::Size(173, 22);
  | 
        
        
            | 
            | 
           964 | 
           			this->gamesToolStripMenuItem->Text = L"Games";
  | 
        
        
            | 
            | 
           965 | 
           			// 
  | 
        
        
            | 
            | 
           966 | 
           			// loadGameTextToolStripMenuItem
  | 
        
        
            | 
            | 
           967 | 
           			// 
  | 
        
        
            | 
            | 
           968 | 
           			this->loadGameTextToolStripMenuItem->Name = L"loadGameTextToolStripMenuItem";
  | 
        
        
            | 
            | 
           969 | 
           			this->loadGameTextToolStripMenuItem->Size = System::Drawing::Size(173, 22);
  | 
        
        
            | 
            | 
           970 | 
           			this->loadGameTextToolStripMenuItem->Text = L"Load Game Text";
  | 
        
        
            | 
            | 
           971 | 
           			this->loadGameTextToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::loadGameTextToolStripMenuItem_Click);
  | 
        
        
            | 
            | 
           972 | 
           			// 
  | 
        
        
            | 
            | 
           973 | 
           			// toolStripSeparator1
  | 
        
        
            | 
            | 
           974 | 
           			// 
  | 
        
        
            | 
            | 
           975 | 
           			this->toolStripSeparator1->Name = L"toolStripSeparator1";
  | 
        
        
            | 
            | 
           976 | 
           			this->toolStripSeparator1->Size = System::Drawing::Size(170, 6);
  | 
        
        
            | 
            | 
           977 | 
           			// 
  | 
        
        
            | 
            | 
           978 | 
           			// updateGameDataToolStripMenuItem
  | 
        
        
            | 
            | 
           979 | 
           			// 
  | 
        
        
            | 
            | 
           980 | 
           			this->updateGameDataToolStripMenuItem->Name = L"updateGameDataToolStripMenuItem";
  | 
        
        
            | 
            | 
           981 | 
           			this->updateGameDataToolStripMenuItem->Size = System::Drawing::Size(173, 22);
  | 
        
        
            | 
            | 
           982 | 
           			this->updateGameDataToolStripMenuItem->Text = L"Update Game Data";
  | 
        
        
            | 
            | 
           983 | 
           			this->updateGameDataToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::updateGameDataToolStripMenuItem_Click);
  | 
        
        
            | 
            | 
           984 | 
           			// 
  | 
        
        
            | 
            | 
           985 | 
           			// panel1
  | 
        
        
            | 
            | 
           986 | 
           			// 
  | 
        
        
            | 
            | 
           987 | 
           			this->panel1->Controls->Add(this->ButExit);
  | 
        
        
            | 
            | 
           988 | 
           			this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
  | 
        
        
            | 
            | 
           989 | 
           			this->panel1->Location = System::Drawing::Point(0, 376);
  | 
        
        
            | 
            | 
           990 | 
           			this->panel1->Name = L"panel1";
  | 
        
        
            | 
            | 
           991 | 
           			this->panel1->Size = System::Drawing::Size(416, 33);
  | 
        
        
            | 
            | 
           992 | 
           			this->panel1->TabIndex = 1;
  | 
        
        
            | 
            | 
           993 | 
           			// 
  | 
        
        
            | 
            | 
           994 | 
           			// ButExit
  | 
        
        
            | 
            | 
           995 | 
           			// 
  | 
        
        
            | 
            | 
           996 | 
           			this->ButExit->DialogResult = System::Windows::Forms::DialogResult::Cancel;
  | 
        
        
            | 
            | 
           997 | 
           			this->ButExit->Dock = System::Windows::Forms::DockStyle::Right;
  | 
        
        
            | 
            | 
           998 | 
           			this->ButExit->Location = System::Drawing::Point(303, 0);
  | 
        
        
            | 
            | 
           999 | 
           			this->ButExit->Name = L"ButExit";
  | 
        
        
            | 
            | 
           1000 | 
           			this->ButExit->Size = System::Drawing::Size(113, 33);
  | 
        
        
            | 
            | 
           1001 | 
           			this->ButExit->TabIndex = 0;
  | 
        
        
            | 
            | 
           1002 | 
           			this->ButExit->Text = L"Exit";
  | 
        
        
            | 
            | 
           1003 | 
           			this->ButExit->UseVisualStyleBackColor = true;
  | 
        
        
            | 
            | 
           1004 | 
           			this->ButExit->Click += gcnew System::EventHandler(this, &Form1::ButExit_Click);
  | 
        
        
            | 
            | 
           1005 | 
           			// 
  | 
        
        
            | 
            | 
           1006 | 
           			// PanelMain
  | 
        
        
            | 
            | 
           1007 | 
           			// 
  | 
        
        
            | 
            | 
           1008 | 
           			this->PanelMain->Controls->Add(this->tabControl1);
  | 
        
        
            | 
            | 
           1009 | 
           			this->PanelMain->Controls->Add(this->panel2);
  | 
        
        
            | 
            | 
           1010 | 
           			this->PanelMain->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1011 | 
           			this->PanelMain->Location = System::Drawing::Point(0, 24);
  | 
        
        
            | 
            | 
           1012 | 
           			this->PanelMain->Name = L"PanelMain";
  | 
        
        
            | 
            | 
           1013 | 
           			this->PanelMain->Size = System::Drawing::Size(416, 352);
  | 
        
        
            | 
            | 
           1014 | 
           			this->PanelMain->TabIndex = 2;
  | 
        
        
            | 
            | 
           1015 | 
           			// 
  | 
        
        
            | 
            | 
           1016 | 
           			// tabControl1
  | 
        
        
            | 
            | 
           1017 | 
           			// 
  | 
        
        
            | 
            | 
           1018 | 
           			this->tabControl1->Controls->Add(this->tabPage1);
  | 
        
        
            | 
            | 
           1019 | 
           			this->tabControl1->Controls->Add(this->tabPage2);
  | 
        
        
            | 
            | 
           1020 | 
           			this->tabControl1->Controls->Add(this->tabPage3);
  | 
        
        
            | 
            | 
           1021 | 
           			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1022 | 
           			this->tabControl1->Location = System::Drawing::Point(0, 22);
  | 
        
        
            | 
            | 
           1023 | 
           			this->tabControl1->Name = L"tabControl1";
  | 
        
        
            | 
            | 
           1024 | 
           			this->tabControl1->SelectedIndex = 0;
  | 
        
        
            | 
            | 
           1025 | 
           			this->tabControl1->Size = System::Drawing::Size(416, 330);
  | 
        
        
            | 
            | 
           1026 | 
           			this->tabControl1->TabIndex = 2;
  | 
        
        
            | 
            | 
           1027 | 
           			// 
  | 
        
        
            | 
            | 
           1028 | 
           			// tabPage1
  | 
        
        
            | 
            | 
           1029 | 
           			// 
  | 
        
        
            | 
            | 
           1030 | 
           			this->tabPage1->Controls->Add(this->WeaponList);
  | 
        
        
            | 
            | 
           1031 | 
           			this->tabPage1->Location = System::Drawing::Point(4, 22);
  | 
        
        
            | 
            | 
           1032 | 
           			this->tabPage1->Name = L"tabPage1";
  | 
        
        
            | 
            | 
           1033 | 
           			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
  | 
        
        
            | 
            | 
           1034 | 
           			this->tabPage1->Size = System::Drawing::Size(408, 304);
  | 
        
        
            | 
            | 
           1035 | 
           			this->tabPage1->TabIndex = 0;
  | 
        
        
            | 
            | 
           1036 | 
           			this->tabPage1->Text = L"Lasers";
  | 
        
        
            | 
            | 
           1037 | 
           			this->tabPage1->UseVisualStyleBackColor = true;
  | 
        
        
            | 
            | 
           1038 | 
           			// 
  | 
        
        
            | 
            | 
           1039 | 
           			// WeaponList
  | 
        
        
            | 
            | 
           1040 | 
           			// 
  | 
        
        
            | 
            | 
           1041 | 
           			this->WeaponList->CheckOnClick = true;
  | 
        
        
            | 
            | 
           1042 | 
           			this->WeaponList->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1043 | 
           			this->WeaponList->FormattingEnabled = true;
  | 
        
        
            | 
            | 
           1044 | 
           			this->WeaponList->HorizontalScrollbar = true;
  | 
        
        
            | 
            | 
           1045 | 
           			this->WeaponList->Location = System::Drawing::Point(3, 3);
  | 
        
        
            | 
            | 
           1046 | 
           			this->WeaponList->Name = L"WeaponList";
  | 
        
        
            | 
            | 
           1047 | 
           			this->WeaponList->Size = System::Drawing::Size(402, 289);
  | 
        
        
            | 
            | 
           1048 | 
           			this->WeaponList->TabIndex = 3;
  | 
        
        
            | 
            | 
           1049 | 
           			this->WeaponList->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler(this, &Form1::WeaponListEvent_Changed);
  | 
        
        
            | 
            | 
           1050 | 
           			// 
  | 
        
        
            | 
            | 
           1051 | 
           			// tabPage2
  | 
        
        
            | 
            | 
           1052 | 
           			// 
  | 
        
        
            | 
            | 
           1053 | 
           			this->tabPage2->Controls->Add(this->MissileList);
  | 
        
        
            | 
            | 
           1054 | 
           			this->tabPage2->Location = System::Drawing::Point(4, 22);
  | 
        
        
            | 
            | 
           1055 | 
           			this->tabPage2->Name = L"tabPage2";
  | 
        
        
            | 
            | 
           1056 | 
           			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
  | 
        
        
            | 
            | 
           1057 | 
           			this->tabPage2->Size = System::Drawing::Size(408, 304);
  | 
        
        
            | 
            | 
           1058 | 
           			this->tabPage2->TabIndex = 1;
  | 
        
        
            | 
            | 
           1059 | 
           			this->tabPage2->Text = L"Missiles";
  | 
        
        
            | 
            | 
           1060 | 
           			this->tabPage2->UseVisualStyleBackColor = true;
  | 
        
        
            | 
            | 
           1061 | 
           			// 
  | 
        
        
            | 
            | 
           1062 | 
           			// MissileList
  | 
        
        
            | 
            | 
           1063 | 
           			// 
  | 
        
        
            | 
            | 
           1064 | 
           			this->MissileList->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1065 | 
           			this->MissileList->FormattingEnabled = true;
  | 
        
        
            | 
            | 
           1066 | 
           			this->MissileList->HorizontalScrollbar = true;
  | 
        
        
            | 
            | 
           1067 | 
           			this->MissileList->Location = System::Drawing::Point(3, 3);
  | 
        
        
            | 
            | 
           1068 | 
           			this->MissileList->Name = L"MissileList";
  | 
        
        
            | 
            | 
           1069 | 
           			this->MissileList->Size = System::Drawing::Size(402, 289);
  | 
        
        
            | 
            | 
           1070 | 
           			this->MissileList->TabIndex = 4;
  | 
        
        
            | 
            | 
           1071 | 
           			this->MissileList->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler(this, &Form1::MissileListEvent_Changed);
  | 
        
        
            | 
            | 
           1072 | 
           			// 
  | 
        
        
            | 
            | 
           1073 | 
           			// tabPage3
  | 
        
        
            | 
            | 
           1074 | 
           			// 
  | 
        
        
            | 
            | 
           1075 | 
           			this->tabPage3->Controls->Add(this->CockpitWeapons);
  | 
        
        
            | 
            | 
           1076 | 
           			this->tabPage3->Controls->Add(this->ComboCockpits);
  | 
        
        
            | 
            | 
           1077 | 
           			this->tabPage3->Location = System::Drawing::Point(4, 22);
  | 
        
        
            | 
            | 
           1078 | 
           			this->tabPage3->Name = L"tabPage3";
  | 
        
        
            | 
            | 
           1079 | 
           			this->tabPage3->Padding = System::Windows::Forms::Padding(3);
  | 
        
        
            | 
            | 
           1080 | 
           			this->tabPage3->Size = System::Drawing::Size(408, 304);
  | 
        
        
            | 
            | 
           1081 | 
           			this->tabPage3->TabIndex = 2;
  | 
        
        
            | 
            | 
           1082 | 
           			this->tabPage3->Text = L"Cockpits";
  | 
        
        
            | 
            | 
           1083 | 
           			this->tabPage3->UseVisualStyleBackColor = true;
  | 
        
        
            | 
            | 
           1084 | 
           			// 
  | 
        
        
            | 
            | 
           1085 | 
           			// CockpitWeapons
  | 
        
        
            | 
            | 
           1086 | 
           			// 
  | 
        
        
            | 
            | 
           1087 | 
           			this->CockpitWeapons->CheckOnClick = true;
  | 
        
        
            | 
            | 
           1088 | 
           			this->CockpitWeapons->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1089 | 
           			this->CockpitWeapons->FormattingEnabled = true;
  | 
        
        
            | 
            | 
           1090 | 
           			this->CockpitWeapons->HorizontalScrollbar = true;
  | 
        
        
            | 
            | 
           1091 | 
           			this->CockpitWeapons->Location = System::Drawing::Point(3, 24);
  | 
        
        
            | 
            | 
           1092 | 
           			this->CockpitWeapons->Name = L"CockpitWeapons";
  | 
        
        
            | 
            | 
           1093 | 
           			this->CockpitWeapons->Size = System::Drawing::Size(402, 274);
  | 
        
        
            | 
            | 
           1094 | 
           			this->CockpitWeapons->TabIndex = 4;
  | 
        
        
            | 
            | 
           1095 | 
           			// 
  | 
        
        
            | 
            | 
           1096 | 
           			// ComboCockpits
  | 
        
        
            | 
            | 
           1097 | 
           			// 
  | 
        
        
            | 
            | 
           1098 | 
           			this->ComboCockpits->Dock = System::Windows::Forms::DockStyle::Top;
  | 
        
        
            | 
            | 
           1099 | 
           			this->ComboCockpits->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
  | 
        
        
            | 
            | 
           1100 | 
           			this->ComboCockpits->FormattingEnabled = true;
  | 
        
        
            | 
            | 
           1101 | 
           			this->ComboCockpits->Location = System::Drawing::Point(3, 3);
  | 
        
        
            | 
            | 
           1102 | 
           			this->ComboCockpits->Name = L"ComboCockpits";
  | 
        
        
            | 
            | 
           1103 | 
           			this->ComboCockpits->Size = System::Drawing::Size(402, 21);
  | 
        
        
            | 
            | 
           1104 | 
           			this->ComboCockpits->TabIndex = 5;
  | 
        
        
            | 
            | 
           1105 | 
           			this->ComboCockpits->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::ComboCockpits_SelectedIndexChanged);
  | 
        
        
            | 
            | 
           1106 | 
           			// 
  | 
        
        
            | 
            | 
           1107 | 
           			// panel2
  | 
        
        
            | 
            | 
           1108 | 
           			// 
  | 
        
        
            | 
            | 
           1109 | 
           			this->panel2->Controls->Add(this->ComboGame);
  | 
        
        
            | 
            | 
           1110 | 
           			this->panel2->Controls->Add(this->label1);
  | 
        
        
            | 
            | 
           1111 | 
           			this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
  | 
        
        
            | 
            | 
           1112 | 
           			this->panel2->Location = System::Drawing::Point(0, 0);
  | 
        
        
            | 
            | 
           1113 | 
           			this->panel2->Name = L"panel2";
  | 
        
        
            | 
            | 
           1114 | 
           			this->panel2->Size = System::Drawing::Size(416, 22);
  | 
        
        
            | 
            | 
           1115 | 
           			this->panel2->TabIndex = 2;
  | 
        
        
            | 
            | 
           1116 | 
           			// 
  | 
        
        
            | 
            | 
           1117 | 
           			// ComboGame
  | 
        
        
            | 
            | 
           1118 | 
           			// 
  | 
        
        
            | 
            | 
           1119 | 
           			this->ComboGame->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1120 | 
           			this->ComboGame->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
  | 
        
        
            | 
            | 
           1121 | 
           			this->ComboGame->FormattingEnabled = true;
  | 
        
        
            | 
            | 
           1122 | 
           			this->ComboGame->Location = System::Drawing::Point(188, 0);
  | 
        
        
            | 
            | 
           1123 | 
           			this->ComboGame->Name = L"ComboGame";
  | 
        
        
            | 
            | 
           1124 | 
           			this->ComboGame->Size = System::Drawing::Size(228, 21);
  | 
        
        
            | 
            | 
           1125 | 
           			this->ComboGame->TabIndex = 0;
  | 
        
        
            | 
            | 
           1126 | 
           			this->ComboGame->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::ComboGame_SelectedIndexChanged);
  | 
        
        
            | 
            | 
           1127 | 
           			// 
  | 
        
        
            | 
            | 
           1128 | 
           			// label1
  | 
        
        
            | 
            | 
           1129 | 
           			// 
  | 
        
        
            | 
            | 
           1130 | 
           			this->label1->Dock = System::Windows::Forms::DockStyle::Left;
  | 
        
        
            | 
            | 
           1131 | 
           			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
  | 
        
        
            | 
            | 
           1132 | 
           				static_cast<System::Byte>(0)));
  | 
        
        
            | 
            | 
           1133 | 
           			this->label1->Location = System::Drawing::Point(0, 0);
  | 
        
        
            | 
            | 
           1134 | 
           			this->label1->Name = L"label1";
  | 
        
        
            | 
            | 
           1135 | 
           			this->label1->Size = System::Drawing::Size(188, 22);
  | 
        
        
            | 
            | 
           1136 | 
           			this->label1->TabIndex = 1;
  | 
        
        
            | 
            | 
           1137 | 
           			this->label1->Text = L"X-Universe Game:";
  | 
        
        
            | 
            | 
           1138 | 
           			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
  | 
        
        
            | 
            | 
           1139 | 
           			// 
  | 
        
        
            | 
            | 
           1140 | 
           			// PanelNotLoaded
  | 
        
        
            | 
            | 
           1141 | 
           			// 
  | 
        
        
            | 
            | 
           1142 | 
           			this->PanelNotLoaded->Controls->Add(this->LabelNotLoaded);
  | 
        
        
            | 
            | 
           1143 | 
           			this->PanelNotLoaded->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1144 | 
           			this->PanelNotLoaded->Location = System::Drawing::Point(0, 24);
  | 
        
        
            | 
            | 
           1145 | 
           			this->PanelNotLoaded->Name = L"PanelNotLoaded";
  | 
        
        
            | 
            | 
           1146 | 
           			this->PanelNotLoaded->Size = System::Drawing::Size(416, 352);
  | 
        
        
            | 
            | 
           1147 | 
           			this->PanelNotLoaded->TabIndex = 3;
  | 
        
        
            | 
            | 
           1148 | 
           			// 
  | 
        
        
            | 
            | 
           1149 | 
           			// LabelNotLoaded
  | 
        
        
            | 
            | 
           1150 | 
           			// 
  | 
        
        
            | 
            | 
           1151 | 
           			this->LabelNotLoaded->Dock = System::Windows::Forms::DockStyle::Fill;
  | 
        
        
            | 
            | 
           1152 | 
           			this->LabelNotLoaded->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
  | 
        
        
            | 
            | 
           1153 | 
           				static_cast<System::Byte>(0)));
  | 
        
        
            | 
            | 
           1154 | 
           			this->LabelNotLoaded->Location = System::Drawing::Point(0, 0);
  | 
        
        
            | 
            | 
           1155 | 
           			this->LabelNotLoaded->Name = L"LabelNotLoaded";
  | 
        
        
            | 
            | 
           1156 | 
           			this->LabelNotLoaded->Size = System::Drawing::Size(416, 352);
  | 
        
        
            | 
            | 
           1157 | 
           			this->LabelNotLoaded->TabIndex = 0;
  | 
        
        
            | 
            | 
           1158 | 
           			this->LabelNotLoaded->Text = L"No ship file is currently loaded";
  | 
        
        
            | 
            | 
           1159 | 
           			this->LabelNotLoaded->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
  | 
        
        
            | 
            | 
           1160 | 
           			// 
  | 
        
        
            | 
            | 
           1161 | 
           			// Form1
  | 
        
        
            | 
            | 
           1162 | 
           			// 
  | 
        
        
            | 
            | 
           1163 | 
           			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  | 
        
        
            | 
            | 
           1164 | 
           			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  | 
        
        
            | 
            | 
           1165 | 
           			this->CancelButton = this->ButExit;
  | 
        
        
            | 
            | 
           1166 | 
           			this->ClientSize = System::Drawing::Size(416, 409);
  | 
        
        
            | 
            | 
           1167 | 
           			this->Controls->Add(this->PanelMain);
  | 
        
        
            | 
            | 
           1168 | 
           			this->Controls->Add(this->PanelNotLoaded);
  | 
        
        
            | 
            | 
           1169 | 
           			this->Controls->Add(this->panel1);
  | 
        
        
            | 
            | 
           1170 | 
           			this->Controls->Add(this->menuStrip1);
  | 
        
        
            | 
            | 
           1171 | 
           			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
  | 
        
        
            | 
            | 
           1172 | 
           			this->MainMenuStrip = this->menuStrip1;
  | 
        
        
            | 
            | 
           1173 | 
           			this->Name = L"Form1";
  | 
        
        
            | 
            | 
           1174 | 
           			this->Text = L"XSP Ship Convertor";
  | 
        
        
            | 
            | 
           1175 | 
           			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
  | 
        
        
            | 
            | 
           1176 | 
           			this->menuStrip1->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1177 | 
           			this->menuStrip1->PerformLayout();
  | 
        
        
            | 
            | 
           1178 | 
           			this->panel1->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1179 | 
           			this->PanelMain->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1180 | 
           			this->tabControl1->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1181 | 
           			this->tabPage1->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1182 | 
           			this->tabPage2->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1183 | 
           			this->tabPage3->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1184 | 
           			this->panel2->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1185 | 
           			this->PanelNotLoaded->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1186 | 
           			this->ResumeLayout(false);
  | 
        
        
            | 
            | 
           1187 | 
           			this->PerformLayout();
  | 
        
        
            | 
            | 
           1188 | 
              | 
        
        
            | 
            | 
           1189 | 
           		}
  | 
        
        
            | 
            | 
           1190 | 
           #pragma endregion
  | 
        
        
            | 
            | 
           1191 | 
           private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1192 | 
           			 this->OpenFile();
  | 
        
        
            | 
            | 
           1193 | 
           		 }
  | 
        
        
            | 
            | 
           1194 | 
           private: System::Void ButExit_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1195 | 
           			 this->Close();
  | 
        
        
            | 
            | 
           1196 | 
           		 }
  | 
        
        
            | 
            | 
           1197 | 
           private: System::Void saveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1198 | 
           			 this->SaveShip();
  | 
        
        
            | 
            | 
           1199 | 
           		 }
  | 
        
        
            | 
            | 
           1200 | 
           private: System::Void ComboGame_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1201 | 
           			 this->ChangeGame();
  | 
        
        
            | 
            | 
           1202 | 
           		 }
  | 
        
        
            | 
            | 
           1203 | 
           private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1204 | 
           			 this->LoadGameDirectory();
  | 
        
        
            | 
            | 
           1205 | 
              | 
        
        
            | 
            | 
           1206 | 
           			 if ( m_sOpenFile )
  | 
        
        
            | 
            | 
           1207 | 
           				this->OpenFile(m_sOpenFile);
  | 
        
        
            | 
            | 
           1208 | 
           		 }
  | 
        
        
            | 
            | 
           1209 | 
           private: void CloseEvent(System::Object ^Sender, System::EventArgs ^E) {
  | 
        
        
            | 
            | 
           1210 | 
           			 this->CheckSave();
  | 
        
        
            | 
            | 
           1211 | 
           			 this->CloseDialog();
  | 
        
        
            | 
            | 
           1212 | 
           		 }
  | 
        
        
            | 
            | 
           1213 | 
           private: System::Void updateGameDataToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1214 | 
           			 this->LoadGameData();
  | 
        
        
            | 
            | 
           1215 | 
           		 }
  | 
        
        
            | 
            | 
           1216 | 
           private: System::Void loadGameTextToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1217 | 
           			 m_bReadText = !m_bReadText;
  | 
        
        
            | 
            | 
           1218 | 
           			 this->loadGameTextToolStripMenuItem->Checked = m_bReadText;
  | 
        
        
            | 
            | 
           1219 | 
           		 }
  | 
        
        
            | 
            | 
           1220 | 
           private: System::Void WeaponListEvent_Changed(System::Object^  sender, ItemCheckEventArgs^  e) {
  | 
        
        
            | 
            | 
           1221 | 
           			 if ( !m_bLoading )
  | 
        
        
            | 
            | 
           1222 | 
           			 {
  | 
        
        
            | 
            | 
           1223 | 
           				 int index = (1 << e->Index);
  | 
        
        
            | 
            | 
           1224 | 
           				 if ( e->NewValue == CheckState::Checked )
  | 
        
        
            | 
            | 
           1225 | 
           					 m_iLaserMask |= index;
  | 
        
        
            | 
            | 
           1226 | 
           				 else if ( e->NewValue == CheckState::Unchecked )
  | 
        
        
            | 
            | 
           1227 | 
           					 m_iLaserMask &= ~(index);
  | 
        
        
            | 
            | 
           1228 | 
              | 
        
        
            | 
            | 
           1229 | 
           				this->CheckListChanged();
  | 
        
        
            | 
            | 
           1230 | 
           			 }
  | 
        
        
            | 
            | 
           1231 | 
           		 }
  | 
        
        
            | 
            | 
           1232 | 
           private: System::Void MissileListEvent_Changed(System::Object^  sender, ItemCheckEventArgs^  e) {
  | 
        
        
            | 
            | 
           1233 | 
           			 if ( !m_bLoading )
  | 
        
        
            | 
            | 
           1234 | 
           			 {
  | 
        
        
            | 
            | 
           1235 | 
           				 int index = (1 << e->Index);
  | 
        
        
            | 
            | 
           1236 | 
           				 if ( e->NewValue == CheckState::Checked )
  | 
        
        
            | 
            | 
           1237 | 
           					 m_iMissileMask |= index;
  | 
        
        
            | 
            | 
           1238 | 
           				 else if ( e->NewValue == CheckState::Unchecked )
  | 
        
        
            | 
            | 
           1239 | 
           					 m_iMissileMask &= ~(index);
  | 
        
        
            | 
            | 
           1240 | 
              | 
        
        
            | 
            | 
           1241 | 
           				this->CheckListChanged();
  | 
        
        
            | 
            | 
           1242 | 
           			 }
  | 
        
        
            | 
            | 
           1243 | 
           		 }
  | 
        
        
            | 
            | 
           1244 | 
           private: System::Void Event_Changed(System::Object^  sender, ItemCheckEventArgs^  e) {
  | 
        
        
            | 
            | 
           1245 | 
           			 if ( !m_bLoading )
  | 
        
        
            | 
            | 
           1246 | 
           			 {
  | 
        
        
            | 
            | 
           1247 | 
           				this->CheckListChanged();
  | 
        
        
            | 
            | 
           1248 | 
           			 }
  | 
        
        
            | 
            | 
           1249 | 
           		 }
  | 
        
        
            | 
            | 
           1250 | 
           private: System::Void saveAsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1251 | 
           			 this->SaveShipAs();
  | 
        
        
            | 
            | 
           1252 | 
           		 }
  | 
        
        
            | 
            | 
           1253 | 
           private: System::Void ComboCockpits_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
  | 
        
        
            | 
            | 
           1254 | 
           			 this->UpdateCockpitList();
  | 
        
        
            | 
            | 
           1255 | 
           		 }
  | 
        
        
            | 
            | 
           1256 | 
           };
  | 
        
        
            | 
            | 
           1257 | 
           }
  | 
        
        
            | 
            | 
           1258 | 
              |