move to .net 6
output new file with live + trader price
This commit is contained in:
parent
6f0b58a3fb
commit
2737cb6fc7
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -8,7 +8,8 @@
|
||||
public int Average7DaysPrice { get; set; }
|
||||
//public string Trader { get; set; }
|
||||
//public int BuyPackPrice { get; set; }
|
||||
//public string Currency { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public string TemplateId { get; set; }
|
||||
public int TraderPrice { get; set; }
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,26 +42,28 @@ namespace MarketPriceLookup.Common.Helpers
|
||||
int avg7daysPrice = int.Parse(fields[4]);
|
||||
//string trader = fields[5];
|
||||
//int buyBackPrice = int.Parse(fields[6]);
|
||||
//string currency = GetCurrencyType(fields[7]);
|
||||
string currency = GetCurrencyType(fields[7]);
|
||||
string bsgId = fields[8];
|
||||
int traderPrice = int.Parse(fields[9]);
|
||||
|
||||
if (avg7daysPrice == 0)
|
||||
{
|
||||
LoggingHelpers.LogError($"unable to add bad item with price average of 0, ignoring: {bsgId} {name}");
|
||||
continue;
|
||||
}
|
||||
//if (avg7daysPrice == 0)
|
||||
//{
|
||||
// LoggingHelpers.LogError($"unable to add bad item with price average of 0, ignoring: {bsgId} {name}");
|
||||
// continue;
|
||||
//}
|
||||
|
||||
if (priceFile.ContainsKey(bsgId))
|
||||
{
|
||||
//oh no
|
||||
//oh no, item already exists in the csv
|
||||
var existingItem = priceFile[bsgId];
|
||||
LoggingHelpers.LogError($"Unable to add item: {bsgId} {name}. existing item: {existingItem.TemplateId} {existingItem.Name}");
|
||||
if (existingItem.Average7DaysPrice != 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
|
||||
{
|
||||
@ -71,12 +73,14 @@ namespace MarketPriceLookup.Common.Helpers
|
||||
Average7DaysPrice = avg7daysPrice,
|
||||
//Trader = trader,
|
||||
//BuyPackPrice = buyBackPrice,
|
||||
//Currency = currency,
|
||||
TemplateId = bsgId
|
||||
Currency = currency,
|
||||
TemplateId = bsgId,
|
||||
TraderPrice = traderPrice,
|
||||
});
|
||||
LoggingHelpers.LogSuccess($"Adding item: {bsgId} {name}");
|
||||
}
|
||||
|
||||
LoggingHelpers.LogSuccess($"Adding item: {bsgId} {name}");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -10,18 +10,30 @@ namespace MarketPriceLookup
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
var priceData = MarketPricesHelper.GetItemPrice(item.Key);
|
||||
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
|
||||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user