Browse Source

feat(Search) Search hotkey now working. CMD + K

main
Jonathan McCaffrey 4 years ago
parent
commit
ba2eeec13f
  1. 16
      Components/Components.csproj
  2. 36
      Components/Form/FormNumberComponent.razor
  3. 7
      Components/Form/FormTextComponent.razor
  4. 20
      Components/Inputs/SearchButtonComponent.razor
  5. 42
      Components/Navigation/DesktopNavComponent.razor
  6. 4
      Components/Navigation/DesktopNavLinkComponent.razor
  7. 2
      Contexts/Contexts.csproj
  8. 10
      IGP/App.razor
  9. BIN
      IGP/Database.db
  10. 40
      IGP/Dialog/SearchDialogComponent.razor
  11. 18
      IGP/IGP.csproj
  12. 2
      IGP/Index.razor
  13. 7
      IGP/PageLayout.razor
  14. 2
      IGP/Pages/AnaltyicsPage.razor
  15. 2
      IGP/Pages/EconomyComparison.razor
  16. 2
      IGP/Pages/PermissionsPage.razor
  17. 2
      IGP/Pages/StoragePage.razor
  18. 31
      IGP/Portals/SearchPortal.razor
  19. 6
      IGP/wwwroot/content/docs/cheat-sheet.md
  20. 5
      IGP/wwwroot/content/docs/project-data.md
  21. 5
      IGP/wwwroot/content/docs/setup.md
  22. 5
      IGP/wwwroot/content/notes/coop/holdout.md
  23. 9
      IGP/wwwroot/content/notes/settings/hotkeys.md
  24. 5
      IGP/wwwroot/content/notes/the-basics/armor-types.md
  25. 6
      IGP/wwwroot/content/notes/the-basics/economy-overview.md
  26. 6
      IGP/wwwroot/content/notes/the-basics/families-factions-and-immortal-vanguards.md
  27. 6
      IGP/wwwroot/content/notes/the-basics/immortal-spells-and-pyre.md
  28. 5
      IGP/wwwroot/content/notes/the-basics/timing-and-scouting.md
  29. 2
      IGP/wwwroot/generated/GitChangeModels.json
  30. 2
      IGP/wwwroot/generated/GitPatchModels.json
  31. 15
      IGP/wwwroot/index.html
  32. 12
      IGP_Convert/IGP_Convert.csproj
  33. 2
      Model/BuildOrders/BuildOrderModel.cs
  34. 8
      Model/Model.csproj
  35. 27
      Model/Notes/NoteContentModel.cs
  36. 8
      Services/IServices.cs
  37. 11
      Services/Immortal/BuildOrderService.cs
  38. 9
      Services/Immortal/EconomyService.cs
  39. 2
      Services/Immortal/TimingService.cs
  40. 4
      Services/Services.csproj
  41. 3
      Services/Website/EntityDialogService.cs
  42. 75
      Services/Website/SearchService.cs

16
Components/Components.csproj

@ -15,24 +15,24 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<SupportedPlatform Include="browser" /> <SupportedPlatform Include="browser"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.28.1" /> <PackageReference Include="Markdig" Version="0.28.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0-preview.2.22153.2"/>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Inputs\" /> <Folder Include="Inputs\"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj" /> <ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Inputs\" /> <None Remove="Inputs\"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

36
Components/Form/FormNumberComponent.razor

@ -48,25 +48,25 @@
void OnInputChanged(ChangeEventArgs changeEventArgs) void OnInputChanged(ChangeEventArgs changeEventArgs)
{ {
int valueWas = Value; var valueWas = Value;
int newValue = int.Parse(changeEventArgs.Value!.ToString()!); var newValue = int.Parse(changeEventArgs.Value!.ToString()!);
if (newValue > Max)
{
newValue = Max;
}
if (newValue < Min)
{
newValue = Min;
}
if (valueWas != newValue) if (newValue > Max)
{ {
Value = newValue; newValue = Max;
changeEventArgs.Value = newValue; }
OnChange.InvokeAsync(changeEventArgs);
} if (newValue < Min)
{
newValue = Min;
}
if (valueWas != newValue)
{
Value = newValue;
changeEventArgs.Value = newValue;
OnChange.InvokeAsync(changeEventArgs);
}
} }
[Parameter] [Parameter]

7
Components/Form/FormTextComponent.razor

