Blueprint loading works

This commit is contained in:
2021-01-30 22:46:48 +01:00
parent 295f63669d
commit 1ab244f7c5
21 changed files with 710 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
using EveCalc.Shared.ObjectModel;
using Microsoft.Data.Sqlite;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EveCalc.Shared.StaticData
{
public class StaticDataProvider
{
public StaticDataProvider()
{
}
public List<BlueprintMaterial> GetMaterialsForBlueprint(long id)
{
var result = new List<BlueprintMaterial>();
using (var connection = new SqliteConnection("Data Source=StaticData\\staticdata.sqlite"))
{
connection.Open();
var command = connection.CreateCommand();
command.CommandText = @"select materialTypeID, invTypes.typename, quantity "
+ "from industryActivityMaterials "
+ "inner join invTypes on invTypes.typeID=industryActivityMaterials.materialTypeID "
+ "where blueprintTypeID=$id";
command.Parameters.AddWithValue("id", id);
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var material = new BlueprintMaterial();
material.MaterialTypeId = reader.GetInt64(0);
material.MaterialTypeName = reader.GetString(1);
material.Quantity = reader.GetInt64(2);
result.Add(material);
}
}
connection.Close();
}
return result;
}
}
}

Binary file not shown.