public static Settings Parse(IGitModule gitModule, IGitPluginSettingsContainer setting) { var result = new Settings { Username = setting.GetSetting(StashPlugin.StashUsername), Password = setting.GetSetting(StashPlugin.StashPassword) }; var module = ((GitModule)gitModule); var remotes = module.GetRemotes() .Select(r => module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, r))) .ToArray(); foreach (var url in remotes) { var pattern = url.Contains("http") ? StashHttpRegex : StashSshRegex; var match = Regex.Match(url, pattern); if (match.Success) { result.ProjectKey = match.Groups["project"].Value; result.RepoSlug = match.Groups["repo"].Value; result.StashUrl = match.Groups["url"].Value; return result; } } return null; }
public static Settings Parse(IGitModule gitModule, IGitPluginSettingsContainer setting) { var result = new Settings { Username = setting.GetSetting(StashPlugin.StashUsername), Password = setting.GetSetting(StashPlugin.StashPassword), DisableSSL = setting.GetSetting(StashPlugin.StashDisableSSL) }; var module = ((GitModule)gitModule); var remotes = module.GetRemotes() .Select(r => module.GetPathSetting(string.Format(SettingKeyString.RemoteUrl, r))) .ToArray(); foreach (var url in remotes) { var pattern = url.Contains("http") ? StashHttpRegex : StashSshRegex; var match = Regex.Match(url, pattern); if (match.Success) { result.ProjectKey = match.Groups["project"].Value; result.RepoSlug = match.Groups["repo"].Value; result.StashUrl = match.Groups["prefix"].Value + match.Groups["url"].Value; return(result); } } return(null); }
private void ProxySwitcherForm_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(settings.GetSetting(SettingsKey.HttpProxy))) { MessageBox.Show(this, _pleaseSetProxy.Text, this.Text, MessageBoxButtons.OK); this.Close(); } else { RefreshProxy(); } }
private T?GetEnumSettingValue <T>(string key) where T : struct { var type = typeof(T); var value = _container.GetSetting(key); return((from name in Enum.GetNames(type) where name == value select(T?) Enum.Parse(type, name)).FirstOrDefault()); }