Skip to content

Commit a35a40b

Browse files
committed
Bump version
1 parent 3da586b commit a35a40b

5 files changed

Lines changed: 54 additions & 36 deletions

File tree

DotNetClr/CLR/DotNetClr.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ private void Init(DotNetFile p)
5656

5757

5858
/// <summary>
59-
/// Starts the .NET Executable
59+
/// Runs the entry point
6060
/// </summary>
61+
/// <param name="args">String array of arguments</param>
6162
public void Start(string[] args = null)
6263
{
6364
try
@@ -99,6 +100,7 @@ private void InitAssembly(DotNetFile file, bool InitCorLib)
99100
{
100101
if (InitCorLib)
101102
ResolveDLL("mscorlib"); //Always resolve mscorlib, incase the exe uses .net core
103+
102104
//Resolve all of the DLLS
103105
foreach (var item in file.Backend.Tabels.AssemblyRefTabel)
104106
{
@@ -116,8 +118,7 @@ private void InitAssembly(DotNetFile file, bool InitCorLib)
116118
if (m.Name == ".cctor" && m.IsStatic)
117119
{
118120
Console.WriteLine("Creating " + t.FullName + "." + m.Name);
119-
RunMethod(m, file, new CustomList<MethodArgStack>());
120-
//stack.Clear();
121+
RunMethod(m, file, new CustomList<MethodArgStack>(), false);
121122
}
122123
}
123124
}

DotNetClr/libDotNetClr.csproj

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
6-
<PackageId>DotNetParser</PackageId>
7-
<Authors>Misha</Authors>
8-
<Company>MishaProductions</Company>
9-
<Product>DotNetParser</Product>
10-
<Description>Allows to run C# applications in C#.</Description>
11-
<RepositoryUrl>https://github.com/MishaTY/DotNetParser</RepositoryUrl>
12-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
6+
<PackageId>DotNetParser</PackageId>
7+
<Authors>Misha</Authors>
8+
<Company>MishaProductions</Company>
9+
<Product>DotNetParser</Product>
10+
<Description>Allows to run C# applications in C#.</Description>
11+
<RepositoryUrl>https://github.com/MishaTY/DotNetParser</RepositoryUrl>
12+
<Version>0.5.9</Version>
13+
</PropertyGroup>
1314

14-
<ItemGroup>
15-
<ProjectReference Include="..\LibDotNetParser\LibDotNetParser.csproj" />
16-
</ItemGroup>
15+
<ItemGroup>
16+
<ProjectReference Include="..\LibDotNetParser\LibDotNetParser.csproj" PrivateAssets="All" />
17+
</ItemGroup>
1718

19+
<PropertyGroup>
20+
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
21+
<IsPublishable>True</IsPublishable>
22+
</PropertyGroup>
23+
24+
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences">
25+
<ItemGroup>
26+
<!-- Filter out unnecessary files -->
27+
<_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')-&gt;WithMetadataValue('PrivateAssets', 'All'))" />
28+
</ItemGroup>
29+
30+
<!-- Print batches for debug purposes -->
31+
<Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Importance="High" Condition="'@(_ReferenceCopyLocalPaths)' != ''" />
32+
33+
<ItemGroup>
34+
<!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. -->
35+
<BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)" />
36+
</ItemGroup>
37+
</Target>
1838
</Project>

LibDotNetParser/LibDotNetParser.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<OutputType>Library</OutputType>
55
<TargetFramework>net5.0</TargetFramework>
66
<Platforms>AnyCPU;x64</Platforms>
7+
<Version>0.5.9</Version>
78
</PropertyGroup>
89

910
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

TestAppRunner/Program.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,25 @@ class Program
1313
private static int NumbOfFailedTests = 0;
1414
static void Main()
1515
{
16+
//This is for debugging purposes
1617
bool doil2cpu = false;
1718
string il2cpu = @"C:\Users\Misha\AppData\Roaming\Cosmos User Kit\Build\IL2CPU\IL2CPU.dll";
18-
string exe = doil2cpu ? il2cpu : "TestApp.dll";//il2cpu;
19+
string exe = doil2cpu ? il2cpu : "TestApp.dll";
20+
21+
22+
//Create a new dotnetfile with the path to the EXE
1923
var m = new DotNetFile(exe);
2024

25+
//This is not needed, but this shows the IL code of the entry point
2126
var decompiler = new IlDecompiler(m.EntryPoint);
2227
Console.WriteLine("Decompile of Main function:");
23-
2428
var ilFormater = new ILFormater(decompiler.Decompile());
2529
var outputString = ilFormater.Format();
26-
2730
Console.WriteLine(outputString);
31+
32+
//This creates an instance of a CLR, and then runs it
2833
Console.WriteLine("Running program:");
29-
DotNetClr clr = new DotNetClr(
34+
var clr = new DotNetClr(
3035
m,
3136
Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location),
3237
"framework"));
@@ -36,8 +41,10 @@ static void Main()
3641
clr.RegisterCustomInternalMethod("TestSuccess", TestSuccess);
3742
clr.RegisterCustomInternalMethod("TestFail", TestFail);
3843

44+
//Put arguments in the string array
3945
clr.Start(new string[] { "testArg" });
40-
//Console.ReadLine();
46+
47+
4148
if (NumbOfFailedTests >= 1)
4249
Environment.Exit(1);
4350
}

TesterKernel/Kernel.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ public class Kernel : Sys.Kernel
1515
private static int NumbOfFailedTests = 0;
1616
protected override void BeforeRun()
1717
{
18-
//Init
19-
var fs = new Sys.FileSystem.CosmosVFS();
18+
//Init the file system
19+
var fs = new CosmosVFS();
2020
VFSManager.RegisterVFS(fs);
2121
Console.Clear();
2222

23+
//Find the location where we booted from
2324
string boot = "";
2425
bool frame = false;
2526
foreach (var item in fs.GetVolumes())
@@ -64,18 +65,6 @@ protected override void BeforeRun()
6465
fi = File.ReadAllBytes(boot + @"DotNetparserTester.exe");
6566
}
6667
var fl = new DotNetFile(fi);
67-
68-
var decompiler = new IlDecompiler(fl.EntryPoint);
69-
Console.WriteLine("Decompiltion of Main function:");
70-
Console.WriteLine("");
71-
Console.WriteLine(boot);
72-
var ilFormater = new ILFormater(decompiler.Decompile());
73-
var outputString = ilFormater.Format();
74-
Console.WriteLine(outputString);
75-
Console.WriteLine();
76-
Console.WriteLine("Running program:");
77-
78-
7968
var clr = new DotNetClr(fl, frame ? boot + @"framework" : boot + @"FRAMEW");
8069

8170
//Register our internal methods

0 commit comments

Comments
 (0)