示例#1
0
        private void TestExportInternal(Plugin.PluginTypes pluginType, string expectedExtension)
        {
            var outputDir = Path.Combine(Directory.GetCurrentDirectory(), @"TestData\PresetExport");

            Directory.CreateDirectory(outputDir);

            foreach (var file in Directory.EnumerateFiles(outputDir, "*", SearchOption.AllDirectories))
            {
                File.Delete(file);
            }

            var plugin = GetTestPlugin(pluginType);

            TestBankPath1Levels(outputDir, pluginType, expectedExtension);
            TestBankPath2Levels(outputDir, pluginType, expectedExtension);
            TestBankPath3Levels(outputDir, pluginType, expectedExtension);
            TestBankPath4Levels(outputDir, pluginType, expectedExtension);

            var existingDefaultPreset = new Preset();

            existingDefaultPreset.Plugin              = plugin;
            existingDefaultPreset.PresetId            = "a6d4d311-6856-ffff-863b-d90b3240b085";
            existingDefaultPreset.Metadata.PresetName = "Default";
            existingDefaultPreset.Metadata.BankPath   = "Factory/Default/Crazy";

            var exporter = new NKSExport(null);
            var existingPresetExportInfo = new PresetExportInfo(existingDefaultPreset);

            existingPresetExportInfo.UserContentDirectory = outputDir;
            existingPresetExportInfo.FolderMode           = PresetExportInfo.FolderExportMode.ONE_LEVEL_LAST_BANK;

            exporter.ExportNKSPreset(existingPresetExportInfo, new byte[] { 0xFF });

            existingDefaultPreset.PresetId = "ffffff11-6856-ffff-863b-d90b3240b085";

            existingPresetExportInfo = new PresetExportInfo(existingDefaultPreset);
            existingPresetExportInfo.UserContentDirectory = outputDir;
            existingPresetExportInfo.FolderMode           = PresetExportInfo.FolderExportMode.ONE_LEVEL_LAST_BANK;

            existingPresetExportInfo.CanExport().Should().BeFalse();

            existingPresetExportInfo = new PresetExportInfo(existingDefaultPreset);
            existingPresetExportInfo.UserContentDirectory = outputDir;
            existingPresetExportInfo.FolderMode           = PresetExportInfo.FolderExportMode.ONE_LEVEL_LAST_BANK;
            existingPresetExportInfo.OverwriteMode        = PresetExportInfo.FileOverwriteMode.APPEND_GUID;

            MakeRelative(existingPresetExportInfo).Should()
            .Be(@"SuperDuperPlugin\Crazy\Default.ffffff11-6856-ffff-863b-d90b3240b085" + expectedExtension);

            existingPresetExportInfo = new PresetExportInfo(existingDefaultPreset);
            existingPresetExportInfo.UserContentDirectory = outputDir;
            existingPresetExportInfo.FolderMode           = PresetExportInfo.FolderExportMode.ONE_LEVEL_LAST_BANK;
            existingPresetExportInfo.OverwriteMode        = PresetExportInfo.FileOverwriteMode.FORCE_OVERWRITE;

            MakeRelative(existingPresetExportInfo).Should()
            .Be(@"SuperDuperPlugin\Crazy\Default" + expectedExtension);
        }
示例#2
0
        private Plugin GetTestPlugin(Plugin.PluginTypes pluginType)
        {
            var plugin = new Plugin();

            plugin.VstPluginId  = 1222222;
            plugin.PluginName   = "SuperDuperPlugin";
            plugin.PluginVendor = "Drachenkatze";
            plugin.PluginType   = pluginType;

            return(plugin);
        }
示例#3
0
        private void TestBankPath3Levels(string outputDir, Plugin.PluginTypes pluginType, string expectedExtension)
        {
            var plugin = GetTestPlugin(pluginType);

            var preset = new Preset();

            preset.Plugin              = plugin;
            preset.PresetId            = "a6d4d311-6856-4fe7-863b-d90b3240b085";
            preset.Metadata.PresetName = "Preset$!#";
            preset.Metadata.BankPath   = "Factory/Default/Crazy";

            var presetExportInfo = new PresetExportInfo(preset);

            presetExportInfo.UserContentDirectory = outputDir;

            presetExportInfo.FolderMode = PresetExportInfo.FolderExportMode.SINGLE_FOLDER;

            MakeRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Preset$!#" + expectedExtension);
            MakePreviewRelative(presetExportInfo, true).Should().Be(@"SuperDuperPlugin\.previews\Preset$!#" + expectedExtension + ".wav");
            MakePreviewRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\.previews\Preset$!#" + expectedExtension + ".ogg");

            presetExportInfo.FolderMode = PresetExportInfo.FolderExportMode.ONE_LEVEL_FIRST_BANK;

            MakeRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\Preset$!#" + expectedExtension);
            MakePreviewRelative(presetExportInfo, true).Should().Be(@"SuperDuperPlugin\Factory\.previews\Preset$!#" + expectedExtension + ".wav");
            MakePreviewRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\.previews\Preset$!#" + expectedExtension + ".ogg");

            presetExportInfo.FolderMode = PresetExportInfo.FolderExportMode.ONE_LEVEL_LAST_BANK;

            MakeRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Crazy\Preset$!#" + expectedExtension);
            MakePreviewRelative(presetExportInfo, true).Should().Be(@"SuperDuperPlugin\Crazy\.previews\Preset$!#" + expectedExtension + ".wav");
            MakePreviewRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Crazy\.previews\Preset$!#" + expectedExtension + ".ogg");

            presetExportInfo.FolderMode = PresetExportInfo.FolderExportMode.SUBFOLDERS_TRIMMED;

            MakeRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\Default - Crazy\Preset$!#" + expectedExtension);
            MakePreviewRelative(presetExportInfo, true).Should().Be(@"SuperDuperPlugin\Factory\Default - Crazy\.previews\Preset$!#" + expectedExtension + ".wav");
            MakePreviewRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\Default - Crazy\.previews\Preset$!#" + expectedExtension + ".ogg");

            presetExportInfo.FolderMode = PresetExportInfo.FolderExportMode.SUBFOLDERS;

            MakeRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\Default\Crazy\Preset$!#" + expectedExtension);
            MakePreviewRelative(presetExportInfo, true).Should().Be(@"SuperDuperPlugin\Factory\Default\Crazy\.previews\Preset$!#" + expectedExtension + ".wav");
            MakePreviewRelative(presetExportInfo).Should().Be(@"SuperDuperPlugin\Factory\Default\Crazy\.previews\Preset$!#" + expectedExtension + ".ogg");
        }