This commit is contained in:
KP9lKk 2024-12-16 16:07:23 +03:00
parent 1889ede866
commit 9c1a47e720
2 changed files with 26 additions and 21 deletions

View File

@ -1,28 +1,33 @@
using System.Reflection.Emit;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Channels;
using LootBoxSimulator.Models.DAO;
RemoteDatabaseContext db = new RemoteDatabaseContext();
Console.WriteLine("Enter path to file");
string? path = Console.ReadLine();
if (path == null) return;
if (!bool.TryParse(Console.ReadLine(), out bool HaveHeader)) return;
StreamReader file = new StreamReader(path);
string row = String.Empty;
if(HaveHeader) row = file.ReadLine();
Console.WriteLine(row);
while ((row = file.ReadLine()) != null)
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("1. Print category");
stringBuilder.AppendLine();
stringBuilder.Append("2. Print rate");
stringBuilder.AppendLine();
stringBuilder.Append("3. Print items");
Console.WriteLine(stringBuilder.ToString());
if (!int.TryParse(Console.ReadLine(), out int menuPosition))
{
var line = row.Split(',');
if(!decimal.TryParse(line[2], out var decimalValue)) continue;
RateDao dao = new RateDao
{
Name = line[0],
Color = line[1],
Rate = decimalValue
};
db.Rates.Add(dao);
Console.WriteLine("Please enter a valid number");
return;
}
db.SaveChanges();
switch (menuPosition)
{
case 1:
foreach (var categoryDao in db.Categories)
{
Console.WriteLine($"Id: {categoryDao.Id} Name: {categoryDao.Name}");
}
break;
case 2: break;
default:
Console.WriteLine("Unkown Menu Position");
break;
}

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("LootBoxSimulator")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9c61ffba70b4d7b6c85c3d3d7b357920470df9fc")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1889ede86630630ebb95b23f978ced8ff8c96694")]
[assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")]
[assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]