Subversion Repositories spk

Rev

Rev 158 | Rev 175 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 158 Rev 160
Line 149... Line 149...
149
			// read data file
149
			// read data file
150
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
150
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
151
			CFileIO Config;
151
			CFileIO Config;
152
			if ( Config.open(_S(mydoc) + "/Egosoft/xspconvert.dat") )
152
			if ( Config.open(_S(mydoc) + "/Egosoft/xspconvert.dat") )
153
			{
153
			{
154
				std::vector<CyString> *lines = Config.ReadLines();
154
				std::vector<Utils::String> *lines = Config.readLines();
155
				if ( lines )
155
				if ( lines )
156
				{
156
				{
157
					for ( int i = 0; i < (int)lines->size(); i++ )
157
					for ( int i = 0; i < (int)lines->size(); i++ )
158
					{
158
					{
159
						CyString line(lines->at(i));
159
						Utils::String line(lines->at(i));
160
						CyString start = line.GetToken(":", 1, 1).ToLower();
160
						Utils::String start = line.token(":", 1).toLower();
161
						CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
161
						Utils::String rest = line.tokens(":", 2).removeFirstSpace();
162
						if ( start.Compare("Dir") )
162
						if ( start.Compare("Dir") )
163
						{
163
						{
164
							CyString game = rest.GetToken(" ", 1, 1);
164
							Utils::String game = rest.token(" ", 1);
165
							CyString dir = rest.GetToken(" ", 2);
165
							Utils::String dir = rest.tokens(" ", 2);
166
							SStringList *str = m_pDirList->FindData(game);
166
							SStringList *str = m_pDirList->FindData(game);
167
							if ( str )
167
							if ( str )
168
								str->str = dir;
168
								str->str = dir;
169
							else
169
							else
170
								m_pDirList->PushBack(dir, game);
170
								m_pDirList->PushBack(CyString(dir), CyString(game));
171
						}
171
						}
172
						else if ( line.Compare("ReadText") )
172
						else if ( line.Compare("ReadText") )
173
							m_bReadText = true;
173
							m_bReadText = true;
174
					}
174
					}
175
				}
175
				}
Line 520... Line 520...
520
				m_pTextList->push_back(textList);
520
				m_pTextList->push_back(textList);
521
 
521
 
522
				if ( p.ExtractGameFile("types/TLaser.pck", sTempDir + "/TLaser.txt", strNode->str) )
522
				if ( p.ExtractGameFile("types/TLaser.pck", sTempDir + "/TLaser.txt", strNode->str) )
523
				{
523
				{
524
					CFileIO Open(sTempDir + "/TLaser.txt");
524
					CFileIO Open(sTempDir + "/TLaser.txt");
525
					std::vector<CyString> *lines = Open.ReadLines();
525
					std::vector<Utils::String> *lines = Open.readLines();
526
					if ( lines )
526
					if ( lines )
527
					{
527
					{
528
						bool first = false;
528
						bool first = false;
529
						for ( int j = 0; j < (int)lines->size(); j++ )
529
						for ( int j = 0; j < (int)lines->size(); j++ )
530
						{
530
						{
531
							CyString line(lines->at(j));			
531
							Utils::String line(lines->at(j));			
532
							if ( line[0] == '/' )
532
							if ( line[0] == '/' )
533
								continue;
533
								continue;
534
							line.RemoveChar('\r');
534
							line.removeChar('\r');
535
							line = line.RemoveFirstSpace();
535
							line = line.removeFirstSpace();
536
							line = line.RemoveEndSpace();
536
							line = line.removeEndSpace();
537
							if ( line.Empty() )
537
							if ( line.empty() )
538
								continue;
538
								continue;
539
							if ( !first )
539
							if ( !first )
540
							{
540
							{
541
								first = true;
541
								first = true;
542
								continue;
542
								continue;
543
							}
543
							}
544
 
544
 
545
							laserList->PushBack(line);
545
							laserList->PushBack(CyString(line));
546
						}
546
						}
547
					}
547
					}
548
 
548
 
549
					Open.remove();
549
					Open.remove();
550
				}
550
				}
551
 
551
 
552
				if ( p.ExtractGameFile("types/TMissiles.pck", sTempDir + "/TMissiles.txt", strNode->str) )
552
				if ( p.ExtractGameFile("types/TMissiles.pck", sTempDir + "/TMissiles.txt", strNode->str) )
553
				{
553
				{
554
					CFileIO Open(sTempDir + "/TMissiles.txt");
554
					CFileIO Open(sTempDir + "/TMissiles.txt");
555
					std::vector<CyString> *lines = Open.ReadLines();
555
					std::vector<Utils::String> *lines = Open.readLines();
556
					if ( lines )
556
					if ( lines )
557
					{
557
					{
558
						bool first = false;
558
						bool first = false;
559
						for ( int j = 0; j < (int)lines->size(); j++ )
559
						for ( int j = 0; j < (int)lines->size(); j++ )
560
						{
560
						{
561
							CyString line(lines->at(j));			
561
							Utils::String line(lines->at(j));			
562
							if ( line[0] == '/' )
562
							if ( line[0] == '/' )
563
								continue;
563
								continue;
564
							line.RemoveChar('\r');
564
							line.removeChar('\r');
565
							line = line.RemoveFirstSpace();
565
							line = line.removeFirstSpace();
566
							line = line.RemoveEndSpace();
566
							line = line.removeEndSpace();
567
							if ( line.Empty() )
567
							if ( line.empty() )
568
								continue;
568
								continue;
569
							if ( !first )
569
							if ( !first )
570
							{
570
							{
571
								first = true;
571
								first = true;
572
								continue;
572
								continue;
573
							}
573
							}
574
 
574
 
575
							missileList->PushBack(line);
575
							missileList->PushBack(CyString(line));
576
						}
576
						}
577
					}
577
					}
578
 
578
 
579
					Open.remove();
579
					Open.remove();
580
				}
580
				}
Line 706... Line 706...
706
		}
706
		}
707
 
707
 
708
		void CloseDialog()
708
		void CloseDialog()
709
		{
709
		{
710
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
710
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
711
			CFileIO Config(CyStringFromSystemString(mydoc) + "/Egosoft/xspconvert.dat");
711
			CFileIO Config(_S(mydoc) + "/Egosoft/xspconvert.dat");
712
			std::vector<CyString> lines;
712
			std::vector<Utils::String> lines;
713
			for ( SStringList *str = m_pDirList->Head(); str; str = str->next )
713
			for ( SStringList *str = m_pDirList->Head(); str; str = str->next )
714
				lines.push_back(CyString("Dir:") + str->data + "; " + str->str);
714
				lines.push_back("Dir:" + str->data.ToString() + "; " + str->str.ToString());
715
			if ( m_bReadText )
715
			if ( m_bReadText )
716
				lines.push_back("ReadText");
716
				lines.push_back("ReadText");
717
			Config.WriteFile(&lines);
717
			Config.writeFile(&lines);
718
		}
718
		}
719
 
719
 
720
		void CheckListChanged()
720
		void CheckListChanged()
721
		{
721
		{
722
			if ( m_bDontUpdate )
722
			if ( m_bDontUpdate )