Compare commits

..

2 Commits

Author SHA1 Message Date
KP9lKk
13f06cb083 add file reader 2024-12-10 11:29:58 +03:00
KP9lKk
d667c02cfe add filereader 2024-12-10 11:29:26 +03:00
13 changed files with 1805 additions and 11 deletions

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,117 @@
// <auto-generated />
using System;
using LootBoxSimulator.Models.DAO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LootBoxSimulator.Migrations
{
[DbContext(typeof(RemoteDatabaseContext))]
[Migration("20241204111540_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LootBoxSimulator.Models.DAO.CategoryDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("RateId")
.HasColumnType("integer");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("RateId");
b.ToTable("Items");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.RateDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Color")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<decimal>("Rate")
.HasColumnType("numeric");
b.HasKey("Id");
b.ToTable("Rates");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b =>
{
b.HasOne("LootBoxSimulator.Models.DAO.CategoryDao", "Category")
.WithMany()
.HasForeignKey("CategoryId");
b.HasOne("LootBoxSimulator.Models.DAO.RateDao", "Rate")
.WithMany()
.HasForeignKey("RateId");
b.Navigation("Category");
b.Navigation("Rate");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,92 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LootBoxSimulator.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Rates",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Rate = table.Column<decimal>(type: "numeric", nullable: false),
Color = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Rates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
Url = table.Column<string>(type: "text", nullable: false),
CategoryId = table.Column<int>(type: "integer", nullable: true),
RateId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.Id);
table.ForeignKey(
name: "FK_Items_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Items_Rates_RateId",
column: x => x.RateId,
principalTable: "Rates",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Items_CategoryId",
table: "Items",
column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Items_RateId",
table: "Items",
column: "RateId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "Rates");
}
}
}

View File

@ -0,0 +1,121 @@
// <auto-generated />
using System;
using LootBoxSimulator.Models.DAO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LootBoxSimulator.Migrations
{
[DbContext(typeof(RemoteDatabaseContext))]
[Migration("20241204111858_AddDescripForItem")]
partial class AddDescripForItem
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LootBoxSimulator.Models.DAO.CategoryDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("RateId")
.HasColumnType("integer");
b.Property<string>("Url")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("RateId");
b.ToTable("Items");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.RateDao", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Color")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<decimal>("Rate")
.HasColumnType("numeric");
b.HasKey("Id");
b.ToTable("Rates");
});
modelBuilder.Entity("LootBoxSimulator.Models.DAO.ItemDao", b =>
{
b.HasOne("LootBoxSimulator.Models.DAO.CategoryDao", "Category")
.WithMany()
.HasForeignKey("CategoryId");
b.HasOne("LootBoxSimulator.Models.DAO.RateDao", "Rate")
.WithMany()
.HasForeignKey("RateId");
b.Navigation("Category");
b.Navigation("Rate");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LootBoxSimulator.Migrations
{
/// <inheritdoc />
public partial class AddDescripForItem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Description",
table: "Items",
type: "text",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Description",
table: "Items");
}
}
}

View File

