Skip to content

Commit a6e059f

Browse files
committed
Fixed the naming of AresService.csproj
1 parent b77a329 commit a6e059f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+11844
-0
lines changed

AresService/ARESStarter.cs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Reactive.Linq;
5+
using System.Threading.Tasks;
6+
using Ares.Core.Analyzing;
7+
using Ares.Core.Device;
8+
using Ares.Core.Device.Remote;
9+
using Ares.Core.Grpc;
10+
using Ares.Core.Planning;
11+
using Ares.Services;
12+
using AresService.Data;
13+
using AresService.DeviceDbLoaders;
14+
using Microsoft.EntityFrameworkCore;
15+
using Microsoft.Extensions.Configuration;
16+
17+
namespace AresService;
18+
19+
public class AresStarter
20+
{
21+
private readonly IRemoteAnalyzerManager _analyzerManager;
22+
private readonly IDbContextFactory<AresDbContext> _dbContextFactory;
23+
private readonly IDeviceCommandInterpreterRepo _deviceCommandInterpreterRepo;
24+
private readonly IEnumerable<IDeviceDbLoader> _deviceLoaders;
25+
private readonly IRemotePlannerManager _plannerManager;
26+
private readonly IConfiguration _configuration;
27+
private readonly IRemoteDeviceManager _remoteDeviceManager;
28+
private readonly string _dataPath;
29+
private readonly string _resultsPath;
30+
private readonly string _templatesPath;
31+
private readonly string _devicesPath;
32+
33+
public AresStarter(
34+
IDeviceCommandInterpreterRepo deviceCommandInterpreterRepo,
35+
IDbContextFactory<AresDbContext> dbContextFactory,
36+
IRemotePlannerManager plannerManager,
37+
IRemoteAnalyzerManager analyzerManager,
38+
IEnumerable<IDeviceDbLoader> deviceLoaders,
39+
IConfiguration configuration,
40+
IRemoteDeviceManager remoteDeviceManager)
41+
{
42+
_deviceCommandInterpreterRepo = deviceCommandInterpreterRepo;
43+
_dbContextFactory = dbContextFactory;
44+
_plannerManager = plannerManager;
45+
_analyzerManager = analyzerManager;
46+
_deviceLoaders = deviceLoaders;
47+
_configuration = configuration;
48+
_remoteDeviceManager = remoteDeviceManager;
49+
_dataPath = _configuration.Get<AppSettings>()?.AresDataPath ?? "";
50+
_resultsPath = Path.Combine(_dataPath, AppSettings.ResultsFolder);
51+
_templatesPath = Path.Combine(_dataPath, AppSettings.TemplatesFolder);
52+
_devicesPath = Path.Combine(_dataPath, AppSettings.DevicesFolder);
53+
}
54+
55+
public async Task Start()
56+
{
57+
await EnsureDataPathsExist();
58+
59+
foreach(var deviceLoader in _deviceLoaders)
60+
await deviceLoader.Load();
61+
62+
await _plannerManager.LoadPlanners();
63+
await _analyzerManager.LoadAnalyzers();
64+
await _remoteDeviceManager.LoadDevices();
65+
66+
Observable.Interval(TimeSpan.FromSeconds(20))
67+
.Take(1)
68+
.Subscribe(_ => ServerStatusHelper.ServerStatusSubject.OnNext(new ServerStatusResponse { ServerStatus = ServerStatus.Error, StatusMessage = "This is a test error from server." }));
69+
}
70+
71+
public Task EnsureDataPathsExist()
72+
{
73+
Directory.CreateDirectory(_devicesPath);
74+
Directory.CreateDirectory(_resultsPath);
75+
Directory.CreateDirectory(_templatesPath);
76+
77+
return Task.CompletedTask;
78+
}
79+
}

AresService/AppSettings.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
3+
namespace AresService;
4+
5+
public class AppSettings
6+
{
7+
public TokensConfig? TokensConfig { get; set; }
8+
public string AresDataPath { get; set; } = Environment.CurrentDirectory;
9+
public string DatabaseProvider { get; set; } = string.Empty;
10+
public static string ResultsFolder = "CampaignResults";
11+
12+
public static string TemplatesFolder = "CampaignTemplates";
13+
14+
public static string DevicesFolder = "Devices";
15+
16+
public static string ExperimentTagsFile = "UserTags.txt";
17+
}
18+
public class TokensConfig
19+
{
20+
public string? Issuer { get; set; }
21+
public string? Audience { get; set; }
22+
public string? Key { get; set; }
23+
}

