-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
734 additions
and
179 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
NetStone/Definitions/Model/Linkshell/LinkShellSearchEntryDefinition.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,29 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace NetStone.Definitions.Model.Linkshell; | ||
|
||
/// <summary> | ||
/// Definition container for one Link-Shell search result entry | ||
/// </summary> | ||
public class LinkShellSearchEntryDefinition : PagedEntryDefinition | ||
{ | ||
/// <summary> | ||
/// ID | ||
/// </summary> | ||
[JsonProperty("ID")] public DefinitionsPack Id { get; set; } | ||
|
||
/// <summary> | ||
/// Name | ||
/// </summary> | ||
[JsonProperty("NAME")] public DefinitionsPack Name { get; set; } | ||
|
||
/// <summary> | ||
/// Rank | ||
/// </summary> | ||
[JsonProperty("SERVER")] public DefinitionsPack Server { get; set; } | ||
|
||
/// <summary> | ||
/// Rank Icon | ||
/// </summary> | ||
[JsonProperty("ACTIVE_MEMBERS")] public DefinitionsPack ActiveMembers { get; set; } | ||
} |
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
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
53 changes: 53 additions & 0 deletions
53
NetStone/Model/Parseables/Search/Linkshell/LinkShellSearchEntry.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,53 @@ | ||
using System.Threading.Tasks; | ||
using HtmlAgilityPack; | ||
using NetStone.Definitions.Model.Linkshell; | ||
using NetStone.Model.Parseables.Linkshell; | ||
|
||
namespace NetStone.Model.Parseables.Search.Linkshell; | ||
|
||
/// <summary> | ||
/// Models one entry in the linkshell search results list | ||
/// </summary> | ||
public class LinkShellSearchEntry : LodestoneParseable | ||
{ | ||
private readonly LodestoneClient client; | ||
private readonly LinkShellSearchEntryDefinition definition; | ||
|
||
/// | ||
public LinkShellSearchEntry(LodestoneClient client, HtmlNode rootNode, LinkShellSearchEntryDefinition definition) : | ||
base(rootNode) | ||
{ | ||
this.client = client; | ||
this.definition = definition; | ||
} | ||
|
||
/// <summary> | ||
/// Character name | ||
/// </summary> | ||
public string Name => Parse(this.definition.Name); | ||
|
||
/// <summary> | ||
/// Lodestone Id | ||
/// </summary> | ||
public string? Id => ParseHrefId(this.definition.Id); | ||
|
||
/// <summary> | ||
/// Homeworld / Server | ||
/// </summary> | ||
public string HomeWorld => Parse(this.definition.Server); | ||
|
||
/// <summary> | ||
/// Number of active members | ||
/// </summary> | ||
public int ActiveMembers => int.TryParse(Parse(this.definition.ActiveMembers), out var parsed) ? parsed : -1; | ||
|
||
/// <summary> | ||
/// Fetch character profile | ||
/// </summary> | ||
/// <returns>Task of retrieving character</returns> | ||
public async Task<LodestoneLinkShell?> GetLinkshell() => | ||
this.Id is null ? null : await this.client.GetLinkshell(this.Id); | ||
|
||
///<inheritdoc /> | ||
public override string ToString() => this.Name; | ||
} |
Oops, something went wrong.