public void LoadConfiguration() { if (!agent.HasKey(configFile)) { CreateEmptyConfiguration(); } XDocument doc = XDocument.Parse(agent.Read(configFile)); XElement root = doc.Element("config"); FromXml(root); }
public void Open() { if (null == this._agent) { throw new InvalidOperationException("Agent not set"); } // this._data = (HttpContext.Current.Cache[User.CurrentUser.Name] as Dictionary<string, object>); XDocument doc = null; if (_agent.HasKey(STORAGE_KEY)) { doc = XDocument.Parse(_agent.Read(STORAGE_KEY)); } if (null == this._data) { this._data = new Dictionary <string, object>(); if (null != doc) { foreach (string normalizedkey in this._agent.List()) { XElement keyelement = doc.Element("keys") .Elements() .SingleOrDefault(x => x.Attribute("normalized").Value == normalizedkey); if (null != keyelement) { string key = keyelement.Attribute("full").Value; string persisteddata = _agent.Read(normalizedkey); if (!String.IsNullOrEmpty(persisteddata)) { this._data.Add(key, SerializationServices.BinaryDeserialize(persisteddata)); } } } } } }