bool O2IMDB:: Save(const wchar_t *filename, bool clear) { O2IMSelectCondition cond(IM_XMLELM_ALL); string out; ExportToXML(cond, out); Lock(); if (clear) Messages.clear(); Unlock(); /* FILE *fp; if (_wfopen_s(&fp, filename, L"wb") != 0) return false; fwrite(&out[0], 1, out.size(), fp); fclose(fp); */ File f; if (!f.open(filename, MODE_W)) { if (Logger) Logger->AddLog(O2LT_ERROR, MODULE, 0, 0, L"ファイルを開けません(%s)", filename); return false; } f.write((void*)&out[0], out.size()); f.close(); return true; }
bool O2Profile:: Save(void) { wchar_t aaa[256];GetCurrentDirectoryW(256,aaa); O2ProfileSelectCondition cond; cond.mask = PROF_XMLELM_ALL ^ PROF_XMLELM_IP; cond.rootelement = L"profile"; Lock(); string out; ExportToXML(cond, out); Unlock(); /* FILE *fp; if (_wfopen_s(&fp, ProfileFilePath.c_str(), L"wb") != 0) return false; fwrite(&out[0], 1, out.size(), fp); fclose(fp); */ File f; if (!f.open(ProfileFilePath.c_str(), MODE_W)) { if (Logger) Logger->AddLog(O2LT_ERROR, MODULE, 0, 0, L"ファイルを開けません(%s)", ProfileFilePath.c_str()); return false; } f.write((void*)&out[0], out.size()); f.close(); return true; }
bool O2KeyDB:: Save(const wchar_t *filename) { O2KeySelectCondition cond(KEY_XMLELM_COMMON | KEY_XMLELM_DATE | KEY_XMLELM_ENABLE); string out; ExportToXML(cond, out); /* FILE *fp; if (_wfopen_s(&fp, filename, L"wb") != 0) return false; fwrite(&out[0], 1, out.size(), fp); fclose(fp); */ File f; if (!f.open(filename, MODE_W)) { if (Logger) Logger->AddLog(O2LT_ERROR, MODULE, 0, 0, L"ファイルを開けません(%s)", filename); return false; } f.write((void*)&out[0], out.size()); f.close(); return true; }
bool O2Profile:: Save(void) { O2ProfileSelectCondition cond; cond.mask = PROF_XMLELM_ALL ^ PROF_XMLELM_IP; cond.rootelement = L"profile"; Lock(); string out; ExportToXML(cond, out); Unlock(); File f; if (!f.open(ProfileFilePath.c_str(), MODE_W)) { if (Logger) Logger->AddLog(O2LT_ERROR, MODULE, 0, 0, L"ファイルを開けません(%s)", ProfileFilePath.c_str()); return false; } f.write((void*)&out[0], out.size()); f.close(); return true; }
bool O2IPFilter:: Save(const wchar_t *filename) { string out; ExportToXML(out); /* FILE *fp; if (_wfopen_s(&fp, filename, L"wb") != 0) return false; fwrite(&out[0], 1, out.size(), fp); fclose(fp); */ File f; if (!f.open(filename, MODE_W)) { if (Logger) Logger->AddLog(O2LT_ERROR, MODULE, 0, 0, L"ファイルを開けません(%s)", filename); return false; } f.write((void*)&out[0], out.size()); f.close(); return true; }