Subversion Repositories spk

Rev

Rev 19 | Rev 36 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 31
Line 20... Line 20...
20
	///          resources associated with this form.
20
	///          resources associated with this form.
21
	/// </summary>
21
	/// </summary>
22
	public ref class ImportShip : public System::Windows::Forms::Form
22
	public ref class ImportShip : public System::Windows::Forms::Form
23
	{
23
	{
24
	public:
24
	public:
25
		ImportShip(CPackages *p, String ^cat, String ^id)
25
		ImportShip(CPackages *p, String ^cat, String ^id, String ^secondCat)
26
		{
26
		{
27
			InitializeComponent();
27
			InitializeComponent();
28
 
28
 
29
			this->Text = this->Text + " (" + id + ")";
29
			this->Text = this->Text + " (" + id + ")";
30
 
30
 
Line 41... Line 41...
41
			this->pictureBox10->Visible = false;
41
			this->pictureBox10->Visible = false;
42
 
42
 
43
			m_bError = false;
43
			m_bError = false;
44
			m_pPackages = p;
44
			m_pPackages = p;
45
			m_sCatFile = cat;
45
			m_sCatFile = cat;
-
 
46
			m_sSecondCat = secondCat;
46
			m_sID = id;
47
			m_sID = id;
47
			m_pShip = NULL;
48
			m_pShip = NULL;
48
 
49
 
49
			m_pInfo = new CProgressInfoDone;
50
			m_pInfo = new CProgressInfoDone;
50
			m_pInfo->UpdateStatus(IMPORTSHIP_NONE);
51
			m_pInfo->UpdateStatus(IMPORTSHIP_NONE);
Line 57... Line 58...
57
 
58
 
58
		void StartImport()
59
		void StartImport()
59
		{
60
		{
60
			m_pShip = new CXspFile;
61
			m_pShip = new CXspFile;
61
			m_pCatFile = new CCatFile;
62
			m_pCatFile = new CCatFile;
-
 
63
			if ( m_sSecondCat ) {
-
 
64
				m_pSecondCatFile = new CCatFile;
-
 
65
			}
-
 
66
			else {
-
 
67
				m_pSecondCatFile = NULL;
-
 
68
			}
-
 
69
 
62
			if ( m_pCatFile->Open(CyStringFromSystemString(m_sCatFile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
70
			if ( m_pCatFile->Open(CyStringFromSystemString(m_sCatFile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE ) {
-
 
71
				if ( m_pSecondCatFile && m_pSecondCatFile->Open(CyStringFromSystemString(m_sSecondCat), "", CATREAD_CATDECRYPT, false) != CATERR_NONE ) {
-
 
72
					delete m_pSecondCatFile;
-
 
73
					m_pSecondCatFile = NULL;
-
 
74
				}
63
				m_bError = false;
75
				m_bError = false;
-
 
76
			}
64
			else
77
			else
65
			{
78
			{
66
				delete m_pShip;
79
				delete m_pShip;
67
				m_bError = true;
80
				m_bError = true;
68
				m_sError = "Unable to open the cat file: " + m_sCatFile;
81
				m_sError = "Unable to open the cat file: " + m_sCatFile;
Line 85... Line 98...
85
				CyString data = CyStringFromSystemString(m_sID);
98
				CyString data = CyStringFromSystemString(m_sID);
86
				data.RemoveChar('\r');
99
				data.RemoveChar('\r');
87
				while(data.Right(1) == ";")
100
				while(data.Right(1) == ";")
88
					data.Truncate((int)data.Length() - 1);
101
					data.Truncate((int)data.Length() - 1);
89
 
102
 
90
				m_bError = !m_pShip->StartExtractShip(m_pCatFile, data, m_pInfo);
103
				m_bError = !m_pShip->StartExtractShip(m_pCatFile, m_pSecondCatFile, data, m_pInfo);
91
				if ( m_bError ) {
-
 
92
					m_sError = "Unable to extract scene file";
104
				if ( m_bError ) m_sError = "Unable to extract scene file";
93
				}
-
 
94
 
105
 
95
				m_iStatus = IMPORTSHIP_EXTRACTSCENE;
106
				m_iStatus = IMPORTSHIP_EXTRACTSCENE;
96
			}
107
			}
97
			else if ( m_iStatus == IMPORTSHIP_EXTRACTSCENE )
108
			else if ( m_iStatus == IMPORTSHIP_EXTRACTSCENE )
98
			{
109
			{
Line 102... Line 113...
102
					m_sError = "Unable to read the scene file to extract model data";
113
					m_sError = "Unable to read the scene file to extract model data";
103
				}
114
				}
104
				++m_iStatus;
115
				++m_iStatus;
105
			}
116
			}
106
			else if ( m_iStatus == IMPORTSHIP_PACK )
117
			else if ( m_iStatus == IMPORTSHIP_PACK )
107
			{
118
			{
108
				m_pShip->PackAllFiles();
119
				m_pShip->PackAllFiles();
109
				m_iStatus = IMPORTSHIP_DONE;
120
				m_iStatus = IMPORTSHIP_DONE;
110
			}
121
			}
111
			else if ( m_iStatus > IMPORTSHIP_EXTRACTSCENE )
122
			else if ( m_iStatus > IMPORTSHIP_EXTRACTSCENE )
112
			{
123
			{
113
				m_bError = !m_pShip->ProcessSceneFileSection(m_iStatus, m_pCatFile, m_lModels, m_pInfo);
124
				m_bError = !m_pShip->ProcessSceneFileSection(m_iStatus, m_pCatFile, m_pSecondCatFile, m_lModels, m_pInfo);
114
				if ( m_bError ) {
-
 
115
					m_sError = "Unable to process scene file (Status=" + (long)m_iStatus;
125
				if ( m_bError ) m_sError = "Unable to process scene file (Status=" + (long)m_iStatus;
116
				}
-
 
117
				++m_iStatus;
126
				++m_iStatus;
118
			}
127
			}
119
		}
128
		}
120
 
129
 
121
	protected:
130
	protected:
Line 183... Line 192...
183
		CPackages		*m_pPackages;
192
		CPackages		*m_pPackages;
184
		String			^m_sCatFile;
193
		String			^m_sCatFile;
185
		String			^m_sID;
194
		String			^m_sID;
186
		CXspFile		*m_pShip;
195
		CXspFile		*m_pShip;
187
		CCatFile		*m_pCatFile;
196
		CCatFile		*m_pCatFile;
-
 
197
		CCatFile		*m_pSecondCatFile;
188
		String			^m_sError;
198
		String			^m_sError;
-
 
199
		String			^m_sSecondCat;
189
 
200
 
190
#pragma region Windows Form Designer generated code
201
#pragma region Windows Form Designer generated code
191
		/// <summary>
202
		/// <summary>
192
		/// Required method for Designer support - do not modify
203
		/// Required method for Designer support - do not modify
193
		/// the contents of this method with the code editor.
204
		/// the contents of this method with the code editor.