public static PersistentPrinterData PersistedObject() { object tempResult = null; PersistentPrinterData result; try { tempResult = PersistentHelper.RestoreObjectFromFile(persistFileName, new PersistentPrinterDataBinder()); } catch (System.IO.IOException) { } catch (System.UnauthorizedAccessException) { } catch (System.Security.SecurityException) { } catch (System.TypeInitializationException) { } catch (Exception) { } result = tempResult as PersistentPrinterData; return((result == null) ? new PersistentPrinterData() : result); }
/// <summary> /// Updates the object persistent file. /// </summary> private void UpdateObject() { this.Dirty = true; try { PersistentHelper.PersistObjectToFile(persistFileName, this); this.Dirty = false; } catch (System.IO.IOException) { } catch (System.UnauthorizedAccessException) { } catch (System.Security.SecurityException) { } }