Esempio n. 1
0
        public void Start()
        {
            LoadSettings();

            // Start new root session only if its value is empty:
            string session = _settings.Keys[SESSION_COOKIE][XmlData.VAL];

            if (string.IsNullOrWhiteSpace(session))
            {
                _settings.Keys[SESSION_COOKIE][XmlData.VAL] = GenerateRandomString(16);
                _settings.SyncXmlWithKeys();
                _settings.Save(SETTINGS_FILE);
            }

            // Start listener:
            _server.Start();
        }
Esempio n. 2
0
 /// <summary>
 /// Sets one of the properties.
 /// </summary>
 /// <param name="args"></param>
 /// <param name="inputStream"></param>
 /// <returns></returns>
 private void SetProperty(Dictionary <string, string> args, Stream inputStream)
 {
     if (inputStream != null)
     {
         XmlData properties = new XmlData();
         properties.Load(inputStream);
         foreach (var node in properties.Keys)
         {
             _properties.Keys[node.Key][XmlData.VAL] = node.Value[XmlData.VAL];
         }
     }
     else if (args.ContainsKey(XmlData.ID) && !string.IsNullOrWhiteSpace(args[XmlData.ID]) &&
              args.ContainsKey(XmlData.VAL) && !string.IsNullOrWhiteSpace(args[XmlData.VAL]))
     {
         _properties.Keys[args[XmlData.ID]][XmlData.VAL] = Uri.UnescapeDataString(args[XmlData.VAL]);
     }
     _properties.SyncXmlWithKeys();
     _properties.Save(PROPERTIES_FILE);
 }
Esempio n. 3
0
 public void Stop()
 {
     _server.Stop();
     _settings.Save(SETTINGS_FILE);
     _members.Save(MEMBERS_FILE);
 }