Beispiel #1
0
 public static IServiceCollection AddHygouServices(this IServiceCollection sc, EnvironmentType envType)
 {
     sc.AddSetting <HygouSetting>();
     sc.AddInitializer("data", "初始化Hygou数据", sp => SystemInitializer.Initialize(sp, envType));
     sc.AddInitializer("product", "初始化Hygou产品", sp => SampleImporter.ImportSamples(sp));
     sc.InitServices("初始化服务", NewSerivces);
     return(sc);
 }
Beispiel #2
0
        public void TacomaWontLoad()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            Stream   stream   = assembly.GetManifestResourceStream("HydroAfter.Test.tacoma1.txt");

            SampleImporter importer = new SampleImporter(stream);

            importer.ImportToDatabase();
        }
        private void HitsoundLayer_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                SampleGeneratingArgs args = selectedLayer.SampleArgs;
                var mainOutputStream      = SampleImporter.ImportSample(args);

                if (mainOutputStream == null)
                {
                    MessageBox.Show("Could not load the specified sample.");
                    return;
                }

                WaveOutEvent player = new WaveOutEvent();

                player.Init(mainOutputStream.GetSampleProvider());
                player.PlaybackStopped += PlayerStopped;

                player.Play();
            }
            catch (FileNotFoundException) { MessageBox.Show("Could not find the specified sample."); }
            catch (DirectoryNotFoundException) { MessageBox.Show("Could not find the specified sample's directory."); }
            catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); }
        }
