-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added price info for each crafting recipe. Both lowest and lowest avg prices are now visible.
- Loading branch information
1 parent
be17f88
commit 68c7981
Showing
13 changed files
with
295 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Prism.Events; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NewWorldCompanion.Events | ||
{ | ||
public class VersionInfoUpdatedEvent : 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,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NewWorldCompanion.Interfaces | ||
{ | ||
public interface IVersionManager | ||
{ | ||
string CurrentVersion { get; } | ||
string LatestVersion { 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
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,91 @@ | ||
using NewWorldCompanion.Events; | ||
using NewWorldCompanion.Interfaces; | ||
using Prism.Events; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml.XPath; | ||
|
||
namespace NewWorldCompanion.Services | ||
{ | ||
public class VersionManager : IVersionManager | ||
{ | ||
private readonly IEventAggregator _eventAggregator; | ||
private readonly IHttpClientHandler _httpClientHandler; | ||
|
||
private string _latestVersion = string.Empty; | ||
|
||
// Start of Constructor region | ||
|
||
#region Constructor | ||
|
||
public VersionManager(IEventAggregator eventAggregator, HttpClientHandler httpClientHandler) | ||
{ | ||
// Init IEventAggregator | ||
_eventAggregator = eventAggregator; | ||
|
||
// Init services | ||
_httpClientHandler = httpClientHandler; | ||
|
||
// Init servers | ||
UpdateVersionInfo(); | ||
} | ||
|
||
#endregion | ||
|
||
// Start of Properties region | ||
|
||
#region Properties | ||
|
||
public string CurrentVersion | ||
{ | ||
get | ||
{ | ||
Version version = Assembly.GetExecutingAssembly().GetName().Version; | ||
return version.ToString(); | ||
} | ||
} | ||
|
||
public string LatestVersion { get => _latestVersion; set => _latestVersion = value; } | ||
|
||
#endregion | ||
|
||
// Start of Events region | ||
|
||
#region Events | ||
|
||
#endregion | ||
|
||
// Start of Methods region | ||
|
||
#region Methods | ||
|
||
private async void UpdateVersionInfo() | ||
{ | ||
string uri = $"https://raw.githubusercontent.com/josdemmers/NewWorldCompanion/master/NewWorldCompanion/common.props"; | ||
string xml = await _httpClientHandler.GetRequest(uri); | ||
if (!string.IsNullOrWhiteSpace(xml)) | ||
{ | ||
var xPathDocument = new XPathDocument(new StringReader(xml)); | ||
var xPathNavigator = xPathDocument.CreateNavigator(); | ||
var xPathExpression = xPathNavigator.Compile("/Project/PropertyGroup/FileVersion/text()"); | ||
var xPathNodeIterator = xPathNavigator.Select(xPathExpression); | ||
while (xPathNodeIterator.MoveNext()) | ||
{ | ||
LatestVersion = xPathNodeIterator.Current?.ToString() ?? string.Empty; | ||
} | ||
} | ||
else | ||
{ | ||
LatestVersion = string.Empty; | ||
} | ||
_eventAggregator.GetEvent<VersionInfoUpdatedEvent>().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
Oops, something went wrong.