AresService/AresService.csproj

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<nullable>enable</nullable>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
9+
<DefineConstants>TRACE;SIM</DefineConstants>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.AspNetCore.Authentication.Certificate" Version="8.0.21" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
15+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.21" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.10">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.10">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23+
</PackageReference>
24+
<PackageReference Include="Serilog" Version="4.3.0" />
25+
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
26+
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.5" />
27+
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.2" />
28+
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
29+
<PackageReference Include="System.CommandLine" Version="2.0.0-rc.2.25502.107" />
30+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<ProjectReference Include="..\Ares.Core.Grpc\Ares.Core.Grpc.csproj" />
35+
<ProjectReference Include="..\AresMessaging\AresMessaging.csproj" />
36+
<ProjectReference Include="..\CrealityCamera\AresCamera.csproj" />
37+
<ProjectReference Include="..\PrusaMK4S\PrusaMK4S.csproj" />
38+
<ProjectReference Include="..\AresService.Migrations.Postgres\AresService.Migrations.Postgres.csproj" />
39+
<ProjectReference Include="..\AresService.Migrations.Sqlite\AresService.Migrations.Sqlite.csproj" />
40+
<ProjectReference Include="..\AresService.Migrations.SqlServer\AresService.Migrations.SqlServer.csproj" />
41+
</ItemGroup>
42+
43+
<ItemGroup>
44+
<None Update="FC2ServiceCert.pfx">
45+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
46+
</None>
47+
</ItemGroup>
48+
49+
<ItemGroup>
50+
<Folder Include="DeviceStateExport\ExportDataProviders\Devices\" />
51+
<Folder Include="DeviceStateExport\StreamProviders\" />
52+
<Folder Include="DeviceStateLoggers\" />
53+
<Folder Include="Services\DeviceStateLogging\" />
54+
</ItemGroup>
55+
56+
</Project>

AresService/AresService.sln

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.5.2.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARESService", "ARESService.csproj", "{8C501483-FD55-A619-CFD5-3F4ED8A21D5A}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{8C501483-FD55-A619-CFD5-3F4ED8A21D5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{8C501483-FD55-A619-CFD5-3F4ED8A21D5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{8C501483-FD55-A619-CFD5-3F4ED8A21D5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{8C501483-FD55-A619-CFD5-3F4ED8A21D5A}.Release|Any CPU.Build.0 = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
GlobalSection(ExtensibilityGlobals) = postSolution
22+
SolutionGuid = {49EF51B4-1235-4D04-9DB3-2826B622E92E}
23+
EndGlobalSection
24+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Ares.Core;
2+
using Ares.Core.Device;
3+
using AresCamera;
4+
using AresCamera.Config;
5+
using Microsoft.EntityFrameworkCore;
6+
7+
namespace AresService.ConfigManagers;
8+
9+
public class AresCameraConfigManager : DeviceConfigManagerBase<AresCameraConfig, IAresCamera>
10+
{
11+
public AresCameraConfigManager(IDbContextFactory<CoreDatabaseContext> dbContextFactory) : base(dbContextFactory)
12+
{
13+
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Ares.Core;
2+
using Ares.Core.Device;
3+
using Microsoft.EntityFrameworkCore;
4+
using MK4S.Config;
5+
using PrusaMK4S;
6+
7+
namespace AresService.ConfigManagers;
8+
9+
public class MK4SPrinterConfigManager : DeviceConfigManagerBase<MK4SConfig, IPrusaMK4S>
10+
{
11+
public MK4SPrinterConfigManager(IDbContextFactory<CoreDatabaseContext> dbContextFactory) : base(dbContextFactory)
12+
{
13+
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Ares.Device;
2+
3+
namespace AresService.ConnectionManagement;
4+
5+
public interface ISerialConnectionManager<TConnection> where TConnection : IAresDeviceConnection
6+
{
7+
TConnection GetConnection(string portName, bool simulated = false);
8+
void RemoveConnection(string portName, bool simulated = false);
9+
void RemoveConnection(TConnection connection);
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Collections.Generic;
2+
using Ares.Device;
3+
4+
namespace AresService.ConnectionManagement;
5+
6+
public interface ISerialConnectionRepository : ICollection<IAresDeviceConnection>
7+
{
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Collections.Generic;
2+
using Ares.Device;
3+
4+
namespace AresService.ConnectionManagement;
5+
6+
public class SerialConnectionRepository : List<IAresDeviceConnection>, ISerialConnectionRepository
7+
{
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using AresService.Data;
2+
3+
namespace AresService.DbDesignFactories;
4+
public class AresDbContextFactory : BaseDesignFactory<AresDbContext>
5+
{
6+
}

0 commit comments

Comments
 (0)