Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on: [push, pull_request]

jobs:
build:
runs-on: windows-2019
runs-on: windows-2025
steps:
- uses: actions/checkout@v1
- name: Setup .NetCore
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.100
dotnet-version: 10.0.100
- name: Build with dotnet
run: |
dotnet build --configuration Release
dotnet build -c Release
- name: Unit Tests
run: |
dotnet test
dotnet test -c Release
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ operating XTMF2.

### Requirements

1. DotNet Core 3.0+ SDK
1. DotNet Core 10.0+ SDK

### Clone the XTMF2 repository

> git clone https://github.com/TravelModellingGroup/XTMF2.git

### Compile from command line

> dotnet build
> dotnet build -c Release

> dotnet test
> dotnet test -c Release


## Main Branches
Expand Down
3 changes: 1 addition & 2 deletions XTMF2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFi
.github\workflows\blank.yml = .github\workflows\blank.yml
..\LICENSE = ..\LICENSE
README.md = README.md
XTMF2.vsdx = XTMF2.vsdx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9040CC77-712E-414D-8453-391F9F348218}"
Expand All @@ -19,7 +18,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XTMF2", "src\XTMF2\XTMF2.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XTMF2.Interfaces", "src\XTMF2.Interfaces\XTMF2.Interfaces.csproj", "{5E0E170B-5A98-41C0-A9AB-4A0ED28C5CF1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XTMF2.Client", "src\XTMF2.Client\XTMF2.Client.csproj", "{A4FC5ADC-58CA-429A-9626-EF07907AFB28}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XTMF2.RunServer", "src\XTMF2.Client\XTMF2.RunServer.csproj", "{A4FC5ADC-58CA-429A-9626-EF07907AFB28}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{77789778-93F5-46A6-9114-CCE855E5919C}"
EndProject
Expand Down
Binary file removed XTMF2.vsdx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/XTMF2.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static void RunClient(Stream serverStream, List<string> extraDlls, Syste
{
loadedConfig.LoadAssembly(dll);
}
using var clientBus = new ClientBus(serverStream, true, runtime, extraDlls);
using var clientBus = new RunServerBus(serverStream, true, runtime, extraDlls);
clientBus.ProcessRequests();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>XTMF2.Client</RootNamespace>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>XTMF2.RunServer</RootNamespace>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
<StartupObject></StartupObject>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.IO.Pipes" Version="4.3.0" />
<Content Include="..\..\src\XTMF2.Run\bin\$(Configuration)\$(TargetFramework)\XTMF2.Run.deps.json" Link="XTMF2.Run.deps.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion src/XTMF2.Interfaces/XTMF2.Interfaces.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>XTMF2</RootNamespace>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/XTMF2.Run/XTMF2.Run.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/XTMF2/ArbitraryParameterParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

namespace XTMF2
Expand Down Expand Up @@ -109,9 +110,9 @@ public static (bool Sucess, object? Value) ArbitraryParameterParse(Type type, st
/// <param name="value">The value held as a string</param>
/// <param name="error">Contains an error if this returns false</param>
/// <returns>True if it is a value, false otherwise with a reason inside of error.</returns>
public static bool Check(Type type, string value, ref string? error)
public static bool Check(Type type, string value, [NotNullWhen(false)] ref string? error)
{
return ArbitraryParameterParse(type, value, ref error).Sucess;
return ArbitraryParameterParse(type, value, ref error).Sucess;
}

private static (bool, object?) ErrorTryParse(string input, ref string? error, MethodInfo errorTryParse)
Expand Down
12 changes: 6 additions & 6 deletions src/XTMF2/Bus/RunContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static bool CreateRunContext(XTMFRuntime runtime, string id, byte[] model
return true;
}

private Stream? CreateRunBusLocal(ClientBus clientBus)
private Stream? CreateRunBusLocal(RunServerBus clientBus)
{
var pipeName = Guid.NewGuid().ToString();
string? error = null;
Expand All @@ -109,14 +109,14 @@ public static bool CreateRunContext(XTMFRuntime runtime, string id, byte[] model
return clientToRunStream;
}

private (Stream clientToRunStream, Process runProcess) CreateRunBusRemote(ClientBus clientBus)
private (Stream clientToRunStream, Process runProcess) CreateRunBusRemote(RunServerBus clientBus)
{
var pipeName = Guid.NewGuid().ToString();
string? error = null;
Process? runProcess = null;
CreateStreams.CreateNewNamedPipeHost(pipeName, out var clientToRunStream, ref error, () =>
{
var path = Path.GetDirectoryName(typeof(ClientBus).GetTypeInfo().Assembly.Location)!;
var path = Path.GetDirectoryName(typeof(RunServerBus).GetTypeInfo().Assembly.Location)!;
var startInfo = new ProcessStartInfo()
{
FileName = "dotnet",
Expand All @@ -135,7 +135,7 @@ public static bool CreateRunContext(XTMFRuntime runtime, string id, byte[] model
return (clientToRunStream!, runProcess!);
}

private string GetExtraDlls(ClientBus client)
private string GetExtraDlls(RunServerBus client)
{
var builder = new StringBuilder();
foreach (var dll in client.ExtraDlls)
Expand All @@ -148,7 +148,7 @@ private string GetExtraDlls(ClientBus client)
}


public void RunInNewProcess(ClientBus client)
public void RunInNewProcess(RunServerBus client)
{
(Stream stream, Process runProcess) = CreateRunBusRemote(client);
using var writer = new BinaryWriter(stream, Encoding.UTF8, false);
Expand All @@ -162,7 +162,7 @@ public void RunInNewProcess(ClientBus client)
runProcess.WaitForExit();
}

public void RunInCurrentProcess(ClientBus client)
public void RunInCurrentProcess(RunServerBus client)
{
using var stream = CreateRunBusLocal(client);
new Run(ID, _modelSystem, StartToExecute, _runtime, _currentWorkingDirectory).StartRun();
Expand Down
6 changes: 3 additions & 3 deletions src/XTMF2/Bus/ClientBus.cs → src/XTMF2/Bus/RunServerBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace XTMF2.Bus
/// Provides communication to the host and forwards communication
/// to the Run.
/// </summary>
public sealed class ClientBus : IDisposable
public sealed class RunServerBus : IDisposable
{
private readonly Stream _clientHost;
private readonly bool _owner;
Expand All @@ -55,7 +55,7 @@ public sealed class ClientBus : IDisposable
/// <param name="serverStream">A stream that connects to the host.</param>
/// <param name="streamOwner">Should this bus assume ownership over the stream?</param>
/// <param name="runtime">The XTMFRuntime to work within.</param>
public ClientBus(Stream serverStream, bool streamOwner, XTMFRuntime runtime, List<string>? extraDlls = null)
public RunServerBus(Stream serverStream, bool streamOwner, XTMFRuntime runtime, List<string>? extraDlls = null)
{
Runtime = runtime;
_runScheduler = new Scheduler(this);
Expand Down Expand Up @@ -85,7 +85,7 @@ public void Dispose()
Dispose(true);
}

~ClientBus()
~RunServerBus()
{
Dispose(false);
}
Expand Down
4 changes: 2 additions & 2 deletions src/XTMF2/Bus/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace XTMF2.Bus
internal sealed class Scheduler : IDisposable
{
private readonly ConcurrentQueue<RunContext> _ToRun = new ConcurrentQueue<RunContext>();
private readonly ClientBus _Bus;
private readonly RunServerBus _Bus;
private readonly CancellationTokenSource _CancelExecutionEngine;
private readonly SemaphoreSlim _RunsToGo = new SemaphoreSlim(0);

Expand All @@ -43,7 +43,7 @@ internal sealed class Scheduler : IDisposable
/// Create a new Scheduler to process the given client bus.
/// </summary>
/// <param name="bus">The bus to listen to.</param>
public Scheduler(ClientBus bus)
public Scheduler(RunServerBus bus)
{
_Bus = bus;
_CancelExecutionEngine = new CancellationTokenSource();
Expand Down
Loading