public void Release() { writer.Flush(); writer.Dispose(); }
public bool GenerateRecordFile() { try { //Main.main.LogMessage("Main", "Generating Record file ....." , ""); //string recordFilePath = Application.CommonAppDataPath + "\\composition\\RecordFile.txt"; string recordFilePath = MainParameter.AppdataPath + MainParameter.AssemblyFileVersion + "\\composition\\RecordFile.txt"; //StringBuilder shortPath = new StringBuilder(255); //Main.GetShortPathName(recordFilePath, shortPath, shortPath.Capacity); //recordFilePath = shortPath.ToString(); FileStream fs = File.Open(recordFilePath, FileMode.Create); EnglishStreamWriter2 writer = new EnglishStreamWriter2(fs); //Main.main.threedview.ui.ProfileSettings_UI.Dispatcher.Invoke(new Action(() =>{ //writer.WriteLine("Infill Scan Speed: "+Main.main.threedview.ui.ProfileSettings_UI.txt_InfillScanningSpeed.Text); //writer.WriteLine("Contour Scan Speed: " + Main.main.threedview.ui.ProfileSettings_UI.txt_ContourScanningSpeed.Text); //writer.WriteLine("Beam Offset: " + Main.main.threedview.ui.ProfileSettings_UI.txt_InfillContourOffset.Text); //writer.WriteLine("Fill Round Pitch: " + Main.main.threedview.ui.ProfileSettings_UI.txt_InfillBorderOffset.Text); //writer.WriteLine("Border: 0.12"); //writer.WriteLine("Step Angle: 90"); //writer.WriteLine("Offset Angle: 180"); //writer.WriteLine("Infill Pitch: " + Main.main.threedview.ui.ProfileSettings_UI.txt_InfillSinterPitch.Text); //writer.WriteLine("Start Angle: " + Main.main.threedview.ui.ProfileSettings_UI.txt_StartAngle.Text); //writer.WriteLine("Powder Density:" + Main.main.threedview.ui.ProfileSettings_UI.Powder_Density.Text); //writer.WriteLine("Sintered Density:" + Main.main.threedview.ui.ProfileSettings_UI.Sintered_Density.Text); //writer.WriteLine("Laser Sintering Twice: " + Main.main.threedview.ui.ProfileSettings_UI.SelectedProfileSettings.SinteringTwice.ToString()); ////<timmy><9-15-2020><add base/cover in RecordFile.txt> //writer.WriteLine("Base Layers: " + Main.main.threedview.ui.ProfileSettings_UI.SelectedProfileSettings.baselayercyclecount.ToString()); //writer.WriteLine("Cover Layers: " + Main.main.threedview.ui.ProfileSettings_UI.SelectedProfileSettings.coverlayer.ToString()); ////<><><> //})); writer.WriteLine("Infill Scan Speed: 0"); writer.WriteLine("Contour Scan Speed: 0"); writer.WriteLine("Beam Offset: 0"); writer.WriteLine("Fill Round Pitch: 0"); writer.WriteLine("Border: 0"); writer.WriteLine("Step Angle: 0"); writer.WriteLine("Offset Angle: 0"); writer.WriteLine("Infill Pitch: 0"); writer.WriteLine("Start Angle: 0"); writer.WriteLine("Powder Density:0"); writer.WriteLine("Sintered Density:0"); writer.WriteLine("Laser Sintering Twice: 0"); //<timmy><9-15-2020><add base/cover in RecordFile.txt> writer.WriteLine("Base Layers: 0"); writer.WriteLine("Cover Layers: 0"); //<><><> writer.Flush(); writer.Dispose(); //Main.main.LogMessage("Main", "Success: Record File was Generated.", ""); return(true); } catch (Exception ex) { //Main.main.LogMessage("Main", "Failed: Generating record file.", ""); SVGTo3WL.logFile.writer.WriteLine("3WL Data, Error encountered: GenerateRecordFile."); SVGTo3WL.logFile.writer.WriteLine("3WL Data exception: {0}", ex.ToString()); SVGTo3WL.logFile.writer.Flush(); Console.WriteLine("3WL Data, Error encountered: GenerateRecordFile"); Console.WriteLine("3WL Data exception: {0}", ex.ToString()); gCode.Release(); return(false); } }