Detect crashes or broken project files

pull/298/head
James H Ball 2025-04-05 11:22:18 +01:00
rodzic cdf3e88e17
commit edff0e529e
4 zmienionych plików z 34 dodań i 2 usunięć

Wyświetl plik

@ -86,6 +86,7 @@ void CommonAudioProcessor::addAllParameters() {
CommonAudioProcessor::~CommonAudioProcessor()
{
setGlobalValue("endTime", juce::Time::getCurrentTime().toISO8601(true));
saveGlobalSettings();
}

Wyświetl plik

@ -709,6 +709,37 @@ void OscirenderAudioProcessor::getStateInformation(juce::MemoryBlock& destData)
}
void OscirenderAudioProcessor::setStateInformation(const void* data, int sizeInBytes) {
// check that the previous end time is later than the start time.
// if not, the program did not close properly.
juce::String startTime = getGlobalStringValue("startTime");
juce::String endTime = getGlobalStringValue("endTime");
if (startTime.isNotEmpty() && endTime.isNotEmpty()) {
juce::Time start = juce::Time::fromISO8601(startTime);
juce::Time end = juce::Time::fromISO8601(endTime);
if ((start > end || end == juce::Time()) && juce::MessageManager::getInstance()->isThisTheMessageThread()) {
juce::String message = "It appears that " + juce::String(ProjectInfo::projectName) + " did not close properly during your last session. This may indicate a problem with your project or session.";
// Use a synchronous dialog to ensure user makes a choice before proceeding
bool userPressedReset = juce::AlertWindow::showOkCancelBox(
juce::AlertWindow::WarningIcon,
"Possible Crash Detected",
message + "\n\nDo you want to reset to a new project, or continue loading your previous session?",
"Reset to New Project",
"Continue",
nullptr,
nullptr
);
if (userPressedReset) {
return;
}
}
}
setGlobalValue("startTime", juce::Time::getCurrentTime().toISO8601(true));
std::unique_ptr<juce::XmlElement> xml;
const uint32_t magicXmlNumber = 0x21324356;

Wyświetl plik

@ -5,7 +5,7 @@
pluginManufacturer="jameshball" aaxIdentifier="sh.ball.oscirender"
cppLanguageStandard="20" projectLineFeed="&#10;" headerPath="./include"
version="2.4.11.1" companyName="James H Ball" companyWebsite="https://osci-render.com"
companyEmail="james@ball.sh" defines="NOMINMAX=1&#10;INTERNET_FLAG_NO_AUTO_REDIRECT=0&#10;SOSCI_FEATURES=1&#10;JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1"
companyEmail="james@ball.sh" defines="NOMINMAX=1&#10;INTERNET_FLAG_NO_AUTO_REDIRECT=0&#10;SOSCI_FEATURES=1&#10;JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1&#10;JUCE_MODAL_LOOPS_PERMITTED=1"
pluginAUMainType="'aumf'">
<MAINGROUP id="j5Ge2T" name="osci-render">
<GROUP id="{5ABCED88-0059-A7AF-9596-DBF91DDB0292}" name="Resources">

Wyświetl plik

@ -5,7 +5,7 @@
aaxIdentifier="sh.ball.sosci" cppLanguageStandard="20" projectLineFeed="&#10;"
headerPath="./include" version="1.1.5.1" companyName="James H Ball"
companyWebsite="https://osci-render.com" companyEmail="james@ball.sh"
defines="NOMINMAX=1&#10;INTERNET_FLAG_NO_AUTO_REDIRECT=0&#10;SOSCI_FEATURES=1&#10;JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1"
defines="NOMINMAX=1&#10;INTERNET_FLAG_NO_AUTO_REDIRECT=0&#10;SOSCI_FEATURES=1&#10;JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1&#10;JUCE_MODAL_LOOPS_PERMITTED=1"
pluginManufacturerCode="Jhba" pluginCode="Sosc" pluginAUMainType="'aufx'">
<MAINGROUP id="j5Ge2T" name="sosci">
<GROUP id="{5ABCED88-0059-A7AF-9596-DBF91DDB0292}" name="Resources">