@ -11,7 +11,7 @@
placeholder="@Placeholder" placeholder="@Placeholder"
type="text" type="text"
value="@Value" value="@Value"
id="@labelId" id="@Id"
@oninput="OnChange" @oninput="OnChange"
@onchange="OnChange"/> @onchange="OnChange"/>
</div> </div>
@ -51,6 +51,9 @@
@code { @code {
[Parameter]
public string Id { get; set; } = "";
[Parameter] [Parameter]
public string Label { get; set; } = ""; public string Label { get; set; } = "";
@ -62,7 +65,7 @@
[Parameter] [Parameter]
public EventCallback<ChangeEventArgs> OnChange { get; set; } public EventCallback<ChangeEventArgs> OnChange { get; set; }
[Parameter] [Parameter]
public bool ReadOnly { get; set; } public bool ReadOnly { get; set; }

20
Components/Inputs/SearchButtonComponent.razor

@ -1,5 +1,4 @@
@using System.Runtime.InteropServices @inject ISearchService searchService
@inject ISearchService searchService
@inject NavigationManager navigationManager @inject NavigationManager navigationManager
@inject IJSRuntime jsRuntime @inject IJSRuntime jsRuntime
@ -7,13 +6,9 @@
<div class="searchText"> <div class="searchText">
Search... Search...
</div> </div>
@if (false) <div class="searchHotkey">
{ @CommandKey + K
<div class="searchHotkey"> </div>
@CommandKey + K
</div>
}
</button> </button>
<style> <style>
@ -35,6 +30,7 @@
.searchHotkey { .searchHotkey {
padding: 2px; padding: 2px;
background-color: var(--info);
border: 2px solid var(--primary-border); border: 2px solid var(--primary-border);
} }
@ -42,20 +38,22 @@
@code { @code {
[Parameter] [Parameter]
public RenderFragment ChildContent { get; set; } = default!; public RenderFragment ChildContent { get; set; } = default!;
private string userAgent = ""; private string userAgent = "";
string CommandKey => userAgent.Contains("Mac OS") ? "CMD" : "Ctrl"; string CommandKey => userAgent.Contains("Mac OS") ? "CMD" : "Ctrl";
private void ButtonClicked(EventArgs eventArgs) private void ButtonClicked(EventArgs eventArgs)
{ {
searchService.Show(); searchService.Show();
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
userAgent = await jsRuntime.InvokeAsync<string>("getUserAgent"); userAgent = await jsRuntime.InvokeAsync<string>("getUserAgent");
} }
} }

42
Components/Navigation/DesktopNavComponent.razor

@ -17,31 +17,31 @@
</NavLink> </NavLink>
<div class="sectionNavs"> <div class="sectionNavs">
@foreach (var webSection in WebSections) @foreach (var webSection in WebSections)
{
var isSelected = navigationService.GetNavigationSectionId().Equals(webSection.Id);
var sectionButtonStyle = "sectionButton";
if (isSelected)
{ {
sectionButtonStyle += " sectionButtonSelected"; var isSelected = navigationService.GetNavigationSectionId().Equals(webSection.Id);
} var sectionButtonStyle = "sectionButton";
if (isSelected)
<div class="sectionNav">
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">@webSection.Name</button>
@if (isSelected)
{ {
<div class="navMenuPosition"> sectionButtonStyle += " sectionButtonSelected";
<div class="navMenuContainer">
<DesktopNavSectionComponent Section=webSection />
</div>
</div>
} }
</div>
} <div class="sectionNav">
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">@webSection.Name</button>
@if (isSelected)
{
<div class="navMenuPosition">
<div class="navMenuContainer">
<DesktopNavSectionComponent Section=webSection/>
</div>
</div>
}
</div>
}
</div> </div>
<SearchButtonComponent /> <SearchButtonComponent/>
</div> </div>
</div> </div>

4
Components/Navigation/DesktopNavLinkComponent.razor

@ -11,9 +11,7 @@
} }
else else
{ {
<NavLink @onclick="() => { <NavLink @onclick="() => { navigationService.ChangeNavigationState(NavigationStateType.Default); navigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink">
navigationService.ChangeNavigationState(NavigationStateType.Default);
navigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink">
<div class="navName"> <div class="navName">
@Page.Name @Page.Name
</div> </div>

2
Contexts/Contexts.csproj

@ -15,7 +15,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

10
IGP/App.razor

@ -15,7 +15,8 @@
<EntityDialogPortal/> <EntityDialogPortal/>
<ToastPortal/> <ToastPortal/>
<SearchPortal /> <SearchPortal/>
<style> <style>
a { a {
@ -68,11 +69,4 @@
@code { @code {
#if NO_SQL
#else
[Inject]
DatabaseContext Database { get; set; }
#endif
} }

BIN
IGP/Database.db

Binary file not shown.

40
IGP/Dialog/SearchDialogComponent.razor

@ -5,24 +5,24 @@
@inject NavigationManager navigationManager @inject NavigationManager navigationManager
@if (searchService.IsLoaded()) @if (searchService.IsLoaded() && searchService.IsVisible)
{ {
<div class="searchBackground" onclick="@CloseDialog"> <div class="searchBackground" onclick="@CloseDialog">
<div class="searchContainer" <div class="searchContainer"
@onclick:preventDefault="true" @onclick:preventDefault="true"
@onclick:stopPropagation="true"> @onclick:stopPropagation="true">
<FormLayoutComponent> <FormLayoutComponent>
<FormTextComponent Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent> <FormTextComponent Id="search-input-box" Placeholder="Search..." OnChange="SearchChanged"></FormTextComponent>
</FormLayoutComponent> </FormLayoutComponent>
<div class="searchBox"> <div class="searchBox">
@if (SearchText.Length > 0) @if (SearchText.Length > 0)
{ {
foreach (var searchSection in searchService.Searches) foreach (var searchSection in searchService.Searches)
{ {
var searchPoints = searchSection.Value.FindAll(x => x.Title.ToLower().Contains(SearchText.ToLower())); var searchPoints = searchSection.Value.FindAll(x => x.Title.ToLower().Contains(SearchText.ToLower()));
@if (searchPoints.Count > 0) @if (searchPoints.Count > 0)
{ {
<div> <div>
@ -30,22 +30,20 @@
@searchSection.Key @searchSection.Key
</div> </div>
<div class="searchContents"> <div class="searchContents">
@foreach (var searchPoint in searchPoints) @foreach (var searchPoint in searchPoints)
{ {
<button class="searchLink @searchPoint.PointType.ToLower()" @onclick="() => OnSearch(searchPoint)">@searchPoint.Title</button> <button class="searchLink @searchPoint.PointType.ToLower()" @onclick="() => OnSearch(searchPoint)">@searchPoint.Title</button>
} }
</div> </div>
</div> </div>
} }
} }
} }
</div> </div>
</div> </div>
</div> </div>
<style> <style>
.pageContents * { .pageContents * {
filter: blur(2px); filter: blur(2px);
@ -110,7 +108,6 @@
} }
</style> </style>
} }
@ -125,12 +122,17 @@
searchService.Subscribe(OnSearchChanged); searchService.Subscribe(OnSearchChanged);
} }
private System.Threading.Timer timer = null!;
private void OnSearchChanged() private void OnSearchChanged()
{ {
if (searchService.IsVisible) if (searchService.IsVisible)
{ {
jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-dialog-input"); timer = new System.Threading.Timer(_ =>
{
jsRuntime.InvokeVoidAsync("SetFocusToElement", "search-input-box");
InvokeAsync(StateHasChanged);
}, null, 1, 1);
} }
} }
@ -149,15 +151,13 @@
{ {
if (url.Contains("#")) if (url.Contains("#"))
{ {
navigationManager.NavigateTo(url,
navigationManager.NavigateTo(url, navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
} }
else else
{ {
navigationManager.NavigateTo(url); navigationManager.NavigateTo(url);
} }
} }
private void SearchChanged(ChangeEventArgs obj) private void SearchChanged(ChangeEventArgs obj)

18
IGP/IGP.csproj

@ -20,10 +20,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.28.1" /> <PackageReference Include="Markdig" Version="0.28.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all"/>
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.0-preview.2.22153.2"/>
<!-- <!--
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
@ -32,17 +32,17 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" /> <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Components\Components.csproj" /> <ProjectReference Include="..\Components\Components.csproj"/>
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj"/>
<ProjectReference Include="..\Services\Services.csproj" /> <ProjectReference Include="..\Services\Services.csproj"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\generated" /> <Folder Include="wwwroot\generated"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
IGP/Index.razor

@ -3,7 +3,7 @@
@layout PageLayout @layout PageLayout
<DevOnlyComponent> <DevOnlyComponent>
<SearchButtonComponent /> <SearchButtonComponent/>
</DevOnlyComponent> </DevOnlyComponent>
<HomePage/> <HomePage/>

7
IGP/PageLayout.razor

@ -39,19 +39,18 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await webService.Load(); await webService.Load();
await Focus();
await Focus();
} }
private async Task Focus() private async Task Focus()
{ {
// await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents); // await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents);
} }
protected override async void OnAfterRender(bool firstRender) protected override async void OnAfterRender(bool firstRender)
{ {
// await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents); // await jsRuntime.InvokeVoidAsync("SetFocusToElement", pageContents);
} }
void IDisposable.Dispose() void IDisposable.Dispose()

2
IGP/Pages/AnaltyicsPage.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title> <Title>Not Implemented</Title>
<Message></Message> <Message></Message>
</AlertComponent> </AlertComponent>
<PaperComponent> <PaperComponent>
TODO TODO
</PaperComponent> </PaperComponent>

2
IGP/Pages/EconomyComparison.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title> <Title>Not Implemented</Title>
<Message></Message> <Message></Message>
</AlertComponent> </AlertComponent>
<PaperComponent> <PaperComponent>
TODO TODO
</PaperComponent> </PaperComponent>

2
IGP/Pages/PermissionsPage.razor

@ -8,7 +8,7 @@
<Title>Not Implemented</Title> <Title>Not Implemented</Title>
<Message></Message> <Message></Message>
</AlertComponent> </AlertComponent>
<PaperComponent> <PaperComponent>
TODO TODO
</PaperComponent> </PaperComponent>

2
IGP/Pages/StoragePage.razor

@ -7,7 +7,7 @@
<Title>Not Implemented</Title> <Title>Not Implemented</Title>
<Message></Message> <Message></Message>
</AlertComponent> </AlertComponent>
<PaperComponent> <PaperComponent>
TODO TODO
</PaperComponent> </PaperComponent>

31
IGP/Portals/SearchPortal.razor

@ -1,14 +1,13 @@
@implements IDisposable; @implements IDisposable;
@inject ISearchService searchService @inject ISearchService searchService
@inject IJSRuntime jsRuntime
@if (searchService.IsVisible) <SearchDialogComponent></SearchDialogComponent>
{
<SearchDialogComponent></SearchDialogComponent>
}
@code { @code {
private string test = "Q";
protected override void OnInitialized() protected override void OnInitialized()
{ {
searchService.Subscribe(OnUpdate); searchService.Subscribe(OnUpdate);
@ -17,15 +16,35 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await searchService.Load(); await searchService.Load();
await jsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this));
} }
public void Dispose() public void Dispose()
{ {
searchService.Unsubscribe(OnUpdate); searchService.Unsubscribe(OnUpdate);
} }
void OnUpdate() void OnUpdate()
{ {
StateHasChanged(); StateHasChanged();
} }
[JSInvokable("OnKeyPress")]
public async Task OnKeyPress(string code, bool ctrlKey, bool shiftKey, bool altKey, bool metaKey)
{
if (code.ToLower().Equals("k") && (ctrlKey || shiftKey || altKey || metaKey))
{
if (searchService.IsVisible)
{
searchService.Hide();
}
else
{
searchService.Show();
}
}
}
} }

