-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [CastViewer] Add special symbols table
- Loading branch information
1 parent
c48de95
commit 8e18441
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
viewer/CastViewer/CastViewer.Core/Model/SpSymbolTableColumn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using CevioCasts; | ||
|
||
namespace CastViewer.Core.Model; | ||
|
||
public record SpSymbolTableColumn | ||
( | ||
Category Cat, | ||
string CastName, | ||
Product Product, | ||
IEnumerable<DisplaySpSymbol> SpSymbols | ||
) | ||
{ | ||
public string Category { get; } = Cat switch | ||
{ | ||
CevioCasts.Category.SingerSong => "Song", | ||
CevioCasts.Category.TextVocal => "Talk", | ||
_ => "ERROR" | ||
}; | ||
public string? LabelFalsetto { get; } = GetName(SpSymbols, ["$", "$", "※"]); | ||
public string? LabelAtmark { get; } = GetName(SpSymbols, ["@", "@"]); | ||
public string? LabelCaret { get; } = GetName(SpSymbols, ["^", "^"]); | ||
public string? LabelPercent { get; } = GetName(SpSymbols, ["%", "%"]); | ||
public string? LabelEqual { get; } = GetName(SpSymbols, ["=", "="]); | ||
public string? LabelUnderscore { get; } = GetName(SpSymbols, ["_","_"]); | ||
|
||
private static string GetName(IEnumerable<DisplaySpSymbol> spSymbols, IReadOnlyList<string> labels) | ||
{ | ||
var symbol = spSymbols | ||
.FirstOrDefault(s => s.Symbols?.Any(v => labels.Contains(v)) == true); | ||
var label = symbol?.Names?[0] | ||
?? string.Empty; | ||
var version = symbol?.Versions?.Count == 1 ? symbol?.Versions?.LastOrDefault() ?? string.Empty : string.Empty; | ||
return (version is []) ? label : $"{label} ({version})"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters