Ejemplo n.º 1
0
 public static UserData inst()
 {
     if (inst_ == null) {
         inst_ = LoadUserData();
         foreach (IDE.IDESettings setting in inst_.IDESettings)
             setting.Parent = inst_;
     } return inst_;
 }
Ejemplo n.º 2
0
        static UserData LoadUserData()
        {
            string fileName = GetAppDataPath("UserData.xml");
            try {
                if (File.Exists(fileName)) {
                    System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(UserData));

                    UserData ud = new UserData();
                    using (System.IO.FileStream file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        ud = (UserData)reader.Deserialize(file);
                        file.Close();
                    }

                    return ud;
                }
                return new UserData();
            }
            catch (Exception ex) {
                ErrorHandler.inst().Error(ex);
                return new UserData();
            } finally { }
        }