/* This file is part of OpenTexMod. OpenTexMod is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenTexMod is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with FooOpenTexMod. If not, see . */ #include "OTM_Main.h" OTM_GameInfo::OTM_GameInfo(const wxString &name) { Name = name; Checked = NULL; NumberOfChecked = 0; LengthOfChecked = 0; Init(); } OTM_GameInfo::~OTM_GameInfo(void) { } void OTM_GameInfo::Init(void) { SaveSingleTexture = false; SaveAllTextures = false; KeyBack = -1; KeySave = -1; KeyNext = -1; NumberOfChecked = 0; SavePath.Empty(); OpenPath.Empty(); Textures.Empty(); } int OTM_GameInfo::SaveToFile( const wxString &file_name) { wxString name = file_name; name += L"_save.txt"; wxFile file; //if (!file.Access(name, wxFile::write)) return -1; file.Open(name, wxFile::write); if (!file.IsOpened()) {return -1;} wxString content; if (SavePath.Len()>0) { content.Printf( L"SavePath:%ls\n", SavePath.wc_str()); file.Write( content.char_str(), content.Len()); } if (OpenPath.Len()>0) { content.Printf( L"OpenPath:%ls\n", OpenPath.wc_str()); file.Write( content.char_str(), content.Len()); } content.Printf( L"SaveAllTextures:%d\nSaveSingeTexture:%d\n", SaveAllTextures, SaveSingleTexture); file.Write( content.char_str(), content.Len()); if (KeyBack>=0) { content.Printf( L"KeyBack:%d\n", KeyBack); file.Write( content.char_str(), content.Len()); } if (KeySave>=0) { content.Printf( L"KeySave:%d\n", KeySave); file.Write( content.char_str(), content.Len()); } if (KeyNext>=0) { content.Printf( L"KeyNext:%d\n", KeyNext); file.Write( content.char_str(), content.Len()); } int num = Textures.GetCount(); for (int i=0; i=LengthOfChecked) { bool *t_bool; try {t_bool = new bool [LengthOfChecked+100];} catch (...) {return -1;} for (int i=0; iNumberOfChecked) { if (Checked!=NULL) delete [] Checked; try {Checked = new bool [num+100];} catch (...) {Checked=NULL; return -1;} LengthOfChecked = num+100; } for (int i=0; i