static PrinterConfig() { try { printerConfig = new ConfigUtil("Ini/printers.ini"); List<string> printerIds = printerConfig.Notes(); printers = new List<Printer>(); foreach (string id in printerIds) { printers.Add(new Printer() { Id = id, Output = printerConfig.Get("Output", id), Template = printerConfig.Get("Template", id), Name = printerConfig.Get("Name", id), Type = int.Parse(printerConfig.Get("Type", id)), Copy = int.Parse(printerConfig.Get("Copy", id)) }); } } catch (Exception e) { throw e; } }
static TskBaseConfig() { try { config = new ConfigUtil("BaseConfig", @"Ini\TskClientConfig.ini"); remoteServerIP =config.Get("RemoteServerIP") ; remoteServerPort = config.Get("RemoteServerPort"); dataFilePath = config.Get("DataFilePath"); errorFilePath = config.Get("ErrorFilePath"); movedFilePath = config.Get("MovedFilePath"); if (!bool.TryParse(config.Get("DeleteFileAfterRead"), out deleteFileAfterRead)) { deleteFileAfterRead = false; } if (!int.TryParse(config.Get("ScanInterval"), out scanInterval)) { scanInterval = 2; } } catch (Exception e) { throw e; } }
static MSSqlConfig() { try { config = new ConfigUtil("Connection", @"Ini\SqlConfig.ini"); connectionString = config.Get("ConnectionString"); } catch (Exception e) { throw e; } }
static TskConfig() { try { config = new ConfigUtil(@"Ini\TskConfig.ini"); int.TryParse(config.Get("DataCount", "DataFormat"), out dataCount); dataSpliter = config.Get("DataSpliter", "DataFormat").ToCharArray().First(); } catch (Exception e) { throw e; } }
static SerialPortConfig() { config = new ConfigUtil("Base", @"Ini\serial_port.ini"); servicePort = config.Get("ServicePort"); zigBeeId = config.Get("ZigBeeId"); portName = config.Get("PortName"); portBaudRate = int.Parse(config.Get("BaudRate")); portParity = (Parity)int.Parse(config.Get("Parity")); dataBits = int.Parse(config.Get("DataBits")); portStopBits = (StopBits)int.Parse(config.Get("StopBits")); portHandshake = (Handshake)int.Parse(config.Get("Handshake")); readTimeout = int.Parse(config.Get("ReadTimeout")); writeTimeout = int.Parse(config.Get("WriteTimeout")); }
static ApiConfig() { try { config = new ConfigUtil("API", "Ini/api.ini"); Protocal = config.Get("Protocal"); host = config.Get("Host"); port = config.Get("Port"); ApiUri = config.Get("ApiUri"); if (port == "") BaseUri = Protocal + "://" + host + ApiUri; else BaseUri = Protocal + "://" + host + ":" + port + ApiUri; Token = config.Get("Token"); PrintDataAction = config.Get("PrintDataAction"); } catch (Exception e) { throw e; } }