Rev 224 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once
namespace ModMerge {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
m_pFile1 = new CCatFile;
m_pFile2 = new CCatFile;
this->panel1->Enabled = false;
this->panel2->Enabled = false;
this->panel5->Enabled = false;
m_pPackages = new CPackages();
m_pPackages->startup(L".", L".", L".");
m_iLocX = m_iLocY = -1;
}
String ^OpenFile(String ^desc)
{
OpenFileDialog ^ofd = gcnew OpenFileDialog();
ofd->Filter = "X-Mod Files (*.cat)|*.cat";
ofd->FilterIndex = 1;
ofd->RestoreDirectory = true;
ofd->Title = desc;
if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
return ofd->FileName;
return nullptr;
}
void UpdateFileList()
{
Windows::Forms::Cursor::Current = Windows::Forms::Cursors::WaitCursor;
this->treeView1->BeginUpdate();
this->treeView1->Nodes->Clear();
Utils::WStringList list;
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
if (!list.empty())
{
TreeNode ^merged = gcnew TreeNode("Files to Merge");
TreeNode ^conflict = gcnew TreeNode("Potential Conflicts");
TreeNode ^both = gcnew TreeNode("Files in Both (using primarys)");
TreeNode ^node1 = gcnew TreeNode("From: " + this->textBox1->Text);
TreeNode ^node2 = gcnew TreeNode("From: " + this->textBox2->Text);
this->treeView1->Nodes->Add(merged);
this->treeView1->Nodes->Add(conflict);
this->treeView1->Nodes->Add(both);
this->treeView1->Nodes->Add(node1);
this->treeView1->Nodes->Add(node2);
merged->ForeColor = Color::Green;
conflict->ForeColor = Color::Red;
for(auto itr = list.begin(); itr != list.end(); itr++)
{
TreeNode ^newNode = gcnew TreeNode(_US((*itr)->str));
int status = (*itr)->data.toInt();
if ( status == -1 ) // in both
{
if ( m_pPackages->canWeMerge((*itr)->str) )
merged->Nodes->Add(newNode);
else if ( m_pPackages->needToMerge((*itr)->str) )
conflict->Nodes->Add(newNode);
else
both->Nodes->Add(newNode);
}
else if ( status == 1 )
node1->Nodes->Add(newNode);
else if ( status == 2 )
node2->Nodes->Add(newNode);
}
merged->Text = "[" + merged->Nodes->Count + "] " + merged->Text;
node1->Text = "[" + node1->Nodes->Count + "] " + node1->Text;
node2->Text = "[" + node2->Nodes->Count + "] " + node2->Text;
both->Text = "[" + both->Nodes->Count + "] " + both->Text;
conflict->Text = "[" + conflict->Nodes->Count + "] " + conflict->Text;
this->treeView1->ExpandAll();
this->button4->Enabled = true;
}
Windows::Forms::Cursor::Current = Cursors::Default;
this->treeView1->EndUpdate();
}
void DoGameDirectory()
{
OpenFileDialog ^ofd = gcnew OpenFileDialog();
ofd->Title = "Choose the path for the Game you wish to merge mods for";
ofd->Filter = "X-Universe Executable|";
String ^games = "";
for ( int i = 0; i < m_pPackages->GetGameExe()->numGames(); i++ )
{
SGameExe *exe = m_pPackages->GetGameExe()->game(i);
if ( i ) ofd->Filter += ";";
ofd->Filter += _US(exe->sExe);
games += "|" + _US(exe->sName) + "|" + _US(exe->sExe);
}
ofd->Filter += games;
ofd->FilterIndex = 1;
ofd->RestoreDirectory = true;
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
{
if (!SetGameDir(-1, IO::FileInfo(ofd->FileName).DirectoryName))
MessageBox::Show(this, "Error: not a valid game directory\n" + IO::FileInfo(ofd->FileName).DirectoryName, "Invalid Game Directory", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
void StartMerge()
{
SaveFileDialog ^ofd = gcnew SaveFileDialog();
ofd->Filter = "X-Universe Mod File (*.cat)|*.cat";
ofd->Title = "Select the mod file you wish to merge files into";
ofd->FilterIndex = 1;
ofd->RestoreDirectory = true;
ofd->AddExtension = true;
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK ) {
if ( ofd->FileName == this->textBox1->Text || ofd->FileName == this->textBox2->Text )
MessageBox::Show(this, "Error: Unable to save to file: " + ofd->FileName + "\nYou must not select the same file name as the primary or secondary mod", "Invalid Save File", MessageBoxButtons::OK, MessageBoxIcon::Error);
else
Merge(ofd->FileName);
}
}
void Merge(String ^file)
{
// create the mod file by copying the primary mod
if ( IO::File::Exists(file) )
IO::File::Delete(file);
IO::File::Copy(this->textBox1->Text, file);
// and the dat file
Utils::WString file1 = CFileIO(_WS(this->textBox1->Text)).changeFileExtension(L"dat");
Utils::WString file2 = CFileIO(_WS(file)).changeFileExtension(L"dat");
if ( IO::File::Exists(_US(file2)) )
IO::File::Delete(_US(file2));
IO::File::Copy(_US(file1), _US(file2));
CCatFile CatFile;
if ( !CCatFile::Opened(CatFile.open(_WS(file), L"", CATREAD_CATDECRYPT, false), false) )
{
MessageBox::Show(this, "Unable to open cat file: " + file, "Merge Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
return;
}
// now we need to move non merge files from the 2nd mod to the new one
Utils::WStringList list;
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
if (!list.empty())
{
CModDiff Diff(_WS(this->textBox3->Text).token(L" (", 1), L"addon", Convert::ToInt32(this->numericUpDown1->Value));
if ( Diff.startDiff(_WS(this->textBox2->Text)) ) {
for(auto itr = list.begin(); itr != list.end(); itr++)
{
int status = (*itr)->data.toInt();
if ( status == 2 ) { // in 2nd mod
if ( CatFile.appendFile(_WS(this->textBox2->Text) + L"::" + (*itr)->str, (*itr)->str) )
CatFile.WriteCatFile();
}
// finally, we need to diff the remaining files
else if ( status == -1 ) { // in both
// only diffable files, we ignore the rest
if ( CModDiff::CanBeDiffed((*itr)->str) ) Diff.doDiff((*itr)->str);
}
}
Diff.ApplyDiff(_WS(file));
}
}
MessageBox::Show(this, "Mod files have been merged to: " + file, "Mod Merged", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
void LoadData()
{
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
CFileIO Config;
if ( Config.open(_WS(mydoc) + L"/Egosoft/modmerge.dat") )
{
std::vector<Utils::WString> lines;
if(Config.readLines(lines))
{
for (size_t i = 0; i < (int)lines.size(); i++ )
{
Utils::WString line(lines.at(i));
Utils::WString start = line.token(L":", 1).lower();
Utils::WString rest = line.tokens(L":", 2).removeFirstSpace();
if ( start.Compare(L"ModMergeSize") )
this->Size = System::Drawing::Size(rest.token(L" ", 1).toInt(), rest.token(L" ", 2).toInt());
else if ( start.Compare(L"ModMergePos") )
{
m_iLocX = rest.token(L" ", 1).toInt();
m_iLocY = rest.token(L" ", 2).toInt();
if ( !this->TopMost )
this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
}
else if ( start.Compare(L"ModMergeMax") )
{
if ( !this->TopMost )
this->WindowState = FormWindowState::Maximized;
}
else if ( start.Compare(L"GameDir") )
SetGameDir(rest.token(L";", 1).toInt(), _US(rest.tokens(L";", 2)));
}
}
}
if ( m_pPackages->getCurrentDirectory().empty() )
DoGameDirectory();
}
void SaveData()
{
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
CFileIO Config(_WS(mydoc) + L"/Egosoft/modmerge.dat");
Utils::WStringList lines;
if ( this->WindowState == FormWindowState::Normal )
{
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->Size.Width + L" " + (long)this->Size.Height);
if ( this->TopMost )
{
if ( m_iLocX != -1 && m_iLocY != -1 )
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
}
else
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->Location.X + L" " + (long)this->Location.Y);
}
else
{
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->RestoreBounds.Size.Width + L" " + (long)this->RestoreBounds.Size.Height);
if ( this->TopMost )
{
if ( m_iLocX != -1 && m_iLocY != -1 )
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
}
else
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->RestoreBounds.Location.X + L" " + (long)this->RestoreBounds.Location.Y);
}
if ( this->WindowState == FormWindowState::Maximized )
lines.pushBack(L"ModMergeMax:");
if ( this->textBox3->Text->Length )
lines.pushBack(Utils::WString(L"GameDir:") + (long)Convert::ToInt32(this->numericUpDown1->Value) + L";" + m_pPackages->getCurrentDirectory());
Config.writeFile(&lines);
}
bool SetGameDir(int patch, String ^gameDir)
{
Utils::WString dir = _WS(gameDir);
if ( !dir.empty() )
{
Utils::WString gameName = m_pPackages->getGameName(dir);
if ( !gameName.empty() )
{
this->textBox3->Text = gameDir + " (" + _US(gameName) + ")";
this->panel5->Enabled = true;
this->numericUpDown1->Minimum = 1;
m_pPackages->setCurrentDir(dir);
this->numericUpDown1->Maximum = m_pPackages->findNextFakePatch() - 1;
if ( patch < 1 || patch > this->numericUpDown1->Maximum )
this->numericUpDown1->Value = this->numericUpDown1->Maximum;
else
this->numericUpDown1->Value = patch;
this->label5->Text = "(prevent loading added mods, max=" + Convert::ToString(this->numericUpDown1->Maximum) + ")";
this->panel1->Enabled = true;
return true;
}
}
return false;
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
if ( m_pPackages ) delete m_pPackages;
}
#pragma region defines
private:
CCatFile *m_pFile1;
CCatFile *m_pFile2;
CPackages *m_pPackages;
int m_iLocX;
int m_iLocY;
#pragma endregion
#pragma region designer defines
private: System::Windows::Forms::Panel^ panel1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Panel^ panel2;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::TreeView^ treeView1;
private: System::Windows::Forms::Panel^ panel3;
private: System::Windows::Forms::Panel^ panel5;
private: System::Windows::Forms::Panel^ panel4;
private: System::Windows::Forms::NumericUpDown^ numericUpDown1;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Panel^ panel6;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::Button^ button4;
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma endregion
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->panel2 = (gcnew System::Windows::Forms::Panel());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->button2 = (gcnew System::Windows::Forms::Button());
this->treeView1 = (gcnew System::Windows::Forms::TreeView());
this->panel3 = (gcnew System::Windows::Forms::Panel());
this->panel5 = (gcnew System::Windows::Forms::Panel());
this->panel4 = (gcnew System::Windows::Forms::Panel());
this->label5 = (gcnew System::Windows::Forms::Label());
this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown());
this->label4 = (gcnew System::Windows::Forms::Label());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->button3 = (gcnew System::Windows::Forms::Button());
this->panel6 = (gcnew System::Windows::Forms::Panel());
this->button5 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->panel1->SuspendLayout();
this->panel2->SuspendLayout();
this->panel3->SuspendLayout();
this->panel5->SuspendLayout();
this->panel4->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit();
this->panel6->SuspendLayout();
this->SuspendLayout();
//
// panel1
//
this->panel1->Controls->Add(this->textBox1);
this->panel1->Controls->Add(this->label1);
this->panel1->Controls->Add(this->button1);
this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
this->panel1->Location = System::Drawing::Point(0, 50);
this->panel1->Name = L"panel1";
this->panel1->Padding = System::Windows::Forms::Padding(5);
this->panel1->Size = System::Drawing::Size(564, 31);
this->panel1->TabIndex = 5;
//
// textBox1
//
this->textBox1->Dock = System::Windows::Forms::DockStyle::Fill;
this->textBox1->Location = System::Drawing::Point(160, 5);
this->textBox1->Name = L"textBox1";
this->textBox1->ReadOnly = true;
this->textBox1->Size = System::Drawing::Size(371, 20);
this->textBox1->TabIndex = 0;
//
// label1
//
this->label1->Dock = System::Windows::Forms::DockStyle::Left;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(5, 5);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(155, 21);
this->label1->TabIndex = 2;
this->label1->Text = L"Primary Mod";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// button1
//
this->button1->AutoSize = true;
this->button1->Dock = System::Windows::Forms::DockStyle::Right;
this->button1->Location = System::Drawing::Point(531, 5);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(28, 21);
this->button1->TabIndex = 1;
this->button1->Text = L"...";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// panel2
//
this->panel2->Controls->Add(this->textBox2);
this->panel2->Controls->Add(this->label2);
this->panel2->Controls->Add(this->button2);
this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
this->panel2->Enabled = false;
this->panel2->Location = System::Drawing::Point(0, 81);
this->panel2->Name = L"panel2";
this->panel2->Padding = System::Windows::Forms::Padding(5);
this->panel2->Size = System::Drawing::Size(564, 31);
this->panel2->TabIndex = 6;
//
// textBox2
//
this->textBox2->Dock = System::Windows::Forms::DockStyle::Fill;
this->textBox2->Location = System::Drawing::Point(160, 5);
this->textBox2->Name = L"textBox2";
this->textBox2->ReadOnly = true;
this->textBox2->Size = System::Drawing::Size(371, 20);
this->textBox2->TabIndex = 0;
//
// label2
//
this->label2->Dock = System::Windows::Forms::DockStyle::Left;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label2->Location = System::Drawing::Point(5, 5);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(155, 21);
this->label2->TabIndex = 2;
this->label2->Text = L"Secondary Mod";
this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// button2
//
this->button2->AutoSize = true;
this->button2->Dock = System::Windows::Forms::DockStyle::Right;
this->button2->Location = System::Drawing::Point(531, 5);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(28, 21);
this->button2->TabIndex = 1;
this->button2->Text = L"...";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// treeView1
//
this->treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
this->treeView1->Location = System::Drawing::Point(0, 112);
this->treeView1->Name = L"treeView1";
this->treeView1->Size = System::Drawing::Size(564, 395);
this->treeView1->TabIndex = 7;
//
// panel3
//
this->panel3->Controls->Add(this->panel5);
this->panel3->Controls->Add(this->label3);
this->panel3->Controls->Add(this->button3);
this->panel3->Dock = System::Windows::Forms::DockStyle::Top;
this->panel3->Location = System::Drawing::Point(0, 0);
this->panel3->Name = L"panel3";
this->panel3->Padding = System::Windows::Forms::Padding(5);
this->panel3->Size = System::Drawing::Size(564, 50);
this->panel3->TabIndex = 8;
//
// panel5
//
this->panel5->Controls->Add(this->panel4);
this->panel5->Controls->Add(this->textBox3);
this->panel5->Dock = System::Windows::Forms::DockStyle::Fill;
this->panel5->Location = System::Drawing::Point(160, 5);
this->panel5->Name = L"panel5";
this->panel5->Size = System::Drawing::Size(371, 40);
this->panel5->TabIndex = 6;
//
// panel4
//
this->panel4->Controls->Add(this->label5);
this->panel4->Controls->Add(this->numericUpDown1);
this->panel4->Controls->Add(this->label4);
this->panel4->Dock = System::Windows::Forms::DockStyle::Fill;
this->panel4->Location = System::Drawing::Point(0, 20);
this->panel4->Name = L"panel4";
this->panel4->Size = System::Drawing::Size(371, 20);
this->panel4->TabIndex = 5;
//
// label5
//
this->label5->Dock = System::Windows::Forms::DockStyle::Fill;
this->label5->Location = System::Drawing::Point(173, 0);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(198, 20);
this->label5->TabIndex = 5;
this->label5->Text = L"(prevent loading added mods, max=)";
this->label5->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// numericUpDown1
//
this->numericUpDown1->Dock = System::Windows::Forms::DockStyle::Left;
this->numericUpDown1->Location = System::Drawing::Point(122, 0);
this->numericUpDown1->Name = L"numericUpDown1";
this->numericUpDown1->Size = System::Drawing::Size(51, 20);
this->numericUpDown1->TabIndex = 3;
//
// label4
//
this->label4->Dock = System::Windows::Forms::DockStyle::Left;
this->label4->Location = System::Drawing::Point(0, 0);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(122, 20);
this->label4->TabIndex = 4;
this->label4->Text = L"Cap Fake Patch To";
this->label4->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// textBox3
//
this->textBox3->Dock = System::Windows::Forms::DockStyle::Top;
this->textBox3->Location = System::Drawing::Point(0, 0);
this->textBox3->Name = L"textBox3";
this->textBox3->ReadOnly = true;
this->textBox3->Size = System::Drawing::Size(371, 20);
this->textBox3->TabIndex = 0;
//
// label3
//
this->label3->Dock = System::Windows::Forms::DockStyle::Left;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label3->Location = System::Drawing::Point(5, 5);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(155, 40);
this->label3->TabIndex = 2;
this->label3->Text = L"Game Directory";
this->label3->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// button3
//
this->button3->AutoSize = true;
this->button3->Dock = System::Windows::Forms::DockStyle::Right;
this->button3->Location = System::Drawing::Point(531, 5);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(28, 40);
this->button3->TabIndex = 1;
this->button3->Text = L"...";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// panel6
//
this->panel6->Controls->Add(this->button5);
this->panel6->Controls->Add(this->button4);
this->panel6->Dock = System::Windows::Forms::DockStyle::Bottom;
this->panel6->Location = System::Drawing::Point(0, 507);
this->panel6->Name = L"panel6";
this->panel6->Padding = System::Windows::Forms::Padding(10);
this->panel6->Size = System::Drawing::Size(564, 48);
this->panel6->TabIndex = 9;
//
// button5
//
this->button5->DialogResult = System::Windows::Forms::DialogResult::Abort;
this->button5->Dock = System::Windows::Forms::DockStyle::Right;
this->button5->ForeColor = System::Drawing::Color::DarkRed;
this->button5->Location = System::Drawing::Point(436, 10);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(118, 28);
this->button5->TabIndex = 1;
this->button5->Text = L"Exit";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
//
// button4
//
this->button4->Dock = System::Windows::Forms::DockStyle::Left;
this->button4->Enabled = false;
this->button4->ForeColor = System::Drawing::Color::ForestGreen;
this->button4->Location = System::Drawing::Point(10, 10);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(116, 28);
this->button4->TabIndex = 0;
this->button4->Text = L"Merge";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->CancelButton = this->button5;
this->ClientSize = System::Drawing::Size(564, 555);
this->Controls->Add(this->treeView1);
this->Controls->Add(this->panel6);
this->Controls->Add(this->panel2);
this->Controls->Add(this->panel1);
this->Controls->Add(this->panel3);
this->Name = L"Form1";
this->Text = L"Mod Merger";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
this->panel1->ResumeLayout(false);
this->panel1->PerformLayout();
this->panel2->ResumeLayout(false);
this->panel2->PerformLayout();
this->panel3->ResumeLayout(false);
this->panel3->PerformLayout();
this->panel5->ResumeLayout(false);
this->panel5->PerformLayout();
this->panel4->ResumeLayout(false);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit();
this->panel6->ResumeLayout(false);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
String ^openfile = this->OpenFile("Select the mod file to use as the primary mod");
if ( openfile )
{
if ( m_pFile1->open(_WS(openfile), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
{
this->textBox1->Text = openfile;
this->panel2->Enabled = true;
}
else
MessageBox::Show(this, "Unable to open mod file\n" + openfile, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
String ^openfile = this->OpenFile("Select the mod file to use as the secondary mod");
if ( openfile )
{
if ( m_pFile2->open(_WS(openfile), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
{
this->textBox2->Text = openfile;
this->UpdateFileList();
}
else
MessageBox::Show(this, "Unable to open mod file\n" + openfile, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
DoGameDirectory();
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
StartMerge();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
LoadData();
}
private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
SaveData();
}
};
}