Skip to content
Snippets Groups Projects
Commit 699c12e2 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

projektit .net5

parent 5e99ead1
No related branches found
No related tags found
No related merge requests found
Showing
with 32 additions and 133 deletions
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -15,9 +15,10 @@ from shutil import copyfile
def fast_scandir(dirname):
subfolders = [f.path for f in os.scandir(dirname) if f.is_dir()]
subfolders = [f.path for f in os.scandir(dirname) if f.is_dir() and f.path.find(".git")<0]
for dirname in list(subfolders):
subfolders.extend(fast_scandir(dirname))
if dirname.find(".git") < 0:
subfolders.extend(fast_scandir(dirname))
return subfolders
......@@ -63,7 +64,7 @@ def copy_projfile(empty_proj_file_name, text, new_proj_file_name):
def change(datadir):
deldirs()
onlydirs = [f for f in listdir('.') if isdir(join('.', f))]
onlydirs = fast_scandir('.')
for d in onlydirs:
projs = [d + '/' + f for f in listdir(d) if match(r'.*csproj', f)]
if projs:
......@@ -72,27 +73,23 @@ def change(datadir):
proj_name = os.path.basename(proj_file_name).replace('.csproj', '')
with open(proj_file_name) as pf:
text = pf.read()
if 'ypeli.dll' in text:
proj_type = "jypeli"
elif 'Properties' in text:
proj_type = "console"
if proj_type:
print(proj_file_name, proj_type)
# copyfile(datadir + '\\' + proj_type + '.csproj', proj_file_name)
copy_projfile(datadir + '\\' + proj_type + '.csproj', text, proj_file_name)
if proj_type == "jypeli":
# Add proj name to run to Ohjelma.cs
with open(datadir + '\\EmptyOhjelma.cs') as f:
ohjelma = f.read()
ohjelma = ohjelma.replace('XXX', proj_name)
with open(d + '/Ohjelma.cs', 'w') as f:
f.write(ohjelma)
oldtext = text
text = text.replace("<TargetFrameworks>netcoreapp3.1</TargetFrameworks>", "<TargetFramework>net5.0</TargetFramework>")
text = text.replace('<TargetFramework>netcoreapp3.1</TargetFramework>', '<TargetFramework>net5.0</TargetFramework>')
text = text.replace('<PackageReference Include="Jypeli.Core" Version="9.*" />', '<PackageReference Include="Jypeli.NET" Version="10.*" />')
text = text.replace('<PackageReference Include="Jypeli.Physics2d.Core" Version="1.5.*" />', '<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.*" />')
if oldtext != text:
print(proj_file_name)
print("============================")
print(text)
with open(proj_file_name, 'w') as f:
f.write(text)
"""
slns = [f for f in listdir('.') if match(r'.*sln', f)]
if slns:
print(slns[0])
copyfile(datadir + '\\' + 'empty.sln', slns[0])
"""
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using static Nelio;
[TestFixture]
public class TestNelio
{
[Test]
public void TestNelionAla23()
{
Assert.AreEqual( 1, NelionAla(1) , 0.000001, "in method NelionAla, line 24");
Assert.AreEqual( 4, NelionAla(2) , 0.000001, "in method NelionAla, line 25");
Assert.AreEqual( 9, NelionAla(3) , 0.000001, "in method NelionAla, line 26");
}
}
<?xml version="1.0" encoding="UTF-8"?><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>
<ItemGroup><ProjectReference Include="E:\kurssit\ohj1\esimerkit\2020s\harjoittelu\demo3\Nelio\Nelio.csproj"/></ItemGroup></Project>
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
using System;
using NUnit.Framework;
using static LaskeLuvut;
[TestFixture]
public class TestLaskeLuvut
{
[Test]
public void TestMontako24()
{
Assert.AreEqual( 1, Montako(new int[]{3, 2, 1}, 2) , "in method Montako, line 25");
Assert.AreEqual( 3, Montako(new int[]{5, 5, 5}, 5) , "in method Montako, line 26");
Assert.AreEqual( 0, Montako(new int[]{2, 1, 3, 4}, 6) , "in method Montako, line 27");
Assert.AreEqual( 0, Montako(new int[]{}, 6) , "in method Montako, line 28");
}
}
<?xml version="1.0" encoding="UTF-8"?><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>
<ItemGroup><ProjectReference Include="E:\kurssit\ohj1\esimerkit\2020s\harjoittelu\demo5\LaskeLuvut\LaskeLuvut.csproj"/></ItemGroup></Project>
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
<?xml version="1.0" encoding="UTF-8"?><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>
<ItemGroup><ProjectReference Include="E:\kurssit\ohj1\esimerkit\2020s\harjoittelu\demo5\LisaaKeskelle\LisaaKeskelle.csproj"/></ItemGroup></Project>
using System;
using System.Text;
using NUnit.Framework;
using static Lisaile;
[TestFixture]
public class TestLisaile
{
[Test]
public void TestLisaaKeskelle20()
{
Assert.AreEqual( "Abcba", LisaaKeskelle(new StringBuilder("Abba"), "c").ToString() , "in method LisaaKeskelle, line 21");
Assert.AreEqual( "a", LisaaKeskelle(new StringBuilder(""), "a").ToString() , "in method LisaaKeskelle, line 22");
Assert.AreEqual( "1423", LisaaKeskelle(new StringBuilder("123"), "4").ToString() , "in method LisaaKeskelle, line 23");
}
}
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,14 +2,14 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFramework>net5.0</TargetFramework>
<PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Jypeli.Core" Version="9.*" />
<PackageReference Include="Jypeli.Physics2d.Core" Version="1.5.*" />
<PackageReference Include="Jypeli.NET" Version="10.*" />
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.*" />
</ItemGroup>
<ItemGroup>
<None Update="Icon.ico">
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment