static Config() { try { // Prvo ide èitanje konfiguracijske datoteke. string configFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), "App.config"); if (!File.Exists(configFile)) { throw new FileNotFoundException(string.Format("Konfiguracijska datoteka '{0}' nije pronaðena.", configFile)); } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(configFile); XmlNodeList nodeList = xmlDocument.GetElementsByTagName("appSettings"); Settings = new NameValueCollection(); foreach (XmlNode node in nodeList) { foreach (XmlNode key in node.ChildNodes) { Settings.Add(key.Attributes["key"].Value, key.Attributes["value"].Value); } } MobTrenisWS = new WS(Settings["Server"]); } catch (Exception ex) { throw ex; } }
static Config() { MobTrenisWS = new WS(); }