public static Config GetConfig(string options) { var document = GetDocument(options); var rootTagName = document.ChildNodes.OfType <XmlNode>() .First(n => n.Name == FxComConfig.Name || n.Name == FxEnetConfig.Name || n.Name == QConfig.Name) .Name; Config config; switch (rootTagName) { case FxComConfig.Name: config = new FxComConfig(); break; case FxEnetConfig.Name: config = new FxEnetConfig(); break; case QConfig.Name: config = new QConfig(); break; default: throw new NotSupportedException(rootTagName); } config.SetDocument(document); return(config); }
public static Config GetConfig(string options) { var document = GetDocument(options); var rootTagName = document.ChildNodes.OfType<XmlNode>() .First(n => n.Name == FxComConfig.Name || n.Name == FxEnetConfig.Name || n.Name == QConfig.Name) .Name; Config config; switch (rootTagName) { case FxComConfig.Name: config = new FxComConfig(); break; case FxEnetConfig.Name: config = new FxEnetConfig(); break; case QConfig.Name: config = new QConfig(); break; default: throw new NotSupportedException(rootTagName); } config.SetDocument(document); return config; }
private void UpdateConfig() { switch (ConfigType) { case ConfigType.FxCom: if (FxComConfig == null) { Config = new FxComConfig(); } break; case ConfigType.FxEnet: if (FxEnetConfig == null) { Config = new FxEnetConfig(); } break; case ConfigType.Q: if (QConfig == null) { Config = new QConfig(); } break; default: throw new NotSupportedException(ConfigType.ToString()); } }