Subversion Repositories spk

Rev

Rev 197 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
using namespace System;
4
using namespace System::ComponentModel;
5
using namespace System::Collections;
6
using namespace System::Windows::Forms;
7
using namespace System::Data;
8
using namespace System::Drawing;
9
 
10
 
11
namespace Creator {
12
 
13
	/// <summary>
14
	/// Summary for ModDiff
15
	///
16
	/// WARNING: If you change the name of this class, you will need to change the
17
	///          'Resource File Name' property for the managed resource compiler tool
18
	///          associated with all .resx files this class depends on.  Otherwise,
19
	///          the designers will not be able to interact properly with localized
20
	///          resources associated with this form.
21
	/// </summary>
22
	public ref class ModDiff : public System::Windows::Forms::Form
23
	{
24
	public:
94 cycrow 25
		ModDiff(CGameDirectories *gameDir, CPackages *p)
1 cycrow 26
		{
27
			InitializeComponent();
28
 
197 cycrow 29
			for ( Utils::WString dir = gameDir->first(); !dir.empty(); dir = gameDir->next() ) 
30
				this->comboBox1->Items->Add(_US(dir + L" (" + gameDir->currentName() + L")"));
94 cycrow 31
 
1 cycrow 32
			m_pPackages = p;
33
 
34
			this->panel3->Enabled = false;
35
			this->panel5->Enabled = false;
36
			this->pictureBox2->Image = nullptr;
37
			this->pictureBox3->Image = nullptr;
38
			this->splitContainer1->Visible = false;
39
 
40
			this->toolTip1->SetToolTip(this->comboBox2, "All mod/patchs that are after this one will not be included when generating a diff");
41
		}
42
 
43
		void SetImage(Windows::Forms::PictureBox ^pic)
44
		{
45
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(ModDiff::typeid));
46
			pic->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
47
		}
48
 
49
	protected:
50
		/// <summary>
51
		/// Clean up any resources being used.
52
		/// </summary>
53
		~ModDiff()
54
		{
55
			if (components)
56
			{
57
				delete components;
58
			}
59
		}
60
	private: System::Windows::Forms::PictureBox^  pictureBox1;
61
	protected: 
62
	private: System::Windows::Forms::Panel^  panel1;
63
	private: System::Windows::Forms::ComboBox^  comboBox1;
64
	private: System::Windows::Forms::Label^  label1;
65
	private: System::Windows::Forms::Panel^  panel2;
66
	private: System::Windows::Forms::Panel^  panel3;
67
	private: System::Windows::Forms::Panel^  panel4;
68
	private: System::Windows::Forms::ComboBox^  comboBox2;
69
	private: System::Windows::Forms::Label^  label2;
70
	private: System::Windows::Forms::PictureBox^  pictureBox2;
71
 
72
	private:
73
		CPackages *m_pPackages;
74
	private: System::Windows::Forms::Panel^  panel5;
75
	private: System::Windows::Forms::Panel^  panel6;
76
 
77
	private: System::Windows::Forms::Label^  label3;
78
	private: System::Windows::Forms::PictureBox^  pictureBox3;
79
	private: System::Windows::Forms::TextBox^  textBox1;
80
	private: System::Windows::Forms::Button^  button1;
81
	private: System::Windows::Forms::Panel^  panel7;
82
	private: System::Windows::Forms::SplitContainer^  splitContainer1;
83
	private: System::Windows::Forms::Button^  button2;
84
	private: System::Windows::Forms::Button^  button3;
85
	private: System::Windows::Forms::ToolTip^  toolTip1;
86
	private: System::ComponentModel::IContainer^  components;
87
			 /// <summary>
88
		/// Required designer variable.
89
		/// </summary>
90
 
91
 
92
#pragma region Windows Form Designer generated code
93
		/// <summary>
94
		/// Required method for Designer support - do not modify
95
		/// the contents of this method with the code editor.
96
		/// </summary>
97
		void InitializeComponent(void)
98
		{
99
			this->components = (gcnew System::ComponentModel::Container());
100
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(ModDiff::typeid));
101
			this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
102
			this->panel1 = (gcnew System::Windows::Forms::Panel());
103
			this->panel2 = (gcnew System::Windows::Forms::Panel());
104
			this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
105
			this->label1 = (gcnew System::Windows::Forms::Label());
106
			this->panel3 = (gcnew System::Windows::Forms::Panel());
107
			this->panel4 = (gcnew System::Windows::Forms::Panel());
108
			this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
109
			this->label2 = (gcnew System::Windows::Forms::Label());
110
			this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox());
