Line 54... |
Line 54... |
54 |
void UpdateFileList()
|
54 |
void UpdateFileList()
|
55 |
{
|
55 |
{
|
56 |
Windows::Forms::Cursor::Current = Windows::Forms::Cursors::WaitCursor;
|
56 |
Windows::Forms::Cursor::Current = Windows::Forms::Cursors::WaitCursor;
|
57 |
this->treeView1->BeginUpdate();
|
57 |
this->treeView1->BeginUpdate();
|
58 |
this->treeView1->Nodes->Clear();
|
58 |
this->treeView1->Nodes->Clear();
|
59 |
Utils::CStringList list;
|
59 |
Utils::WStringList list;
|
60 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
60 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
61 |
if (!list.empty())
|
61 |
if (!list.empty())
|
62 |
{
|
62 |
{
|
63 |
TreeNode ^merged = gcnew TreeNode("Files to Merge");
|
63 |
TreeNode ^merged = gcnew TreeNode("Files to Merge");
|
64 |
TreeNode ^conflict = gcnew TreeNode("Potential Conflicts");
|
64 |
TreeNode ^conflict = gcnew TreeNode("Potential Conflicts");
|
Line 112... |
Line 112... |
112 |
{
|
112 |
{
|
113 |
OpenFileDialog ^ofd = gcnew OpenFileDialog();
|
113 |
OpenFileDialog ^ofd = gcnew OpenFileDialog();
|
114 |
ofd->Title = "Choose the path for the Game you wish to merge mods for";
|
114 |
ofd->Title = "Choose the path for the Game you wish to merge mods for";
|
115 |
ofd->Filter = "X-Universe Executable|";
|
115 |
ofd->Filter = "X-Universe Executable|";
|
116 |
String ^games = "";
|
116 |
String ^games = "";
|
117 |
for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ )
|
117 |
for ( int i = 0; i < m_pPackages->GetGameExe()->numGames(); i++ )
|
118 |
{
|
118 |
{
|
119 |
SGameExe *exe = m_pPackages->GetGameExe()->GetGame(i);
|
119 |
SGameExe *exe = m_pPackages->GetGameExe()->game(i);
|
120 |
if ( i ) ofd->Filter += ";";
|
120 |
if ( i ) ofd->Filter += ";";
|
121 |
ofd->Filter += _US(exe->sExe);
|
121 |
ofd->Filter += _US(exe->sExe);
|
122 |
games += "|" + _US(exe->sName) + "|" + _US(exe->sExe);
|
122 |
games += "|" + _US(exe->sName) + "|" + _US(exe->sExe);
|
123 |
}
|
123 |
}
|
124 |
ofd->Filter += games;
|
124 |
ofd->Filter += games;
|
Line 166... |
Line 166... |
166 |
MessageBox::Show(this, "Unable to open cat file: " + file, "Merge Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
166 |
MessageBox::Show(this, "Unable to open cat file: " + file, "Merge Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
167 |
return;
|
167 |
return;
|
168 |
}
|
168 |
}
|
169 |
|
169 |
|
170 |
// now we need to move non merge files from the 2nd mod to the new one
|
170 |
// now we need to move non merge files from the 2nd mod to the new one
|
171 |
Utils::CStringList list;
|
171 |
Utils::WStringList list;
|
172 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
172 |
m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
|
173 |
if (!list.empty())
|
173 |
if (!list.empty())
|
174 |
{
|
174 |
{
|
175 |
CModDiff Diff(_S(this->textBox3->Text).token(" (", 1), "addon", Convert::ToInt32(this->numericUpDown1->Value));
|
175 |
CModDiff Diff(_S(this->textBox3->Text).token(" (", 1), "addon", Convert::ToInt32(this->numericUpDown1->Value));
|
176 |
if ( Diff.startDiff(_S(this->textBox2->Text)) ) {
|
176 |
if ( Diff.startDiff(_S(this->textBox2->Text)) ) {
|
177 |
for(auto itr = list.begin(); itr != list.end(); itr++)
|
177 |
for(auto itr = list.begin(); itr != list.end(); itr++)
|
178 |
{
|
178 |
{
|
179 |
int status = (*itr)->data.toInt();
|
179 |
int status = (*itr)->data.toInt();
|
180 |
if ( status == 2 ) { // in 2nd mod
|
180 |
if ( status == 2 ) { // in 2nd mod
|
181 |
if ( CatFile.appendFile(_S(this->textBox2->Text) + "::" + (*itr)->str, (*itr)->str) )
|
181 |
if ( CatFile.appendFile(_WS(this->textBox2->Text) + L"::" + (*itr)->str, (*itr)->str) )
|
182 |
CatFile.WriteCatFile();
|
182 |
CatFile.WriteCatFile();
|
183 |
}
|
183 |
}
|
184 |
// finally, we need to diff the remaining files
|
184 |
// finally, we need to diff the remaining files
|
185 |
else if ( status == -1 ) { // in both
|
185 |
else if ( status == -1 ) { // in both
|
186 |
// only diffable files, we ignore the rest
|
186 |
// only diffable files, we ignore the rest
|
Line 236... |
Line 236... |
236 |
}
|
236 |
}
|
237 |
|
237 |
|
238 |
void SaveData()
|
238 |
void SaveData()
|
239 |
{
|
239 |
{
|
240 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
240 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
241 |
CFileIO Config(_S(mydoc) + "/Egosoft/modmerge.dat");
|
241 |
CFileIO Config(_WS(mydoc) + L"/Egosoft/modmerge.dat");
|
242 |
Utils::CStringList lines;
|
242 |
Utils::WStringList lines;
|
243 |
|
243 |
|
244 |
if ( this->WindowState == FormWindowState::Normal )
|
244 |
if ( this->WindowState == FormWindowState::Normal )
|
245 |
{
|
245 |
{
|
246 |
lines.pushBack(Utils::String("ModMergeSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
|
246 |
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->Size.Width + L" " + (long)this->Size.Height);
|
247 |
if ( this->TopMost )
|
247 |
if ( this->TopMost )
|
248 |
{
|
248 |
{
|
249 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
249 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
250 |
lines.pushBack(Utils::String("ModMergePos:") + (long)m_iLocX + " " + (long)m_iLocY);
|
250 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
|
251 |
}
|
251 |
}
|
252 |
else
|
252 |
else
|
253 |
lines.pushBack(Utils::String("ModMergePos:") + (long)this->Location.X + " " + (long)this->Location.Y);
|
253 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->Location.X + L" " + (long)this->Location.Y);
|
254 |
}
|
254 |
}
|
255 |
else
|
255 |
else
|
256 |
{
|
256 |
{
|
257 |
lines.pushBack(Utils::String("ModMergeSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
|
257 |
lines.pushBack(Utils::WString(L"ModMergeSize:") + (long)this->RestoreBounds.Size.Width + L" " + (long)this->RestoreBounds.Size.Height);
|
258 |
if ( this->TopMost )
|
258 |
if ( this->TopMost )
|
259 |
{
|
259 |
{
|
260 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
260 |
if ( m_iLocX != -1 && m_iLocY != -1 )
|
261 |
lines.pushBack(Utils::String("ModMergePos:") + (long)m_iLocX + " " + (long)m_iLocY);
|
261 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)m_iLocX + L" " + (long)m_iLocY);
|
262 |
}
|
262 |
}
|
263 |
else
|
263 |
else
|
264 |
lines.pushBack(Utils::String("ModMergePos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
|
264 |
lines.pushBack(Utils::WString(L"ModMergePos:") + (long)this->RestoreBounds.Location.X + L" " + (long)this->RestoreBounds.Location.Y);
|
265 |
}
|
265 |
}
|
266 |
|
266 |
|
267 |
if ( this->WindowState == FormWindowState::Maximized )
|
267 |
if ( this->WindowState == FormWindowState::Maximized )
|
268 |
lines.pushBack("ModMergeMax:");
|
268 |
lines.pushBack(L"ModMergeMax:");
|
269 |
|
269 |
|
270 |
if ( this->textBox3->Text->Length )
|
270 |
if ( this->textBox3->Text->Length )
|
271 |
lines.pushBack(Utils::String("GameDir:") + (long)Convert::ToInt32(this->numericUpDown1->Value) + ";" + m_pPackages->getCurrentDirectory());
|
271 |
lines.pushBack(Utils::WString(L"GameDir:") + (long)Convert::ToInt32(this->numericUpDown1->Value) + L";" + m_pPackages->getCurrentDirectory());
|
272 |
Config.writeFile(&lines);
|
272 |
Config.writeFile(&lines);
|
273 |
}
|
273 |
}
|
274 |
|
274 |
|
275 |
|
275 |
|
276 |
bool SetGameDir(int patch, String ^gameDir)
|
276 |
bool SetGameDir(int patch, String ^gameDir)
|
277 |
{
|
277 |
{
|
278 |
Utils::String dir = _S(gameDir);
|
278 |
Utils::String dir = _S(gameDir);
|
279 |
if ( !dir.empty() )
|
279 |
if ( !dir.empty() )
|
280 |
{
|
280 |
{
|
281 |
Utils::String gameName = m_pPackages->getGameName(dir);
|
281 |
Utils::WString gameName = m_pPackages->getGameName(dir);
|
282 |
if ( !gameName.empty() )
|
282 |
if ( !gameName.empty() )
|
283 |
{
|
283 |
{
|
284 |
this->textBox3->Text = gameDir + " (" + _US(gameName) + ")";
|
284 |
this->textBox3->Text = gameDir + " (" + _US(gameName) + ")";
|
285 |
this->panel5->Enabled = true;
|
285 |
this->panel5->Enabled = true;
|
286 |
this->numericUpDown1->Minimum = 1;
|
286 |
this->numericUpDown1->Minimum = 1;
|