public static bool LoadPrinterViewFile(string filename, out PrintDetails.PrintJobObjectViewDetails printerview_settings) { try { var textReader = (TextReader) new StreamReader(filename); XmlSerializer classSerializer = PrintDetails.PrintJobObjectViewDetails.ClassSerializer; printerview_settings = (PrintDetails.PrintJobObjectViewDetails)classSerializer.Deserialize(textReader); textReader.Close(); return(true); } catch (Exception ex) { printerview_settings = null; return(false); } }
public static bool SavePrintingObjectsDetails(string printerViewFile, List <PrintDetails.ObjectDetails> objectList) { var objectViewDetails = new PrintDetails.PrintJobObjectViewDetails(objectList); try { var textWriter = (TextWriter) new StreamWriter(printerViewFile); var namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); PrintDetails.PrintJobObjectViewDetails.ClassSerializer.Serialize(textWriter, objectViewDetails, namespaces); textWriter.Close(); } catch (Exception ex) { return(false); } return(true); }
public static bool LoadPrinterView(string jobGuid, out PrintDetails.PrintJobObjectViewDetails printerview_settings) { return(SettingsManager.LoadPrinterViewFile(Path.Combine(M3D.Spooling.Core.Paths.QueuePath, jobGuid) + "_printerview.xml", out printerview_settings)); }