Skip to content

Commit

Permalink
Fix text search in sheets
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Nov 15, 2024
1 parent d01c858 commit d2ec9e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Alpha/Gui/Windows/ExcelWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,11 @@ private void ContentFilterSimple(string filter) {
this.filteredRows = new();
var colCount = this.selectedSheet!.Columns.Count;
for (var i = 0u; i < this.selectedSheet.Count; i++) {
foreach (var row in this.selectedSheet.GetRows()) {
if (this.contentFilterCts?.Token.IsCancellationRequested == true) return;
var row = this.selectedSheet.GetRow(i);
if (row is null) continue;
var rowStr = row.Row.ToString();
if (row.Subrow is not null) rowStr += $".{row.Subrow}";
if (rowStr.Contains(filter, StringComparison.CurrentCultureIgnoreCase)) {
this.filteredRows!.Add((row.Row, row.Subrow));
continue;
Expand All @@ -385,6 +383,9 @@ private void ContentFilterSimple(string filter) {
}
}
}
this.contentFilterCts?.Dispose();
this.contentFilterCts = null;
}, this.contentFilterCts!.Token);
}

Expand Down
4 changes: 4 additions & 0 deletions Alpha/Services/Excel/ExcelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ExcelService(WindowManagerService windowManager, ILogger<ExcelServi
.ToArray()) ?? [];

private readonly HttpClient httpClient = new();
private readonly List<string> resolvingDefinitions = new();

public void Dispose() {
this.httpClient.Dispose();
Expand Down Expand Up @@ -68,6 +69,9 @@ public Cell GetCell(IAlphaSheet sheet, uint row, ushort? subrow, uint column, ob
: null;

private void ResolveSheetDefinition(string name) {
if (this.resolvingDefinitions.Contains(name)) return;
this.resolvingDefinitions.Add(name);

// TODO: exdschema
var url =
$"https://raw.githubusercontent.com/xivapi/SaintCoinach/master/SaintCoinach/Definitions/{name}.json";
Expand Down

0 comments on commit d2ec9e7

Please sign in to comment.