调整目录结构

This commit is contained in:
2025-08-29 09:11:08 +08:00
parent efb64ce7bc
commit 1fff9db9ca
351 changed files with 304 additions and 215 deletions

View File

@@ -0,0 +1,44 @@
using System.Collections.Generic;
using System.Linq;
namespace NBF.Setting
{
public class OptionTable<T>
{
public struct OptionEntry
{
public string Name;
public T Value;
public OptionEntry(string name, T value)
{
this.Name = name;
this.Value = value;
}
}
List<OptionEntry> entries = new List<OptionEntry>();
public void Add(string name, T value)
{
entries.Add(new OptionEntry(name, value));
}
public List<string> GetNames() => entries.Select(x => x.Name).ToList();
public List<T> GetValues() => entries.Select(x => x.Value).ToList();
public T GetValue(int index)
{
if (entries == null) return default;
if (index < 0 || index >= entries.Count) return default;
return entries[index].Value;
}
public string GetName(int index)
{
if (entries == null) return string.Empty;
if (index < 0 || index >= entries.Count) return string.Empty;
return entries[index].Name;
}
}
}