static void Main() { ProgramDataFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Tag2Space.xml"); ProgramData = new _ProgramData(); serializer = new XmlSerializer(typeof(_ProgramData)); ReadProgramData(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWindow()); SaveProgramData(); }
public static bool ReadProgramData() { bool ret = true; FileStream stream = null; try { stream = new FileStream(ProgramDataFile, FileMode.Open); ProgramData = (_ProgramData)serializer.Deserialize(stream); } catch (Exception ex) { ret = false; } finally { if (stream != null) { stream.Close(); } } return(ret); }