Beispiel #4
0
        private void CopyHitsounds(HitsoundCopierVm arg, Beatmap beatmapTo,
                                   Timeline tlFrom, Timeline tlTo,
                                   List <TimingPointsChange> timingPointsChanges, GameMode mode, string mapDir,
                                   Dictionary <string, string> firstSamples, ref SampleSchema sampleSchema)
        {
            var CustomSampledTimes = new HashSet <int>();
            var tloToSliderSlide   = new List <TimelineObject>();

            foreach (var tloFrom in tlFrom.TimelineObjects)
            {
                var tloTo = tlTo.GetNearestTlo(tloFrom.Time, true);

                if (tloTo != null &&
                    Math.Abs(Math.Round(tloFrom.Time) - Math.Round(tloTo.Time)) <= arg.TemporalLeniency)
                {
                    // Copy to this tlo
                    CopyHitsounds(arg, tloFrom, tloTo);

                    // Add timingpointschange to copy timingpoint hitsounds
                    var tp = tloFrom.HitsoundTimingPoint.Copy();
                    tp.Offset = tloTo.Time;
                    timingPointsChanges.Add(new TimingPointsChange(tp, sampleset: arg.CopySampleSets,
                                                                   index: arg.CopySampleSets, volume: arg.CopyVolumes));
                }
                // Try to find a slider tick in range to copy the sample to instead.
                // This slider tick gets a custom sample and timingpoints change to imitate the copied hitsound.
                else
                if (arg.CopyToSliderTicks &&
                    FindSliderTickInRange(beatmapTo, tloFrom.Time - arg.TemporalLeniency, tloFrom.Time + arg.TemporalLeniency, out var sliderTickTime, out var tickSlider) &&
                    !CustomSampledTimes.Contains((int)sliderTickTime))
                {
                    // Add a new custom sample to this slider tick to represent the hitsounds
                    List <string> sampleFilenames       = tloFrom.GetFirstPlayingFilenames(mode, mapDir, firstSamples, false);
                    List <SampleGeneratingArgs> samples = sampleFilenames
                                                          .Select(o => new SampleGeneratingArgs(Path.Combine(mapDir, o)))
                                                          .Where(o => SampleImporter.ValidateSampleArgs(o, true))
                                                          .ToList();

                    if (samples.Count > 0)
                    {
                        if (sampleSchema.AddHitsound(samples, "slidertick", tloFrom.FenoSampleSet,
                                                     out int index, out var sampleSet, arg.StartIndex))
                        {
                            // Add a copy of the slider slide sound to this index if necessary
                            var oldIndex         = tloFrom.HitsoundTimingPoint.SampleIndex;
                            var oldSampleSet     = tloFrom.HitsoundTimingPoint.SampleSet;
                            var oldSlideFilename =
                                $"{oldSampleSet.ToString().ToLower()}-sliderslide{(oldIndex == 1 ? string.Empty : oldIndex.ToInvariant())}";
                            var oldSlidePath = Path.Combine(mapDir, oldSlideFilename);

                            if (firstSamples.ContainsKey(oldSlidePath))
                            {
                                oldSlidePath = firstSamples[oldSlidePath];
                                var slideGeneratingArgs = new SampleGeneratingArgs(oldSlidePath);
                                var newSlideFilename    =
                                    $"{sampleSet.ToString().ToLower()}-sliderslide{index.ToInvariant()}";

                                sampleSchema.Add(newSlideFilename,
                                                 new List <SampleGeneratingArgs> {
                                    slideGeneratingArgs
                                });
                            }
                        }

                        // Make sure the slider with the slider ticks uses auto sampleset so the customized greenlines control the hitsounds
                        tickSlider.SampleSet = SampleSet.Auto;

                        // Add timingpointschange
                        var tp = tloFrom.HitsoundTimingPoint.Copy();
                        tp.Offset      = sliderTickTime;
                        tp.SampleIndex = index;
                        tp.SampleSet   = sampleSet;
                        tp.Volume      = tloFrom.FenoSampleVolume;
                        timingPointsChanges.Add(new TimingPointsChange(tp, sampleset: arg.CopySampleSets,
                                                                       index: arg.CopySampleSets, volume: arg.CopyVolumes));

                        // Add timingpointschange 5ms later to revert the stuff back to whatever it should be
                        var tp2 = tloFrom.HitsoundTimingPoint.Copy();
                        tp2.Offset = sliderTickTime + 5;
                        timingPointsChanges.Add(new TimingPointsChange(tp2, sampleset: arg.CopySampleSets,
                                                                       index: arg.CopySampleSets, volume: arg.CopyVolumes));

                        CustomSampledTimes.Add((int)sliderTickTime);
                    }
                }
        private void Make_Hitsounds(Arguments arg, BackgroundWorker worker, DoWorkEventArgs _)
        {
            if (arg.Debug)
            {
                // Convert the multiple layers into packages that have the samples from all the layers at one specific time
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample);
                UpdateProgressBar(worker, 10);

                // Balance the volume between greenlines and samples
                HitsoundConverter.BalanceVolumes(samplePackages, new VolumeBalancingArgs(0, false));
                UpdateProgressBar(worker, 20);

                // Load the samples so validation can be done
                HashSet <SampleGeneratingArgs> allSampleArgs = new HashSet <SampleGeneratingArgs>();
                foreach (SamplePackage sp in samplePackages)
                {
                    allSampleArgs.UnionWith(sp.Samples.Select(o => o.SampleArgs));
                }
                var loadedSamples = SampleImporter.ImportSamples(allSampleArgs);
                UpdateProgressBar(worker, 40);

                // Convert the packages to hitsounds that fit on an osu standard map
                CompleteHitsounds completeHitsounds = HitsoundConverter.GetCompleteHitsounds(samplePackages, loadedSamples);
                UpdateProgressBar(worker, 60);

                int samples = completeHitsounds.CustomIndices.SelectMany(ci => ci.Samples.Values).Count(h => h.Any(SampleImporter.ValidateSampleArgs));
                UpdateProgressBar(worker, 80);

                int greenlines = 0;
                int lastIndex  = -1;
                foreach (var hit in completeHitsounds.Hitsounds.Where(hit => hit.CustomIndex != lastIndex))
                {
                    lastIndex = hit.CustomIndex;
                    greenlines++;
                }
                UpdateProgressBar(worker, 100);

                MessageBox.Show(
                    $"Number of sample indices: {completeHitsounds.CustomIndices.Count}, Number of samples: {samples}, Number of greenlines: {greenlines}");
            }
            else
            {
                // Convert the multiple layers into packages that have the samples from all the layers at one specific time
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample);
                UpdateProgressBar(worker, 10);

                // Balance the volume between greenlines and samples
                HitsoundConverter.BalanceVolumes(samplePackages, new VolumeBalancingArgs(0, false));
                UpdateProgressBar(worker, 20);

                // Load the samples so validation can be done
                HashSet <SampleGeneratingArgs> allSampleArgs = new HashSet <SampleGeneratingArgs>();
                foreach (SamplePackage sp in samplePackages)
                {
                    allSampleArgs.UnionWith(sp.Samples.Select(o => o.SampleArgs));
                }
                var loadedSamples = SampleImporter.ImportSamples(allSampleArgs);
                UpdateProgressBar(worker, 30);

                // Convert the packages to hitsounds that fit on an osu standard map
                CompleteHitsounds completeHitsounds = HitsoundConverter.GetCompleteHitsounds(samplePackages, loadedSamples);
                UpdateProgressBar(worker, 60);

                // Delete all files in the export folder before filling it again
                DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                foreach (FileInfo file in di.GetFiles())
                {
                    file.Delete();
                }
                UpdateProgressBar(worker, 80);

                // Export the hitsound .osu and sound samples
                HitsoundExporter.ExportCompleteHitsounds(arg.ExportFolder, arg.BaseBeatmap, completeHitsounds, loadedSamples);
                UpdateProgressBar(worker, 99);

                // Open export folder
                System.Diagnostics.Process.Start(arg.ExportFolder);
            }
            // Collect garbage
            GC.Collect();

            UpdateProgressBar(worker, 100);
        }
