public static void Init() { #if _NEWSTART_ /** AGL.START Controlado */ int Contador = 0; var NewList = new List <VoidDelegate> { delegate() { if (string.IsNullOrEmpty(_HostId) || string.IsNullOrEmpty(_SipIp)) { List <string> ips = General.GetOperationalV4Ips(); if (string.IsNullOrEmpty(_SipIp)) { _SipIp = (ips.Count > 0) ? ips[ips.Count - 1] : "127.0.0.1"; } if (string.IsNullOrEmpty(_HostId)) { _HostId = "PICT" + _SipIp.Substring(_SipIp.LastIndexOf('.') + 1); } } }, delegate(){ InitSnmp(); }, delegate(){ _WorkingThread = new EventQueue(); }, delegate(){ _PublisherThread = new EventQueue(); }, delegate() { #if _AUDIOGENERIC_ // switch (Properties.Settings.Default.TipoAudioUsb) switch (HwManager.AudioDeviceType) { case eAudioDeviceTypes.MICRONAS: _HwManager = new MicronasHwManager(); break; case eAudioDeviceTypes.CMEDIA: _HwManager = new HidCMediaHwManager(); break; case eAudioDeviceTypes.GENERIC_PTT: // Cascos y Altavoces USB... _HwManager = new HidGenericHwManager(true); break; case eAudioDeviceTypes.GENERIC: // Cascos sin PTT y Altavoces USB... _HwManager = new HidGenericHwManager(false); break; case eAudioDeviceTypes.SIMUL: // Simulacion de Tarjetas HID _HwManager = new SimCMediaHwManager(); break; default: throw new Exception("Dispositivos de Audio no Conocidos..."); } #else _HwManager = new HwManager(); #endif }, delegate(){ _Registry = new TopRegistry(); }, delegate(){ _CfgManager = new CfgManager(); }, delegate(){ _SipManager = new SipManager(); }, delegate(){ _MixerManager = new MixerManager(); }, delegate(){ _TlfManager = new TlfManager(); }, delegate(){ _LcManager = new LcManager(); }, delegate(){ _RdManager = new RdManager(); }, delegate(){ _RecorderManager = new RecorderManager(Settings.Default.GLP); }, delegate(){ _ReplayManager = new ReplayManager(); } }; var nNames = new List <string> { "_SipIp & _HostId", "InitSnmp", "_WorkingThread", "_PublisherThread", "HwManager", "Registry", "CfgManager", "SipManager", "MixedManager", "TlfManager", "LcManager", "RdManager", "RecorderManager", "ReplayManager" }; foreach (VoidDelegate _new in NewList) { try { _new(); Contador++; } catch (Exception x) { _Logger.Fatal("Error en Rutina {1} de Creacion TOP: \n{0}", x.Message, nNames[Contador]); } } #else if (string.IsNullOrEmpty(_HostId) || string.IsNullOrEmpty(_SipIp)) { List <string> ips = General.GetOperationalV4Ips(); if (string.IsNullOrEmpty(_SipIp)) { _SipIp = (ips.Count > 0) ? ips[ips.Count - 1] : "127.0.0.1"; } if (string.IsNullOrEmpty(_HostId)) { _HostId = "PICT" + _SipIp.Substring(_SipIp.LastIndexOf('.') + 1); } } /* Inicializa la gestion SNMP */ InitSnmp(); _WorkingThread = new EventQueue(); _PublisherThread = new EventQueue(); #if _AUDIOGENERIC_ /** AGL.CMEDIA */ switch (Properties.Settings.Default.TipoAudioUsb) { case 0: // IAU. Micronas. _HwManager = new MicronasHwManger(); break; case 1: // IAU. CMedia. _HwManager = new HidCMediaHwManager(); break; case 2: // Cascos y Altavoces USB... _HwManager = new HidGenericHwManager(true); break; case 3: // Cascos sin PTT y Altavoces USB... _HwManager = new HidGenericHwManager(true); break; default: throw new Exception("HwManager de tipo Desconocido..."); } #else _HwManager = new HwManager(); #endif /** */ _Registry = new TopRegistry(); _CfgManager = new CfgManager(); _SipManager = new SipManager(); _MixerManager = new MixerManager(); _TlfManager = new TlfManager(); _LcManager = new LcManager(); _RdManager = new RdManager(); _RecorderManager = new RecorderManager(); _ReplayManager = new ReplayManager(); /** */ #endif #if _NEWSTART_ /** AGL.START Controlado */ Contador = 0; var InitList = new List <VoidDelegate> { delegate() { if (_HwManager != null) { _HwManager.Init(); } }, delegate() { if (_Registry != null) { _Registry.Init(); } }, delegate() { if (_CfgManager != null) { _CfgManager.Init(); } }, delegate() { if (_SipManager != null) { _SipManager.Init(); } }, delegate() { if (_MixerManager != null) { _MixerManager.Init(); } }, delegate() { if (_TlfManager != null) { _TlfManager.Init(); } }, delegate() { if (_LcManager != null) { _LcManager.Init(); } }, delegate() { if (_RdManager != null) { _RdManager.Init(); } }, delegate() { if (_RecorderManager != null) { _RecorderManager.Init(); } } }; var iNames = new List <string> { "HwManager", "Registry", "CfgManager", "SipManager", "MixedManager", "TlfManager", "LcManager", "RdManager", "RecorderManager" }; foreach (VoidDelegate init in InitList) { try { init(); Contador++; } catch (Exception x) { _Logger.Fatal("Error en Rutina {1} de Inicializacion TOP: \n{0}", x.Message, iNames[Contador]); } } #else _HwManager.Init(); _Registry.Init(); _CfgManager.Init(); _SipManager.Init(); _MixerManager.Init(_HwManager.ListaDispositivos); _TlfManager.Init(); _LcManager.Init(); _RdManager.Init(); _RecorderManager.Init(); #endif #if _NICMON_V0_ /** */ NetworkIFSupervisor.AutoReset = true; NetworkIFSupervisor.Elapsed += NetworkChange_NetworkAvailabilityChanged; NetworkIFSupervisor.Enabled = Settings.Default.SNMPEnabled == 1; _Logger.Info("TIMER NetworkIFSupervisor Arrancado..."); #else string jconfig = Properties.Settings.Default.LanTeamConfigs.Count > Properties.Settings.Default.LanTeamType ? Properties.Settings.Default.LanTeamConfigs[Properties.Settings.Default.LanTeamType] : ""; mon = new NicEventMonitor(jconfig, (lan, status) => { string oid = lan == 0 ? Settings.Default.NetworkIF_1_Oid : Settings.Default.NetworkIF_2_Oid; SnmpIntObject.Get(oid).Value = (int)status; _Logger.Info(String.Format("Notificado cambio en LAN {0} => {1}", lan, status)); }, (m, x) => { _Logger.Error(String.Format("Error Message: {0}", m)); } /*, filePath*/); _Logger.Info("NetworkIFSupervisor Arrancado..."); #endif /** 20170309. AGL. Supervision Cliente NTP. */ NtpClientSupervisor.AutoReset = true; NtpClientSupervisor.Elapsed += NtpClientSupervisor_tick; NtpClientSupervisor.Enabled = Settings.Default.SNMPEnabled == 1; _Logger.Info("TIMER NtpClientSupervisor Arrancado..."); /*****************/ }