public Sofia GetSofia() { Sofia sofia = new Sofia(); foreach (SettingsField field in fields) { FieldValue val = FieldValue.GetByName(sofia.values, field.name); if (val != null) val.value = field.value; } return sofia; }
private void init_us() { if (is_inited) return; is_inited = true; try { if (!System.IO.File.Exists("conf/freeswitch.xml")) { MessageBox.Show("conf/freeswitch.xml is not found, without it we must quit.", "Missing Base Configuration File", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } if (System.IO.File.Exists("log/freeswitch.log")) { try { System.IO.File.WriteAllText("log/freeswitch.log", ""); } catch (System.IO.IOException e) { MessageBox.Show( "Unable to truncate freeswitch.log (most likely due to FSCLient already running) due to: " + e.Message, "Truncation Error", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } } Account.LoadSettings(); recordings_folder = Properties.Settings.Default.RecordingPath; IncomingBalloons = Properties.Settings.Default.IncomingBalloons; IncomingTopMost = Properties.Settings.Default.FrontOnIncoming; ClearDTMFS = Properties.Settings.Default.ClearDTMFS; UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput; CheckForUpdates = Properties.Settings.Default.CheckForUpdates; if (Properties.Settings.Default.Sofia != null) sofia = Properties.Settings.Default.Sofia.GetSofia(); else sofia = new Sofia(); if (Properties.Settings.Default.HeadsetPlugins != null) headset_plugin_manager = HeadsetPluginManager.GetPluginManager(Properties.Settings.Default.HeadsetPlugins); else headset_plugin_manager = new HeadsetPluginManager(); headset_plugin_manager.LoadPlugins(); if (Properties.Settings.Default.EventSocket != null) event_socket = Properties.Settings.Default.EventSocket.GetEventSocket(); else event_socket = new EventSocket(); } catch (Exception e) { MessageBoxResult res = MessageBox.Show( "Unable to properly load our settings if you continue existing settings may be lost, do you want to continue?(No to exit)\n" + e.Message, "Error Loading Settings", MessageBoxButton.YesNo); if (res != MessageBoxResult.Yes) Environment.Exit(-1); } Thread t = new Thread(init_freeswitch); t.IsBackground = true; t.Start(); t = new Thread(VersionCheck); t.IsBackground = true; t.Start(); }
public SettingsSofia(Sofia sofia) { fields = (from fv in sofia.values select new SettingsField(fv)).ToArray(); }
public void reload_sofia(Sofia.RELOAD_CONFIG_MODE mode) { sofia.reload_config(mode); }