-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed detection of multiline affixes. - Improve multiline aspect detection. - Changed affix/aspect view to text. - Updated system preset: 1920x1080_SMF_en.zip
- Loading branch information
1 parent
a3c60d1
commit 90ad686
Showing
31 changed files
with
259 additions
and
125 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace D4Companion.Entities | ||
{ | ||
public class Release | ||
{ | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } = string.Empty; | ||
[JsonPropertyName("assets")] | ||
public List<Assets> Assets { get; set; } = new List<Assets>(); | ||
[JsonPropertyName("body")] | ||
public string Body { get; set; } = string.Empty; | ||
[JsonPropertyName("tag_name")] | ||
public string Version { get; set; } = string.Empty; | ||
[JsonPropertyName("created_at")] | ||
public DateTime CreatedAt { get; set; } = DateTime.MinValue; | ||
[JsonPropertyName("published_at")] | ||
public DateTime PublishedAt { get; set; } = DateTime.MinValue; | ||
} | ||
|
||
public class Assets | ||
{ | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } = string.Empty; | ||
/// <summary> | ||
/// zip: application/x-zip-compressed | ||
/// </summary> | ||
[JsonPropertyName("content_type")] | ||
public string ContentType { get; set; } = string.Empty; | ||
[JsonPropertyName("size")] | ||
public int Size { get; set; } | ||
[JsonPropertyName("created_at")] | ||
public DateTime CreatedAt { get; set; } = DateTime.MinValue; | ||
[JsonPropertyName("updated_at")] | ||
public DateTime UpdatedAt { get; set; } = DateTime.MinValue; | ||
[JsonPropertyName("browser_download_url")] | ||
public string BrowserDownloadUrl { get; set; } = string.Empty; | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using Prism.Events; | ||
|
||
namespace D4Companion.Events | ||
{ | ||
public class ReleaseInfoUpdatedEvent : PubSubEvent { } | ||
} |
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,10 @@ | ||
using D4Companion.Entities; | ||
|
||
namespace D4Companion.Interfaces | ||
{ | ||
public interface IReleaseManager | ||
{ | ||
List<Release> Releases { get; } | ||
string Repository { get; } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using D4Companion.Entities; | ||
using D4Companion.Events; | ||
using D4Companion.Interfaces; | ||
using Microsoft.Extensions.Logging; | ||
using Prism.Events; | ||
using System.Text.Json; | ||
|
||
namespace D4Companion.Services | ||
{ | ||
public class ReleaseManager : IReleaseManager | ||
{ | ||
private readonly IEventAggregator _eventAggregator; | ||
private readonly ILogger _logger; | ||
private readonly IHttpClientHandler _httpClientHandler; | ||
|
||
private List<Release> _releases = new List<Release>(); | ||
|
||
// Start of Constructors region | ||
|
||
#region Constructors | ||
|
||
public ReleaseManager(IEventAggregator eventAggregator, ILogger<ReleaseManager> logger, HttpClientHandler httpClientHandler) | ||
{ | ||
// Init IEventAggregator | ||
_eventAggregator = eventAggregator; | ||
|
||
// Init logger | ||
_logger = logger; | ||
|
||
// Init services | ||
_httpClientHandler = httpClientHandler; | ||
|
||
// Update release info | ||
Task.Factory.StartNew(() => | ||
{ | ||
UpdateAvailableReleases(); | ||
}); | ||
} | ||
|
||
#endregion | ||
|
||
// Start of Events region | ||
|
||
#region Events | ||
|
||
#endregion | ||
|
||
// Start of Properties region | ||
|
||
#region Properties | ||
|
||
public List<Release> Releases { get => _releases; set => _releases = value; } | ||
public string Repository { get; } = "https://api.github.com/repos/josdemmers/diablo4Companion/releases"; | ||
|
||
#endregion | ||
|
||
// Start of Event handlers region | ||
|
||
#region Event handlers | ||
|
||
#endregion | ||
|
||
// Start of Methods region | ||
|
||
#region Methods | ||
|
||
private async void UpdateAvailableReleases() | ||
{ | ||
_logger.LogInformation($"Updating release info from: {Repository}"); | ||
|
||
string json = await _httpClientHandler.GetRequest(Repository); | ||
if (!string.IsNullOrWhiteSpace(json)) | ||
{ | ||
Releases.Clear(); | ||
Releases = JsonSerializer.Deserialize<List<Release>>(json) ?? new List<Release>(); | ||
|
||
} | ||
else | ||
{ | ||
_logger.LogWarning($"Invalid response. uri: {Repository}"); | ||
} | ||
_eventAggregator.GetEvent<ReleaseInfoUpdatedEvent>().Publish(); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
D4Companion/Converters/FileNameToFileNameNoExtConverter.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,23 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Windows.Data; | ||
|
||
namespace D4Companion.Converters | ||
{ | ||
[ValueConversion(typeof(string), typeof(string))] | ||
public class FileNameToFileNameNoExtConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null) return string.Empty; | ||
|
||
return Path.GetFileNameWithoutExtension((string)value); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
Oops, something went wrong.