Subversion Repositories spk

Rev

Rev 197 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 197 Rev 224
Line 400... Line 400...
400
		}
400
		}
401
#pragma endregion
401
#pragma endregion
402
	private: System::Void ModDiff_Load(System::Object^  sender, System::EventArgs^  e) {
402
	private: System::Void ModDiff_Load(System::Object^  sender, System::EventArgs^  e) {
403
			 }
403
			 }
404
private: System::Void comboBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
404
private: System::Void comboBox1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
405
			 int fake = m_pPackages->findNextFakePatch(0, _S(this->comboBox1->Text).token(" (", 1));
405
			 int fake = m_pPackages->findNextFakePatch(0, _WS(this->comboBox1->Text).token(L" (", 1));
406
 
406
 
407
			 this->comboBox2->Items->Add("- None -");
407
			 this->comboBox2->Items->Add("- None -");
408
			 for ( int i = 1; i < fake; i++ )
408
			 for ( int i = 1; i < fake; i++ )
409
				 this->comboBox2->Items->Add(_US(Utils::String::PadNumber(i, 2)) + ".cat");
409
				 this->comboBox2->Items->Add(_US(Utils::WString::PadNumber(i, 2)) + ".cat");
410
 
410
 
411
			 this->pictureBox1->Image = nullptr;
411
			 this->pictureBox1->Image = nullptr;
412
			 SetImage(this->pictureBox2);
412
			 SetImage(this->pictureBox2);
413
			 this->comboBox1->Enabled = false;
413
			 this->comboBox1->Enabled = false;
414
			 this->panel3->Enabled = true;
414
			 this->panel3->Enabled = true;
Line 438... Line 438...
438
			ofd->RestoreDirectory = true;
438
			ofd->RestoreDirectory = true;
439
			ofd->AddExtension =  true;
439
			ofd->AddExtension =  true;
440
			ofd->Title = "Select the diff file to save changes to";
440
			ofd->Title = "Select the diff file to save changes to";
441
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
441
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
442
			{
442
			{
443
				CModDiff Diff(_S(this->comboBox1->Text).token(" (", 1), "addon", this->comboBox2->SelectedIndex);
443
				CModDiff Diff(_WS(this->comboBox1->Text).token(L" (", 1), L"addon", this->comboBox2->SelectedIndex);
444
				if ( !Diff.CreateDiff(_S(this->textBox1->Text)) )
444
				if ( !Diff.CreateDiff(_WS(this->textBox1->Text)) )
445
				{
445
				{
446
					MessageBox::Show(this, "Unable to create diff from mod:\n" + this->textBox1->Text, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
446
					MessageBox::Show(this, "Unable to create diff from mod:\n" + this->textBox1->Text, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
447
					Close();
447
					Close();
448
				}
448
				}
449
 
449
 
450
				if ( !Diff.WriteDiff(_S(ofd->FileName)) )
450
				if ( !Diff.WriteDiff(_WS(ofd->FileName)) )
451
				{
451
				{
452
					MessageBox::Show(this, "Unable to write diff file:\n" + ofd->FileName, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
452
					MessageBox::Show(this, "Unable to write diff file:\n" + ofd->FileName, "Create Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
453
					Close();
453
					Close();
454
				}
454
				}
455
 
455
 
Line 463... Line 463...
463
			ofd->FilterIndex = 1;
463
			ofd->FilterIndex = 1;
464
			ofd->RestoreDirectory = true;
464
			ofd->RestoreDirectory = true;
465
			ofd->Title = "Select the diff file to apply to the mod";
465
			ofd->Title = "Select the diff file to apply to the mod";
466
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
466
			if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
467
			{
467
			{
468
				CModDiff Diff(_S(this->comboBox1->Text).token(" (", 1), "addon", this->comboBox2->SelectedIndex);
468
				CModDiff Diff(_WS(this->comboBox1->Text).token(L" (", 1), L"addon", this->comboBox2->SelectedIndex);
469
				Diff.ApplyDiff(_S(this->textBox1->Text));
469
				Diff.ApplyDiff(_WS(this->textBox1->Text));
470
				if ( !Diff.ReadDiff(_S(ofd->FileName)) )
470
				if ( !Diff.ReadDiff(_WS(ofd->FileName)) )
471
				{
471
				{
472
					MessageBox::Show(this, "Unable to read diff file:\n" + ofd->FileName, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
472
					MessageBox::Show(this, "Unable to read diff file:\n" + ofd->FileName, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
473
					Close();
473
					Close();
474
				}
474
				}
475
 
475
 
476
				if ( !Diff.ApplyDiff(_S(this->textBox1->Text)) )
476
				if ( !Diff.ApplyDiff(_WS(this->textBox1->Text)) )
477
				{
477
				{
478
					MessageBox::Show(this, "Unable to apply diff to mod:\n" + this->textBox1->Text, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
478
					MessageBox::Show(this, "Unable to apply diff to mod:\n" + this->textBox1->Text, "Apply Diff", MessageBoxButtons::OK, MessageBoxIcon::Error);
479
					Close();
479
					Close();
480
				}
480
				}
481
 
481