111
			this->panel5 = (gcnew System::Windows::Forms::Panel());
112
			this->panel6 = (gcnew System::Windows::Forms::Panel());
113
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
114
			this->button1 = (gcnew System::Windows::Forms::Button());
115
			this->label3 = (gcnew System::Windows::Forms::Label());
116
			this->pictureBox3 = (gcnew System::Windows::Forms::PictureBox());
117
			this->panel7 = (gcnew System::Windows::Forms::Panel());
118
			this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());
119
			this->button2 = (gcnew System::Windows::Forms::Button());
120
			this->button3 = (gcnew System::Windows::Forms::Button());
121
			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
122
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
123
			this->panel1->SuspendLayout();
124
			this->panel2->SuspendLayout();
125
			this->panel3->SuspendLayout();
126
			this->panel4->SuspendLayout();
127
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox2))->BeginInit();
128
			this->panel5->SuspendLayout();
129
			this->panel6->SuspendLayout();
130
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox3))->BeginInit();
131
			this->panel7->SuspendLayout();
132
			this->splitContainer1->Panel1->SuspendLayout();
133
			this->splitContainer1->Panel2->SuspendLayout();
134
			this->splitContainer1->SuspendLayout();
135
			this->SuspendLayout();
136
			// 
137
			// pictureBox1
138
			// 
139
			this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Left;
140
			this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
141
			this->pictureBox1->Location = System::Drawing::Point(3, 3);
142
			this->pictureBox1->Name = L"pictureBox1";
143
			this->pictureBox1->Size = System::Drawing::Size(33, 30);
144
			this->pictureBox1->TabIndex = 0;
145
			this->pictureBox1->TabStop = false;
146
			// 
147
			// panel1
148
			// 
149
			this->panel1->Controls->Add(this->panel2);
150
			this->panel1->Controls->Add(this->label1);
151
			this->panel1->Controls->Add(this->pictureBox1);
152
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
153
			this->panel1->Location = System::Drawing::Point(5, 5);
154
			this->panel1->Name = L"panel1";
155
			this->panel1->Padding = System::Windows::Forms::Padding(3);
156
			this->panel1->Size = System::Drawing::Size(573, 36);
157
			this->panel1->TabIndex = 1;
158
			// 
159
			// panel2
160
			// 
161
			this->panel2->Controls->Add(this->comboBox1);
162
			this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
163
			this->panel2->Location = System::Drawing::Point(201, 3);
164
			this->panel2->Name = L"panel2";
165
			this->panel2->Padding = System::Windows::Forms::Padding(0, 5, 0, 0);
166
			this->panel2->Size = System::Drawing::Size(369, 30);
167
			this->panel2->TabIndex = 3;
168
			// 
169
			// comboBox1
170
			// 
171
			this->comboBox1->Dock = System::Windows::Forms::DockStyle::Fill;
172
			this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
173
			this->comboBox1->FormattingEnabled = true;
174
			this->comboBox1->Location = System::Drawing::Point(0, 5);
175
			this->comboBox1->Name = L"comboBox1";
176
			this->comboBox1->Size = System::Drawing::Size(369, 21);
177
			this->comboBox1->TabIndex = 2;
178
			this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &ModDiff::comboBox1_SelectedIndexChanged);
179
			// 
180
			// label1
181
			// 
182
			this->label1->Dock = System::Windows::Forms::DockStyle::Left;
183
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
184
				static_cast<System::Byte>(0)));
185
			this->label1->Location = System::Drawing::Point(36, 3);
186
			this->label1->Name = L"label1";
187
			this->label1->Size = System::Drawing::Size(165, 30);
188
			this->label1->TabIndex = 1;
189
			this->label1->Text = L"Game Directory";
190
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
191
			// 
192
			// panel3
193
			// 
194
			this->panel3->Controls->Add(this->panel4);
195
			this->panel3->Controls->Add(this->label2);
196
			this->panel3->Controls->Add(this->pictureBox2);
197
			this->panel3->Dock = System::Windows::Forms::DockStyle::Top;
198
			this->panel3->Location = System::Drawing::Point(5, 41);
199
			this->panel3->Name = L"panel3";
200
			this->panel3->Padding = System::Windows::Forms::Padding(3);
201
			this->panel3->Size = System::Drawing::Size(573, 36);
202
			this->panel3->TabIndex = 2;
