| Line 150... |
Line 150... |
| 150 |
{
|
150 |
{
|
| 151 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
151 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
| 152 |
CFileIO Config;
|
152 |
CFileIO Config;
|
| 153 |
if ( Config.open(_S(mydoc) + "/Egosoft/spkexplorer.dat") )
|
153 |
if ( Config.open(_S(mydoc) + "/Egosoft/spkexplorer.dat") )
|
| 154 |
{
|
154 |
{
|
| 155 |
std::vector<CyString> *lines = Config.ReadLines();
|
155 |
std::vector<Utils::String> *lines = Config.readLines();
|
| 156 |
if ( lines )
|
156 |
if ( lines )
|
| 157 |
{
|
157 |
{
|
| 158 |
for ( int i = 0; i < (int)lines->size(); i++ )
|
158 |
for ( int i = 0; i < (int)lines->size(); i++ )
|
| 159 |
{
|
159 |
{
|
| 160 |
CyString line(lines->at(i));
|
160 |
Utils::String line(lines->at(i));
|
| 161 |
CyString start = line.GetToken(":", 1, 1).lower();
|
161 |
Utils::String start = line.token(":", 1).lower();
|
| 162 |
CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
|
162 |
Utils::String rest = line.tokens(":", 2).removeFirstSpace();
|
| 163 |
if ( start.Compare("ExplorerSize") )
|
163 |
if ( start.Compare("ExplorerSize") )
|
| 164 |
this->Size = System::Drawing::Size(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
|
164 |
this->Size = System::Drawing::Size(rest.token(" ", 1).toInt(), rest.token(" ", 2).toInt());
|
| 165 |
else if ( start.Compare("ExplorerPos") )
|
165 |
else if ( start.Compare("ExplorerPos") )
|
| 166 |
{
|
166 |
{
|
| 167 |
m_iLocX = rest.GetToken(" ", 1, 1).ToInt();
|
167 |
m_iLocX = rest.token(" ", 1).toInt();
|
| 168 |
m_iLocY = rest.GetToken(" ", 2, 2).ToInt();
|
168 |
m_iLocY = rest.token(" ", 2).toInt();
|
| 169 |
}
|
169 |
}
|
| 170 |
else if ( start.Compare("Loaded") )
|
170 |
else if ( start.Compare("Loaded") )
|
| 171 |
m_pLoadedList->PushBack(rest);
|
171 |
m_pLoadedList->PushBack(CyString(rest));
|
| 172 |
else if ( start.Compare("ExplorerMax") )
|
172 |
else if ( start.Compare("ExplorerMax") )
|
| 173 |
this->WindowState = FormWindowState::Maximized;
|
173 |
this->WindowState = FormWindowState::Maximized;
|
| 174 |
}
|
174 |
}
|
| 175 |
|
175 |
|
| 176 |
delete lines;
|
176 |
delete lines;
|
| Line 297... |
Line 297... |
| 297 |
}
|
297 |
}
|
| 298 |
|
298 |
|
| 299 |
void SaveData()
|
299 |
void SaveData()
|
| 300 |
{
|
300 |
{
|
| 301 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
301 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
| 302 |
CFileIO Config(CyStringFromSystemString(mydoc) + "/Egosoft/spkexplorer.dat");
|
302 |
CFileIO Config(_S(mydoc) + "/Egosoft/spkexplorer.dat");
|
| 303 |
CyStringList lines;
|
303 |
Utils::CStringList lines;
|
| 304 |
|
304 |
|
| 305 |
if ( this->WindowState == FormWindowState::Normal )
|
305 |
if ( this->WindowState == FormWindowState::Normal )
|
| 306 |
{
|
306 |
{
|
| 307 |
lines.PushBack(CyString("ExplorerSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
|
307 |
lines.pushBack(Utils::String("ExplorerSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
|
| 308 |
lines.PushBack(CyString("ExplorerPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
|
308 |
lines.pushBack(Utils::String("ExplorerPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
|
| 309 |
}
|
309 |
}
|
| 310 |
else
|
310 |
else
|
| 311 |
{
|
311 |
{
|
| 312 |
lines.PushBack(CyString("ExplorerPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
|
312 |
lines.pushBack(Utils::String("ExplorerPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
|
| 313 |
lines.PushBack(CyString("ExplorerSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
|
313 |
lines.pushBack(Utils::String("ExplorerSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
|
| 314 |
}
|
314 |
}
|
| 315 |
|
315 |
|
| 316 |
if ( this->WindowState == FormWindowState::Maximized )
|
316 |
if ( this->WindowState == FormWindowState::Maximized )
|
| 317 |
lines.PushBack("ExplorerMax:");
|
317 |
lines.pushBack("ExplorerMax:");
|
| 318 |
|
318 |
|
| 319 |
for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
|
319 |
for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
|
| 320 |
lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
|
320 |
lines.pushBack(Utils::String("Loaded:") + str->data.ToString() + " " + str->str.ToString());
|
| 321 |
Config.WriteFile(&lines);
|
321 |
Config.writeFile(&lines);
|
| 322 |
}
|
322 |
}
|
| 323 |
void CloseEvent(System::Object ^Sender, System::EventArgs ^E)
|
323 |
void CloseEvent(System::Object ^Sender, System::EventArgs ^E)
|
| 324 |
{
|
324 |
{
|
| 325 |
this->CloseAll();
|
325 |
this->CloseAll();
|
| 326 |
this->SaveData();
|
326 |
this->SaveData();
|