Skip to content

Commit

Permalink
Updated preset/process/parameter UI
Browse files Browse the repository at this point in the history
Added button to toggle map filters
Added delete confirmation to presets
  • Loading branch information
Exactol committed Jan 2, 2023
1 parent 0ae23ed commit 0fb0c4d
Show file tree
Hide file tree
Showing 5 changed files with 341 additions and 65 deletions.
22 changes: 21 additions & 1 deletion CompilePalX/Configuration/ConfigurationManager.cs
Expand Up @@ -16,7 +16,7 @@

namespace CompilePalX
{
public class Preset : IEquatable<Preset>
public class Preset : IEquatable<Preset>, ICloneable
{
public string Name { get; set; }
public string? Map { get; set; }
Expand All @@ -41,6 +41,10 @@ public override int GetHashCode()
{
return HashCode.Combine(Name, MapRegex, Map);
}
public object Clone()
{
return this.MemberwiseClone();
}

/// <summary>
/// Returns whether a map can use the preset
Expand Down Expand Up @@ -284,6 +288,22 @@ public static Preset NewPreset(Preset preset)
return preset;
}

public static Preset? EditPreset(Preset preset)
{
if (CurrentPreset == null)
{
return null;
}

// "Edit" preset by deleting the current preset and adding a new preset, then make it the currently selected preset
RemovePreset(CurrentPreset);
var newPreset = NewPreset(preset);

CurrentPreset = newPreset;

return newPreset;
}

private static string GetPresetFolder(Preset preset)
{
return preset.Map != null ? Path.Combine(PresetsFolder, $"{preset.Name}_{preset.Map}") : Path.Combine(PresetsFolder, preset.Name);
Expand Down

0 comments on commit 0fb0c4d

Please sign in to comment.