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 GetMaterialsForBlueprint(long id) { var result = new List(); 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; } } }