Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the cheatsheet module. #181

Merged
merged 8 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 293 additions & 23 deletions .editorconfig

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Open Website](https://img.shields.io/badge/website-6b6ebe?style=flat-square)](https://sidekick-poe.github.io/) [![Download](https://img.shields.io/badge/download-00BCD4?style=flat-square)](https://sidekick-poe.github.io/) [![](https://img.shields.io/github/v/release/Sidekick-Poe/Sidekick?style=flat-square)](https://github.com/Sidekick-Poe/Sidekick/releases) [![](https://img.shields.io/github/downloads-pre/Sidekick-Poe/Sidekick/total?style=flat-square)](https://github.com/Sidekick-Poe/Sidekick/releases) [![](https://img.shields.io/discord/664252463188279300?color=%23738AD6&label=Discord&style=flat-square)](https://discord.gg/H4bg4GQ)

A Path of Exile companion tool. Price check items, check for dangerous map modifiers, look at easily accessible cheatsheets, and more!
A Path of Exile companion tool. Price check items, check for dangerous map modifiers, and more!

[![Website](https://img.shields.io/badge/Website_and_Download-6b6ebe?style=for-the-badge)](https://sidekick-poe.github.io/)

Expand Down
14 changes: 0 additions & 14 deletions Sidekick.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1D8BF515
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Mock", "src\Sidekick.Mock\Sidekick.Mock.csproj", "{1C2974D8-B04E-4BF5-8CD8-65A82EE89493}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Modules.Cheatsheets", "src\Sidekick.Modules.Cheatsheets\Sidekick.Modules.Cheatsheets.csproj", "{1182B4D2-EFD9-4155-8021-1A44897D25D1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Common.Blazor", "src\Sidekick.Common.Blazor\Sidekick.Common.Blazor.csproj", "{A78010BD-2B6B-4D13-A1A5-F90B1C395C1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Common", "src\Sidekick.Common\Sidekick.Common.csproj", "{484EAA27-27A0-4B0E-BA43-B5047D697CAE}"
Expand All @@ -48,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Apis.Poe", "src\Si
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Apis.PoePriceInfo", "src\Sidekick.Apis.PoePriceInfo\Sidekick.Apis.PoePriceInfo.csproj", "{8A13FFC9-5C43-4565-B24C-2F2F10BF5AA2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Modules.About", "src\Sidekick.Modules.About\Sidekick.Modules.About.csproj", "{8E63B10C-109A-442B-81DE-1B7280988C0F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Modules.Development", "src\Sidekick.Modules.Development\Sidekick.Modules.Development.csproj", "{10ECD152-C29C-4799-BF16-76CC33DA82F4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Modules.Maps", "src\Sidekick.Modules.Maps\Sidekick.Modules.Maps.csproj", "{642D3141-6336-4424-A4D4-C97498615C3F}"
Expand Down Expand Up @@ -84,10 +80,6 @@ Global
{1C2974D8-B04E-4BF5-8CD8-65A82EE89493}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C2974D8-B04E-4BF5-8CD8-65A82EE89493}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C2974D8-B04E-4BF5-8CD8-65A82EE89493}.Release|Any CPU.Build.0 = Release|Any CPU
{1182B4D2-EFD9-4155-8021-1A44897D25D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1182B4D2-EFD9-4155-8021-1A44897D25D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1182B4D2-EFD9-4155-8021-1A44897D25D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1182B4D2-EFD9-4155-8021-1A44897D25D1}.Release|Any CPU.Build.0 = Release|Any CPU
{A78010BD-2B6B-4D13-A1A5-F90B1C395C1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A78010BD-2B6B-4D13-A1A5-F90B1C395C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A78010BD-2B6B-4D13-A1A5-F90B1C395C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -120,10 +112,6 @@ Global
{8A13FFC9-5C43-4565-B24C-2F2F10BF5AA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A13FFC9-5C43-4565-B24C-2F2F10BF5AA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A13FFC9-5C43-4565-B24C-2F2F10BF5AA2}.Release|Any CPU.Build.0 = Release|Any CPU
{8E63B10C-109A-442B-81DE-1B7280988C0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E63B10C-109A-442B-81DE-1B7280988C0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E63B10C-109A-442B-81DE-1B7280988C0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E63B10C-109A-442B-81DE-1B7280988C0F}.Release|Any CPU.Build.0 = Release|Any CPU
{10ECD152-C29C-4799-BF16-76CC33DA82F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10ECD152-C29C-4799-BF16-76CC33DA82F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10ECD152-C29C-4799-BF16-76CC33DA82F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -178,7 +166,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1C2974D8-B04E-4BF5-8CD8-65A82EE89493} = {1D8BF515-81E9-4769-9B27-24DFB8D8BDCC}
{1182B4D2-EFD9-4155-8021-1A44897D25D1} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
{A78010BD-2B6B-4D13-A1A5-F90B1C395C1A} = {E4920CFB-0EED-44B1-AC8D-8F5ECBCB7788}
{484EAA27-27A0-4B0E-BA43-B5047D697CAE} = {E4920CFB-0EED-44B1-AC8D-8F5ECBCB7788}
{13179DD8-18ED-4BDC-B317-E7A6F45D363D} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
Expand All @@ -187,7 +174,6 @@ Global
{DF327715-65A1-4F16-A016-CE7A87E921E4} = {7285BD58-2544-44AA-8488-52EA8E55D239}
{D3311A5D-F921-4B5F-9EB1-6AEC5EAD72FF} = {7285BD58-2544-44AA-8488-52EA8E55D239}
{8A13FFC9-5C43-4565-B24C-2F2F10BF5AA2} = {7285BD58-2544-44AA-8488-52EA8E55D239}
{8E63B10C-109A-442B-81DE-1B7280988C0F} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
{10ECD152-C29C-4799-BF16-76CC33DA82F4} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
{642D3141-6336-4424-A4D4-C97498615C3F} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
{AD46F63E-E1AE-4E71-AC6B-B1947AFED1A3} = {BB6816F5-1413-4545-96FA-D31D2D9BF6B1}
Expand Down
11 changes: 6 additions & 5 deletions src/Sidekick.Apis.Poe/Bulk/BulkTradeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Sidekick.Apis.Poe.Trade.Requests;
using Sidekick.Apis.Poe.Trade.Results;
using Sidekick.Common.Enums;
using Sidekick.Common.Exceptions;
using Sidekick.Common.Game.Items;
using Sidekick.Common.Game.Languages;
using Sidekick.Common.Settings;
Expand Down Expand Up @@ -46,15 +47,15 @@ public async Task<BulkResponseModel> SearchBulk(Item item, TradeCurrency currenc

if (gameLanguageProvider.Language == null)
{
throw new Exception("[Trade API] Could not find a valid language.");
throw new ApiErrorException("[Trade API] Could not find a valid language.");
}

var uri = $"{gameLanguageProvider.Language.PoeTradeApiBaseUrl}exchange/{settings.LeagueId}";

var itemId = itemStaticDataProvider.GetId(item.Metadata.Name, item.Metadata.Type);
if (itemId == null)
{
throw new Exception("[Trade API] Could not find a valid item.");
throw new ApiErrorException("[Trade API] Could not find a valid item.");
}

var model = new BulkQueryRequest();
Expand Down Expand Up @@ -83,23 +84,23 @@ public async Task<BulkResponseModel> SearchBulk(Item item, TradeCurrency currenc
logger.LogWarning("[Trade API] Query: {query}", json);

var errorResult = JsonSerializer.Deserialize<ErrorResult>(content, poeTradeClient.Options);
throw new Exception(errorResult?.Error?.Message);
throw new ApiErrorException(errorResult?.Error?.Message);
}

try
{
var result = JsonSerializer.Deserialize<BulkResponse?>(content, poeTradeClient.Options);
if (result == null)
{
throw new Exception("[Trade API] Could not understand the API response.");
throw new ApiErrorException("[Trade API] Could not understand the API response.");
}

return new BulkResponseModel(result);
}
catch (Exception e)
{
logger.LogError(e, "An exception occured while parsing the API response. {data}", content);
return new BulkResponseModel(new BulkResponse());
throw new ApiErrorException("[Trade API] An exception occured while parsing the API response.");
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Sidekick.Apis.Poe/IItemParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace Sidekick.Apis.Poe
{
public interface IItemParser
{
Task<Item?> ParseItemAsync(string itemText);
Task<Item> ParseItemAsync(string itemText);

Header? ParseHeader(string itemText);
Header ParseHeader(string itemText);

Item? ParseItem(string itemText);
Item ParseItem(string itemText);
}
}
17 changes: 9 additions & 8 deletions src/Sidekick.Apis.Poe/Parser/ItemParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Sidekick.Apis.Poe.Parser.AdditionalInformation;
using Sidekick.Apis.Poe.Parser.Patterns;
using Sidekick.Apis.Poe.Pseudo;
using Sidekick.Common.Exceptions;
using Sidekick.Common.Game.Items;

namespace Sidekick.Apis.Poe.Parser
Expand Down Expand Up @@ -37,16 +38,16 @@ public ItemParser(
this.invariantMetadataProvider = invariantMetadataProvider;
}

public Task<Item?> ParseItemAsync(string itemText)
public Task<Item> ParseItemAsync(string itemText)
{
return Task.Run(() => ParseItem(itemText));
}

public Item? ParseItem(string itemText)
public Item ParseItem(string itemText)
{
if (string.IsNullOrEmpty(itemText))
{
return null;
throw new UnparsableException();
}

try
Expand All @@ -55,7 +56,7 @@ public ItemParser(
var metadata = itemMetadataProvider.Parse(parsingItem);
if (metadata == null || (string.IsNullOrEmpty(metadata?.Name) && string.IsNullOrEmpty(metadata?.Type)))
{
throw new NotSupportedException("Item not found.");
throw new UnparsableException("Item was not found in the metadata provider.");
}

// Strip the Superior affix from the name
Expand Down Expand Up @@ -100,15 +101,15 @@ public ItemParser(
catch (Exception e)
{
logger.LogWarning(e, "Could not parse item.");
return null;
throw new UnparsableException();
}
}

public Header? ParseHeader(string itemText)
public Header ParseHeader(string itemText)
{
if (string.IsNullOrEmpty(itemText))
{
return null;
throw new UnparsableException();
}

try
Expand All @@ -118,7 +119,7 @@ public ItemParser(
catch (Exception e)
{
logger.LogWarning(e, "Could not parse item.");
return null;
throw new UnparsableException();
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/Sidekick.Apis.Poe/Trade/TradeSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Sidekick.Apis.Poe.Trade.Requests.Filters;
using Sidekick.Apis.Poe.Trade.Results;
using Sidekick.Common.Enums;
using Sidekick.Common.Exceptions;
using Sidekick.Common.Game.Items;
using Sidekick.Common.Game.Languages;
using Sidekick.Common.Settings;
Expand Down Expand Up @@ -41,13 +42,14 @@

public async Task<TradeSearchResult<string>> Search(Item item, TradeCurrency currency, PropertyFilters? propertyFilters = null, List<ModifierFilter>? modifierFilters = null, List<PseudoModifierFilter>? pseudoFilters = null)
{
throw new ApiErrorException("[Trade API] Could not find a valid language.");
try

Check warning on line 46 in src/Sidekick.Apis.Poe/Trade/TradeSearchService.cs

View workflow job for this annotation

GitHub Actions / tests

Unreachable code detected
{
logger.LogInformation("[Trade API] Querying Trade API.");

if (gameLanguageProvider.Language == null)
{
throw new Exception("[Trade API] Could not find a valid language.");
throw new ApiErrorException("[Trade API] Could not find a valid language.");
}

var request = new QueryRequest();
Expand Down Expand Up @@ -110,8 +112,7 @@
logger.LogWarning("[Trade API] Query: {query}", json);

var errorResult = await JsonSerializer.DeserializeAsync<ErrorResult>(content, poeTradeClient.Options);

return new() { Error = errorResult?.Error };
throw new ApiErrorException("[Trade API] Querying failed. " + errorResult?.Error?.Message);
}

var result = await JsonSerializer.DeserializeAsync<TradeSearchResult<string>?>(content, poeTradeClient.Options);
Expand All @@ -125,7 +126,7 @@
logger.LogWarning(ex, "[Trade API] Exception thrown while querying trade api.");
}

throw new Exception("[Trade API] Could not understand the API response.");
throw new ApiErrorException("[Trade API] Could not understand the API response.");
}

private static void SetPropertyFilters(Query query, PropertyFilters? propertyFilters)
Expand Down
26 changes: 0 additions & 26 deletions src/Sidekick.Common.Blazor/Errors/ErrorResources.cs

This file was deleted.

Loading
Loading