private void LoadConfiguration (Config config) { if (config == null) config = Conf.Get (Conf.Names.NetworkingConfig); if (String.IsNullOrEmpty (name)) // Whats a good default value ? name = config.GetOption (Conf.Names.ServiceName, String.Empty); // Check to see if our enabled status hasn't changed if (enabled != config.GetOption (Conf.Names.ServiceEnabled, enabled)) { enabled = config.GetOption (Conf.Names.ServiceEnabled, enabled); if (enabled) { try { Publish (); } catch (ClientException) { Log.Error ("Could not start avahi"); return; } } else Unpublish (); Logger.Log.Info ("Zeroconf: Index sharing is {0}", enabled ? "enabled" : "disabled"); } // Handle index name changes if (String.Compare (name, config.GetOption (Conf.Names.ServiceName, name)) != 0) Update (); }
private void ConfigUpdateHandler (Config config) { if (config == null || config.Name != Conf.Names.NetworkingConfig) return; bool to_webinterface = config.GetOption ("WebInterface", false); Log.Debug ("WebInterface option changed to {0}", to_webinterface); if (to_webinterface) StartWebserver (); else StopWebserver (); }
private void OnConfigurationChanged (Config config) { if (config == null || config.Name != Conf.Names.FilesQueryableConfig) return; List<string[]> values = config.GetListOptionValues (Conf.Names.Roots); if (values == null) values = new List<string[]> (0); ArrayList roots_wanted = new ArrayList (values.Count); foreach (string[] root in values) roots_wanted.Add (root [0]); if (config.GetOption (Conf.Names.IndexHomeDir, true)) roots_wanted.Add (PathFinder.HomeDir); IList roots_to_add, roots_to_remove; ArrayFu.IntersectListChanges (roots_wanted, Roots, out roots_to_add, out roots_to_remove); foreach (string root in roots_to_remove) RemoveRoot (root); foreach (string root in roots_to_add) AddRoot (root); }