203
			// 
204
			// panel4
205
			// 
206
			this->panel4->Controls->Add(this->comboBox2);
207
			this->panel4->Dock = System::Windows::Forms::DockStyle::Fill;
208
			this->panel4->Location = System::Drawing::Point(201, 3);
209
			this->panel4->Name = L"panel4";
210
			this->panel4->Padding = System::Windows::Forms::Padding(0, 5, 0, 0);
211
			this->panel4->Size = System::Drawing::Size(369, 30);
212
			this->panel4->TabIndex = 3;
213
			// 
214
			// comboBox2
215
			// 
216
			this->comboBox2->Dock = System::Windows::Forms::DockStyle::Fill;
217
			this->comboBox2->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
218
			this->comboBox2->FormattingEnabled = true;
219
			this->comboBox2->Location = System::Drawing::Point(0, 5);
220
			this->comboBox2->Name = L"comboBox2";
221
			this->comboBox2->Size = System::Drawing::Size(369, 21);
222
			this->comboBox2->TabIndex = 2;
223
			this->comboBox2->SelectedIndexChanged += gcnew System::EventHandler(this, &ModDiff::comboBox2_SelectedIndexChanged);
224
			// 
225
			// label2
226
			// 
227
			this->label2->Dock = System::Windows::Forms::DockStyle::Left;
228
			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
229
				static_cast<System::Byte>(0)));
230
			this->label2->Location = System::Drawing::Point(36, 3);
231
			this->label2->Name = L"label2";
232
			this->label2->Size = System::Drawing::Size(165, 30);
233
			this->label2->TabIndex = 1;
234
			this->label2->Text = L"Fake Patch Start";
235
			this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
236
			// 
237
			// pictureBox2
238
			// 
239
			this->pictureBox2->Dock = System::Windows::Forms::DockStyle::Left;
240
			this->pictureBox2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox2.Image")));
241
			this->pictureBox2->Location = System::Drawing::Point(3, 3);
242
			this->pictureBox2->Name = L"pictureBox2";
243
			this->pictureBox2->Size = System::Drawing::Size(33, 30);
244
			this->pictureBox2->TabIndex = 0;
245
			this->pictureBox2->TabStop = false;
246
			// 
247
			// panel5
248
			// 
249
			this->panel5->Controls->Add(this->panel6);
250
			this->panel5->Controls->Add(this->label3);
251
			this->panel5->Controls->Add(this->pictureBox3);
252
			this->panel5->Dock = System::Windows::Forms::DockStyle::Top;
253
			this->panel5->Location = System::Drawing::Point(5, 77);
254
			this->panel5->Name = L"panel5";
255
			this->panel5->Padding = System::Windows::Forms::Padding(3);
256
			this->panel5->Size = System::Drawing::Size(573, 36);
257
			this->panel5->TabIndex = 3;
258
			// 
259
			// panel6
260
			// 
261
			this->panel6->Controls->Add(this->textBox1);
262
			this->panel6->Controls->Add(this->button1);
263
			this->panel6->Dock = System::Windows::Forms::DockStyle::Fill;
264
			this->panel6->Location = System::Drawing::Point(201, 3);
265
			this->panel6->Name = L"panel6";
266
			this->panel6->Padding = System::Windows::Forms::Padding(0, 5, 0, 0);
267
			this->panel6->Size = System::Drawing::Size(369, 30);
268
			this->panel6->TabIndex = 3;
269
			// 
270
			// textBox1
271
			// 
272
			this->textBox1->Dock = System::Windows::Forms::DockStyle::Fill;
273
			this->textBox1->Location = System::Drawing::Point(0, 5);
274
			this->textBox1->Name = L"textBox1";
275
			this->textBox1->ReadOnly = true;
276
			this->textBox1->Size = System::Drawing::Size(343, 20);
277
			this->textBox1->TabIndex = 0;
278
			// 
279
			// button1
280
			// 
281
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
282
			this->button1->ForeColor = System::Drawing::Color::ForestGreen;
283
			this->button1->Location = System::Drawing::Point(343, 5);
284
			this->button1->Name = L"button1";
285
			this->button1->Size = System::Drawing::Size(26, 25);
286
			this->button1->TabIndex = 1;
287
			this->button1->Text = L"...";
288
			this->button1->UseVisualStyleBackColor = true;
289
			this->button1->Click += gcnew System::EventHandler(this, &ModDiff::button1_Click);
290
			// 
291
			// label3
292
			// 