6
IGP/wwwroot/content/docs/cheat-sheet.md

@ -1,8 +1,6 @@
--- ---
title: Cheat Sheet title: Cheat Sheet summary: Handy links or quick information on this project. created_date: 2022-04-11 updated_date:
summary: Handy links or quick information on this project. 2022-04-11
created_date: 2022-04-11
updated_date: 2022-04-11
--- ---
# Overview # Overview

5
IGP/wwwroot/content/docs/project-data.md

@ -1,8 +1,5 @@
--- ---
title: Project Data title: Project Data summary: Using data in this project. created_date: 2022-04-11 updated_date: 2022-04-11
summary: Using data in this project.
created_date: 2022-04-11
updated_date: 2022-04-11
--- ---
# Overview # Overview

5
IGP/wwwroot/content/docs/setup.md

@ -1,8 +1,5 @@
--- ---
title: Setup title: Setup summary: Get set up on developing this web project. created_date: 3/30/2022 updated_date: 4/7/2022
summary: Get set up on developing this web project.
created_date: 3/30/2022
updated_date: 4/7/2022
--- ---
# Overview # Overview

5
IGP/wwwroot/content/notes/coop/holdout.md

@ -1,8 +1,5 @@
--- ---
title: Holdout title: Holdout summary: First coop test map in pre-alpha. created_date: 2/18/2022 updated_date: 2/18/2022
summary: First coop test map in pre-alpha.
created_date: 2/18/2022
updated_date: 2/18/2022
--- ---
Information contained in this note is based on this <a href="https://www.youtube.com/watch?v=XkAgOCIz3DE">YouTube, Information contained in this note is based on this <a href="https://www.youtube.com/watch?v=XkAgOCIz3DE">YouTube,

