Revise user configuration support
This commit is contained in:
parent
0c7fac04da
commit
e7aa50a909
5 changed files with 37 additions and 4 deletions
|
|
@ -607,6 +607,7 @@
|
|||
<DependentUpon>InspectForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="App.config" />
|
||||
<None Include="appsettings.json" />
|
||||
<None Include="Library\LibraryProviders.cd" />
|
||||
<None Include="Library\Widgets\ListView\ListView.cd" />
|
||||
<None Include="SlicerConfiguration\Settings\SettingsDiagram.cd" />
|
||||
|
|
@ -730,6 +731,8 @@
|
|||
<PackageReference Include="Markdig" Version="0.15.2" />
|
||||
<PackageReference Include="MIConvexHull" Version="1.1.17.1019" />
|
||||
<PackageReference Include="Mindscape.Raygun4Net" Version="5.5.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="Zeroconf" Version="3.0.30" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
21
Program.cs
21
Program.cs
|
|
@ -5,6 +5,8 @@ using System.Threading;
|
|||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Mindscape.Raygun4Net;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
|
|
@ -17,6 +19,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private static RaygunClient _raygunClient;
|
||||
|
||||
private class SlicerOptions
|
||||
{
|
||||
public bool Debug { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
|
@ -40,7 +47,19 @@ namespace MatterHackers.MatterControl
|
|||
_raygunClient = new RaygunClient("hQIlyUUZRGPyXVXbI6l1dA=="); // this is the PC key
|
||||
}
|
||||
|
||||
AggContext.Init(embeddedResourceName: "config.json");
|
||||
// Set default Agg providers
|
||||
AggContext.Config.ProviderTypes.SystemWindow = "MatterHackers.Agg.UI.OpenGLSystemWindow, agg_platform_win32";
|
||||
AggContext.Config.ProviderTypes.SystemWindowProvider = "MatterHackers.Agg.UI.WinformsSystemWindowProvider, agg_platform_win32";
|
||||
|
||||
// Load optional user configuration
|
||||
IConfiguration config = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: true)
|
||||
.Build();
|
||||
|
||||
// Override defaults via configuration
|
||||
config.Bind("Agg:ProviderTypes", AggContext.Config.ProviderTypes);
|
||||
config.Bind("Agg:GraphicsMode", AggContext.Config.GraphicsMode);
|
||||
Slicer.RunInProcess = config.GetValue<bool>("MatterControl:Slicer:Debug");
|
||||
|
||||
// Make sure we have the right working directory as we assume everything relative to the executable.
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
private static Dictionary<Mesh, MeshPrintOutputSettings> meshPrintOutputSettings = new Dictionary<Mesh, MeshPrintOutputSettings>();
|
||||
|
||||
public static List<bool> extrudersUsed = new List<bool>();
|
||||
public static bool runInProcess = false;
|
||||
public static bool RunInProcess = false;
|
||||
|
||||
public static List<(Matrix4X4 matrix, string fileName)> GetStlFileLocations(IObject3D object3D, ref string mergeRules, PrinterConfig printer, IProgress<ProgressStatus> progressReporter, CancellationToken cancellationToken)
|
||||
{
|
||||
|
|
@ -293,7 +293,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
if (AggContext.OperatingSystem == OSType.Android
|
||||
|| AggContext.OperatingSystem == OSType.Mac
|
||||
|| runInProcess)
|
||||
|| RunInProcess)
|
||||
{
|
||||
EventHandler WriteOutput = (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 4d61415fe2ae91d1d67d3ee3023286bb27bef80c
|
||||
Subproject commit c5d5886d54c40e56258c88c8351227574593db1b
|
||||
11
appsettings.json
Normal file
11
appsettings.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Agg": {
|
||||
"GraphicsMode": {
|
||||
"Color": 32,
|
||||
"Depth": 24,
|
||||
"FSAASamples": 8
|
||||
}
|
||||
},
|
||||
"MatterControl": {
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue