move to .net 6

output new file with live + trader price
This commit is contained in:
Chomp 2022-01-04 19:56:05 +00:00
parent 6f0b58a3fb
commit 2737cb6fc7
7 changed files with 291469 additions and 248828 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -8,7 +8,8 @@
public int Average7DaysPrice { get; set; } public int Average7DaysPrice { get; set; }
//public string Trader { get; set; } //public string Trader { get; set; }
//public int BuyPackPrice { get; set; } //public int BuyPackPrice { get; set; }
//public string Currency { get; set; } public string Currency { get; set; }
public string TemplateId { get; set; } public string TemplateId { get; set; }
public int TraderPrice { get; set; }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -42,26 +42,28 @@ namespace MarketPriceLookup.Common.Helpers
int avg7daysPrice = int.Parse(fields[4]); int avg7daysPrice = int.Parse(fields[4]);
//string trader = fields[5]; //string trader = fields[5];
//int buyBackPrice = int.Parse(fields[6]); //int buyBackPrice = int.Parse(fields[6]);
//string currency = GetCurrencyType(fields[7]); string currency = GetCurrencyType(fields[7]);
string bsgId = fields[8]; string bsgId = fields[8];
int traderPrice = int.Parse(fields[9]);
if (avg7daysPrice == 0) //if (avg7daysPrice == 0)
{ //{
LoggingHelpers.LogError($"unable to add bad item with price average of 0, ignoring: {bsgId} {name}"); // LoggingHelpers.LogError($"unable to add bad item with price average of 0, ignoring: {bsgId} {name}");
continue; // continue;
} //}
if (priceFile.ContainsKey(bsgId)) if (priceFile.ContainsKey(bsgId))
{ {
//oh no //oh no, item already exists in the csv
var existingItem = priceFile[bsgId]; var existingItem = priceFile[bsgId];
LoggingHelpers.LogError($"Unable to add item: {bsgId} {name}. existing item: {existingItem.TemplateId} {existingItem.Name}"); LoggingHelpers.LogError($"Unable to add item: {bsgId} {name}. existing item: {existingItem.TemplateId} {existingItem.Name}");
if (existingItem.Average7DaysPrice != avg7daysPrice) if (existingItem.Average7DaysPrice != avg7daysPrice)
{ {
LoggingHelpers.LogError($"Price diff found: already existing item price: {existingItem.Average7DaysPrice} new item price: {avg7daysPrice}"); LoggingHelpers.LogError($"Price diff found: already existing item price: {existingItem.Average7DaysPrice} new item price: {avg7daysPrice}");
continue;
} }
} }
else if (!priceFile.ContainsKey(bsgId))
{ {
priceFile.Add(bsgId, new Prices priceFile.Add(bsgId, new Prices
{ {
@ -71,12 +73,14 @@ namespace MarketPriceLookup.Common.Helpers
Average7DaysPrice = avg7daysPrice, Average7DaysPrice = avg7daysPrice,
//Trader = trader, //Trader = trader,
//BuyPackPrice = buyBackPrice, //BuyPackPrice = buyBackPrice,
//Currency = currency, Currency = currency,
TemplateId = bsgId TemplateId = bsgId,
TraderPrice = traderPrice,
}); });
LoggingHelpers.LogSuccess($"Adding item: {bsgId} {name}");
} }
LoggingHelpers.LogSuccess($"Adding item: {bsgId} {name}");
} }
} }
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -10,18 +10,30 @@ namespace MarketPriceLookup
static void Main(string[] args) static void Main(string[] args)
{ {
// loop over all items and get a price for each // loop over all items and get a price for each
var priceList = new Dictionary<string, int>(); var priceList = new Dictionary<string, OutputPrices>();
foreach (var item in ItemTemplateHelper.Items) foreach (var item in ItemTemplateHelper.Items)
{ {
var priceData = MarketPricesHelper.GetItemPrice(item.Key); var priceData = MarketPricesHelper.GetItemPrice(item.Key);
if (priceData != null && priceData.Price != 0) if (priceData != null && priceData.Price != 0)
{ {
priceList.Add(item.Key, priceData.Average7DaysPrice); priceList.Add(item.Key, new OutputPrices
{
LivePrice = priceData.Average7DaysPrice,
TraderPrice = priceData.TraderPrice,
TraderCurrency = priceData.Currency
});
} }
} }
// save found prices to json // save found prices to json
JsonWriter.WriteJson(priceList, "output", Directory.GetCurrentDirectory(), "prices"); JsonWriter.WriteJson(priceList, "output", Directory.GetCurrentDirectory(), "prices");
} }
public class OutputPrices
{
public int LivePrice { get; set; }
public int TraderPrice { get; set; }
public string TraderCurrency { get; set; }
}
} }
} }