Remove duplicate code

This commit is contained in:
John Lewin 2017-08-09 11:25:19 -07:00
parent e60e77eba7
commit c881624aac

View file

@ -289,30 +289,19 @@ namespace MatterHackers.MatterControl
footerRow.AddChild(cancelButton);
}
public void ExportGcodeCommandLineUtility(String nameOfFile)
public void ExportGcodeCommandLineUtility(string gcodePathAndFilenameToSave)
{
try
{
if (!string.IsNullOrEmpty(nameOfFile))
string sourceExtension = Path.GetExtension(printItemWrapper.FileLocation).ToUpper();
if (MeshFileIo.ValidFileExtensions().Contains(sourceExtension))
{
gcodePathAndFilenameToSave = nameOfFile;
string extension = Path.GetExtension(gcodePathAndFilenameToSave);
if (extension == "")
{
File.Delete(gcodePathAndFilenameToSave);
gcodePathAndFilenameToSave += ".gcode";
}
string sourceExtension = Path.GetExtension(printItemWrapper.FileLocation).ToUpper();
if (MeshFileIo.ValidFileExtensions().Contains(sourceExtension))
{
SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
printItemWrapper.SlicingDone += sliceItem_Done;
}
else if (partIsGCode)
{
SaveGCodeToNewLocation(printItemWrapper.FileLocation, gcodePathAndFilenameToSave);
}
SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper);
printItemWrapper.SlicingDone += sliceItem_Done;
}
else if (partIsGCode)
{
SaveGCodeToNewLocation(printItemWrapper.FileLocation, gcodePathAndFilenameToSave);
}
}
catch