public static void LoadCustomLevels(GameData gameData) { //don't check if already custom cause their could be changes...just always reload custom using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { if (isf.FileExists(GAME_DATA_FILENAME)) { using (Stream stream = TitleContainer.OpenStream("levels.dat")) { SharpSerializer serializer = new SharpSerializer(true); gameData.Levels = (List<int[,]>)serializer.Deserialize(stream); gameData.LevelLoadedType = LevelLoadedType.Custom; } } } gameData.Levels = gameData.Levels ?? new List<int[,]>(); }
public static void LoadPreBuiltLevels(GameData gameData) { if (gameData.LevelLoadedType != LevelLoadedType.PreBuilt) //prevent reloading pre-built { using (Stream stream = TitleContainer.OpenStream("levels.dat")) { SharpSerializer serializer = new SharpSerializer(true); gameData.Levels = (List<int[,]>)serializer.Deserialize(stream); gameData.LevelLoadedType = LevelLoadedType.PreBuilt; } } }
public override object Deserialize(string serialized) { byte[] b = Convert.FromBase64String(serialized); using (var stream = new MemoryStream(b)) { stream.Seek(0, SeekOrigin.Begin); return(_serializer.Deserialize(stream)); } }
private static void serialize(object source, SharpSerializer serializer, Func <byte[], byte[]> dataCallback) { byte[] data; // Serializing using (var stream = new MemoryStream()) { // serialize serializer.Serialize(source, stream); data = stream.ToArray(); } // Modifying data if (dataCallback != null) { data = dataCallback(data); } // Deserializing using (var stream = new MemoryStream(data)) { // deserialize var result = serializer.Deserialize(stream); // it comes never here } }
/// <summary> /// Check GitHub for the current published version /// </summary> /// <returns> /// 0 - No update available /// 1 - Update available</returns> public int CheckForUpdate() { FastMoveUpdateInfoVariables UpdateVariables; string downloadString = ""; WebClient client = new WebClient(); try { downloadString = client.DownloadString("https://raw.githubusercontent.com/j-b-n/Fastmove/master/update.xml"); } catch(Exception) { } //writeOnlineUpdateInfo(); var serializer = new SharpSerializer(false); using (Stream s = GenerateStreamFromString(downloadString)) { UpdateVariables = (FastMoveUpdateInfoVariables)serializer.Deserialize(s); string runningVersion = GetRunningVersion(); if (UpdateVariables.version != runningVersion) { //New version available! return 1; } } return 0; }
private void StartEstudio_Load(object sender, EventArgs e) { try { var serializer = new SharpSerializer(); Console.WriteLine(Path); estudioAbierto = (Estudio)serializer.Deserialize(Path); Console.WriteLine(estudioAbierto.ProjectName); lblProjectName.Text = estudioAbierto.ProjectName; listaItemsEstudio = estudioAbierto.ListaItemsEstudio; iNeutral = estudioAbierto.NeutralImage; foreach (ItemsEstudio item in listaItemsEstudio) { string[] row = new string[] {""+ item.Numero,item.Nombre,item.Tipo }; tablaTimeline.Rows.Add(row); } } catch (Exception es) { Console.WriteLine("No Jala"); Console.WriteLine(es); } }
/// <summary> /// Reads a string value from the Octgn registry /// </summary> /// <param name="valName"> The name of the value </param> /// <returns> A string value </returns> public static string ReadValue(string valName) { try { if (File.Exists(GetPath())) { var serializer = new SharpSerializer(); var config = (Hashtable)serializer.Deserialize(GetPath()); if (config.ContainsKey(valName)) { return config[valName].ToString(); } } } catch(Exception e) { Trace.WriteLine("[SimpleConfig]ReadValue Error: " + e.Message); try { File.Delete(GetPath()); } catch (Exception) { Trace.WriteLine("[SimpleConfig]ReadValue Error: Couldn't delete the corrupt config file."); } } return null; }
public void BinSerial_TwoIdenticalChildsShouldBeSameInstance() { var parent = new ParentChildTestClass() { Name = "parent", }; var child = new ParentChildTestClass() { Name = "child", Father = parent, Mother = parent, }; Assert.AreSame(child.Father, child.Mother, "Precondition: Saved Father and Mother are same instance"); var stream = new MemoryStream(); var settings = new SharpSerializerBinarySettings(BinarySerializationMode.SizeOptimized); var serializer = new SharpSerializer(settings); serializer.Serialize(child, stream); serializer = new SharpSerializer(settings); stream.Position = 0; ParentChildTestClass loaded = serializer.Deserialize(stream) as ParentChildTestClass; Assert.AreSame(loaded.Father, loaded.Mother, "Loaded Father and Mother are same instance"); }
public void XmlSerial_ShouldSerializeDateTimeOffset() { var parent = new ClassWithDateTimeOffset { Date = DateTimeOffset.Now, DateTimeLocal = new DateTime(2021, 12, 11, 10, 9, 8, DateTimeKind.Local), DateTimeUtc = new DateTime(2021, 12, 11, 10, 9, 8, DateTimeKind.Utc) }; var stream = new MemoryStream(); var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); serializer.Serialize(parent, stream); stream.Position = 0; XmlDocument doc = new XmlDocument(); doc.Load(stream); System.Console.WriteLine(doc.InnerXml); serializer = new SharpSerializer(settings); stream.Position = 0; ClassWithDateTimeOffset loaded = serializer.Deserialize(stream) as ClassWithDateTimeOffset; Assert.AreEqual(parent.Date, loaded.Date); // Additional tests concerning // https://github.com/polenter/SharpSerializer/issues/17#issuecomment-994484009 Assert.AreEqual(parent.DateTimeLocal, loaded.DateTimeLocal); Assert.AreEqual(parent.DateTimeLocal.Kind, loaded.DateTimeLocal.Kind); Assert.AreEqual(parent.DateTimeUtc, loaded.DateTimeUtc); Assert.AreEqual(parent.DateTimeUtc.Kind, loaded.DateTimeUtc.Kind); }
public void CanDeserializeClassWithPrivateConstructor() { var child = new ClassWithPrivateConstructor("child"); var data = new ClassWithPrivateConstructor("MyName") { Complex = child }; var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); using (var stream = new MemoryStream()) { serializer.Serialize(data, stream); stream.Position = 0; var deserialized = serializer.Deserialize(stream) as ClassWithPrivateConstructor; Assert.IsNotNull(deserialized); Assert.AreEqual(data.Name, deserialized.Name); Assert.AreEqual(data.Complex.Name, deserialized.Complex.Name); } }
public void BinSerial_ShouldSerializeDateTimeOffset() { var parent = new ClassWithDateTimeOffset { Date = DateTimeOffset.Now, DateTimeLocal = new DateTime(2021, 12, 11, 10, 9, 8, DateTimeKind.Local), DateTimeUtc = new DateTime(2021, 12, 11, 10, 9, 8, DateTimeKind.Utc) }; var stream = new MemoryStream(); var settings = new SharpSerializerBinarySettings(BinarySerializationMode.SizeOptimized); var serializer = new SharpSerializer(settings); serializer.Serialize(parent, stream); serializer = new SharpSerializer(settings); stream.Position = 0; ClassWithDateTimeOffset loaded = serializer.Deserialize(stream) as ClassWithDateTimeOffset; Assert.AreEqual(parent.Date, loaded.Date, "same date"); // Additional tests concerning // https://github.com/polenter/SharpSerializer/issues/17#issuecomment-994484009 // DateTimeKind is not deserialized as expected. // A suggested workaround is using DateTimeOffset or a complex object instead of DateTime. Assert.AreEqual(parent.DateTimeLocal, loaded.DateTimeLocal); Assert.AreEqual(DateTimeKind.Unspecified, loaded.DateTimeLocal.Kind); Assert.AreEqual(parent.DateTimeUtc, loaded.DateTimeUtc); Assert.AreEqual(DateTimeKind.Unspecified, loaded.DateTimeUtc.Kind); }
public static IEnumerable<TwitterStatus> GetFromCache(TwitterResource resource) { string fileName = GetCacheName(resource); var serializer = new SharpSerializer(SerializerSettings); Mutex mutex = new Mutex(false, "OCELL_FILE_MUTEX" + fileName); IEnumerable<TwitterStatus> statuses = null; if (mutex.WaitOne(1000)) { try { using (var stream = FileAbstractor.GetFileStream(fileName)) { statuses = serializer.Deserialize(stream) as IEnumerable<TwitterStatus>; } } catch (Exception ex) { Debug.WriteLine(ex); } finally { mutex.ReleaseMutex(); } } mutex.Dispose(); return statuses ?? new List<TwitterStatus>(); }
public void XmlSerial_ShouldSerializeGuid() { var parent = new ClassWithGuid() { Guid = Guid.NewGuid(), }; var stream = new MemoryStream(); var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); serializer.Serialize(parent, stream); stream.Position = 0; XmlDocument doc = new XmlDocument(); doc.Load(stream); System.Console.WriteLine(doc.InnerXml); serializer = new SharpSerializer(settings); stream.Position = 0; ClassWithGuid loaded = serializer.Deserialize(stream) as ClassWithGuid; Assert.AreEqual(parent.Guid, loaded.Guid, "same guid"); }
public static IEnumerable<TwitterStatus> GetFromCache(TwitterResource resource) { string fileName = GetCacheName(resource); var serializer = new SharpSerializer(SerializerSettings); IEnumerable<TwitterStatus> statuses = null; MutexUtil.DoWork("OCELL_FILE_MUTEX" + fileName, () => { try { using (var stream = FileAbstractor.GetFileStream(fileName)) { if (stream.Length != 0) statuses = serializer.Deserialize(stream) as IEnumerable<TwitterStatus>; } } catch (Exception ex) { Debug.WriteLine(ex); } }); return statuses ?? new List<TwitterStatus>(); }
private static object Deserialize(Stream streamObject) { if (streamObject == null) return null; // true - binary serialization, default - xml ser. var serializer = new SharpSerializer(true); return serializer.Deserialize(streamObject); }
static public void Load(object sender, EventArgs e) { Form form = (Form)sender; if (File.Exists(fileName(form))) { var serializer = new Polenter.Serialization.SharpSerializer(); form = (Form)serializer.Deserialize(fileName(form)); } }
public IEnumerable<Datensatz> Load() { using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication()) { using (var file = appStorage.OpenFile(Filename, FileMode.OpenOrCreate)) { using (var reader = new StreamReader(file)) { var serializer = new SharpSerializer(); var verbrauchswerte = serializer.Deserialize(reader.BaseStream); return (IEnumerable<Datensatz>)verbrauchswerte; } } } }
public static SyncHistory Deserialize(string path) { try { SharpSerializer serializer = new SharpSerializer(); return (SyncHistory)serializer.Deserialize(path); } catch (Exception ex) { Log.Error($"Loading history from {path} failed", ex); return new SyncHistory(); } }
/// <summary> /// Writes a string value to the Octgn registry /// </summary> /// <param name="valName"> Name of the value </param> /// <param name="value"> String to write for value </param> public static void WriteValue(string valName, string value) { var serializer = new SharpSerializer(); var config = new Hashtable(); if (File.Exists(GetPath())) { config = (Hashtable) serializer.Deserialize(GetPath()); } config[valName] = value; serializer.Serialize(config, GetPath()); }
public static IList<TrackBranch> Deserialize(string path, DXVcsWrapper vcsWrapper) { if (!File.Exists(path)) { Log.Error($"Track branch config with path {path} was not found."); return new List<TrackBranch>(); } SharpSerializer serializer = new SharpSerializer(); var branches = (IList<TrackBranch>)serializer.Deserialize(path); ProcessTrackItems(branches, vcsWrapper); return branches; }
public static void Load() { SharpSerializer serializer = new SharpSerializer(); OrusTheGame loadedGame = serializer.Deserialize("save.xml") as OrusTheGame; if(loadedGame != null) { if (loadedGame.GameInformation.Character != null && !loadedGame.GameInformation.GameMenu.CharacterSelectionInProgress) { UpdateGameProperties(loadedGame); } } }
/// <summary> /// Reads a string value from the Octgn registry /// </summary> /// <param name="valName"> The name of the value </param> /// <returns> A string value </returns> public static string ReadValue(string valName) { if (File.Exists(GetPath())) { var serializer = new SharpSerializer(); var config = (Hashtable) serializer.Deserialize(GetPath()); if (config.ContainsKey(valName)) { return config[valName].ToString(); } } return null; }
/// <summary> /// Returns the fully rehydrated object based upon the given XML. /// </summary> /// <param name="xml">The xml that represents object.</param> /// <returns>Fully rehydrated object.</returns> public static object DeserializeFromXml(string xml) { using (var memStream = new MemoryStream(Encoding.Unicode.GetBytes(xml))) { var settings = new SharpSerializerXmlSettings { IncludeAssemblyVersionInTypeName = true, IncludeCultureInTypeName = true, IncludePublicKeyTokenInTypeName = true }; SharpSerializer ser = new SharpSerializer(settings); return ser.Deserialize(memStream); } }
/// <summary> /// Returns the fully rehydrated object based upon the given byte array. /// </summary> /// <param name="data">The byte array that represents the object.</param> /// <returns>Fully rehydrated object.</returns> public static object DeserializeFromBinary(byte[] data) { using (var memStream = new MemoryStream(data)) { var settings = new SharpSerializerBinarySettings { IncludeAssemblyVersionInTypeName = true, IncludeCultureInTypeName = true, IncludePublicKeyTokenInTypeName = true }; SharpSerializer ser = new SharpSerializer(settings); return ser.Deserialize(memStream); } }
List<SyncProfile> IProfileMapper.Load() { List<SyncProfile> p; if (File.Exists(Filename)) { SharpSerializer s = new SharpSerializer(); p = (List<SyncProfile>)s.Deserialize(Filename); } else { p = new List<SyncProfile>(); } return p; }
public void XmlSerial_TwoIdenticalChildsShouldBeSameInstance() { var parent = new ParentChildTestClass() { Name = "parent", }; var child = new ParentChildTestClass() { Name = "child", Father = parent, Mother = parent, }; Assert.AreSame(child.Father, child.Mother, "Precondition: Saved Father and Mother are same instance"); var stream = new MemoryStream(); var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); serializer.Serialize(child, stream); /* * <Complex name="Root" type="Polenter.Serialization.XmlSerialisationTests+ParentChildTestClass, SharpSerializer.Tests"> * <Properties> * <Simple name="Name" value="child" /> * <Complex name="Mother" id="1"> * <Properties> * <Simple name="Name" value="parent" /> * <Null name="Mother" /> * <Null name="Father" /> * </Properties> * </Complex> * <ComplexReference name="Father" id="1" /> * </Properties> * </Complex> */ stream.Position = 0; XmlDocument doc = new XmlDocument(); doc.Load(stream); System.Console.WriteLine(doc.InnerXml); serializer = new SharpSerializer(settings); stream.Position = 0; ParentChildTestClass loaded = serializer.Deserialize(stream) as ParentChildTestClass; Assert.AreSame(loaded.Father, loaded.Mother, "Loaded Father and Mother are same instance"); }
/// <summary> /// Reads a string value from the Octgn registry /// </summary> /// <param name="valName"> The name of the value </param> /// <returns> A string value </returns> public static string ReadValue(string valName, string def) { lock (lockObject) { var ret = def; Stream f = null; try { if (File.Exists(GetPath())) { var serializer = new SharpSerializer(); Hashtable config = new Hashtable(); if (OpenFile(GetPath(), FileMode.OpenOrCreate, FileShare.None, TimeSpan.FromSeconds(2), out f)) { config = (Hashtable)serializer.Deserialize(f); } if (config.ContainsKey(valName)) { return config[valName].ToString(); } } } catch (Exception e) { Trace.WriteLine("[SimpleConfig]ReadValue Error: " + e.Message); try { File.Delete(GetPath()); } catch (Exception) { Trace.WriteLine("[SimpleConfig]ReadValue Error: Couldn't delete the corrupt config file."); } } finally { if (f != null) { f.Close(); f = null; } } return ret; } }
/// <summary> /// Writes a string value to the Octgn registry /// </summary> /// <param name="valName"> Name of the value </param> /// <param name="value"> String to write for value </param> public static void WriteValue(string valName, string value) { try { var serializer = new SharpSerializer(); var config = new Hashtable(); if (File.Exists(GetPath())) { config = (Hashtable) serializer.Deserialize(GetPath()); } config[valName] = value; serializer.Serialize(config, GetPath()); } catch(Exception e) { Trace.WriteLine("[SimpleConfig]WriteValue Error: " + e.Message); } }
public void BinSerial_ShouldSerializeGuid() { var parent = new ClassWithGuid() { Guid = Guid.NewGuid(), }; var stream = new MemoryStream(); var settings = new SharpSerializerBinarySettings(BinarySerializationMode.SizeOptimized); var serializer = new SharpSerializer(settings); serializer.Serialize(parent, stream); serializer = new SharpSerializer(settings); stream.Position = 0; ClassWithGuid loaded = serializer.Deserialize(stream) as ClassWithGuid; Assert.AreEqual(parent.Guid, loaded.Guid, "same guid"); }
public DataXML LoadData(string filename) { DataXML data; var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var filePath = Path.Combine(documentsPath, filename); var serializer = new SharpSerializer(); Stream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); try { data = (DataXML)serializer.Deserialize(fileStream); } catch (Exception e) { return null; } finally { fileStream.Close(); } return data; }
public void CannotDeserializeClassWithoutParameterlessConstructor() { var child = new ClassWithoutParameterlessConstructor("child"); var data = new ClassWithoutParameterlessConstructor("MyName") { Complex = child }; var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); using (var stream = new MemoryStream()) { serializer.Serialize(data, stream); stream.Position = 0; serializer.Deserialize(stream); } }
public Experimento(Estudio estudioAbierto, string sujetoPrueba) { this.estudioAbierto = estudioAbierto; this.sujetoPrueba = sujetoPrueba; try { var serializer = new SharpSerializer(); Console.WriteLine(estudioAbierto.FolderName + "//" + "Narrativas-" + estudioAbierto.ProjectName + ".xml"); grupoNarrGet = (GrupoNarrativa)serializer.Deserialize(estudioAbierto.FolderName + "//" + "Narrativas-" + estudioAbierto.ProjectName + ".xml"); listaNarrativas = grupoNarrGet.ListaNarrativas; Console.WriteLine(grupoNarrGet.ListaNarrativas); getElementos(); } catch (Exception es) { Console.WriteLine("Error al cargar las Narrativas del proyecto"); Console.WriteLine(es); } }
private static void serialize(HelloWorldTestCase testCase, SharpSerializer serializer) { using (var stream = new MemoryStream()) { // serialize serializer.Serialize(testCase.Source, stream); // reset stream stream.Position = 0; // deserialize var result = serializer.Deserialize(stream); // reset stream to test if it is not closed // the stream will be closed by the user stream.Position = 0; // Fix assertions Assert.AreEqual(testCase.Source.GetType(), result.GetType()); // Custom assertions testCase.MakeAssertion(result); } }
public override object Deserialize(Stream stream) { return(m_Serializer.Deserialize(stream)); }
SyncProfile[] IProfileMapper.Load(string machineName) { SharpSerializer s = new SharpSerializer(false); List<SyncProfile> results = (List<SyncProfile>)s.Deserialize(Filename); return results.ToArray(); }
private string serialize(object obj, SharpSerializer serializer, string shortFilename) { // Serializing the first object var file1 = getFullFilename(shortFilename, "1"); serializer.Serialize(obj, file1); // Deserializing to a second object var obj2 = serializer.Deserialize(file1); // Serializing the second object var file2 = getFullFilename(shortFilename, "2"); serializer.Serialize(obj2, file2); // Comparing two files string retval = compareTwoFiles(file1, file2); // Show files in explorer showInExplorer(file1); return retval; }
public void XmlSerial_TwoIdenticalChildsShouldBeSameInstance() { var parent = new ParentChildTestClass() { Name = "parent", }; var child = new ParentChildTestClass() { Name = "child", Father = parent, Mother = parent, }; Assert.AreSame(child.Father, child.Mother, "Precondition: Saved Father and Mother are same instance"); var stream = new MemoryStream(); var settings = new SharpSerializerXmlSettings(); var serializer = new SharpSerializer(settings); serializer.Serialize(child, stream); /* <Complex name="Root" type="Polenter.Serialization.XmlSerialisationTests+ParentChildTestClass, SharpSerializer.Tests"> <Properties> <Simple name="Name" value="child" /> <Complex name="Mother" id="1"> <Properties> <Simple name="Name" value="parent" /> <Null name="Mother" /> <Null name="Father" /> </Properties> </Complex> <ComplexReference name="Father" id="1" /> </Properties> </Complex> */ stream.Position = 0; XmlDocument doc = new XmlDocument(); doc.Load(stream); System.Console.WriteLine(doc.InnerXml); serializer = new SharpSerializer(settings); stream.Position = 0; ParentChildTestClass loaded = serializer.Deserialize(stream) as ParentChildTestClass; Assert.AreSame(loaded.Father, loaded.Mother, "Loaded Father and Mother are same instance"); }
private static void GetUserModules() { string[] userModules = Directory.GetDirectories(Common.UserModulePath); for (int i = 0; i < userModules.Length; i++) { string UserModuleConfig = userModules[i] + Path.DirectorySeparatorChar + "UserModule.config.xml"; if (File.Exists(UserModuleConfig)) { SharpSerializer _serializer = new SharpSerializer(); try { object obj = _serializer.Deserialize(UserModuleConfig); if (obj is BaseUserModuleConfig) { BaseUserModuleConfig config = obj as BaseUserModuleConfig; config.SetConfigFileName(UserModuleConfig); if (string.IsNullOrEmpty(config.Code)) HandleLogMessage(null, new LogMessageEventArgs(AddinManager.CurrentLocalizer.GetString("UserModuleEmptyCode"), null, LogLevel.Error)); else { string directory = userModules[i].Substring(Common.UserModulePath.Length + 1); IUserModule userModule = CompileUserModule(config.Code, config.Assemblies.ToArray(), config, directory); userModule.LogMessage += HandleLogMessage; _userModules.Add(userModule); } } else HandleLogMessage(null, new LogMessageEventArgs(AddinManager.CurrentLocalizer.GetString("UserModuleWrongConfigClass"), null, LogLevel.Error)); } catch (Exception ex) { HandleLogMessage(null, new LogMessageEventArgs(ex.Message, ex, LogLevel.Error)); } } } }
public static GameData LoadGameData() { GameData gameData = null; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { //isf.DeleteFile(GAME_DATA_FILENAME); if (isf.FileExists(GAME_DATA_FILENAME)) { using (var stream = isf.OpenFile(GAME_DATA_FILENAME, System.IO.FileMode.Open)) { SharpSerializer serializer = new SharpSerializer(true); gameData = (GameData)serializer.Deserialize(stream); } } gameData = gameData ?? new GameData(); LoadPreBuiltLevels(gameData); return gameData; } }
public void loadVariables() { string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FastMove"; try { // If the directory doesn't exist, create it. if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } catch (System.Exception) { // Fail silently } path += "\\FastMove.xml"; try { // If the directory doesn't exist, create it. if (!File.Exists(path)) { writeVariables(); } } catch (System.Exception) { // Fail silently } try { FastMoveVariables up; var serializer = new SharpSerializer(); up = (FastMoveVariables)serializer.Deserialize(path); _FoldersLevel1 = up._FoldersLevel1; _recentItems = up._recentItems; _items = up._folderItems; _ignoreList = up._ignoreList; _InboxAvg = up._InboxAvg; _avgTimeBeforeMove = up._avgTimeBeforeMove; _MailsPerDay = up.MailsPerDay; _LastMailReceived = up.LastMailReceived; _LastOnlineCheck = up.LastOnlineCheck; _OnlineCheckInterval = up.OnlineCheckInterval; _CountedNewMails = up.CountedNewMails; _MailsFromWho = up.MailsFromWho; //Defer emails _deferEmails = up.DeferEmailActive; _deferEmailsAlwaysSendHighPriority = up.DeferEmailsAlwaysSendHighPriority; _deferEmailsAllowedTime = up.DeferEmailsAllowedTime; } catch (System.Exception e) { // Let the user know what went wrong. MessageBox.Show("The file could not be read: "+e.Message); } //GetVariables(); }