@ -1,8 +1,14 @@
using LootBoxSimulator.Models.DAO;
RemoteDatabaseContext db = new RemoteDatabaseContext();
foreach (var result in db.Categories)
String path = Console.ReadLine();
StreamReader file = new StreamReader(path);
string line;
while ((line = file.ReadLine()) != null)
{
Console.WriteLine($"{result.Id} | {result.Name}");
var row = line.Split(";");
CategoryDao categoryDao = new CategoryDao { Name = row[0]};
db.Categories.Add(categoryDao);
db.SaveChanges();
}
Console.WriteLine(file.ReadToEnd());

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+f05c4ca34c40f604537abb997bf99aa3ec9ee1e5")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+684a1ad6929b649ac97d03976112fc7cfccb5497")]
[assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")]
[assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,47 @@
{
"version": 2,
"dgSpecHash": "eamoFob6erM=",
"dgSpecHash": "QYfTKOl98mU=",
"success": true,
"projectFilePath": "/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/LootBoxSimulator.csproj",
"expectedPackageFiles": [
"/home/laptop/.nuget/packages/humanizer.core/2.14.1/humanizer.core.2.14.1.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.bcl.asyncinterfaces/6.0.0/microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.codeanalysis.analyzers/3.3.3/microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.codeanalysis.common/4.5.0/microsoft.codeanalysis.common.4.5.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.codeanalysis.csharp/4.5.0/microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.codeanalysis.csharp.workspaces/4.5.0/microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.codeanalysis.workspaces.common/4.5.0/microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.entityframeworkcore/8.0.11/microsoft.entityframeworkcore.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.entityframeworkcore.abstractions/8.0.11/microsoft.entityframeworkcore.abstractions.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.entityframeworkcore.analyzers/8.0.11/microsoft.entityframeworkcore.analyzers.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.entityframeworkcore.design/8.0.11/microsoft.entityframeworkcore.design.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.entityframeworkcore.relational/8.0.11/microsoft.entityframeworkcore.relational.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.caching.abstractions/8.0.0/microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.caching.memory/8.0.1/microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.configuration.abstractions/8.0.0/microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.1/microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/8.0.2/microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.dependencymodel/8.0.2/microsoft.extensions.dependencymodel.8.0.2.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.logging/8.0.1/microsoft.extensions.logging.8.0.1.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.logging.abstractions/8.0.2/microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.options/8.0.2/microsoft.extensions.options.8.0.2.nupkg.sha512",
"/home/laptop/.nuget/packages/microsoft.extensions.primitives/8.0.0/microsoft.extensions.primitives.8.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/mono.texttemplating/2.2.1/mono.texttemplating.2.2.1.nupkg.sha512",
"/home/laptop/.nuget/packages/npgsql/8.0.6/npgsql.8.0.6.nupkg.sha512",
"/home/laptop/.nuget/packages/npgsql.entityframeworkcore.postgresql/8.0.11/npgsql.entityframeworkcore.postgresql.8.0.11.nupkg.sha512"
"/home/laptop/.nuget/packages/npgsql.entityframeworkcore.postgresql/8.0.11/npgsql.entityframeworkcore.postgresql.8.0.11.nupkg.sha512",
"/home/laptop/.nuget/packages/system.codedom/4.4.0/system.codedom.4.4.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.collections.immutable/6.0.0/system.collections.immutable.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition/6.0.0/system.composition.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition.attributedmodel/6.0.0/system.composition.attributedmodel.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition.convention/6.0.0/system.composition.convention.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition.hosting/6.0.0/system.composition.hosting.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition.runtime/6.0.0/system.composition.runtime.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.composition.typedparts/6.0.0/system.composition.typedparts.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.io.pipelines/6.0.3/system.io.pipelines.6.0.3.nupkg.sha512",
"/home/laptop/.nuget/packages/system.reflection.metadata/6.0.1/system.reflection.metadata.6.0.1.nupkg.sha512",
"/home/laptop/.nuget/packages/system.runtime.compilerservices.unsafe/6.0.0/system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.text.encoding.codepages/6.0.0/system.text.encoding.codepages.6.0.0.nupkg.sha512",
"/home/laptop/.nuget/packages/system.threading.channels/6.0.0/system.threading.channels.6.0.0.nupkg.sha512"
],
"logs": []
}

View File

@ -1 +1 @@
"restore":{"projectUniqueName":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/LootBoxSimulator.csproj","projectName":"LootBoxSimulator","projectPath":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/LootBoxSimulator.csproj","outputPath":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/obj/","projectStyle":"PackageReference","UsingMicrosoftNETSdk":false,"originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.EntityFrameworkCore":{"target":"Package","version":"[8.0.11, )"},"Npgsql.EntityFrameworkCore.PostgreSQL":{"target":"Package","version":"[8.0.11, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/share/dotnet/sdk/8.0.403/PortableRuntimeIdentifierGraph.json"}}
"restore":{"projectUniqueName":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/LootBoxSimulator.csproj","projectName":"LootBoxSimulator","projectPath":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/LootBoxSimulator.csproj","outputPath":"/home/laptop/RiderProjects/LootBoxSimulator/LootBoxSimulator/obj/","projectStyle":"PackageReference","UsingMicrosoftNETSdk":false,"originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.EntityFrameworkCore":{"target":"Package","version":"[8.0.11, )"},"Microsoft.EntityFrameworkCore.Design":{"include":"Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive","suppressParent":"All","target":"Package","version":"[8.0.11, )"},"Npgsql.EntityFrameworkCore.PostgreSQL":{"target":"Package","version":"[8.0.11, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/share/dotnet/sdk/8.0.403/PortableRuntimeIdentifierGraph.json"}}

View File

@ -1 +1 @@
17333088740485110
17333113237597597

View File

@ -1 +1 @@
17333088743484999
17333113237597597

View File

@ -0,0 +1,4 @@
Name
редкая
очень редкая
легендарная