MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / savePanelBin

Method savePanelBin

Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp:555–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555Result CtrlrPanel::savePanelBin(const File &fileToSave, CtrlrPanel *panel, const bool compressPanel)
556{
557 MemoryOutputStream panelBinData;
558
559 if (panel == nullptr)
560 return (Result::fail ("Invalid panel pointer"));
561
562 panel->sync();
563
564 if (compressPanel)
565 {
566 panel->luaSavePanel (PanelFileBinaryCompressed, fileToSave);
567
568 GZIPCompressorOutputStream gzOutputStream (&panelBinData);
569 panel->getPanelTree().writeToStream(gzOutputStream);
570 gzOutputStream.flush();
571 }
572 else
573 {
574 panel->luaSavePanel (PanelFileBinary, fileToSave);
575 panel->getPanelTree().writeToStream(panelBinData);
576 }
577
578 if (fileToSave.hasWriteAccess())
579 {
580 if (fileToSave.replaceWithData(panelBinData.getData(), panelBinData.getDataSize()))
581 {
582 return (Result::ok());
583 }
584 else
585 {
586 return (Result::fail ("savePanelBin replaceWithData() failed on destination file "+fileToSave.getFullPathName()));
587 }
588 }
589 else
590 {
591 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Can't save panel", "I can't write to the specified file", "OK");
592 return (Result::fail ("savePanelBin now write access to file: "+fileToSave.getFullPathName()));
593 }
594}
595
596void CtrlrPanel::writePanelXml(OutputStream &outputStream, CtrlrPanel *panel, const bool compressPanel)
597{

Callers

nothing calls this directly

Calls 8

syncMethod · 0.80
luaSavePanelMethod · 0.80
writeToStreamMethod · 0.45
flushMethod · 0.45
hasWriteAccessMethod · 0.45
replaceWithDataMethod · 0.45
getDataMethod · 0.45
getDataSizeMethod · 0.45

Tested by

no test coverage detected