void SQDbgServer::Break(HSQUIRRELVM v, SQInteger line, const SQChar *src, const SQChar *type, const SQChar *error) { _line = line; _src = src; _break_type = src; if (!error) { BeginDocument(); BeginElement(_SC("break")); Attribute(_SC("thread"), PtrToString(v)); Attribute(_SC("line"), IntToString(line)); Attribute(_SC("src"), src); Attribute(_SC("type"), type); SerializeState(v); EndElement(_SC("break")); EndDocument(); } else { BeginDocument(); BeginElement(_SC("break")); Attribute(_SC("thread"), PtrToString(v)); Attribute(_SC("line"), IntToString(line)); Attribute(_SC("src"), src); Attribute(_SC("type"), type); Attribute(_SC("error"), error); SerializeState(v); EndElement(_SC("break")); EndDocument(); } }
bool GDocApp<OptionsFmt>::_DoSerialize(bool Write) { bool Status = false; if (!d->OptionsFile) { const char *Ext = d->GetExtension(Options); d->OptionsFile = d->GetOptionsFile(Ext); } if (!Options) { if (FileExists(d->OptionsFile)) Options = new OptionsFmt(d->OptionsFile); else Options = new OptionsFmt(GOptionsFile::PortableMode, d->OptionsParam); } if (Write) { // Save window position SerializeState(Options, "Pos", false); // save misc options SerializeOptions(Options, true); GOptionsFile *Of = dynamic_cast<GOptionsFile*>(Options); if (Of) Of->CreateTag("Mru"); GMru::Serialize(Options, "Mru", true); } // do the work Status = _SerializeFile(Write); if (!Write) { GVariant Lang; if (_LangOptsName && Options->GetValue(_LangOptsName, Lang)) { GXmlTag *t = new GXmlTag("language"); if (t) { t->SetAttr("id", Lang.Str()); LgiApp->SetConfig(t); } } // read misc options GMru::Serialize(Options, "Mru", false); SerializeOptions(Options, false); // window pos SerializeState(Options, "Pos", true); } return Status; }
tresult PLUGIN_API IPlugVST3Plugin::setEditorState(IBStream* state) { TRACE; WDL_MutexLock lock(&mMutex); ByteChunk chunk; SerializeState(&chunk); // to get the size if (chunk.Size() > 0) { state->read(chunk.GetBytes(), chunk.Size()); UnserializeState(&chunk, 0); int32 savedBypass = 0; if (state->read (&savedBypass, sizeof (int32)) != kResultOk) { return kResultFalse; } mIsBypassed = (bool) savedBypass; RedrawParamControls(); return kResultOk; } return kResultFalse; }
void CSimpleReport::LayoutLoad(const char* id, const char* tag) { UINT nBytes = 0; LPBYTE pData = 0; if (!AfxGetApp()->GetProfileBinary(id, tag, &pData, &nBytes)) return; CMemFile memFile(pData, nBytes); CArchive ar (&memFile,CArchive::load); try { SerializeState(ar); } catch (COleException* pEx) { pEx->Delete (); } catch (CArchiveException* pEx) { pEx->Delete (); } ar.Close(); memFile.Close(); delete[] pData; }
tresult PLUGIN_API IPlugVST3::getEditorState(IBStream* state) { ByteChunk chunk; if (SerializeState(&chunk)) { state->write(chunk.GetBytes(), chunk.Size()); return kResultOk; } return kResultFalse; }
void CSimpleReport::LayoutSave(const char* id, const char* tag) { CMemFile memFile; CArchive ar (&memFile,CArchive::store); SerializeState(ar); ar.Flush(); DWORD nBytes = (DWORD)memFile.GetPosition(); LPBYTE pData = memFile.Detach(); AfxGetApp()->WriteProfileBinary(id, tag, pData, nBytes); ar.Close(); memFile.Close(); free(pData); }
void SQDbgServer::Break(int line,const SQChar *src,const SQChar *type,const SQChar *error) { if(!error){ BeginDocument(); BeginElement(_SC("break")); Attribute(_SC("line"),IntToString(line)); Attribute(_SC("src"),src); Attribute(_SC("type"),type); SerializeState(); EndElement(_SC("break")); EndDocument(); }else{ BeginDocument(); BeginElement(_SC("break")); Attribute(_SC("line"),IntToString(line)); Attribute(_SC("src"),src); Attribute(_SC("type"),type); Attribute(_SC("error"),error); SerializeState(); EndElement(_SC("break")); EndDocument(); } }
tresult PLUGIN_API IPlugVST3::setEditorState(IBStream* state) { ByteChunk chunk; SerializeState(&chunk); if (chunk.Size() >= 0) { state->read(chunk.GetBytes(), chunk.Size()); UnserializeState(&chunk, 0); RedrawParamControls(); return kResultOk; } return kResultFalse; }
tresult PLUGIN_API IPlugVST3Plugin::getEditorState(IBStream* state) { TRACE; WDL_MutexLock lock(&mMutex); ByteChunk chunk; if (SerializeState(&chunk)) { state->write(chunk.GetBytes(), chunk.Size()); } else { return kResultFalse; } int32 toSaveBypass = mIsBypassed ? 1 : 0; state->write(&toSaveBypass, sizeof (int32)); return kResultOk; }