Exemple #1
0
        public virtual void LoadUserProperties()
        {
            if (userProperties != null)
            {
                userProperties.Dispose();
            }
            userProperties = null;

            string preferencesFileName = GetPreferencesFileName();

            if (!File.Exists(preferencesFileName))
            {
                return;
            }

            XmlTextReader reader = new XmlTextReader(preferencesFileName);

            try {
                reader.MoveToContent();
                if (reader.LocalName != "Properties")
                {
                    return;
                }

                XmlDataSerializer ser = new XmlDataSerializer(new DataContext());
                ser.SerializationContext.BaseFile = preferencesFileName;
                userProperties = (PropertyBag)ser.Deserialize(reader, typeof(PropertyBag));
            } catch (Exception e) {
                LoggingService.LogError("Exception while loading user solution preferences.", e);
                return;
            } finally {
                reader.Close();
            }
        }