c# conversion start

This commit is contained in:
2025-03-07 11:04:47 +01:00
parent 8c373e7d56
commit 44c589cfe4
31 changed files with 444 additions and 0 deletions

View File

30
ora1gyak/Keres.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Keres{
abstract class Feladat<T> {
public T Kezdo { get; }
public T Cel{ get; protected set;}
public Feladat(T kezdo, T cel){
Kezdo = kezdo;
Cel = cel;
}
public virtual bool Celteszt(T allapot){
return EqualityComparer<T>.Default.Equals(allapot, Cel);
}
public abstract IEnumerable<(string, T)> Rakovetkezo(T allapot);
public virtual int Utkoltseg(int c, T allapot1, string lepes, T allapot2){
return c+1;
}
}
public class Csucs<T>{
}
}

5
ora1gyak/Program.cs Normal file
View File

@@ -0,0 +1,5 @@
public class Program{
public static void Main(String[] args) {
Console.WriteLine("Hello World");
}
}

122
ora1gyak/Seged.cs Normal file
View File

@@ -0,0 +1,122 @@
using System.Collections.Generic;
using System;
namespace Seged
{
class Varolista<T>
{
private List<T> list;
public Varolista()
{
list = new List<T>();
}
public void Extend(List<T> list)
{
foreach (var item in list)
{
this.list.Add(item);
}
}
public List<T> GetList()
{
return list;
}
public void SetList(List<T> list)
{
this.list = list;
}
}
class Sor<T> : Varolista<T>
{
private int kezdo = 0;
public void Append(T item)
{
List<T> value = new List<T> { item };
Extend(value);
}
public int Length()
{
return GetList().Count - kezdo;
}
public T Pop()
{
T e = GetList()[kezdo++];
if (kezdo > 5 && kezdo > GetList().Count / 2)
{
SetList(GetList().GetRange(kezdo, GetList().Count - kezdo));
kezdo = 0;
}
return e;
}
}
class RLElem<T>
{
private readonly int ertek;
private readonly T elem;
public int GetErtek()
{
return ertek;
}
public T Elem()
{
return elem;
}
public RLElem(int ertek, T elem)
{
this.ertek = ertek;
this.elem = elem;
}
public bool lt(int other)
{
return ertek < other;
}
}
class RendezettLista<T> : Varolista<T>
{
private readonly Func<T, int> f; // Sorting function
public RendezettLista(Func<T, int> f)
{
this.f = f;
}
public void Append(T elem)
{
var par = new RLElem<T>(f(elem), elem);
List<RLElem<T>> list = GetList().ConvertAll(e => new RLElem<T>(f(e), e));
int index = list.BinarySearch(par, Comparer<RLElem<T>>.Create((a, b) => a.GetErtek().CompareTo(b.GetErtek())));
if (index < 0) index = ~index; // Get correct insertion position
list.Insert(index, par); // Insert at sorted position
SetList(list.ConvertAll(e => e.Elem())); // Convert back to original type
}
public T Pop()
{
List<T> list = GetList();
if (list.Count == 0) throw new InvalidOperationException("The list is empty.");
T elem = list[0];
list.RemoveAt(0);
SetList(list);
return elem;
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"ora1gyak/1.0.0": {
"runtime": {
"ora1gyak.dll": {}
}
}
}
},
"libraries": {
"ora1gyak/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

BIN
ora1gyak/obj/Debug/net8.0/apphost Executable file

Binary file not shown.

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("ora1gyak")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8c373e7d5620b80df629e5851ca3542a784386f9")]
[assembly: System.Reflection.AssemblyProductAttribute("ora1gyak")]
[assembly: System.Reflection.AssemblyTitleAttribute("ora1gyak")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1 @@
e7ca40aec6b04e9f591e0faf4b64578af1c3bec275a11809e6c94bfec5b8b9ef

View File

@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = ora1gyak
build_property.ProjectDir = /home/tom/Dev/mestint/ora1gyak/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =

View File

@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Binary file not shown.

View File

@@ -0,0 +1 @@
58c3a24b8ebc449cdc625d4897d827855bcb1f4e129dd4b4f5460053ed60e85d

View File

@@ -0,0 +1,15 @@
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.GeneratedMSBuildEditorConfig.editorconfig
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.AssemblyInfoInputs.cache
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.AssemblyInfo.cs
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.csproj.CoreCompileInputs.cache
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.sourcelink.json
/home/tom/Dev/mestint/ora1gyak/bin/Debug/net8.0/ora1gyak
/home/tom/Dev/mestint/ora1gyak/bin/Debug/net8.0/ora1gyak.deps.json
/home/tom/Dev/mestint/ora1gyak/bin/Debug/net8.0/ora1gyak.runtimeconfig.json
/home/tom/Dev/mestint/ora1gyak/bin/Debug/net8.0/ora1gyak.dll
/home/tom/Dev/mestint/ora1gyak/bin/Debug/net8.0/ora1gyak.pdb
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.dll
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/refint/ora1gyak.dll
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.pdb
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ora1gyak.genruntimeconfig.cache
/home/tom/Dev/mestint/ora1gyak/obj/Debug/net8.0/ref/ora1gyak.dll

Binary file not shown.

View File

@@ -0,0 +1 @@
00c58dbc257927f48ee145ad6916648f2e700d8dfb2cd12774e6b25a442996cc

Binary file not shown.

View File

@@ -0,0 +1 @@
{"documents":{"/home/tom/Dev/mestint/*":"https://raw.githubusercontent.com/htamas1210/mestint/8c373e7d5620b80df629e5851ca3542a784386f9/*"}}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,61 @@
{
"format": 1,
"restore": {
"/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj": {}
},
"projects": {
"/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj",
"projectName": "ora1gyak",
"projectPath": "/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj",
"packagesPath": "/home/tom/.nuget/packages/",
"outputPath": "/home/tom/Dev/mestint/ora1gyak/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/tom/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.112/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/tom/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/tom/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/tom/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@@ -0,0 +1,66 @@
{
"version": 3,
"targets": {
"net8.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net8.0": []
},
"packageFolders": {
"/home/tom/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj",
"projectName": "ora1gyak",
"projectPath": "/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj",
"packagesPath": "/home/tom/.nuget/packages/",
"outputPath": "/home/tom/Dev/mestint/ora1gyak/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/tom/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.112/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "6++IdPzGwkAIg/uzl5ldolEqJu61iAjLnWh+qV2PgIiRbX9Ix9XOBePbaLs9qaF5jyMOOgmAOXn3h9eMTkHlaA==",
"success": true,
"projectFilePath": "/home/tom/Dev/mestint/ora1gyak/ora1gyak.csproj",
"expectedPackageFiles": [],
"logs": []
}

10
ora1gyak/ora1gyak.csproj Normal file
View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

24
ora1gyak/ora1gyak.sln Normal file
View File

@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ora1gyak", "ora1gyak.csproj", "{D42A19B6-75D8-4289-8C97-DAE2849838B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D42A19B6-75D8-4289-8C97-DAE2849838B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D42A19B6-75D8-4289-8C97-DAE2849838B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D42A19B6-75D8-4289-8C97-DAE2849838B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D42A19B6-75D8-4289-8C97-DAE2849838B0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {01549981-9189-4D13-901E-FEEAD2027EB3}
EndGlobalSection
EndGlobal