9
IGP/wwwroot/content/notes/settings/hotkeys.md

@ -1,8 +1,6 @@
--- ---
title: Custom HotKey Setup title: Custom HotKey Setup summary: Customize your hotkeys in the pre-alpha. created_date: 4/13/2022 updated_date:
summary: Customize your hotkeys in the pre-alpha. 4/13/2022
created_date: 4/13/2022
updated_date: 4/13/2022
--- ---
In the pre-alpha, IGP comes with some Unreal default hotkey setup. In the pre-alpha, IGP comes with some Unreal default hotkey setup.
@ -97,7 +95,8 @@ You can notice a single line of this file can be broken down like this.
`ActionMappings=(ActionName="AttackMove",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=A)` `ActionMappings=(ActionName="AttackMove",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=A)`
- `ActionMappings=(***)`: Indicates content is an action mapping. i.e. a hotkey - `ActionMappings=(***)`: Indicates content is an action mapping. i.e. a hotkey
- `ActionName="AttackMove"`: Indicates the name of the selected action. Here, we are using the `AttackMove` move action, that forces your selected army to attack. - `ActionName="AttackMove"`: Indicates the name of the selected action. Here, we are using the `AttackMove` move action,
that forces your selected army to attack.
- `Key=A`: Indicates key being mapped to the action. Set to `Key=Tab` to require the Tab key to be pressed instead, to - `Key=A`: Indicates key being mapped to the action. Set to `Key=Tab` to require the Tab key to be pressed instead, to
perform the `AttackMove` action. perform the `AttackMove` action.
- `bShift=False`: Indicates that the Shift key is not held. Set to `bShift=True` to require a shift key held to - `bShift=False`: Indicates that the Shift key is not held. Set to `bShift=True` to require a shift key held to

