public static Dictionary <string, StateSended> loadDictionary(PilotkaSettings settings) { ILog log = LogManager.GetLogger(settings.LoggerName); Dictionary <string, StateSended> imeiDictionary = new Dictionary <string, StateSended>(); var imeiSet = ImeiListLoader.loadImeis(log, settings.ImeiListFileName); foreach (string imei in imeiSet) { imeiDictionary.Add(imei, new StateSended()); } return(imeiDictionary); }
public ImeiList(IUnifiedProtocolSettings settings) { this.settings = settings; this.log = LogManager.GetLogger(settings.LoggerName); this.imeiDictionary = new Dictionary <string, string>(); if (settings.Enabled) { var set = ImeiListLoader.loadImeis(log, settings.ImeiListFileName); foreach (string csv in set) { var strs = csv.Split(';'); imeiDictionary[strs[0]] = strs[1]; } } }
public AsyncRetranslator(string listenHost, int listenPort, string monHost, int monPort) { appPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); string log4netConfigPath = Path.Combine(appPath, "log4net.config"); FileInfo fi = new FileInfo(log4netConfigPath); XmlConfigurator.ConfigureAndWatch(fi); log = LogManager.GetLogger(typeof(AsyncRetranslator)); commandLog = LogManager.GetLogger("command"); messageReceivedFromBlockDelegate = messageReceivedFromBlock; messageReceivedFromMonDelegate = messageReceivedFromMon; messageReceivedFromMon2Delegate = messageReceivedFromMon2; messageSendedToMonDelegate = messageSendedToMon; messageSendedToMon2Delegate = messageSendedToMon2; messageSendedToBlockDelegate = messageSendedToBlock; blockReceiveFailedDelegate = blockReceiveFailed; blockSendFailedDelegate = blockSendFailed; monReceiveFailedDelegate = monReceiveFailed; monSendFailedDelegate = monSendFailed; mon2ReceiveFailedDelegate = mon2ReceiveFailed; mon2SendFailedDelegate = mon2SendFailed; blockConnectionAcceptedDelegate = blockConnectionAccepted; blocksAcceptor = new BlocksAcceptor(listenHost, listenPort, messageReceivedFromBlockDelegate, messageSendedToBlockDelegate, blockConnectionAcceptedDelegate, blockReceiveFailedDelegate, blockSendFailedDelegate); monConnector = new MonConnector(monHost, monPort, messageReceivedFromMonDelegate, messageSendedToMonDelegate, monReceiveFailedDelegate, monSendFailedDelegate, 3, 7000); receivePacketProcessor = new ReceivePacketProcessor(); if (Settings.Default.Mon2_Enabled) { // 1. load imeis if (!Settings.Default.Mon2_Allboards) { mon2Imeis = ImeiListLoader.loadImeis(log, Settings.Default.Mon2_ImeiListFileName); } // 2. init mon2connector mon2Connector = new MonConnector(Settings.Default.Mon2_Host, Settings.Default.Mon2_Port, messageReceivedFromMon2Delegate, messageSendedToMon2Delegate, mon2ReceiveFailedDelegate, mon2SendFailedDelegate); } }
public void start() { log = LogManager.GetLogger(typeof(GISHandler)); if (!Settings.Default.GIS_Enabled) { return; } allImeis = Settings.Default.GIS_Allboards; if (!allImeis) { imeis = ImeiListLoader.loadImeis(log, Settings.Default.GIS_ImeiListFileName); } stoped = false; thread = new Thread(() => process()); thread.Start(); log.Info("2GIS started"); }