Skip to content

Commit

Permalink
Add dequeue system selection in preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
ButterscotchV committed Jan 31, 2024
1 parent 36c9a17 commit 5a259cd
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
26 changes: 26 additions & 0 deletions ButterSTT/Config/EnumConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Text.Json.Serialization;

namespace ButterSTT.Config
{
public struct EnumConfig<T>
where T : struct, Enum
{
[JsonPropertyName("options")]
public readonly string[] Options { get; } = Enum.GetNames<T>();

[JsonPropertyName("value")]
public string Value { get; set; } = "";

[JsonIgnore]
public T EnumValue
{
readonly get => Enum.Parse<T>(Value, ignoreCase: true);
set => Value = Enum.GetName(value)!;
}

public EnumConfig(T value)
{
EnumValue = value;
}
}
}
7 changes: 6 additions & 1 deletion ButterSTT/Config/STTConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Net;
using System.Text.Json.Serialization;
using ButterSTT.MessageSystem;

namespace ButterSTT.Config
{
Expand All @@ -8,7 +9,7 @@ public record STTConfig
public static readonly STTConfig Default = new();

[JsonPropertyName("config_version")]
public int ConfigVersion { get; set; } = 0;
public int ConfigVersion { get; set; } = 1;

[JsonPropertyName("models_path")]
public string ModelsPath { get; set; } = "Models";
Expand All @@ -25,6 +26,10 @@ public record STTConfig
[JsonPropertyName("message_length")]
public int MessageLength { get; set; } = 144;

[JsonPropertyName("dequeue_system")]
public EnumConfig<DequeueSystems> DequeueSystem { get; set; } =
new(DequeueSystems.Pagination);

[JsonPropertyName("max_words_dequeued")]
public int MaxWordsDequeued { get; set; } = 10;

Expand Down
8 changes: 8 additions & 0 deletions ButterSTT/MessageSystem/DequeueSystems.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ButterSTT.MessageSystem
{
public enum DequeueSystems
{
Scrolling,
Pagination,
}
}

0 comments on commit 5a259cd

Please sign in to comment.