protected async Task GetPresetsUsingFullBank(PresetBank bank, int start, int numPresets, string sourceFile)
        {
            if (start < 0)
            {
                Logger.Error("GetPresets start index is less than 0, ignoring. This is probably a bug or a " +
                             "misconfiguration. Please report this including the full log file.");
                return;
            }

            var endIndex = start + numPresets;

            if (endIndex > PluginInstance.Plugin.PluginInfo.ProgramCount)
            {
                Logger.Error(
                    $"Tried to retrieve presets between the index {start} and {endIndex}, but this would exceed maximum " +
                    $"program count of {PluginInstance.Plugin.PluginInfo.ProgramCount}, ignoring. You might wish to " +
                    "report this as a bug.");
                return;
            }

            for (var index = start; index < endIndex; index++)
            {
                PluginInstance.SetProgram(index);

                var preset = new PresetParserMetadata
                {
                    PresetName = PluginInstance.GetCurrentProgramName(),
                    BankPath   = bank.BankPath,
                    SourceFile = sourceFile + ":" + index,
                    Plugin     = PluginInstance.Plugin
                };

                await DataPersistence.PersistPreset(preset, PluginInstance.GetChunk(false));
            }
        }
        protected async Task GetPresetsUsingBankTrickery(PresetBank bank, int start, int numPresets, string sourceFile)
        {
            if (start < 0)
            {
                Logger.Error("GetPresets start index is less than 0, ignoring. This is probably a bug or a " +
                             "misconfiguration. Please report this including the full log file.");
                return;
            }

            var endIndex = start + numPresets;

            if (endIndex > PluginInstance.Plugin.PluginInfo.ProgramCount)
            {
                Logger.Error(
                    $"Tried to retrieve presets between the index {start} and {endIndex}, but this would exceed maximum " +
                    $"program count of {PluginInstance.Plugin.PluginInfo.ProgramCount}, ignoring. You might wish to " +
                    "report this as a bug.");
                return;
            }

            for (var index = start; index < endIndex; index++)
            {
                PluginInstance.SetProgram(0);
                PluginInstance.PerformIdleLoop(10);

                var programBackup = PluginInstance.GetChunk(true);
                PluginInstance.SetProgram(index);
                PluginInstance.PerformIdleLoop(10);

                var programName    = PluginInstance.GetCurrentProgramName();
                var fullSourceFile = sourceFile + ":" + index;
                var vstPreset      = new PresetParserMetadata
                {
                    SourceFile = fullSourceFile,
                    BankPath   = bank.BankPath,
                    PresetName = programName,
                    Plugin     = PluginInstance.Plugin
                };


                var realProgram = PluginInstance.GetChunk(true);
                PluginInstance.SetProgram(0);
                PluginInstance.PerformIdleLoop(10);

                PluginInstance.SetChunk(realProgram, true);
                PluginInstance.PerformIdleLoop(10);

                var presetData = PluginInstance.GetChunk(false);

                // Restore original program 0
                PluginInstance.SetChunk(programBackup, true);
                PluginInstance.PerformIdleLoop(10);

                var hash = HashUtils.getIxxHash(presetData);

                if (PresetHashes.ContainsKey(hash))
                {
                    Logger.Warning(
                        $"Skipping program {index} with name {programName} because a program with the same data " +
                        $"was already added ({PresetHashes[hash]}. Please report this if you think if it's a bug.");
                }
                else
                {
                    PresetHashes.Add(hash, fullSourceFile + " " + programName);
                    await DataPersistence.PersistPreset(vstPreset, presetData);
                }
            }
        }