5
IGP/wwwroot/content/notes/the-basics/armor-types.md

@ -1,8 +1,5 @@
--- ---
title: Armor Types title: Armor Types summary: Heavy, Medium, and Light. What does it mean? created_date: 4/13/2000 updated_date: 4/13/2000
summary: Heavy, Medium, and Light. What does it mean?
created_date: 4/13/2000
updated_date: 4/13/2000
--- ---
## Armor Types ## Armor Types

6
IGP/wwwroot/content/notes/the-basics/economy-overview.md

@ -1,6 +1,4 @@
--- ---
title: Economy Overview title: Economy Overview summary: Alloy, Ether and Supply. Don't forget to expand!
summary: Alloy, Ether and Supply. Don't forget to expand! created_date: 1/01/2000 updated_date: 1/01/2000
created_date: 1/01/2000
updated_date: 1/01/2000
--- ---

6
IGP/wwwroot/content/notes/the-basics/families-factions-and-immortal-vanguards.md

@ -1,6 +1,4 @@
--- ---
title: Families, Factions, and Immortal Vanguards title: Families, Factions, and Immortal Vanguards summary: How IMMORTAL: Gates of Pyre handle your army selection
summary: How IMMORTAL: Gates of Pyre handle your army selection choices choices created_date: 1/01/2000 updated_date: 1/01/2000
created_date: 1/01/2000
updated_date: 1/01/2000
--- ---

6
IGP/wwwroot/content/notes/the-basics/immortal-spells-and-pyre.md

@ -1,8 +1,6 @@
--- ---
title: Immortals Spells and Pyre title: Immortals Spells and Pyre summary: Customize your hotkeys in the pre-alpha. created_date: 1/01/2000 updated_date:
summary: Customize your hotkeys in the pre-alpha. 1/01/2000
created_date: 1/01/2000
updated_date: 1/01/2000
--- ---
## What are Immortals ## What are Immortals

5
IGP/wwwroot/content/notes/the-basics/timing-and-scouting.md

@ -1,8 +1,5 @@
--- ---
title: Timing and Scouting title: Timing and Scouting summary: Knowing is half the battle. created_date: 1/01/2000 updated_date: 1/01/2000
summary: Knowing is half the battle.
created_date: 1/01/2000
updated_date: 1/01/2000
--- ---
## Timing ## Timing

2
IGP/wwwroot/generated/GitChangeModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/GitPatchModels.json

@ -1 +1 @@
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Path","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"}] [{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Patch","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":33,"Name":"Search Hotfix","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"}]

15
IGP/wwwroot/index.html

