protected override void OnStart(string[] args) { cfg = Config.sharedInstance(); http = new HTTP(); http.setPort(int.Parse(cfg.port)); http.start(); }
public static Config sharedInstance() { if (cfg_ == null) { cfg_ = new Config(); string path = AppDomain.CurrentDomain.BaseDirectory; XmlDocument xml = new XmlDocument(); xml.Load(path + "cfg.xml"); XmlNode root = xml.SelectSingleNode("root"); XmlElement node = root["ADHost"]; cfg_.adhost = node.InnerText; node = root["ADName"]; cfg_.adname = node.InnerText; node = root["ADPwd"]; cfg_.adpwd = node.InnerText; node = root["Port"]; cfg_.port = node.InnerText; } return cfg_; }
static void Main(string[] args) { cfg = Config.sharedInstance(); http = new HTTP(); http.setPort(int.Parse(cfg.port)); http.start(); while(true){} }