Platform providers

- New Provider model
- Remove WindowsFileDialogs project
- Remove PlatformAbstract assembly, use AggContext
- Rename OsInformation to OperatingSystem
This commit is contained in:
John Lewin 2017-08-20 02:34:39 -07:00
parent 82c2d333e7
commit 3a9833697d
108 changed files with 398 additions and 435 deletions

View file

@ -28,7 +28,7 @@ either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
@ -62,7 +62,7 @@ namespace MatterControl.Tests.MatterControl
[Test, Category("GCodeProcessing")]
public void ReplaceMacroValuesWorking()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
TestMacroReplacement("[temperature]", "200");

View file

@ -30,7 +30,7 @@ either expressed or implied, of the FreeBSD Project.
using System.Collections.Generic;
using System.Diagnostics;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.GCodeVisualizer;
using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.SlicerConfiguration;
@ -72,7 +72,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
MaxLengthStream maxLengthStream = new MaxLengthStream(new TestGCodeStream(lines), 6);
@ -176,7 +176,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
List<GCodeStream> streamList;
@ -232,7 +232,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
List<GCodeStream> streamList;
@ -321,7 +321,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
List<GCodeStream> streamList;
@ -395,7 +395,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
// this is the pause and resume from the Eris
@ -466,7 +466,7 @@ namespace MatterControl.Tests.MatterControl
null,
};
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
PrinterSettings settings = ActiveSliceSettings.Instance;
@ -494,7 +494,7 @@ namespace MatterControl.Tests.MatterControl
public void FeedRateRatioChangesFeedRate()
{
string line;
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
Assert.AreEqual(1, FeedRateMultiplyerStream.FeedRateRatio, "FeedRateRatio should default to 1");
@ -515,7 +515,7 @@ namespace MatterControl.Tests.MatterControl
public void ExtrusionRatioChangesExtrusionAmount()
{
string line;
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
Assert.AreEqual(1, ExtrusionMultiplyerStream.ExtrusionRatio, "ExtrusionRatio should default to 1");

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
using NUnit.Framework;
@ -18,7 +18,7 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void CheckImportPrinterSettingsToPrinter()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
var printerSettings = new PrinterSettings();

View file

@ -29,7 +29,7 @@ either expressed or implied, of the FreeBSD Project.
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.GCodeVisualizer;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.SlicerConfiguration;
@ -45,7 +45,7 @@ namespace MatterControl.Tests.MatterControl
[Test, Category("Leveling")]
public void Leveling7PointsNeverGetsTooHigh()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
var levelingData = new PrintLevelingData(ActiveSliceSettings.Instance);
@ -86,7 +86,7 @@ namespace MatterControl.Tests.MatterControl
[Test, Category("Leveling")]
public void Leveling7PointsCorectInterpolation()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
var levelingData = new PrintLevelingData(ActiveSliceSettings.Instance);
@ -189,7 +189,7 @@ namespace MatterControl.Tests.MatterControl
[Test, Category("Leveling")]
public void LevelingMesh3x3CorectInterpolation()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
// a 2 x 2 mesh that goes form 0 on the left to 10 on the right

View file

@ -37,7 +37,7 @@ using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.GuiAutomation;
using MatterHackers.MatterControl.DataStorage;
@ -470,7 +470,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
#if !__ANDROID__
// Set the static data to point to the directory of MatterControl
StaticData.Instance = new FileSystemStaticData(staticDataPathOverride);
AggContext.StaticData = new FileSystemStaticData(staticDataPathOverride);
#endif
// Popping one directory above MatterControl, then back down into MatterControl ensures this works in MCCentral as well and MatterControl
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl"));

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
using NUnit.Framework;
@ -18,7 +18,7 @@ namespace MatterControl.Tests.MatterControl
static OemProfileTests()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
allPrinters = (from printerFile in new DirectoryInfo(printerSettingsDirectory).GetFiles("*.printer", SearchOption.AllDirectories)

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.Tests.Automation;
@ -14,7 +14,7 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void PrinterChooserHonorsWhitelist()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
var manufacturers = new string[] { "3D Factory", "3D Stuffmaker", "Airwolf 3D", "BCN", "BeeVeryCreative", "Blue Eagle Labs", "Deezmaker", "FlashForge", "gCreate", "IRA3D", "JumpStart", "Leapfrog", "Lulzbot", "MAKEiT", "Maker's Tool Works", "MakerBot", "MakerGear", "Me3D", "OpenBeam", "Organic Thinking System", "Other", "Portabee", "Printrbot", "PrintSpace", "Revolution 3D Printers", "ROBO 3D", "SeeMeCNC", "Solidoodle", "Tosingraf", "Type A Machines", "Ultimaker", "Velleman", "Wanhao" };

View file

@ -4,7 +4,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
using NUnit.Framework;
@ -19,7 +19,7 @@ namespace MatterControl.Tests.MatterControl
{
string staticDataPath = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "StaticData");
StaticData.Instance = new FileSystemStaticData(staticDataPath);
AggContext.StaticData = new FileSystemStaticData(staticDataPath);
var profilesDirectory = new DirectoryInfo(Path.Combine(staticDataPath, "Profiles"));

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
@ -15,7 +15,7 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void Check3PointLevelingPositions()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
{
@ -83,7 +83,7 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void CheckIfShouldBeShownParseTests()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
{
@ -162,7 +162,7 @@ namespace MatterControl.Tests.MatterControl
[Test]
public void SupportInterfaceMaterialAssignedToExtruderOne()
{
StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
// first_layer_extrusion_width
{

View file

@ -28,7 +28,7 @@ either expressed or implied, of the FreeBSD Project.
*/
using System.Threading;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.Platform;
#if !__ANDROID__
using MatterHackers.MatterControl.Tests.Automation;
#endif
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.Slicing.Tests
public void SliceLayersGeneratingCorrectSegments()
{
// TODO: Make tests work on Mac as well as Windows
if (OsInformation.OperatingSystem == OSType.Mac)
if (AggContext.OperatingSystem == OSType.Mac)
{
return;
}