@ -12,8 +12,8 @@
<link href="css/app.css" rel="stylesheet"/> <link href="css/app.css" rel="stylesheet"/>
<link href="IGP.styles.css" rel="stylesheet"/> <link href="IGP.styles.css" rel="stylesheet"/>
<link href="manifest.json" rel="manifest" /> <link href="manifest.json" rel="manifest"/>
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" /> <link href="icon-512.png" rel="apple-touch-icon" sizes="512x512"/>
</head> </head>
<body style="background-color: #161618; color: white;"> <body style="background-color: #161618; color: white;">
@ -37,14 +37,21 @@
}); });
</script> </script>
<script> <script>
window.DotNetReference = null;
window.SetDotnetReference = function (dotnetReference) {
window.DotNetReference = dotnetReference;
};
window.getUserAgent = () => { window.getUserAgent = () => {
return navigator.userAgent; return navigator.userAgent;
}; };
</script>
<script>
window.SetFocusToElement = (elementId) => { window.SetFocusToElement = (elementId) => {
document.getElementById(elementId).focus(); document.getElementById(elementId).focus();
}; };
document.addEventListener("keydown", function (e) {
DotNetReference?.invokeMethodAsync('OnKeyPress', e.key, e.ctrlKey, e.shiftKey, e.altKey, e.metaKey)
});
</script> </script>
<script>navigator.serviceWorker.register('service-worker.js');</script> <script>navigator.serviceWorker.register('service-worker.js');</script>

12
IGP_Convert/IGP_Convert.csproj

@ -8,17 +8,17 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Contexts\Contexts.csproj" /> <ProjectReference Include="..\Contexts\Contexts.csproj"/>
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.2.22153.1"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.2.22153.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

2
Model/BuildOrders/BuildOrderModel.cs

@ -17,7 +17,7 @@ public class BuildOrderModel
public Dictionary<string, int> UniqueCompletedTimes { get; set; } = new(); public Dictionary<string, int> UniqueCompletedTimes { get; set; } = new();
public Dictionary<string, int> UniqueCompletedCount { get; set; } = new(); public Dictionary<string, int> UniqueCompletedCount { get; set; } = new();
public Dictionary<int, int> SupplyCountTimes { get; set; } = new(); public Dictionary<int, int> SupplyCountTimes { get; set; } = new();
public List<EntityModel> GetHarvestersCompletedBefore(int interval) public List<EntityModel> GetHarvestersCompletedBefore(int interval)
{ {
return (from ordersAtTime in StartedOrders return (from ordersAtTime in StartedOrders

8
Model/Model.csproj

@ -3,14 +3,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="_PaperWork\**"/>
<EmbeddedResource Remove="_PaperWork\**"/>
<None Remove="_PaperWork\**"/>
<None Remove="Immortal\MemoryTester\"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="YamlDotNet" Version="11.2.1"/> <PackageReference Include="YamlDotNet" Version="11.2.1"/>

27
Model/Notes/NoteContentModel.cs

@ -24,22 +24,27 @@ public class NoteContentModel
public string Description { get; set; } public string Description { get; set; }
public string Content { get; set; } public string Content { get; set; }
[NotMapped]
public virtual string LoadedContent { get; set; }
[NotMapped] public virtual string LoadedContent { get; set; }
public string IsHidden { get; set; } = "False"; public string IsHidden { get; set; } = "False";
public string IsPreAlpha { get; set; } = "True"; public string IsPreAlpha { get; set; } = "True";
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
public List<SearchPointModel> GetHeaders() public List<SearchPointModel> GetHeaders()
{ {
var regex = new Regex(@"^#* (.*)$", RegexOptions.Multiline); var regex = new Regex(@"^#* (.*)$", RegexOptions.Multiline);
var listOfMatches = regex.Matches(LoadedContent); var listOfMatches = regex.Matches(LoadedContent);
List<SearchPointModel> foundHeaders = new List<SearchPointModel>(); var foundHeaders = new List<SearchPointModel>();
foreach (var capture in listOfMatches) foreach (var capture in listOfMatches)
{ {
var cleanUp = capture.ToString(); var cleanUp = capture.ToString();
@ -49,18 +54,12 @@ public class NoteContentModel
cleanUp = cleanUp.Replace("\"", ""); cleanUp = cleanUp.Replace("\"", "");
cleanUp = cleanUp.Trim(); cleanUp = cleanUp.Trim();
cleanUp = cleanUp.Replace(" ", "-"); cleanUp = cleanUp.Replace(" ", "-");
foundHeaders.Add(new SearchPointModel(){ Title = capture.ToString().Trim(), Href = cleanUp}); foundHeaders.Add(new SearchPointModel { Title = capture.ToString().Trim(), Href = cleanUp });
Console.WriteLine($"Capture: {cleanUp}"); Console.WriteLine($"Capture: {cleanUp}");
} }
return foundHeaders; return foundHeaders;
} }
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
private string GetLink() private string GetLink()

8
Services/IServices.cs

@ -28,16 +28,16 @@ public interface IToastService
public interface ISearchService public interface ISearchService
{ {
public List<SearchPointModel> SearchPoints { get; set; } public List<SearchPointModel> SearchPoints { get; set; }
public Dictionary<string, List<SearchPointModel>> Searches { get; set; } public Dictionary<string, List<SearchPointModel>> Searches { get; set; }
public bool IsVisible { get; set; } public bool IsVisible { get; set; }
public void Subscribe(Action action); public void Subscribe(Action action);
public void Unsubscribe(Action action); public void Unsubscribe(Action action);
public void Search(string entityId); public void Search(string entityId);
public Task Load(); public Task Load();
public bool IsLoaded(); public bool IsLoaded();
@ -90,7 +90,7 @@ public interface IAgileService
public void Unsubscribe(Action? action); public void Unsubscribe(Action? action);
public void Update(); public void Update();
public Task Load(); public Task Load();
public bool IsLoaded(); public bool IsLoaded();
} }

11
Services/Immortal/BuildOrderService.cs

@ -13,14 +13,15 @@ namespace Services.Immortal;
public class BuildOrderService : IBuildOrderService public class BuildOrderService : IBuildOrderService
{ {
private BuildOrderModel buildOrder = new(); private BuildOrderModel buildOrder = new();
public int BuildingInputDelay { get; set; } = 2; private int lastInterval;
private int lastInterval = 0;
public BuildOrderService() public BuildOrderService()
{ {
Reset(); Reset();
} }
public int BuildingInputDelay { get; set; } = 2;
public Dictionary<int, List<EntityModel>> StartedOrders => buildOrder.StartedOrders; public Dictionary<int, List<EntityModel>> StartedOrders => buildOrder.StartedOrders;
public Dictionary<int, List<EntityModel>> CompletedOrders => buildOrder.CompletedOrders; public Dictionary<int, List<EntityModel>> CompletedOrders => buildOrder.CompletedOrders;
public Dictionary<string, int> UniqueCompletedTimes => buildOrder.UniqueCompletedTimes; public Dictionary<string, int> UniqueCompletedTimes => buildOrder.UniqueCompletedTimes;
@ -254,7 +255,7 @@ public class BuildOrderService : IBuildOrderService
public void Reset() public void Reset()
{ {
lastInterval = 0; lastInterval = 0;
buildOrder = new BuildOrderModel buildOrder = new BuildOrderModel
{ {
StartedOrders = new Dictionary<int, List<EntityModel>> StartedOrders = new Dictionary<int, List<EntityModel>>
@ -304,7 +305,7 @@ public class BuildOrderService : IBuildOrderService
} }
} }
}; };
NotifyDataChanged(); NotifyDataChanged();
} }
@ -326,7 +327,7 @@ public class BuildOrderService : IBuildOrderService
atInterval = interval; atInterval = interval;
if (entity.EntityType != EntityType.Army) atInterval += BuildingInputDelay; if (entity.EntityType != EntityType.Army) atInterval += BuildingInputDelay;
return true; return true;
} }
} }

9
Services/Immortal/EconomyService.cs

@ -1,8 +1,6 @@
using Model.Economy; using Model.Economy;
using Model.Entity; using Model.Entity;
using Model.Feedback;
using Model.Types; using Model.Types;
using Services.Website;
namespace Services.Immortal; namespace Services.Immortal;
@ -159,11 +157,8 @@ public class EconomyService : IEconomyService
public EconomyModel GetEconomy(int atInterval) public EconomyModel GetEconomy(int atInterval)
{ {
if (atInterval >= economyOverTime.Count) if (atInterval >= economyOverTime.Count) return economyOverTime.Last();
{
return economyOverTime.Last();
}
return economyOverTime[atInterval]; return economyOverTime[atInterval];
} }

2
Services/Immortal/TimingService.cs

@ -28,7 +28,7 @@ public class TimingService : ITimingService
NotifyDataChanged(); NotifyDataChanged();
} }
} }
public int GetTravelTime() public int GetTravelTime()
{ {
return travelTime; return travelTime;

4
Services/Services.csproj

@ -15,11 +15,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="YamlDotNet" Version="11.2.1" /> <PackageReference Include="YamlDotNet" Version="11.2.1"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

3
Services/Website/EntityDialogService.cs

@ -3,9 +3,8 @@
//TODO Move to a database folder, with EntityService, EntityFilterService //TODO Move to a database folder, with EntityService, EntityFilterService
public class EntityDialogService : IEntityDialogService public class EntityDialogService : IEntityDialogService
{ {
private string? entityId;
private readonly List<string> history = new(); private readonly List<string> history = new();
private string? entityId;
public void Subscribe(Action action) public void Subscribe(Action action)
{ {

75
Services/Website/SearchService.cs

@ -1,23 +1,20 @@
using Model.Entity.Data; using Model.Entity.Data;
using Model.Feedback;
using Model.Website; using Model.Website;
namespace Services.Website; namespace Services.Website;
public class SearchService : ISearchService public class SearchService : ISearchService
{ {
private readonly IDocumentationService documentationService;
private bool isLoaded = false;
public List<SearchPointModel> SearchPoints { get; set; } = new();
public Dictionary<string, List<SearchPointModel>> Searches { get; set; } = new(); private bool isLoaded;
private readonly INoteService noteService;
private IWebsiteService websiteService; private readonly IWebsiteService websiteService;
private INoteService noteService;
private IDocumentationService documentationService;
public SearchService(IWebsiteService websiteService, INoteService noteService, IDocumentationService documentationService) public SearchService(IWebsiteService websiteService, INoteService noteService,
IDocumentationService documentationService)
{ {
this.websiteService = websiteService; this.websiteService = websiteService;
this.noteService = noteService; this.noteService = noteService;
@ -25,7 +22,11 @@ public class SearchService : ISearchService
// All Unit Data // All Unit Data
} }
public List<SearchPointModel> SearchPoints { get; set; } = new();
public Dictionary<string, List<SearchPointModel>> Searches { get; set; } = new();
public bool IsVisible { get; set; } public bool IsVisible { get; set; }
public void Subscribe(Action action) public void Subscribe(Action action)
@ -47,8 +48,8 @@ public class SearchService : ISearchService
await websiteService.Load(); await websiteService.Load();
await noteService.Load(); await noteService.Load();
await documentationService.Load(); await documentationService.Load();
Searches.Add("Pages", new List<SearchPointModel>()); Searches.Add("Pages", new List<SearchPointModel>());
Searches.Add("Notes", new List<SearchPointModel>()); Searches.Add("Notes", new List<SearchPointModel>());
Searches.Add("Documents", new List<SearchPointModel>()); Searches.Add("Documents", new List<SearchPointModel>());
@ -56,47 +57,55 @@ public class SearchService : ISearchService
foreach (var webPage in websiteService.WebPageModels) foreach (var webPage in websiteService.WebPageModels)
{ {
SearchPoints.Add(new SearchPointModel{ Title = webPage.Name, SearchPoints.Add(new SearchPointModel
{
Title = webPage.Name,
PointType = "WebPage", PointType = "WebPage",
Href=webPage.Href Href = webPage.Href
}); });
Searches["Pages"].Add(SearchPoints.Last()); Searches["Pages"].Add(SearchPoints.Last());
} }
foreach (var note in noteService.NoteContentModels) foreach (var note in noteService.NoteContentModels)
{ {
SearchPoints.Add(new SearchPointModel(){ Title = note.Name, SearchPoints.Add(new SearchPointModel
PointType = "Note", Href = note.GetNoteLink()}); {
Title = note.Name,
Searches["Notes"].Add(SearchPoints.Last()); PointType = "Note", Href = note.GetNoteLink()
});
Searches["Notes"].Add(SearchPoints.Last());
} }
foreach (var entity in DATA.Get().Values) foreach (var entity in DATA.Get().Values)
{ {
SearchPoints.Add(new SearchPointModel(){ SearchPoints.Add(new SearchPointModel
Title = entity.Info().Name, {
Title = entity.Info().Name,
Tags = $"{entity.EntityType},{entity.Descriptive}", Tags = $"{entity.EntityType},{entity.Descriptive}",
PointType = "Entity", PointType = "Entity",
Href = $"database/{entity.Info().Name.ToLower()}" Href = $"database/{entity.Info().Name.ToLower()}"
}); });
Searches["Entities"].Add(SearchPoints.Last()); Searches["Entities"].Add(SearchPoints.Last());
} }
foreach (var doc in documentationService.DocContentModels) foreach (var doc in documentationService.DocContentModels)
{ {
SearchPoints.Add(new SearchPointModel { Title = doc.Name, SearchPoints.Add(new SearchPointModel
PointType = "Document", Href = doc.GetDocLink()}); {
Title = doc.Name,
PointType = "Document", Href = doc.GetDocLink()
});
Searches["Documents"].Add(SearchPoints.Last()); Searches["Documents"].Add(SearchPoints.Last());
} }
isLoaded = true; isLoaded = true;
NotifyDataChanged(); NotifyDataChanged();
} }
@ -108,14 +117,14 @@ public class SearchService : ISearchService
public void Show() public void Show()
{ {
IsVisible = true; IsVisible = true;
NotifyDataChanged(); NotifyDataChanged();
} }
public void Hide() public void Hide()
{ {
IsVisible = false; IsVisible = false;
NotifyDataChanged(); NotifyDataChanged();
} }

Loading…
Cancel
Save