示例#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
 public void ExportNks(Guid pluginGuid, PresetExportInfo preset, byte[] presetData)
 {
     App.Ping();
     try
     {
         var exporter = new NKSExport(_vstHost);
         exporter.ExportNKSPreset(preset, presetData);
     }
     catch (Exception e)
     {
         throw GetFaultException <GenericFault>(e);
     }
 }