From 02f5179ab65764fa40daf9efff626455daf5af35 Mon Sep 17 00:00:00 2001 From: gregory-diaz Date: Wed, 19 Feb 2014 18:42:52 -0800 Subject: [PATCH] Updated fix to XP file extension problem --- CustomWidgets/ExportQueueItemWindow.cs | 14 ++++++-------- MatterControl.userprefs | 19 ++++++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/CustomWidgets/ExportQueueItemWindow.cs b/CustomWidgets/ExportQueueItemWindow.cs index dc00955ce..a2dcd91de 100644 --- a/CustomWidgets/ExportQueueItemWindow.cs +++ b/CustomWidgets/ExportQueueItemWindow.cs @@ -70,10 +70,10 @@ namespace MatterHackers.MatterControl string exportStlTxt = new LocalizedString("Export as").Translated; string exportStlTxtFull = string.Format("{0} STL", exportStlTxt); - Button exportSTL = textImageButtonFactory.Generate(exportStlTxtFull); - exportSTL.Click += new ButtonBase.ButtonEventHandler(exportSTL_Click); + Button exportAsStlButton = textImageButtonFactory.Generate(exportStlTxtFull); + exportAsStlButton.Click += new ButtonBase.ButtonEventHandler(exportSTL_Click); //exportSTL.HAnchor = Agg.UI.HAnchor.ParentCenter; - topToBottom.AddChild(exportSTL); + topToBottom.AddChild(exportAsStlButton); } bool showExportGCodeButton = ActivePrinterProfile.Instance.ActivePrinter != null || partIsGCode; @@ -142,19 +142,17 @@ namespace MatterHackers.MatterControl if (streamToSaveTo != null) { streamToSaveTo.Close (); - string filePathToSave = saveParams.FileName; string extension = GetExtension(filePathToSave); if(extension == "") { + File.Delete (filePathToSave); filePathToSave += ".gcode"; } - if (System.IO.Path.GetExtension(printQueueItem.PrintItemWrapper.FileLocation).ToUpper() == ".STL") { - pathAndFilenameToSave = saveParams.FileName; Close(); SlicingQueue.Instance.QueuePartForSlicing(printQueueItem.PrintItemWrapper); printQueueItem.PrintItemWrapper.Done += new EventHandler(sliceItem_Done); @@ -162,7 +160,7 @@ namespace MatterHackers.MatterControl else if (partIsGCode) { Close(); - SaveGCodeToNewLocation(printQueueItem.PrintItemWrapper.FileLocation, saveParams.FileName); + SaveGCodeToNewLocation(printQueueItem.PrintItemWrapper.FileLocation, filePathToSave); } } } @@ -250,9 +248,9 @@ namespace MatterHackers.MatterControl string extension = CheckExtension(filePathToSave); if (extension == "") { + File.Delete (filePathToSave); filePathToSave += ".stl"; } - File.Copy (printQueueItem.PrintItemWrapper.FileLocation, filePathToSave, true); ShowFileIfRequested (filePathToSave); } diff --git a/MatterControl.userprefs b/MatterControl.userprefs index a0a90fa94..4e970df75 100644 --- a/MatterControl.userprefs +++ b/MatterControl.userprefs @@ -1,22 +1,19 @@  - + - + - - + + - - - - + + + - - - + \ No newline at end of file