293
			this->label3->Dock = System::Windows::Forms::DockStyle::Left;
294
			this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
295
				static_cast<System::Byte>(0)));
296
			this->label3->Location = System::Drawing::Point(36, 3);
297
			this->label3->Name = L"label3";
298
			this->label3->Size = System::Drawing::Size(165, 30);
299
			this->label3->TabIndex = 1;
300
			this->label3->Text = L"Mod";
301
			this->label3->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
302
			// 
303
			// pictureBox3
304
			// 
305
			this->pictureBox3->Dock = System::Windows::Forms::DockStyle::Left;
306
			this->pictureBox3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox3.Image")));
307
			this->pictureBox3->Location = System::Drawing::Point(3, 3);
308
			this->pictureBox3->Name = L"pictureBox3";
309
			this->pictureBox3->Size = System::Drawing::Size(33, 30);
310
			this->pictureBox3->TabIndex = 0;
311
			this->pictureBox3->TabStop = false;
312
			// 
313
			// panel7
314
			// 
315
			this->panel7->Controls->Add(this->splitContainer1);
316
			this->panel7->Dock = System::Windows::Forms::DockStyle::Fill;
317
			this->panel7->Location = System::Drawing::Point(5, 113);
318
			this->panel7->Name = L"panel7";
319
			this->panel7->Padding = System::Windows::Forms::Padding(100, 10, 100, 10);
320
			this->panel7->Size = System::Drawing::Size(573, 49);
321
			this->panel7->TabIndex = 4;
322
			// 
323
			// splitContainer1
324
			// 
325
			this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
326
			this->splitContainer1->IsSplitterFixed = true;
327
			this->splitContainer1->Location = System::Drawing::Point(100, 10);
328
			this->splitContainer1->Name = L"splitContainer1";
329
			// 
330
			// splitContainer1.Panel1
331
			// 
332
			this->splitContainer1->Panel1->Controls->Add(this->button2);
333
			// 
334
			// splitContainer1.Panel2
335
			// 
336
			this->splitContainer1->Panel2->Controls->Add(this->button3);
337
			this->splitContainer1->Size = System::Drawing::Size(373, 29);
338
			this->splitContainer1->SplitterDistance = 192;
339
			this->splitContainer1->TabIndex = 5;
340
			// 
341
			// button2
342
			// 
343
			this->button2->Dock = System::Windows::Forms::DockStyle::Fill;
344
			this->button2->Location = System::Drawing::Point(0, 0);
345
			this->button2->Name = L"button2";
346
			this->button2->Size = System::Drawing::Size(192, 29);
347
			this->button2->TabIndex = 0;
348
			this->button2->Text = L"Create Diff";
349
			this->button2->UseVisualStyleBackColor = true;
350
			this->button2->Click += gcnew System::EventHandler(this, &ModDiff::button2_Click);
351
			// 
352
			// button3
353
			// 
354
			this->button3->Dock = System::Windows::Forms::DockStyle::Fill;
355
			this->button3->Location = System::Drawing::Point(0, 0);
356
			this->button3->Name = L"button3";
357
			this->button3->Size = System::Drawing::Size(177, 29);
358
			this->button3->TabIndex = 1;
359
			this->button3->Text = L"Apply Diff";
360
			this->button3->UseVisualStyleBackColor = true;
361
			this->button3->Click += gcnew System::EventHandler(this, &ModDiff::button3_Click);
362
			// 
363
			// toolTip1
364
			// 
365
			this->toolTip1->IsBalloon = true;
366
			this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
367
			this->toolTip1->ToolTipTitle = L"Help";
368
			// 
369
			// ModDiff
370
			// 
371
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
372
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
373
			this->ClientSize = System::Drawing::Size(583, 167);
374
			this->Controls->Add(this->panel7);
375
			this->Controls->Add(this->panel5);
376
			this->Controls->Add(this->panel3);
377
			this->Controls->Add(this->panel1);
378
			this->Name = L"ModDiff";
379
			this->Padding = System::Windows::Forms::Padding(5);
380
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
381
			this->Text = L"Mod Diff";
382
			this->TopMost = true;
383
			this->Load += gcnew System::EventHandler(this, &ModDiff::ModDiff_Load);
384
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
385
			this->panel1->ResumeLayout(false);
386
			this->panel2->ResumeLayout(false);
387
			this->panel3->ResumeLayout(false);
388
			this->panel4->ResumeLayout(false);