Beispiel #6
0
        private string Make_Hitsounds(HitsoundStudioVm arg, BackgroundWorker worker, DoWorkEventArgs _)
        {
            string result = string.Empty;

            if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Standard)
            {
                // Convert the multiple layers into packages that have the samples from all the layers at one specific time
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample);
                UpdateProgressBar(worker, 10);

                // Balance the volume between greenlines and samples
                HitsoundConverter.BalanceVolumes(samplePackages, 0, false);
                UpdateProgressBar(worker, 20);

                // Load the samples so validation can be done
                HashSet <SampleGeneratingArgs> allSampleArgs = new HashSet <SampleGeneratingArgs>();
                foreach (SamplePackage sp in samplePackages)
                {
                    allSampleArgs.UnionWith(sp.Samples.Select(o => o.SampleArgs));
                }

                var loadedSamples = SampleImporter.ImportSamples(allSampleArgs);
                UpdateProgressBar(worker, 30);

                // Convert the packages to hitsounds that fit on an osu standard map
                CompleteHitsounds completeHitsounds =
                    HitsoundConverter.GetCompleteHitsounds(samplePackages, loadedSamples);
                UpdateProgressBar(worker, 60);

                if (arg.ShowResults)
                {
                    // Count the number of samples
                    int samples = completeHitsounds.CustomIndices.SelectMany(ci => ci.Samples.Values)
                                  .Count(h => h.Any(SampleImporter.ValidateSampleArgs));

                    // Count the number of changes of custom index
                    int greenlines = 0;
                    int lastIndex  = -1;
                    foreach (var hit in completeHitsounds.Hitsounds.Where(hit => hit.CustomIndex != lastIndex))
                    {
                        lastIndex = hit.CustomIndex;
                        greenlines++;
                    }

                    result = $"Number of sample indices: {completeHitsounds.CustomIndices.Count}, " +
                             $"Number of samples: {samples}, Number of greenlines: {greenlines}";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }

                UpdateProgressBar(worker, 70);

                // Export the hitsound map and sound samples
                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(completeHitsounds.Hitsounds, arg.BaseBeatmap, arg.ExportFolder);
                }

                UpdateProgressBar(worker, 80);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportCustomIndices(completeHitsounds.CustomIndices, arg.ExportFolder,
                                                         loadedSamples);
                }

                UpdateProgressBar(worker, 99);
            }
            else if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Coinciding)
            {
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample, 0, false);

                HitsoundConverter.BalanceVolumes(samplePackages, 0, false, true);
                UpdateProgressBar(worker, 20);

                Dictionary <SampleGeneratingArgs, SampleSoundGenerator> loadedSamples = null;
                Dictionary <SampleGeneratingArgs, string>  sampleNames     = null;
                Dictionary <SampleGeneratingArgs, Vector2> samplePositions = null;
                var hitsounds = HitsoundConverter.GetHitsounds(samplePackages, ref loadedSamples, ref sampleNames, ref samplePositions);

                // Load the samples so validation can be done
                UpdateProgressBar(worker, 50);

                if (arg.ShowResults)
                {
                    result = "Number of sample indices: 0, " +
                             $"Number of samples: {loadedSamples.Count}, Number of greenlines: 0";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }
                UpdateProgressBar(worker, 60);

                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(hitsounds, arg.BaseBeatmap, arg.ExportFolder, false);
                }
                UpdateProgressBar(worker, 70);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportLoadedSamples(loadedSamples, arg.ExportFolder, sampleNames);
                }
            }
            else if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Storyboard)
            {
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample, 0, false);

                HitsoundConverter.BalanceVolumes(samplePackages, 0, false, true);
                UpdateProgressBar(worker, 20);

                Dictionary <SampleGeneratingArgs, SampleSoundGenerator> loadedSamples = null;
                Dictionary <SampleGeneratingArgs, string>  sampleNames     = null;
                Dictionary <SampleGeneratingArgs, Vector2> samplePositions = null;
                var hitsounds = HitsoundConverter.GetHitsounds(samplePackages, ref loadedSamples, ref sampleNames, ref samplePositions);

                // Load the samples so validation can be done
                UpdateProgressBar(worker, 50);

                if (arg.ShowResults)
                {
                    result = "Number of sample indices: 0, " +
                             $"Number of samples: {loadedSamples.Count}, Number of greenlines: 0";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }
                UpdateProgressBar(worker, 60);

                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(hitsounds, arg.BaseBeatmap, arg.ExportFolder, false, true);
                }
                UpdateProgressBar(worker, 70);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportLoadedSamples(loadedSamples, arg.ExportFolder, sampleNames);
                }
            }

            // Open export folder
            if (arg.ExportSamples || arg.ExportMap)
            {
                System.Diagnostics.Process.Start(arg.ExportFolder);
            }

            // Collect garbage
            GC.Collect();

            UpdateProgressBar(worker, 100);

            return(result);
        }
