예제 #1
0
파일: ViewsManager.cs 프로젝트: t1b1c/lwas
        public void LoadConfiguration()
        {
            if (!agent.HasKey(configFile))
            {
                CreateEmptyConfiguration();
            }

            XDocument doc  = XDocument.Parse(agent.Read(configFile));
            XElement  root = doc.Element("config");

            FromXml(root);
        }
예제 #2
0
        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));
                            }
                        }
                    }
                }
            }
        }