asd
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Konyvtari_Rendszer</RootNamespace>
|
||||
<AssemblyName>Konyvtari_Rendszer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
204
20250130/Konyvtari_Rendszer/Konyvtari_Rendszer/Program.cs
Normal file
204
20250130/Konyvtari_Rendszer/Konyvtari_Rendszer/Program.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Konyvtari_Rendszer
|
||||
{
|
||||
public class Konyvtar
|
||||
{
|
||||
public List<Konyv> konyvek = new List<Konyv>();
|
||||
|
||||
public Konyvtar(List<Konyv> konyvek) {
|
||||
this.konyvek = konyvek;
|
||||
}
|
||||
|
||||
public Konyvtar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void KonyvFelvetel(Konyv konyv)
|
||||
{
|
||||
if (!konyvek.Contains(konyv))
|
||||
{
|
||||
konyvek.Add(konyv);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < konyvek.Count; i++)
|
||||
{
|
||||
if (konyvek[i].cim == konyv.cim)
|
||||
{
|
||||
konyvek[i].darabszam++;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void Kilistazas()
|
||||
{
|
||||
foreach (var item in konyvek)
|
||||
{
|
||||
Console.WriteLine($"Cím: {item.cim}, Szerző: {item.szerzo}, Kiadás éve: {item.kiadasEve}, Darab: {item.darabszam}");
|
||||
}
|
||||
}
|
||||
|
||||
private Konyv KeresesCim(string cim)
|
||||
{
|
||||
foreach (var item in konyvek) {
|
||||
if (cim == item.cim)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void KeresesCimAlapjan(string cim)
|
||||
{
|
||||
Konyv konyv = KeresesCim(cim);
|
||||
if (konyv != null)
|
||||
{
|
||||
Console.WriteLine($"Cím: {konyv.cim}, Szerző: {konyv.szerzo}, Kiadás éve: {konyv.kiadasEve}, Darab: {konyv.darabszam}");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Nincs ilyen című könyv!");
|
||||
}
|
||||
|
||||
private List<Konyv> KeresesSzerzo(string szerzo)
|
||||
{
|
||||
List<Konyv> talalatok = new List<Konyv>();
|
||||
foreach (var item in konyvek) {
|
||||
if (item.szerzo == szerzo)
|
||||
{
|
||||
talalatok.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return talalatok;
|
||||
}
|
||||
|
||||
public void KeresesSzerzoAlapjan(string szerzo)
|
||||
{
|
||||
List<Konyv> talalatok = KeresesSzerzo(szerzo);
|
||||
|
||||
if (talalatok.Count != 0)
|
||||
{
|
||||
foreach (var item in talalatok)
|
||||
{
|
||||
Console.WriteLine($"Cím: {item.cim}, Szerző: {item.szerzo}, Kiadás éve: {item.kiadasEve}, Darab: {item.darabszam}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("A keresett szerzőtől nem találtunk könyvet!");
|
||||
}
|
||||
|
||||
public void KonyvModositas(Konyv modositando, Konyv modositott)
|
||||
{
|
||||
for (int i = 0; i < konyvek.Count; i++)
|
||||
{
|
||||
if (konyvek[i].cim == modositando.cim)
|
||||
{
|
||||
konyvek[i] = modositott;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void KonyvTorles(Konyv torlendo)
|
||||
{
|
||||
konyvek.Remove(torlendo);
|
||||
}
|
||||
}
|
||||
|
||||
public class Konyv {
|
||||
public string cim;
|
||||
public string szerzo;
|
||||
public int kiadasEve;
|
||||
public int darabszam = 1;
|
||||
|
||||
public Konyv(string cim, string szerzo, int kiadasEve) {
|
||||
this.cim = cim;
|
||||
this.szerzo = szerzo;
|
||||
this.kiadasEve = kiadasEve;
|
||||
}
|
||||
|
||||
public Konyv(string cim, string szerzo, int kiadasEve, int darabszam)
|
||||
{
|
||||
this.cim = cim;
|
||||
this.szerzo = szerzo;
|
||||
this.kiadasEve = kiadasEve;
|
||||
this.darabszam = darabszam;
|
||||
}
|
||||
}
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string path = "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\konyvek.txt";
|
||||
Konyvtar konyvtar = new Konyvtar(FileReading(path));
|
||||
|
||||
Konyv HP = new Konyv("Harry Potter", "J.K.Rowling", 2000);
|
||||
Konyv HP_2 = new Konyv("Harry Potter és a Tűz Serlege", "J.K.Rowling", 2005);
|
||||
Konyv AH = new Konyv("Atomic Habits", "James Clear", 2015);
|
||||
|
||||
konyvtar.KonyvFelvetel(HP);
|
||||
konyvtar.KonyvFelvetel(HP);
|
||||
|
||||
konyvtar.KonyvFelvetel(AH);
|
||||
konyvtar.KonyvFelvetel(HP_2);
|
||||
|
||||
konyvtar.Kilistazas();
|
||||
|
||||
konyvtar.KeresesCimAlapjan("Atomic Habits");
|
||||
konyvtar.KeresesCimAlapjan("Aranyember");
|
||||
|
||||
|
||||
konyvtar.KeresesSzerzoAlapjan("J.K.Rowling");
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
konyvtar.KonyvModositas(HP, HP_2);
|
||||
konyvtar.KeresesSzerzoAlapjan("J.K.Rowling");
|
||||
Console.WriteLine();
|
||||
|
||||
konyvtar.KonyvTorles(HP_2);
|
||||
konyvtar.KeresesSzerzoAlapjan("J.K.Rowling");
|
||||
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
public static List<Konyv> FileReading(string path)
|
||||
{
|
||||
List<Konyv> konyvek = new List<Konyv>();
|
||||
|
||||
FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
StreamReader streamReader = new StreamReader(fileStream);
|
||||
|
||||
string line = streamReader.ReadLine();
|
||||
while(line != null)
|
||||
{
|
||||
string[] adatok = line.Split(';');
|
||||
Konyv konyv = new Konyv(adatok[0], adatok[1], Convert.ToInt32(adatok[2]), Convert.ToInt32(adatok[3]));
|
||||
konyvek.Add(konyv);
|
||||
line = streamReader.ReadLine();
|
||||
}
|
||||
|
||||
|
||||
streamReader.Close();
|
||||
fileStream.Close();
|
||||
|
||||
return konyvek;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Konyvtari_Rendszer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Konyvtari_Rendszer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0b7010bc-8a3d-4289-afdb-fea2c7b1ae15")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509
|
||||
@@ -0,0 +1,7 @@
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\bin\Debug\Konyvtari_Rendszer.exe.config
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\bin\Debug\Konyvtari_Rendszer.exe
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\bin\Debug\Konyvtari_Rendszer.pdb
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\obj\Debug\Konyvtari_Rendszer.csproj.AssemblyReference.cache
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\obj\Debug\Konyvtari_Rendszer.csproj.CoreCompileInputs.cache
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\obj\Debug\Konyvtari_Rendszer.exe
|
||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20250130\Konyvtari_Rendszer\Konyvtari_Rendszer\obj\Debug\Konyvtari_Rendszer.pdb
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user