generated from JustArchiNET/ASF-PluginTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redlib - Extract created date and use for RedditGameEntry
- Extracted the created date from the Redlib HTML response. - Added a new field `Date` to `RedlibGameEntry` to store the extracted date. - Updated `RedlibHtmlParser.ParseGamesFromHtml` to return a collection of `RedlibGameEntry` with the populated `Date` field. - Modified `RedlibGameEntry.ToRedditGameEntry` to use the provided `Date` when available, falling back to the current time otherwise. This commit improves data accuracy and enables the use of the created date in the `RedditGameEntry` object.
- Loading branch information
Showing
5 changed files
with
100 additions
and
10 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace Maxisoft.ASF.Redlib.Html; | ||
|
||
internal readonly record struct ParserIndices(int StartOfCommandIndex, int EndOfCommandIndex, int StartOfFooterIndex, int HrefStartIndex, int HrefEndIndex); | ||
internal readonly record struct ParserIndices(int StartOfCommandIndex, int EndOfCommandIndex, int StartOfFooterIndex, int HrefStartIndex, int HrefEndIndex, int DateStartIndex, int DateEndIndex); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Collections.Generic; | ||
using ASFFreeGames.ASFExtentions.Games; | ||
using Maxisoft.ASF.Reddit; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Maxisoft.ASF.Redlib; | ||
|
||
#pragma warning disable CA1819 | ||
|
||
public readonly record struct RedlibGameEntry(IReadOnlyCollection<GameIdentifier> GameIdentifiers, string CommentLink, EGameType TypeFlags) { | ||
public RedditGameEntry ToRedditGameEntry(long date = default) => new(string.Join(',', GameIdentifiers), TypeFlags.ToRedditGameEntryKind(), date); | ||
public readonly record struct RedlibGameEntry(IReadOnlyCollection<GameIdentifier> GameIdentifiers, string CommentLink, EGameType TypeFlags, DateTimeOffset Date) { | ||
public RedditGameEntry ToRedditGameEntry(long date = default) { | ||
if ((Date != default(DateTimeOffset)) && (Date != DateTimeOffset.MinValue)) { | ||
date = Date.ToUnixTimeMilliseconds(); | ||
} | ||
|
||
return new RedditGameEntry(string.Join(',', GameIdentifiers), TypeFlags.ToRedditGameEntryKind(), date); | ||
} | ||
} | ||
|
||
#pragma warning restore CA1819 |