1 |
cycrow |
1 |
#pragma once
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
namespace ModMerge {
|
|
|
5 |
|
|
|
6 |
using namespace System;
|
|
|
7 |
using namespace System::ComponentModel;
|
|
|
8 |
using namespace System::Collections;
|
|
|
9 |
using namespace System::Windows::Forms;
|
|
|
10 |
using namespace System::Data;
|
|
|
11 |
using namespace System::Drawing;
|
|
|
12 |
|
|
|
13 |
/// <summary>
|
|
|
14 |
/// Summary for Form1
|
|
|
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 Form1 : public System::Windows::Forms::Form
|
|
|
23 |
{
|
|
|
24 |
public:
|
|
|
25 |
Form1(void)
|
|
|
26 |
{
|
|
|
27 |
InitializeComponent();
|
|
|
28 |
|
|
|
29 |
m_pFile1 = new CCatFile;
|
|
|
30 |
m_pFile2 = new CCatFile;
|
|
|
31 |
|
|
|
32 |
this->panel1->Enabled = false;
|
|
|
33 |
this->panel2->Enabled = false;
|
|
|
34 |
this->panel5->Enabled = false;
|
|
|
35 |
|
|
|
36 |
m_pPackages = new CPackages();
|
226 |
cycrow |
37 |
m_pPackages->startup(L".", L".", L".");
|
1 |
cycrow |
38 |
|
|
|
39 |
m_iLocX = m_iLocY = -1;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
String ^OpenFile(String ^desc)
|
|
|
43 |
{
|
|
|
44 |
OpenFileDialog ^ofd = gcnew OpenFileDialog();
|
|
|
45 |
ofd->Filter = "X-Mod Files (*.cat)|*.cat";
|
|
|
46 |
ofd->FilterIndex = 1;
|
|
|
47 |
ofd->RestoreDirectory = true;
|
|
|
48 |
ofd->Title = desc;
|
|
|
49 |
if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
|
|
|
50 |
return ofd->FileName;
|
|
|
51 |
return nullptr;
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
void UpdateFileList()
|
|
|
55 |
{
|
|
|
56 |
Windows::Forms::Cursor::Current = Windows::Forms::Cursors::WaitCursor;
|
|
|
57 |
this->treeView1->BeginUpdate();
|
|
|
58 |
this->treeView1->Nodes->Clear();
|
197 |
cycrow |
59 |
Utils::WStringList list;
|
124 |
cycrow |
60 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
|
|
61 |
if (!list.empty())
|
1 |
cycrow |
62 |
{
|
|
|
63 |
TreeNode ^merged = gcnew TreeNode("Files to Merge");
|
|
|
64 |
TreeNode ^conflict = gcnew TreeNode("Potential Conflicts");
|
|
|
65 |
TreeNode ^both = gcnew TreeNode("Files in Both (using primarys)");
|
|
|
66 |
TreeNode ^node1 = gcnew TreeNode("From: " + this->textBox1->Text);
|
|
|
67 |
TreeNode ^node2 = gcnew TreeNode("From: " + this->textBox2->Text);
|
|
|
68 |
this->treeView1->Nodes->Add(merged);
|
|
|
69 |
this->treeView1->Nodes->Add(conflict);
|
|
|
70 |
this->treeView1->Nodes->Add(both);
|
|
|
71 |
this->treeView1->Nodes->Add(node1);
|
|
|
72 |
this->treeView1->Nodes->Add(node2);
|
|
|
73 |
|
|
|
74 |
merged->ForeColor = Color::Green;
|
|
|
75 |
conflict->ForeColor = Color::Red;
|
|
|
76 |
|
124 |
cycrow |
77 |
for(auto itr = list.begin(); itr != list.end(); itr++)
|
1 |
cycrow |
78 |
{
|
124 |
cycrow |
79 |
TreeNode ^newNode = gcnew TreeNode(_US((*itr)->str));
|
1 |
cycrow |
80 |
|
124 |
cycrow |
81 |
int status = (*itr)->data.toInt();
|
1 |
cycrow |
82 |
if ( status == -1 ) // in both
|
|
|
83 |
{
|
182 |
cycrow |
84 |
if ( m_pPackages->canWeMerge((*itr)->str) )
|
1 |
cycrow |
85 |
merged->Nodes->Add(newNode);
|
182 |
cycrow |
86 |
else if ( m_pPackages->needToMerge((*itr)->str) )
|
1 |
cycrow |
87 |
conflict->Nodes->Add(newNode);
|
|
|
88 |
else
|
|
|
89 |
both->Nodes->Add(newNode);
|
|
|
90 |
}
|
|
|
91 |
else if ( status == 1 )
|
|
|
92 |
node1->Nodes->Add(newNode);
|
|
|
93 |
else if ( status == 2 )
|
|
|
94 |
node2->Nodes->Add(newNode);
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
merged->Text = "[" + merged->Nodes->Count + "] " + merged->Text;
|
|
|
98 |
node1->Text = "[" + node1->Nodes->Count + "] " + node1->Text;
|
|
|
99 |
node2->Text = "[" + node2->Nodes->Count + "] " + node2->Text;
|
|
|
100 |
both->Text = "[" + both->Nodes->Count + "] " + both->Text;
|
|
|
101 |
conflict->Text = "[" + conflict->Nodes->Count + "] " + conflict->Text;
|
|
|
102 |
|
|
|
103 |
this->treeView1->ExpandAll();
|
|
|
104 |
this->button4->Enabled = true;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
Windows::Forms::Cursor::Current = Cursors::Default;
|
|
|
108 |
this->treeView1->EndUpdate();
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
void DoGameDirectory()
|
|
|
112 |
{
|
|
|
113 |
OpenFileDialog ^ofd = gcnew OpenFileDialog();
|
|
|
114 |
ofd->Title = "Choose the path for the Game you wish to merge mods for";
|
|
|
115 |
ofd->Filter = "X-Universe Executable|";
|
|
|
116 |
String ^games = "";
|
197 |
cycrow |
117 |
for ( int i = 0; i < m_pPackages->GetGameExe()->numGames(); i++ )
|
1 |
cycrow |
118 |
{
|
197 |
cycrow |
119 |
SGameExe *exe = m_pPackages->GetGameExe()->game(i);
|
1 |
cycrow |
120 |
if ( i ) ofd->Filter += ";";
|
191 |
cycrow |
121 |
ofd->Filter += _US(exe->sExe);
|
|
|
122 |
games += "|" + _US(exe->sName) + "|" + _US(exe->sExe);
|
1 |
cycrow |
123 |
}
|
|
|
124 |
ofd->Filter += games;
|
|
|
125 |
ofd->FilterIndex = 1;
|
|
|
126 |
ofd->RestoreDirectory = true;
|
|
|
127 |
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
|
|
128 |
{
|
|
|
129 |
if (!SetGameDir(-1, IO::FileInfo(ofd->FileName).DirectoryName))
|
|
|
130 |
MessageBox::Show(this, "Error: not a valid game directory\n" + IO::FileInfo(ofd->FileName).DirectoryName, "Invalid Game Directory", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
|
|
131 |
}
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
void StartMerge()
|
|
|
135 |
{
|
|
|
136 |
SaveFileDialog ^ofd = gcnew SaveFileDialog();
|
|
|
137 |
ofd->Filter = "X-Universe Mod File (*.cat)|*.cat";
|
|
|
138 |
ofd->Title = "Select the mod file you wish to merge files into";
|
|
|
139 |
ofd->FilterIndex = 1;
|
|
|
140 |
ofd->RestoreDirectory = true;
|
|
|
141 |
ofd->AddExtension = true;
|
58 |
cycrow |
142 |
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK ) {
|
|
|
143 |
if ( ofd->FileName == this->textBox1->Text || ofd->FileName == this->textBox2->Text )
|
|
|
144 |
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);
|
|
|
145 |
else
|
|
|
146 |
Merge(ofd->FileName);
|
|
|
147 |
}
|
1 |
cycrow |
148 |
}
|
|
|
149 |
|
|
|
150 |
void Merge(String ^file)
|
|
|
151 |
{
|
|
|
152 |
// create the mod file by copying the primary mod
|
|
|
153 |
if ( IO::File::Exists(file) )
|
|
|
154 |
IO::File::Delete(file);
|
|
|
155 |
IO::File::Copy(this->textBox1->Text, file);
|
|
|
156 |
// and the dat file
|
224 |
cycrow |
157 |
Utils::WString file1 = CFileIO(_WS(this->textBox1->Text)).changeFileExtension(L"dat");
|
|
|
158 |
Utils::WString file2 = CFileIO(_WS(file)).changeFileExtension(L"dat");
|
160 |
cycrow |
159 |
if ( IO::File::Exists(_US(file2)) )
|
|
|
160 |
IO::File::Delete(_US(file2));
|
|
|
161 |
IO::File::Copy(_US(file1), _US(file2));
|
1 |
cycrow |
162 |
|
|
|
163 |
CCatFile CatFile;
|
224 |
cycrow |
164 |
if ( !CCatFile::Opened(CatFile.open(_WS(file), L"", CATREAD_CATDECRYPT, false), false) )
|
1 |
cycrow |
165 |
{
|
|
|
166 |
MessageBox::Show(this, "Unable to open cat file: " + file, "Merge Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
|
|
167 |
return;
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
// now we need to move non merge files from the 2nd mod to the new one
|
197 |
cycrow |
171 |
Utils::WStringList list;
|
125 |
cycrow |
172 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
|
|
173 |
if (!list.empty())
|
1 |
cycrow |
174 |
{
|
224 |
cycrow |
175 |
CModDiff Diff(_WS(this->textBox3->Text).token(L" (", 1), L"addon", Convert::ToInt32(this->numericUpDown1->Value));
|
|
|
176 |
if ( Diff.startDiff(_WS(this->textBox2->Text)) ) {
|
125 |
cycrow |
177 |
for(auto itr = list.begin(); itr != list.end(); itr++)
|
1 |
cycrow |
178 |
{
|
125 |
cycrow |
179 |
int status = (*itr)->data.toInt();
|
58 |
cycrow |
180 |
if ( status == 2 ) { // in 2nd mod
|
197 |
cycrow |
181 |
if ( CatFile.appendFile(_WS(this->textBox2->Text) + L"::" + (*itr)->str, (*itr)->str) )
|
58 |
cycrow |
182 |
CatFile.WriteCatFile();
|
1 |
cycrow |
183 |
}
|
58 |
cycrow |
184 |
// finally, we need to diff the remaining files
|
|
|
185 |
else if ( status == -1 ) { // in both
|
|
|
186 |
// only diffable files, we ignore the rest
|
125 |
cycrow |
187 |
if ( CModDiff::CanBeDiffed((*itr)->str) ) Diff.doDiff((*itr)->str);
|
58 |
cycrow |
188 |
}
|
1 |
cycrow |
189 |
}
|
58 |
cycrow |
190 |
|
224 |
cycrow |
191 |
Diff.ApplyDiff(_WS(file));
|
1 |
cycrow |
192 |
}
|
|
|
193 |
}
|
|
|
194 |
|
|
|
195 |
MessageBox::Show(this, "Mod files have been merged to: " + file, "Mod Merged", MessageBoxButtons::OK, MessageBoxIcon::Information);
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
void LoadData()
|
|
|
199 |
{
|
|
|
200 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
|
|
201 |
CFileIO Config;
|
223 |
cycrow |
202 |
if ( Config.open(_WS(mydoc) + L"/Egosoft/modmerge.dat") )
|
1 |
cycrow |
203 |
{
|
223 |
cycrow |
204 |
std::vector<Utils::WString> lines;
|
|
|
205 |
if(Config.readLines(lines))
|
1 |
cycrow |
206 |
{
|
223 |
cycrow |
207 |
for (size_t i = 0; i < (int)lines.size(); i++ )
|
1 |
cycrow |
208 |
{
|
223 |
cycrow |
209 |
Utils::WString line(lines.at(i));
|
|
|
210 |
Utils::WString start = line.token(L":", 1).lower();
|
|
|
211 |
Utils::WString rest = line.tokens(L":", 2).removeFirstSpace();
|
|
|
212 |
if ( start.Compare(L"ModMergeSize") )
|
|
|
213 |
this->Size = System::Drawing::Size(rest.token(L" ", 1).toInt(), rest.token(L" ", 2).toInt());
|
|
|
214 |
else if ( start.Compare(L"ModMergePos") )
|
1 |
cycrow |
215 |
{
|
223 |
cycrow |
216 |
m_iLocX = rest.token(L" ", 1).toInt();
|
|
|
217 |
m_iLocY = rest.token(L" ", 2).toInt();
|
1 |
cycrow |
218 |
if ( !this->TopMost )
|
|
|
219 |
this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
|
|
|
220 |
}
|
223 |
cycrow |
221 |
else if ( start.Compare(L"ModMergeMax") )
|
1 |
cycrow |
222 |
{
|
|
|
223 |
if ( !this->TopMost )
|
|
|
224 |
this->WindowState = FormWindowState::Maximized;
|
|
|
225 |
}
|
223 |
cycrow |
226 |
else if ( start.Compare(L"GameDir") )
|
|
|
227 |
SetGameDir(rest.token(L";", 1).toInt(), _US(rest.tokens(L";", 2)));
|
1 |
cycrow |
228 |
}
|
|
|
229 |
}
|
|
|
230 |
}
|
|
|
231 |
|
121 |
cycrow |
232 |
if ( m_pPackages->getCurrentDirectory().empty() )
|
1 |
cycrow |
233 |
DoGameDirectory();
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
void SaveData()
|
|
|
237 |
{
|
|
|
238 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
197 |
cycrow |
239 |
CFileIO Config(_WS(mydoc) + L"/Egosoft/modmerge.dat");
|
|
|
240 |
Utils::WStringList lines;
|
1 |
cycrow |
241 |
|
|
|
242 |
if ( this->WindowState == FormWindowState::Normal )
|
|
|
243 |
{
|
197 |
cycrow |
244 |
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->Size.Width + L" " + (long)this->Size.Height);
|
1 |
cycrow |
245 |
if ( this->TopMost )
|
|
|
246 |
{
|
|
|
247 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
197 |
cycrow |
248 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
|
1 |
cycrow |
249 |
}
|
|
|
250 |
else
|
197 |
cycrow |
251 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->Location.X + L" " + (long)this->Location.Y);
|
1 |
cycrow |
252 |
}
|
|
|
253 |
else
|
|
|
254 |
{
|
197 |
cycrow |
255 |
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->RestoreBounds.Size.Width + L" " + (long)this->RestoreBounds.Size.Height);
|
1 |
cycrow |
256 |
if ( this->TopMost )
|
|
|
257 |
{
|
|
|
258 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
197 |
cycrow |
259 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
|
1 |
cycrow |
260 |
}
|
|
|
261 |
else
|
197 |
cycrow |
262 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->RestoreBounds.Location.X + L" " + (long)this->RestoreBounds.Location.Y);
|
1 |
cycrow |
263 |
}
|
|
|
264 |
|
|
|
265 |
if ( this->WindowState == FormWindowState::Maximized )
|
197 |
cycrow |
266 |
lines.pushBack(L"ModMergeMax:");
|
1 |
cycrow |
267 |
|
|
|
268 |
if ( this->textBox3->Text->Length )
|
197 |
cycrow |
269 |
lines.pushBack(Utils::WString(L"GameDir:") + (long)Convert::ToInt32(this->numericUpDown1->Value) + L";" + m_pPackages->getCurrentDirectory());
|
160 |
cycrow |
270 |
Config.writeFile(&lines);
|
1 |
cycrow |
271 |
}
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
bool SetGameDir(int patch, String ^gameDir)
|
|
|
275 |
{
|
224 |
cycrow |
276 |
Utils::WString dir = _WS(gameDir);
|
158 |
cycrow |
277 |
if ( !dir.empty() )
|
1 |
cycrow |
278 |
{
|
197 |
cycrow |
279 |
Utils::WString gameName = m_pPackages->getGameName(dir);
|
158 |
cycrow |
280 |
if ( !gameName.empty() )
|
1 |
cycrow |
281 |
{
|
158 |
cycrow |
282 |
this->textBox3->Text = gameDir + " (" + _US(gameName) + ")";
|
1 |
cycrow |
283 |
this->panel5->Enabled = true;
|
|
|
284 |
this->numericUpDown1->Minimum = 1;
|
158 |
cycrow |
285 |
m_pPackages->setCurrentDir(dir);
|
182 |
cycrow |
286 |
this->numericUpDown1->Maximum = m_pPackages->findNextFakePatch() - 1;
|
1 |
cycrow |
287 |
if ( patch < 1 || patch > this->numericUpDown1->Maximum )
|
|
|
288 |
this->numericUpDown1->Value = this->numericUpDown1->Maximum;
|
|
|
289 |
else
|
|
|
290 |
this->numericUpDown1->Value = patch;
|
|
|
291 |
this->label5->Text = "(prevent loading added mods, max=" + Convert::ToString(this->numericUpDown1->Maximum) + ")";
|
|
|
292 |
this->panel1->Enabled = true;
|
|
|
293 |
|
|
|
294 |
return true;
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
return false;
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
protected:
|
|
|
302 |
/// <summary>
|
|
|
303 |
/// Clean up any resources being used.
|
|
|
304 |
/// </summary>
|
|
|
305 |
~Form1()
|
|
|
306 |
{
|
|
|
307 |
if (components)
|
|
|
308 |
{
|
|
|
309 |
delete components;
|
|
|
310 |
}
|
|
|
311 |
if ( m_pPackages ) delete m_pPackages;
|
|
|
312 |
}
|
|
|
313 |
|
|
|
314 |
#pragma region defines
|
|
|
315 |
private:
|
|
|
316 |
CCatFile *m_pFile1;
|
|
|
317 |
CCatFile *m_pFile2;
|
|
|
318 |
CPackages *m_pPackages;
|
|
|
319 |
int m_iLocX;
|
|
|
320 |
int m_iLocY;
|
|
|
321 |
#pragma endregion
|
|
|
322 |
|
|
|
323 |
#pragma region designer defines
|
|
|
324 |
private: System::Windows::Forms::Panel^ panel1;
|
|
|
325 |
private: System::Windows::Forms::TextBox^ textBox1;
|
|
|
326 |
private: System::Windows::Forms::Label^ label1;
|
|
|
327 |
private: System::Windows::Forms::Button^ button1;
|
|
|
328 |
private: System::Windows::Forms::Panel^ panel2;
|
|
|
329 |
private: System::Windows::Forms::TextBox^ textBox2;
|
|
|
330 |
private: System::Windows::Forms::Label^ label2;
|
|
|
331 |
private: System::Windows::Forms::Button^ button2;
|
|
|
332 |
private: System::Windows::Forms::TreeView^ treeView1;
|
|
|
333 |
private: System::Windows::Forms::Panel^ panel3;
|
|
|
334 |
private: System::Windows::Forms::Panel^ panel5;
|
|
|
335 |
private: System::Windows::Forms::Panel^ panel4;
|
|
|
336 |
private: System::Windows::Forms::NumericUpDown^ numericUpDown1;
|
|
|
337 |
private: System::Windows::Forms::Label^ label4;
|
|
|
338 |
private: System::Windows::Forms::TextBox^ textBox3;
|
|
|
339 |
private: System::Windows::Forms::Label^ label3;
|
|
|
340 |
private: System::Windows::Forms::Button^ button3;
|
|
|
341 |
private: System::Windows::Forms::Label^ label5;
|
|
|
342 |
private: System::Windows::Forms::Panel^ panel6;
|
|
|
343 |
private: System::Windows::Forms::Button^ button5;
|
|
|
344 |
private: System::Windows::Forms::Button^ button4;
|
|
|
345 |
/// <summary>
|
|
|
346 |
/// Required designer variable.
|
|
|
347 |
/// </summary>
|
|
|
348 |
System::ComponentModel::Container ^components;
|
|
|
349 |
#pragma endregion
|
|
|
350 |
#pragma region Windows Form Designer generated code
|
|
|
351 |
/// <summary>
|
|
|
352 |
/// Required method for Designer support - do not modify
|
|
|
353 |
/// the contents of this method with the code editor.
|
|
|
354 |
/// </summary>
|
|
|
355 |
void InitializeComponent(void)
|
|
|
356 |
{
|
|
|
357 |
this->panel1 = (gcnew System::Windows::Forms::Panel());
|
|
|
358 |
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
|
|
|
359 |
this->label1 = (gcnew System::Windows::Forms::Label());
|
|
|
360 |
this->button1 = (gcnew System::Windows::Forms::Button());
|
|
|
361 |
this->panel2 = (gcnew System::Windows::Forms::Panel());
|
|
|
362 |
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
|
|
|
363 |
this->label2 = (gcnew System::Windows::Forms::Label());
|
|
|
364 |
this->button2 = (gcnew System::Windows::Forms::Button());
|
|
|
365 |
this->treeView1 = (gcnew System::Windows::Forms::TreeView());
|
|
|
366 |
this->panel3 = (gcnew System::Windows::Forms::Panel());
|
|
|
367 |
this->panel5 = (gcnew System::Windows::Forms::Panel());
|
|
|
368 |
this->panel4 = (gcnew System::Windows::Forms::Panel());
|
|
|
369 |
this->label5 = (gcnew System::Windows::Forms::Label());
|
|
|
370 |
this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown());
|
|
|
371 |
this->label4 = (gcnew System::Windows::Forms::Label());
|
|
|
372 |
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
|
|
|
373 |
this->label3 = (gcnew System::Windows::Forms::Label());
|
|
|
374 |
this->button3 = (gcnew System::Windows::Forms::Button());
|
|
|
375 |
this->panel6 = (gcnew System::Windows::Forms::Panel());
|
|
|
376 |
this->button5 = (gcnew System::Windows::Forms::Button());
|
|
|
377 |
this->button4 = (gcnew System::Windows::Forms::Button());
|
|
|
378 |
this->panel1->SuspendLayout();
|
|
|
379 |
this->panel2->SuspendLayout();
|
|
|
380 |
this->panel3->SuspendLayout();
|
|
|
381 |
this->panel5->SuspendLayout();
|
|
|
382 |
this->panel4->SuspendLayout();
|
|
|
383 |
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit();
|
|
|
384 |
this->panel6->SuspendLayout();
|
|
|
385 |
this->SuspendLayout();
|
|
|
386 |
//
|
|
|
387 |
// panel1
|
|
|
388 |
//
|
|
|
389 |
this->panel1->Controls->Add(this->textBox1);
|
|
|
390 |
this->panel1->Controls->Add(this->label1);
|
|
|
391 |
this->panel1->Controls->Add(this->button1);
|
|
|
392 |
this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
393 |
this->panel1->Location = System::Drawing::Point(0, 50);
|
|
|
394 |
this->panel1->Name = L"panel1";
|
|
|
395 |
this->panel1->Padding = System::Windows::Forms::Padding(5);
|
|
|
396 |
this->panel1->Size = System::Drawing::Size(564, 31);
|
|
|
397 |
this->panel1->TabIndex = 5;
|
|
|
398 |
//
|
|
|
399 |
// textBox1
|
|
|
400 |
//
|
|
|
401 |
this->textBox1->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
402 |
this->textBox1->Location = System::Drawing::Point(160, 5);
|
|
|
403 |
this->textBox1->Name = L"textBox1";
|
|
|
404 |
this->textBox1->ReadOnly = true;
|
|
|
405 |
this->textBox1->Size = System::Drawing::Size(371, 20);
|
|
|
406 |
this->textBox1->TabIndex = 0;
|
|
|
407 |
//
|
|
|
408 |
// label1
|
|
|
409 |
//
|
|
|
410 |
this->label1->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
411 |
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
|
|
|
412 |
static_cast<System::Byte>(0)));
|
|
|
413 |
this->label1->Location = System::Drawing::Point(5, 5);
|
|
|
414 |
this->label1->Name = L"label1";
|
|
|
415 |
this->label1->Size = System::Drawing::Size(155, 21);
|
|
|
416 |
this->label1->TabIndex = 2;
|
|
|
417 |
this->label1->Text = L"Primary Mod";
|
|
|
418 |
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
419 |
//
|
|
|
420 |
// button1
|
|
|
421 |
//
|
|
|
422 |
this->button1->AutoSize = true;
|
|
|
423 |
this->button1->Dock = System::Windows::Forms::DockStyle::Right;
|
|
|
424 |
this->button1->Location = System::Drawing::Point(531, 5);
|
|
|
425 |
this->button1->Name = L"button1";
|
|
|
426 |
this->button1->Size = System::Drawing::Size(28, 21);
|
|
|
427 |
this->button1->TabIndex = 1;
|
|
|
428 |
this->button1->Text = L"...";
|
|
|
429 |
this->button1->UseVisualStyleBackColor = true;
|
|
|
430 |
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
|
|
|
431 |
//
|
|
|
432 |
// panel2
|
|
|
433 |
//
|
|
|
434 |
this->panel2->Controls->Add(this->textBox2);
|
|
|
435 |
this->panel2->Controls->Add(this->label2);
|
|
|
436 |
this->panel2->Controls->Add(this->button2);
|
|
|
437 |
this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
438 |
this->panel2->Enabled = false;
|
|
|
439 |
this->panel2->Location = System::Drawing::Point(0, 81);
|
|
|
440 |
this->panel2->Name = L"panel2";
|
|
|
441 |
this->panel2->Padding = System::Windows::Forms::Padding(5);
|
|
|
442 |
this->panel2->Size = System::Drawing::Size(564, 31);
|
|
|
443 |
this->panel2->TabIndex = 6;
|
|
|
444 |
//
|
|
|
445 |
// textBox2
|
|
|
446 |
//
|
|
|
447 |
this->textBox2->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
448 |
this->textBox2->Location = System::Drawing::Point(160, 5);
|
|
|
449 |
this->textBox2->Name = L"textBox2";
|
|
|
450 |
this->textBox2->ReadOnly = true;
|
|
|
451 |
this->textBox2->Size = System::Drawing::Size(371, 20);
|
|
|
452 |
this->textBox2->TabIndex = 0;
|
|
|
453 |
//
|
|
|
454 |
// label2
|
|
|
455 |
//
|
|
|
456 |
this->label2->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
457 |
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
|
|
|
458 |
static_cast<System::Byte>(0)));
|
|
|
459 |
this->label2->Location = System::Drawing::Point(5, 5);
|
|
|
460 |
this->label2->Name = L"label2";
|
|
|
461 |
this->label2->Size = System::Drawing::Size(155, 21);
|
|
|
462 |
this->label2->TabIndex = 2;
|
|
|
463 |
this->label2->Text = L"Secondary Mod";
|
|
|
464 |
this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
465 |
//
|
|
|
466 |
// button2
|
|
|
467 |
//
|
|
|
468 |
this->button2->AutoSize = true;
|
|
|
469 |
this->button2->Dock = System::Windows::Forms::DockStyle::Right;
|
|
|
470 |
this->button2->Location = System::Drawing::Point(531, 5);
|
|
|
471 |
this->button2->Name = L"button2";
|
|
|
472 |
this->button2->Size = System::Drawing::Size(28, 21);
|
|
|
473 |
this->button2->TabIndex = 1;
|
|
|
474 |
this->button2->Text = L"...";
|
|
|
475 |
this->button2->UseVisualStyleBackColor = true;
|
|
|
476 |
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
|
|
|
477 |
//
|
|
|
478 |
// treeView1
|
|
|
479 |
//
|
|
|
480 |
this->treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
481 |
this->treeView1->Location = System::Drawing::Point(0, 112);
|
|
|
482 |
this->treeView1->Name = L"treeView1";
|
|
|
483 |
this->treeView1->Size = System::Drawing::Size(564, 395);
|
|
|
484 |
this->treeView1->TabIndex = 7;
|
|
|
485 |
//
|
|
|
486 |
// panel3
|
|
|
487 |
//
|
|
|
488 |
this->panel3->Controls->Add(this->panel5);
|
|
|
489 |
this->panel3->Controls->Add(this->label3);
|
|
|
490 |
this->panel3->Controls->Add(this->button3);
|
|
|
491 |
this->panel3->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
492 |
this->panel3->Location = System::Drawing::Point(0, 0);
|
|
|
493 |
this->panel3->Name = L"panel3";
|
|
|
494 |
this->panel3->Padding = System::Windows::Forms::Padding(5);
|
|
|
495 |
this->panel3->Size = System::Drawing::Size(564, 50);
|
|
|
496 |
this->panel3->TabIndex = 8;
|
|
|
497 |
//
|
|
|
498 |
// panel5
|
|
|
499 |
//
|
|
|
500 |
this->panel5->Controls->Add(this->panel4);
|
|
|
501 |
this->panel5->Controls->Add(this->textBox3);
|
|
|
502 |
this->panel5->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
503 |
this->panel5->Location = System::Drawing::Point(160, 5);
|
|
|
504 |
this->panel5->Name = L"panel5";
|
|
|
505 |
this->panel5->Size = System::Drawing::Size(371, 40);
|
|
|
506 |
this->panel5->TabIndex = 6;
|
|
|
507 |
//
|
|
|
508 |
// panel4
|
|
|
509 |
//
|
|
|
510 |
this->panel4->Controls->Add(this->label5);
|
|
|
511 |
this->panel4->Controls->Add(this->numericUpDown1);
|
|
|
512 |
this->panel4->Controls->Add(this->label4);
|
|
|
513 |
this->panel4->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
514 |
this->panel4->Location = System::Drawing::Point(0, 20);
|
|
|
515 |
this->panel4->Name = L"panel4";
|
|
|
516 |
this->panel4->Size = System::Drawing::Size(371, 20);
|
|
|
517 |
this->panel4->TabIndex = 5;
|
|
|
518 |
//
|
|
|
519 |
// label5
|
|
|
520 |
//
|
|
|
521 |
this->label5->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
522 |
this->label5->Location = System::Drawing::Point(173, 0);
|
|
|
523 |
this->label5->Name = L"label5";
|
|
|
524 |
this->label5->Size = System::Drawing::Size(198, 20);
|
|
|
525 |
this->label5->TabIndex = 5;
|
|
|
526 |
this->label5->Text = L"(prevent loading added mods, max=)";
|
|
|
527 |
this->label5->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
528 |
//
|
|
|
529 |
// numericUpDown1
|
|
|
530 |
//
|
|
|
531 |
this->numericUpDown1->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
532 |
this->numericUpDown1->Location = System::Drawing::Point(122, 0);
|
|
|
533 |
this->numericUpDown1->Name = L"numericUpDown1";
|
|
|
534 |
this->numericUpDown1->Size = System::Drawing::Size(51, 20);
|
|
|
535 |
this->numericUpDown1->TabIndex = 3;
|
|
|
536 |
//
|
|
|
537 |
// label4
|
|
|
538 |
//
|
|
|
539 |
this->label4->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
540 |
this->label4->Location = System::Drawing::Point(0, 0);
|
|
|
541 |
this->label4->Name = L"label4";
|
|
|
542 |
this->label4->Size = System::Drawing::Size(122, 20);
|
|
|
543 |
this->label4->TabIndex = 4;
|
|
|
544 |
this->label4->Text = L"Cap Fake Patch To";
|
|
|
545 |
this->label4->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
546 |
//
|
|
|
547 |
// textBox3
|
|
|
548 |
//
|
|
|
549 |
this->textBox3->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
550 |
this->textBox3->Location = System::Drawing::Point(0, 0);
|
|
|
551 |
this->textBox3->Name = L"textBox3";
|
|
|
552 |
this->textBox3->ReadOnly = true;
|
|
|
553 |
this->textBox3->Size = System::Drawing::Size(371, 20);
|
|
|
554 |
this->textBox3->TabIndex = 0;
|
|
|
555 |
//
|
|
|
556 |
// label3
|
|
|
557 |
//
|
|
|
558 |
this->label3->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
559 |
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
|
|
|
560 |
static_cast<System::Byte>(0)));
|
|
|
561 |
this->label3->Location = System::Drawing::Point(5, 5);
|
|
|
562 |
this->label3->Name = L"label3";
|
|
|
563 |
this->label3->Size = System::Drawing::Size(155, 40);
|
|
|
564 |
this->label3->TabIndex = 2;
|
|
|
565 |
this->label3->Text = L"Game Directory";
|
|
|
566 |
this->label3->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
|
|
|
567 |
//
|
|
|
568 |
// button3
|
|
|
569 |
//
|
|
|
570 |
this->button3->AutoSize = true;
|
|
|
571 |
this->button3->Dock = System::Windows::Forms::DockStyle::Right;
|
|
|
572 |
this->button3->Location = System::Drawing::Point(531, 5);
|
|
|
573 |
this->button3->Name = L"button3";
|
|
|
574 |
this->button3->Size = System::Drawing::Size(28, 40);
|
|
|
575 |
this->button3->TabIndex = 1;
|
|
|
576 |
this->button3->Text = L"...";
|
|
|
577 |
this->button3->UseVisualStyleBackColor = true;
|
|
|
578 |
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
|
|
|
579 |
//
|
|
|
580 |
// panel6
|
|
|
581 |
//
|
|
|
582 |
this->panel6->Controls->Add(this->button5);
|
|
|
583 |
this->panel6->Controls->Add(this->button4);
|
|
|
584 |
this->panel6->Dock = System::Windows::Forms::DockStyle::Bottom;
|
|
|
585 |
this->panel6->Location = System::Drawing::Point(0, 507);
|
|
|
586 |
this->panel6->Name = L"panel6";
|
|
|
587 |
this->panel6->Padding = System::Windows::Forms::Padding(10);
|
|
|
588 |
this->panel6->Size = System::Drawing::Size(564, 48);
|
|
|
589 |
this->panel6->TabIndex = 9;
|
|
|
590 |
//
|
|
|
591 |
// button5
|
|
|
592 |
//
|
|
|
593 |
this->button5->DialogResult = System::Windows::Forms::DialogResult::Abort;
|
|
|
594 |
this->button5->Dock = System::Windows::Forms::DockStyle::Right;
|
|
|
595 |
this->button5->ForeColor = System::Drawing::Color::DarkRed;
|
|
|
596 |
this->button5->Location = System::Drawing::Point(436, 10);
|
|
|
597 |
this->button5->Name = L"button5";
|
|
|
598 |
this->button5->Size = System::Drawing::Size(118, 28);
|
|
|
599 |
this->button5->TabIndex = 1;
|
|
|
600 |
this->button5->Text = L"Exit";
|
|
|
601 |
this->button5->UseVisualStyleBackColor = true;
|
|
|
602 |
this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
|
|
|
603 |
//
|
|
|
604 |
// button4
|
|
|
605 |
//
|
|
|
606 |
this->button4->Dock = System::Windows::Forms::DockStyle::Left;
|
|
|
607 |
this->button4->Enabled = false;
|
|
|
608 |
this->button4->ForeColor = System::Drawing::Color::ForestGreen;
|
|
|
609 |
this->button4->Location = System::Drawing::Point(10, 10);
|
|
|
610 |
this->button4->Name = L"button4";
|
|
|
611 |
this->button4->Size = System::Drawing::Size(116, 28);
|
|
|
612 |
this->button4->TabIndex = 0;
|
|
|
613 |
this->button4->Text = L"Merge";
|
|
|
614 |
this->button4->UseVisualStyleBackColor = true;
|
|
|
615 |
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
|
|
|
616 |
//
|
|
|
617 |
// Form1
|
|
|
618 |
//
|
|
|
619 |
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
|
|
|
620 |
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
|
|
621 |
this->CancelButton = this->button5;
|
|
|
622 |
this->ClientSize = System::Drawing::Size(564, 555);
|
|
|
623 |
this->Controls->Add(this->treeView1);
|
|
|
624 |
this->Controls->Add(this->panel6);
|
|
|
625 |
this->Controls->Add(this->panel2);
|
|
|
626 |
this->Controls->Add(this->panel1);
|
|
|
627 |
this->Controls->Add(this->panel3);
|
|
|
628 |
this->Name = L"Form1";
|
|
|
629 |
this->Text = L"Mod Merger";
|
|
|
630 |
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
|
|
|
631 |
this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
|
|
|
632 |
this->panel1->ResumeLayout(false);
|
|
|
633 |
this->panel1->PerformLayout();
|
|
|
634 |
this->panel2->ResumeLayout(false);
|
|
|
635 |
this->panel2->PerformLayout();
|
|
|
636 |
this->panel3->ResumeLayout(false);
|
|
|
637 |
this->panel3->PerformLayout();
|
|
|
638 |
this->panel5->ResumeLayout(false);
|
|
|
639 |
this->panel5->PerformLayout();
|
|
|
640 |
this->panel4->ResumeLayout(false);
|
|
|
641 |
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit();
|
|
|
642 |
this->panel6->ResumeLayout(false);
|
|
|
643 |
this->ResumeLayout(false);
|
|
|
644 |
|
|
|
645 |
}
|
|
|
646 |
#pragma endregion
|
|
|
647 |
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
648 |
String ^openfile = this->OpenFile("Select the mod file to use as the primary mod");
|
|
|
649 |
if ( openfile )
|
|
|
650 |
{
|
224 |
cycrow |
651 |
if ( m_pFile1->open(_WS(openfile), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
|
1 |
cycrow |
652 |
{
|
|
|
653 |
this->textBox1->Text = openfile;
|
|
|
654 |
this->panel2->Enabled = true;
|
|
|
655 |
}
|
|
|
656 |
else
|
|
|
657 |
MessageBox::Show(this, "Unable to open mod file\n" + openfile, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
|
|
658 |
}
|
|
|
659 |
}
|
|
|
660 |
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
661 |
String ^openfile = this->OpenFile("Select the mod file to use as the secondary mod");
|
|
|
662 |
if ( openfile )
|
|
|
663 |
{
|
224 |
cycrow |
664 |
if ( m_pFile2->open(_WS(openfile), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
|
1 |
cycrow |
665 |
{
|
|
|
666 |
this->textBox2->Text = openfile;
|
|
|
667 |
this->UpdateFileList();
|
|
|
668 |
}
|
|
|
669 |
else
|
|
|
670 |
MessageBox::Show(this, "Unable to open mod file\n" + openfile, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
|
|
671 |
}
|
|
|
672 |
}
|
|
|
673 |
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
674 |
DoGameDirectory();
|
|
|
675 |
}
|
|
|
676 |
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
677 |
Close();
|
|
|
678 |
}
|
|
|
679 |
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
|
|
|
680 |
StartMerge();
|
|
|
681 |
}
|
|
|
682 |
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
|
|
|
683 |
LoadData();
|
|
|
684 |
}
|
|
|
685 |
private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
|
|
|
686 |
SaveData();
|
|
|
687 |
}
|
|
|
688 |
};
|
|
|
689 |
}
|
|
|
690 |
|