389
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox2))->EndInit();
390
			this->panel5->ResumeLayout(false);
391
			this->panel6->ResumeLayout(false);
392
			this->panel6->PerformLayout();
393
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox3))->EndInit();
394
			this->panel7->ResumeLayout(false);
395
			this->splitContainer1->Panel1->ResumeLayout(false);
396
			this->splitContainer1->Panel2->ResumeLayout(false);
397
			this->splitContainer1->ResumeLayout(false);
398
			this->ResumeLayout(false);
399
 
400
		}
401
#pragma endregion
402
	private: System::Void ModDiff_Load(System::Object^  sender, System::EventArgs^  e) {
403
			 }
404
private: System::Void comboBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
224 cycrow 405
			 int fake = m_pPackages->findNextFakePatch(0, _WS(this->comboBox1->Text).token(L" (", 1));
1 cycrow 406
 
407
			 this->comboBox2->Items->Add("- None -");
408
			 for ( int i = 1; i < fake; i++ )
224 cycrow 409
				 this->comboBox2->Items->Add(_US(Utils::WString::PadNumber(i, 2)) + ".cat");
1 cycrow 410
 
411
			 this->pictureBox1->Image = nullptr;
412
			 SetImage(this->pictureBox2);
413
			 this->comboBox1->Enabled = false;
414
			 this->panel3->Enabled = true;
415
		 }
416
private: System::Void comboBox2_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
417
			 this->pictureBox2->Image = nullptr;
418
			 this->panel5->Enabled = true;
419
			 SetImage(this->pictureBox3);
420
		 }
421
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
422
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
423
			ofd->Filter = "X-Mod Files (*.cat)|*.cat";
424
			ofd->FilterIndex = 1;
425
			ofd->RestoreDirectory = true;
426
			ofd->Title = "Select the mod file to use";
427
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
428
			{
429
				this->textBox1->Text = ofd->FileName;
430
				this->pictureBox3->Image = nullptr;
431
				this->splitContainer1->Visible = true;
432
			}
433
		 }
434
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
435
			SaveFileDialog ^ofd = gcnew SaveFileDialog();
436
			ofd->Filter = "Diff Files (*.diff)|*.diff";
437
			ofd->FilterIndex = 1;
438
			ofd->RestoreDirectory = true;
439
			ofd->AddExtension =  true;
440
			ofd->Title = "Select the diff file to save changes to";
441
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
442
			{
224 cycrow 443
				CModDiff Diff(_WS(this->comboBox1->Text).token(L" (", 1), L"addon", this->comboBox2->SelectedIndex);
444
				if ( !Diff.CreateDiff(_WS(this->textBox1->Text)) )
1 cycrow 445
				{
446
					MessageBox::Show(this, "Unable to create diff from mod:\n" + this->textBox1->Text, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
447
					Close();
448
				}
449
 
224 cycrow 450
				if ( !Diff.WriteDiff(_WS(ofd->FileName)) )
1 cycrow 451
				{
452
					MessageBox::Show(this, "Unable to write diff file:\n" + ofd->FileName, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
453
					Close();
454
				}
455
 
456
				MessageBox::Show(this, "Diff file: " + ofd->FileName + " has been generated", "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Information);
457
				Close();
458
			}
459
		 }
460
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
461
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
462
			ofd->Filter = "Diff Files (*.diff)|*.diff";
463
			ofd->FilterIndex = 1;
464
			ofd->RestoreDirectory = true;
465
			ofd->Title = "Select the diff file to apply to the mod";
466
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
467
			{
224 cycrow 468
				CModDiff Diff(_WS(this->comboBox1->Text).token(L" (", 1), L"addon", this->comboBox2->SelectedIndex);
469
				Diff.ApplyDiff(_WS(this->textBox1->Text));
470
				if ( !Diff.ReadDiff(_WS(ofd->FileName)) )
1 cycrow 471
				{
472
					MessageBox::Show(this, "Unable to read diff file:\n" + ofd->FileName, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
473
					Close();
474
				}
475
 
224 cycrow 476
				if ( !Diff.ApplyDiff(_WS(this->textBox1->Text)) )
1 cycrow 477
				{
478
					MessageBox::Show(this, "Unable to apply diff to mod:\n" + this->textBox1->Text, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
479
					Close();
480
				}
481
 
482
				MessageBox::Show(this, "Diff file: " + ofd->FileName + " has been applied to " + this->textBox1->Text, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Information);
483
				Close();
484
			}
485
		 }
486
};
487
}