108{
109 mFilepath = outfile;
110
111 if (EDR::FileExists(outfile.
Get()))
113
115
116
117 eString infOut = TEXT(
"NGE WORLD FILE\n");
118 infOut += TEXT("EngineVersion=") + eString::ToString(NGE_ENGINE_INFO_VERSION) + TEXT("\n");
119 infOut += TEXT("Compiler=") + TEXT(NGE_COMPILER_NAME) + TEXT("\nCompilerVersion=") + eString::ToString(NGE_COMPILER_VERSION) + TEXT("\n");
120
121 infOut += "<DOERS>\n";
122 for (auto& it : mDoers.Geta())
123 {
126 infOut += TEXT("<") + name + TEXT(">\n");
127 }
128 infOut += "</DOERS>\n";
129
130 infOut += OnSave_info();
131
135
136
137 std::vector<strg> TMPSVSTOR;
138 for (auto& it : mDoers.Geta())
139 {
140 auto& obj = it.second;
141
144
145 eString objclass = obj->mClassName;
147 eString OUT = TEXT(
"class=") + objclass + TEXT(
"\n");
148
149 OUT += TEXT("<PROPS>\n");
150 for (auto& prop : obj->Properties().Geta().Geta())
151 {
152 if (!mPropTypes.
Find(prop.second.mType))
153 {
154 eConsole::PrintLog(
"WARNING::eWorld::Save",
"Property type '" + prop.second.mType.GetStrg() +
"' was not registered!");
155 continue;
156 }
159 OUT += pname + TEXT("=") + mPropTypes[prop.second.mType].mOnSave(prop.second.mValue) + TEXT("\n");
160 }
161 OUT += TEXT("</PROPS>\n");
162
163 OUT += TEXT("<TAGS>\n");
164 const uint64 tsize = obj->Tags().GetCollection().size();
165 OUT += TEXT("a=") + eString::ToString(tsize) + TEXT("\n");
166 for(uint64 i = 0; i < tsize; i++)
167 {
168 auto& tag = obj->Tags().GetCollection()[i];
171 OUT += TEXT("t") + eString::ToString(i) + TEXT("=") + fintag + TEXT("\n");
172 }
173 OUT += TEXT("</TAGS>\n");
174
175 for (auto& it : obj->GetModules().Geta())
176 {
179 OUT += TEXT("<") + modname + TEXT(">\n");
180 for (auto& prop : it.second->Properties().Geta().Geta())
181 {
182 if (!mPropTypes.
Find(prop.second.mType))
183 {
184 eConsole::PrintLog(
"WARNING::eWorld::Save",
"Property type '" + prop.second.mType.GetStrg() +
"' was not registered!");
185 continue;
186 }
189 OUT += pname + TEXT("=") + mPropTypes[prop.second.mType].mOnSave(prop.second.mValue) + TEXT("\n");
190 }
191 OUT += TEXT("</") + modname + TEXT(">\n");
192 }
193
194 TMPSVSTOR.push_back(OUT.
GetStrg());
195 strg& curstorspc = TMPSVSTOR[TMPSVSTOR.size() - 1];
198 strg outfname = name.
GetStrg() +
".doer";
200 }
201
202 OnSave(archive);
203
205}
strg WriteBinaryToString(strg &content)
Write binary text to memory.
void AddBinaryToArchive(Archive *z, const char *filename, const char *content, uint64 size)
Adds binary file to archive.
void RemoveFile(const char *filePath)
Removes a file from the drive.
Archive * CreateArchive(const char *directory)
Creates ZIP archive.