| 553 | } |
| 554 | |
| 555 | Result 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 | |
| 596 | void CtrlrPanel::writePanelXml(OutputStream &outputStream, CtrlrPanel *panel, const bool compressPanel) |
| 597 | { |
nothing calls this directly
no test coverage detected