| Line 159... | Line 159... | 
          
            | 159 | 			if ( IO::File::Exists(SystemStringFromCyString(file2)) )
 | 159 | 			if ( IO::File::Exists(SystemStringFromCyString(file2)) )
 | 
          
            | 160 | 				IO::File::Delete(SystemStringFromCyString(file2));
 | 160 | 				IO::File::Delete(SystemStringFromCyString(file2));
 | 
          
            | 161 | 			IO::File::Copy(SystemStringFromCyString(file1), SystemStringFromCyString(file2));
 | 161 | 			IO::File::Copy(SystemStringFromCyString(file1), SystemStringFromCyString(file2));
 | 
          
            | 162 |  
 | 162 |  
 | 
          
            | 163 | 			CCatFile CatFile;
 | 163 | 			CCatFile CatFile;
 | 
          
            | 164 | 			if ( !CCatFile::Opened(CatFile.Open(CyStringFromSystemString(file), "", CATREAD_CATDECRYPT, false), false) )
 | 164 | 			if ( !CCatFile::Opened(CatFile.open(_S(file), "", CATREAD_CATDECRYPT, false), false) )
 | 
          
            | 165 | 			{
 | 165 | 			{
 | 
          
            | 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 | 			CyStringList *list = m_pPackages->GetMergedFiles(m_pFile1, m_pFile2);
 | 172 | 			m_pPackages->getMergedFiles(list, m_pFile1, m_pFile2);
 | 
          
            | 172 | 			if ( list )
 | 173 | 			if (!list.empty())
 | 
          
            | 173 | 			{
 | 174 | 			{
 | 
          
            | 174 | 				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));
 | 
          
            | 175 | 				if ( Diff.startDiff(_S(this->textBox2->Text)) ) {
 | 176 | 				if ( Diff.startDiff(_S(this->textBox2->Text)) ) {
 | 
          
            | 176 | 					for ( SStringList *str =list->Head();str;str= str->next)
 | 177 | 					for(auto itr = list.begin(); itr != list.end(); itr++)
 | 
          
            | 177 | 					{
 | 178 | 					{
 | 
          
            | 178 | 						int status = str->data.ToInt();
 | 179 | 						int status = (*itr)->data.toInt();
 | 
          
            | 179 | 						if ( status == 2 ) { // in 2nd mod
 | 180 | 						if ( status == 2 ) { // in 2nd mod
 | 
          
            | 180 | 							if ( CatFile.AppendFile(_S(this->textBox2->Text) + "::" + str->str.ToString(),str->str.ToString()) )
 | 181 | 							if ( CatFile.AppendFile(_S(this->textBox2->Text) + "::" + (*itr)->str, (*itr)->str) )
 | 
          
            | 181 | 								CatFile.WriteCatFile();
 | 182 | 								CatFile.WriteCatFile();
 | 
          
            | 182 | 						}
 | 183 | 						}
 | 
          
            | 183 | 						// finally, we need to diff the remaining files
 | 184 | 						// finally, we need to diff the remaining files
 | 
          
            | 184 | 						else if ( status == -1 ) { // in both
 | 185 | 						else if ( status == -1 ) { // in both
 | 
          
            | 185 | 							// only diffable files, we ignore the rest
 | 186 | 							// only diffable files, we ignore the rest
 | 
          
            | 186 | 							if ( CModDiff::CanBeDiffed(str->str.ToString()) ) Diff.doDiff(str->str.ToString());
 | 187 | 							if ( CModDiff::CanBeDiffed((*itr)->str) ) Diff.doDiff((*itr)->str);
 | 
          
            | 187 | 						}
 | 188 | 						}
 | 
          
            | 188 | 					}
 | 189 | 					}
 | 
          
            | 189 |  
 | 190 |  
 | 
          
            | 190 | 					Diff.ApplyDiff(_S(file));
 | 191 | 					Diff.ApplyDiff(_S(file));
 | 
          
            | 191 | 				}
 | 192 | 				}
 | 
          
            | 192 | 				delete list;
 | - |   | 
          
            | 193 | 			}
 | 193 | 			}
 | 
          
            | 194 |  
 | 194 |  
 | 
          
            | 195 | 			MessageBox::Show(this, "Mod files have been merged to: " + file, "Mod Merged", MessageBoxButtons::OK, MessageBoxIcon::Information);
 | 195 | 			MessageBox::Show(this, "Mod files have been merged to: " + file, "Mod Merged", MessageBoxButtons::OK, MessageBoxIcon::Information);
 | 
          
            | 196 | 		}
 | 196 | 		}
 | 
          
            | 197 |  
 | 197 |  
 | 
          
            | Line 648... | Line 648... | 
          
            | 648 | #pragma endregion
 | 648 | #pragma endregion
 | 
          
            | 649 | private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 | 649 | private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 | 
          
            | 650 | 			String ^openfile = this->OpenFile("Select the mod file to use as the primary mod");
 | 650 | 			String ^openfile = this->OpenFile("Select the mod file to use as the primary mod");
 | 
          
            | 651 | 			if ( openfile )
 | 651 | 			if ( openfile )
 | 
          
            | 652 | 			{
 | 652 | 			{
 | 
          
            | 653 | 				if ( m_pFile1->Open(CyStringFromSystemString(openfile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
 | 653 | 				if ( m_pFile1->open(_S(openfile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
 | 
          
            | 654 | 				{
 | 654 | 				{
 | 
          
            | 655 | 					this->textBox1->Text = openfile;
 | 655 | 					this->textBox1->Text = openfile;
 | 
          
            | 656 | 					this->panel2->Enabled = true;
 | 656 | 					this->panel2->Enabled = true;
 | 
          
            | 657 | 				}
 | 657 | 				}
 | 
          
            | 658 | 				else
 | 658 | 				else
 | 
          
            | Line 661... | Line 661... | 
          
            | 661 | 		}
 | 661 | 		}
 | 
          
            | 662 | private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
 | 662 | private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
 | 
          
            | 663 | 			String ^openfile = this->OpenFile("Select the mod file to use as the secondary mod");
 | 663 | 			String ^openfile = this->OpenFile("Select the mod file to use as the secondary mod");
 | 
          
            | 664 | 			if ( openfile )
 | 664 | 			if ( openfile )
 | 
          
            | 665 | 			{
 | 665 | 			{
 | 
          
            | 666 | 				if ( m_pFile2->Open(CyStringFromSystemString(openfile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
 | 666 | 				if ( m_pFile2->open(_S(openfile), "", CATREAD_CATDECRYPT, false) == CATERR_NONE )
 | 
          
            | 667 | 				{
 | 667 | 				{
 | 
          
            | 668 | 					this->textBox2->Text = openfile;
 | 668 | 					this->textBox2->Text = openfile;
 | 
          
            | 669 | 					this->UpdateFileList();
 | 669 | 					this->UpdateFileList();
 | 
          
            | 670 | 				}
 | 670 | 				}
 | 
          
            | 671 | 				else
 | 671 | 				else
 |