Beispiel #7
0
        public void TacomaWontLoad()
        {
            SampleImporter importer = new SampleImporter("tacoma1.txt");

            importer.ImportToDatabase();
        }
Beispiel #8
0
        private string Make_Hitsounds(HitsoundStudioVm arg, BackgroundWorker worker, DoWorkEventArgs _)
        {
            string result = string.Empty;

            bool validateSampleFile =
                !(arg.SingleSampleExportFormat == HitsoundExporter.SampleExportFormat.MidiChords ||
                  arg.MixedSampleExportFormat == HitsoundExporter.SampleExportFormat.MidiChords);

            var comparer = new SampleGeneratingArgsComparer(validateSampleFile);

            if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Standard)
            {
                // Convert the multiple layers into packages that have the samples from all the layers at one specific time
                // Don't add default sample when exporting midi files because that's not a final export.
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample, arg.ZipLayersLeniency, validateSampleFile);
                UpdateProgressBar(worker, 10);

                // Balance the volume between greenlines and samples
                HitsoundConverter.BalanceVolumes(samplePackages, 0, false);
                UpdateProgressBar(worker, 20);

                // Load the samples so validation can be done
                HashSet <SampleGeneratingArgs> allSampleArgs = new HashSet <SampleGeneratingArgs>(comparer);
                foreach (SamplePackage sp in samplePackages)
                {
                    allSampleArgs.UnionWith(sp.Samples.Select(o => o.SampleArgs));
                }

                var loadedSamples = SampleImporter.ImportSamples(allSampleArgs, comparer);
                UpdateProgressBar(worker, 30);

                // Convert the packages to hitsounds that fit on an osu standard map
                CompleteHitsounds completeHitsounds =
                    HitsoundConverter.GetCompleteHitsounds(samplePackages, loadedSamples,
                                                           arg.UsePreviousSampleSchema ? arg.PreviousSampleSchema.GetCustomIndices() : null,
                                                           arg.AllowGrowthPreviousSampleSchema, arg.FirstCustomIndex, validateSampleFile, comparer);
                UpdateProgressBar(worker, 60);

                // Save current sample schema
                if (!arg.UsePreviousSampleSchema)
                {
                    arg.PreviousSampleSchema = new SampleSchema(completeHitsounds.CustomIndices);
                }
                else if (arg.AllowGrowthPreviousSampleSchema)
                {
                    arg.PreviousSampleSchema.MergeWith(new SampleSchema(completeHitsounds.CustomIndices));
                }

                if (arg.ShowResults)
                {
                    // Count the number of samples
                    int samples = completeHitsounds.CustomIndices.SelectMany(ci => ci.Samples.Values)
                                  .Count(h => h.Any(o =>
                                                    SampleImporter.ValidateSampleArgs(o, loadedSamples, validateSampleFile)));

                    // Count the number of changes of custom index
                    int greenlines = 0;
                    int lastIndex  = -1;
                    foreach (var hit in completeHitsounds.Hitsounds.Where(hit => hit.CustomIndex != lastIndex))
                    {
                        lastIndex = hit.CustomIndex;
                        greenlines++;
                    }

                    result = $"Number of sample indices: {completeHitsounds.CustomIndices.Count}, " +
                             $"Number of samples: {samples}, Number of greenlines: {greenlines}";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }

                UpdateProgressBar(worker, 70);

                // Export the hitsound map and sound samples
                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(completeHitsounds.Hitsounds,
                                                     arg.BaseBeatmap, arg.ExportFolder, arg.HitsoundDiffName, arg.HitsoundExportGameMode, true, false);
                }

                UpdateProgressBar(worker, 80);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportCustomIndices(completeHitsounds.CustomIndices, arg.ExportFolder,
                                                         loadedSamples, arg.SingleSampleExportFormat, arg.MixedSampleExportFormat, comparer);
                }

                UpdateProgressBar(worker, 99);
            }
            else if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Coinciding)
            {
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample, 0, false);

                HitsoundConverter.BalanceVolumes(samplePackages, 0, false, true);
                UpdateProgressBar(worker, 20);

                Dictionary <SampleGeneratingArgs, SampleSoundGenerator> loadedSamples = null;
                Dictionary <SampleGeneratingArgs, string>  sampleNames     = arg.UsePreviousSampleSchema ? arg.PreviousSampleSchema?.GetSampleNames(comparer) : null;
                Dictionary <SampleGeneratingArgs, Vector2> samplePositions = null;
                var hitsounds = HitsoundConverter.GetHitsounds(samplePackages, ref loadedSamples, ref sampleNames, ref samplePositions,
                                                               arg.HitsoundExportGameMode == GameMode.Mania, arg.AddCoincidingRegularHitsounds, arg.AllowGrowthPreviousSampleSchema,
                                                               validateSampleFile, comparer);

                // Save current sample schema
                if (!arg.UsePreviousSampleSchema || arg.PreviousSampleSchema == null)
                {
                    arg.PreviousSampleSchema = new SampleSchema(sampleNames);
                }
                else if (arg.AllowGrowthPreviousSampleSchema)
                {
                    arg.PreviousSampleSchema.MergeWith(new SampleSchema(sampleNames));
                }

                // Load the samples so validation can be done
                UpdateProgressBar(worker, 50);

                if (arg.ShowResults)
                {
                    result = "Number of sample indices: 0, " +
                             $"Number of samples: {loadedSamples.Count}, Number of greenlines: 0";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }
                UpdateProgressBar(worker, 60);

                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(hitsounds,
                                                     arg.BaseBeatmap, arg.ExportFolder, arg.HitsoundDiffName, arg.HitsoundExportGameMode, false, false);
                }
                UpdateProgressBar(worker, 70);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportLoadedSamples(loadedSamples, arg.ExportFolder, sampleNames, arg.SingleSampleExportFormat, comparer);
                }
            }
            else if (arg.HitsoundExportModeSetting == HitsoundStudioVm.HitsoundExportMode.Storyboard)
            {
                List <SamplePackage> samplePackages = HitsoundConverter.ZipLayers(arg.HitsoundLayers, arg.DefaultSample, 0, false);

                HitsoundConverter.BalanceVolumes(samplePackages, 0, false, true);
                UpdateProgressBar(worker, 20);

                Dictionary <SampleGeneratingArgs, SampleSoundGenerator> loadedSamples = null;
                Dictionary <SampleGeneratingArgs, string>  sampleNames     = arg.UsePreviousSampleSchema ? arg.PreviousSampleSchema?.GetSampleNames(comparer) : null;
                Dictionary <SampleGeneratingArgs, Vector2> samplePositions = null;
                var hitsounds = HitsoundConverter.GetHitsounds(samplePackages, ref loadedSamples, ref sampleNames, ref samplePositions,
                                                               false, false, arg.AllowGrowthPreviousSampleSchema, validateSampleFile, comparer);

                // Save current sample schema
                if (!arg.UsePreviousSampleSchema || arg.PreviousSampleSchema == null)
                {
                    arg.PreviousSampleSchema = new SampleSchema(sampleNames);
                }
                else if (arg.AllowGrowthPreviousSampleSchema)
                {
                    arg.PreviousSampleSchema.MergeWith(new SampleSchema(sampleNames));
                }

                // Load the samples so validation can be done
                UpdateProgressBar(worker, 50);

                if (arg.ShowResults)
                {
                    result = "Number of sample indices: 0, " +
                             $"Number of samples: {loadedSamples.Count}, Number of greenlines: 0";
                }

                if (arg.DeleteAllInExportFirst && (arg.ExportSamples || arg.ExportMap))
                {
                    // Delete all files in the export folder before filling it again
                    DirectoryInfo di = new DirectoryInfo(arg.ExportFolder);
                    foreach (FileInfo file in di.GetFiles())
                    {
                        file.Delete();
                    }
                }
                UpdateProgressBar(worker, 60);

                if (arg.ExportMap)
                {
                    HitsoundExporter.ExportHitsounds(hitsounds,
                                                     arg.BaseBeatmap, arg.ExportFolder, arg.HitsoundDiffName, arg.HitsoundExportGameMode, false, true);
                }
                UpdateProgressBar(worker, 70);

                if (arg.ExportSamples)
                {
                    HitsoundExporter.ExportLoadedSamples(loadedSamples, arg.ExportFolder, sampleNames, arg.SingleSampleExportFormat, comparer);
                }
            }

            // Open export folder
            if (arg.ExportSamples || arg.ExportMap)
            {
                System.Diagnostics.Process.Start("explorer.exe", arg.ExportFolder);
            }

            // Collect garbage
            GC.Collect();

            UpdateProgressBar(worker, 100);

            return(result);
        }