private void readPrintoutSettings(CSettings settings) { MemoryStream stream; BinaryFormatter formatter = new BinaryFormatter(); try { stream = new MemoryStream(); string paperResultDocumentString = settings.ReadSettingString( CSettings.SettingsNameEnum.PaperResultDocument); if (paperResultDocumentString != null & paperResultDocumentString != "") { byte[] paperResultDocumentBytes = Convert.FromBase64String( paperResultDocumentString); stream.Write(paperResultDocumentBytes, 0, paperResultDocumentBytes.Length); stream.Seek(0, SeekOrigin.Begin); paperResultDocument = (PrintDocumentStd) formatter.Deserialize(stream); } } catch (Exception exc) { Trace.WriteLine( "CPrinterSettings: Exception occured while reading " + "PaperResultDocument from Registry: " + exc.ToString()); } try { stream = new MemoryStream(); string paperResultTeamDocumentString = settings.ReadSettingString( CSettings.SettingsNameEnum.PaperResultTeamDocument); if (paperResultTeamDocumentString != null && paperResultTeamDocumentString != "") { byte[] paperResultTeamDocumentBytes = Convert.FromBase64String( paperResultTeamDocumentString); stream.Write(paperResultTeamDocumentBytes, 0, paperResultTeamDocumentBytes.Length); stream.Seek(0, SeekOrigin.Begin); paperResultTeamDocument = (PrintDocumentStd) formatter.Deserialize(stream); } } catch (Exception exc) { Trace.WriteLine( "CPrinterSettings: Exception occured while reading " + "PaperResultDocument from Registry: " + exc.ToString()); } }
private void readLabelSettings(CSettings settings) { MemoryStream stream = new MemoryStream(); //SoapFormatter formatter = new SoapFormatter(); BinaryFormatter formatter = new BinaryFormatter(); try { string MirrorPrintLabelDocumentString = settings.ReadSettingString( CSettings.SettingsNameEnum.LabelMirrorPrintDocument); if (MirrorPrintLabelDocumentString != null & MirrorPrintLabelDocumentString != "") { byte[] MirrorPrintLabelDocumentBytes = Convert.FromBase64String( MirrorPrintLabelDocumentString); stream.Write(MirrorPrintLabelDocumentBytes, 0, MirrorPrintLabelDocumentBytes.Length); stream.Seek(0, SeekOrigin.Begin); mirrorPrintLabelDocument = (PrintLabelDocument) formatter.Deserialize(stream); } } catch (Exception exc) { Trace.WriteLine( "CPrinterSettings: Exception occured while reading " + "MirrorPrintLabelDocument from Registry: " + exc.ToString()); } try { stream = new MemoryStream(); string resultPrintLabelDocumentString = settings.ReadSettingString( CSettings.SettingsNameEnum.LabelResultPrintDocument); if (resultPrintLabelDocumentString != null & resultPrintLabelDocumentString != "") { byte[] resultPrintLabelDocumentBytes = Convert.FromBase64String( resultPrintLabelDocumentString); stream.Write(resultPrintLabelDocumentBytes, 0, resultPrintLabelDocumentBytes.Length); stream.Seek(0, SeekOrigin.Begin); resultLabelDocument = (PrintLabelDocument) formatter.Deserialize(stream); } } catch (Exception exc) { Trace.WriteLine( "CPrinterSettings: Exception occured while reading " + "resultPrintLabelDocument from Registry: " + exc.ToString()); } try { stream = new MemoryStream(); string stickPrintLabelDocumentString = settings.ReadSettingString( CSettings.SettingsNameEnum.LabelMirrorPrintDocument); if (stickPrintLabelDocumentString != null & stickPrintLabelDocumentString != "") { byte[] stickPrintLabelDocumentBytes = Convert.FromBase64String( stickPrintLabelDocumentString); stream.Write(stickPrintLabelDocumentBytes, 0, stickPrintLabelDocumentBytes.Length); stream.Seek(0, SeekOrigin.Begin); stickPrintLabelDocument = (PrintLabelDocument) formatter.Deserialize(stream); } } catch (Exception exc) { Trace.WriteLine( "CPrinterSettings: Exception occured while reading " + "stickPrintLabelDocument from Registry: " + exc.ToString()); } }