private static void HandleParsedPresetEvent(object sender, PresetDataEventArgs e)
        {
            if (string.IsNullOrEmpty(e.ParentSetListName))
            {
                throw new ArgumentException(nameof(e.ParentSetListName));
            }

            if (string.IsNullOrEmpty(e.PresetName))
            {
                throw new ArgumentException(nameof(e.PresetName));
            }

            if (string.IsNullOrEmpty(e.PresetData))
            {
                throw new ArgumentException(nameof(e.PresetData));
            }

            var presetsFolder = Path.Combine(OutputFolder, SetListsFolder, e.ParentSetListName, PresetsFolder);

            Directory.CreateDirectory(presetsFolder);

            if (!Directory.Exists(presetsFolder))
            {
                throw new Exception($"Cannot create folder: {presetsFolder}");
            }

            var filePath = Path.Combine(presetsFolder, e.SuggestedFileName);

            File.WriteAllText(filePath, e.PresetData);
        }
Example #2
0
 private void OnParsedPresetEvent(PresetDataEventArgs e)
 {
     ParsedPresetEvent?.Invoke(this, e);
 }