Merge pull request #2936 from jlewin/design_tools

Consolidate file extension definitions
This commit is contained in:
johnlewin 2018-01-23 18:52:25 -08:00 committed by GitHub
commit bca072e0b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 8 additions and 22 deletions

View file

@ -37,10 +37,7 @@ namespace MatterHackers.MatterControl
{
using Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PluginSystem;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.RenderOpenGl.OpenGl;
public class WindowsPlatformsFeatures : INativePlatformFeatures
@ -139,18 +136,6 @@ namespace MatterHackers.MatterControl
break;
}
}
// TODO: Do we still want to support command line arguments for adding to the queue?
foreach (string arg in commandLineArgs)
{
string argExtension = Path.GetExtension(arg).ToUpper();
if (argExtension.Length > 1
&& MeshFileIo.ValidFileExtensions().Contains(argExtension))
{
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
}
}
}
public void ReportException(Exception e, string key = "", string value = "", ReportSeverity2 warningLevel = ReportSeverity2.Warning)

View file

@ -121,7 +121,7 @@ namespace MatterHackers.MatterControl.Library.Export
string fileToProcess = "";
string sourceExtension = Path.GetExtension(libraryContent.FileName).ToUpper();
if (MeshFileIo.ValidFileExtensions().Contains(sourceExtension)
if (ApplicationSettings.ValidFileExtensions.Contains(sourceExtension)
|| sourceExtension == ".MCX")
{
// Conceptually we need to:

View file

@ -273,7 +273,7 @@ namespace MatterHackers.MatterControl.Library
// Special load processing for mesh data, simple copy below for non-mesh
if (forceAMF
&& (extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension.ToUpper())))
&& (extension != "" && ApplicationSettings.ValidFileExtensions.Contains(extension.ToUpper())))
{
try
{

View file

@ -513,7 +513,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
foreach (string loadedFileName in filesToLoadIncludingZips)
{
string extension = Path.GetExtension(loadedFileName).ToUpper();
if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)))
if ((extension != "" && ApplicationSettings.ValidFileExtensions.Contains(extension)))
{
filesToLoad.Add(loadedFileName);
}

View file

@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
var printItemWrapper = new PrintItemWrapper(part);
string extension = Path.GetExtension(printItemWrapper.FileLocation).ToUpper();
if (extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension))
if (extension != "" && ApplicationSettings.ValidFileExtensions.Contains(extension))
{
await ApplicationController.Instance.Tasks.Execute((reporter, cancellationToken) =>
{

View file

@ -353,7 +353,7 @@ namespace MatterHackers.MatterControl
foreach (string file in mouseEvent.DragFiles)
{
string extension = Path.GetExtension(file).ToUpper();
if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension))
if ((extension != "" && ApplicationSettings.ValidFileExtensions.Contains(extension))
|| extension == ".GCODE"
|| extension == ".ZIP")
{

View file

@ -20,6 +20,7 @@ namespace MatterHackers.MatterControl
public class ApplicationSettings
{
public static string ValidFileExtensions { get; } = ".STL;.AMF;.OBJ";
public static string LibraryMeshFileExtensions { get; } = ".stl,.obj,.amf,.mcx";
public static string LibraryFilterFileExtensions { get; } = LibraryMeshFileExtensions + ",.gcode";
public static string OpenPrintableFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";

@ -1 +1 @@
Subproject commit 7c227e8487d6432dd0b0db7b380f93d946e5faa4
Subproject commit 006fcf790727fbfffb6de131764f3481b8e65a88

View file

@ -251,7 +251,7 @@ namespace MatterHackers.MatterControl
// - are named manifest.json
if (!string.IsNullOrWhiteSpace(zipEntry.Name) &&
(zipEntry.Name == "manifest.json"
|| MeshFileIo.ValidFileExtensions().Contains(sourceExtension)
|| ApplicationSettings.ValidFileExtensions.Contains(sourceExtension)
|| sourceExtension == ".GCODE"))
{
string extractedFileName = Path.Combine(stagingFolder, zipEntry.Name);