private static int lastAppNumberAdded(string appName) { List <string> al = SSOConfigManager.GetApplications(); int lastAppNumber = -1; foreach (string s in al) { if (s.Equals(appName)) { lastAppNumber = 0; } if (s.Contains(appName + "(")) { string regex = Regex.Match(s, @"\([0-9]+\)(?!.*(\([0-9]+\)))").Value; if (regex == "") { continue; } int splitNumber = Int32.Parse(regex.Split('(')[1].Split(')')[0]); if (splitNumber > lastAppNumber) { lastAppNumber = splitNumber; } } } return(lastAppNumber); }
private bool appExist(string name) { foreach (string s in SSOConfigManager.GetApplications()) { if (s.Equals(name)) { return(true); } } return(false); }
public static void Search(TreeView tvApps, string searchText, DataGridView dgvSearch) { tvApps.Nodes.Clear(); TreeNode rootNode = new TreeNode("Applications"); tvApps.Nodes.Add(rootNode); foreach (var application in SSOConfigManager.GetApplications()) { string appUserAcct, appAdminAcct, description, contactInfo; HybridDictionary props = SSOConfigManager.GetConfigProperties(application, out description, out contactInfo, out appUserAcct, out appAdminAcct); // search string in all keys and values if (!string.IsNullOrWhiteSpace(searchText) && //!application.Equals(searchText, StringComparison.InvariantCultureIgnoreCase) && !ContainsIgnoreCase(application, searchText, StringComparison.OrdinalIgnoreCase) && !SSOConfigManager.SearchKeys(props, searchText) && !SSOConfigManager.SearchValues(props, searchText)) { continue; } var node = new TreeNode(application) { ToolTipText = description }; // add node if found rootNode.Nodes.Add(node); } TreeNodeCollection nodes = rootNode.Nodes; if (nodes.Count > 0) { // Select the root node tvApps.SelectedNode = nodes[0]; tvApps.SelectedNode.Expand(); LoadGrid(nodes[0].Text, dgvSearch); tvApps.Focus(); } }