| 2778 | } |
| 2779 | |
| 2780 | void ExpansionEncodingWindow::run() |
| 2781 | { |
| 2782 | #if USE_BACKEND |
| 2783 | if (projectExport) |
| 2784 | { |
| 2785 | if (encodeResult.failed()) |
| 2786 | return; |
| 2787 | |
| 2788 | encodeResult = performChecks(); |
| 2789 | |
| 2790 | if (encodeResult.failed()) |
| 2791 | return; |
| 2792 | |
| 2793 | auto& h = GET_PROJECT_HANDLER(getMainController()->getMainSynthChain()); |
| 2794 | auto f = Expansion::Helpers::getExpansionInfoFile(h.getWorkDirectory(), Expansion::FileBased); |
| 2795 | |
| 2796 | ValueTree mData(ExpansionIds::ExpansionInfo); |
| 2797 | |
| 2798 | auto projectName = GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::Name).toString(); |
| 2799 | |
| 2800 | mData.setProperty(ExpansionIds::Name, projectName, nullptr); |
| 2801 | mData.setProperty(ExpansionIds::Version, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::Version), nullptr); |
| 2802 | mData.setProperty(ExpansionIds::Company, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::User::Company), nullptr); |
| 2803 | mData.setProperty(ExpansionIds::CompanyURL, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::User::CompanyURL), nullptr); |
| 2804 | mData.setProperty(ExpansionIds::Description, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::ExpansionSettings::Description), nullptr); |
| 2805 | mData.setProperty(ExpansionIds::Tags, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::ExpansionSettings::Tags), nullptr); |
| 2806 | mData.setProperty(ExpansionIds::UUID, GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::ExpansionSettings::UUID), nullptr); |
| 2807 | mData.setProperty(ExpansionIds::HiseVersion, PresetHandler::getVersionString(), nullptr); |
| 2808 | |
| 2809 | if (exportMode == ExportMode::HiseProject) |
| 2810 | { |
| 2811 | auto projectFile = h.getRootFolder().getChildFile("project_info.xml"); |
| 2812 | auto userFile = h.getRootFolder().getChildFile("user_info.xml"); |
| 2813 | |
| 2814 | auto projectXML = XmlDocument::parse(projectFile); |
| 2815 | auto userXML = XmlDocument::parse(userFile); |
| 2816 | |
| 2817 | if (projectXML != nullptr) |
| 2818 | mData.addChild(ValueTree::fromXml(*projectXML), -1, nullptr); |
| 2819 | |
| 2820 | if (userXML != nullptr) |
| 2821 | mData.addChild(ValueTree::fromXml(*userXML), -1, nullptr); |
| 2822 | } |
| 2823 | |
| 2824 | String prevContent; |
| 2825 | |
| 2826 | if(f.existsAsFile()) |
| 2827 | prevContent = f.loadFileAsString(); |
| 2828 | |
| 2829 | |
| 2830 | auto xml = mData.createXml(); |
| 2831 | f.replaceWithText(xml->createDocument("")); |
| 2832 | ScopedPointer<FullInstrumentExpansion> e = new FullInstrumentExpansion(getMainController(), h.getWorkDirectory()); |
| 2833 | e->initialise(); |
| 2834 | e->setIsProjectExporter(); |
| 2835 | encodeResult = e->encodeExpansion(); |
| 2836 | |
| 2837 | // This file is used by the FullInstrument Expansion so |
nothing calls this directly
no test coverage detected