1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- namespace etoy
- {
- sealed class KeyValueTable
- {
- public string Name;
- public string Path;
- public KeyValueRow[] Rows;
- }
- sealed class KeyValueRow
- {
- public string Key;
- public string Value;
- public string Type;
- public string Description;
- public string Tag;
- public int Row;
- /// <summary>
- /// 是否是服务端字段
- /// </summary>
- public bool IsServerField => OutputTag.HasFlag(KeyValueTag.Server);
- /// <summary>
- /// 是否是客户端字段
- /// </summary>
- public bool IsClientField => OutputTag.HasFlag(KeyValueTag.Client);
- public KeyValueTag OutputTag
- {
- get
- {
- if (string.IsNullOrEmpty(Tag))
- return KeyValueTag.All;
- var result = KeyValueTag.None;
- if (Tag.Contains('c', StringComparison.OrdinalIgnoreCase))
- {
- result |= KeyValueTag.Client;
- }
- if (Tag.Contains('s', StringComparison.OrdinalIgnoreCase))
- {
- result |= KeyValueTag.Server;
- }
- if (result == KeyValueTag.None)
- {
- throw new Exception($"error tag, FieldName(Output) tags({Tag})");
- }
- return result;
- }
- }
- }
- enum KeyValueColumn
- {
- Key = 0,
- Value = 1,
- Type = 2,
- Description = 3,
- Tag = 4,
- }
- enum KeyValueTag
- {
- None = 0,
- Client = 0x1,
- Server = 0x10,
- All = Client | Server,
- }
- }
|