This commit is contained in:
szabomarton
2025-01-30 10:20:25 +01:00
parent 21cb07657d
commit 0fc2b5f641
59 changed files with 2108 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}|Konyvtari_Rendszer\\Konyvtari_Rendszer.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20250130\\konyvtari_rendszer\\konyvtari_rendszer\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}|Konyvtari_Rendszer\\Konyvtari_Rendszer.csproj|solutionrelative:konyvtari_rendszer\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\Konyvtari_Rendszer\\Program.cs",
"RelativeDocumentMoniker": "Konyvtari_Rendszer\\Program.cs",
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\Konyvtari_Rendszer\\Program.cs",
"RelativeToolTip": "Konyvtari_Rendszer\\Program.cs",
"ViewState": "AgIAAKEAAAAAAAAAAAAcwLAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-30T06:56:13.633Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}|Konyvtari_Rendszer\\Konyvtari_Rendszer.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20250130\\konyvtari_rendszer\\konyvtari_rendszer\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}|Konyvtari_Rendszer\\Konyvtari_Rendszer.csproj|solutionrelative:konyvtari_rendszer\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\Konyvtari_Rendszer\\Program.cs",
"RelativeDocumentMoniker": "Konyvtari_Rendszer\\Program.cs",
"ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250130\\Konyvtari_Rendszer\\Konyvtari_Rendszer\\Program.cs",
"RelativeToolTip": "Konyvtari_Rendszer\\Program.cs",
"ViewState": "AgIAAK0AAAAAAAAAAAAcwMwAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-30T06:56:13.633Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Konyvtari_Rendszer", "Konyvtari_Rendszer\Konyvtari_Rendszer.csproj", "{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B7010BC-8A3D-4289-AFDB-FEA2C7B1AE15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EDE0055D-B30F-4BD3-B2D2-D9E69D31DD3C}
EndGlobalSection
EndGlobal

View File

@@ -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>

View File

@@ -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>

View 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;
}
}
}

View File

@@ -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")]

View File

@@ -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>

View File

@@ -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")]

View File

@@ -0,0 +1 @@
137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509

View File

@@ -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