mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-06 00:13:33 +00:00
Added device user search
This commit is contained in:
14
MainForm.cs
14
MainForm.cs
@@ -596,7 +596,21 @@ namespace MeshCentralRouter
|
||||
int imageIndex = (node.icon - 1) * 2;
|
||||
if ((node.conn & 1) == 0) { imageIndex++; }
|
||||
device.ImageIndex = imageIndex;
|
||||
|
||||
string userSearch = null;
|
||||
string lowerSearch = search.ToLower();
|
||||
if (lowerSearch.StartsWith("u:")) { userSearch = lowerSearch.Substring(2); }
|
||||
if (lowerSearch.StartsWith("user:")) { userSearch = lowerSearch.Substring(5); }
|
||||
if (userSearch == null)
|
||||
{
|
||||
// Normal search
|
||||
if (connVisible && ((search == "") || (device.SubItems[0].Text.ToLower().IndexOf(search) >= 0))) { controlsToAdd.Add(device); }
|
||||
} else {
|
||||
// User search
|
||||
bool userSearchMatch = false;
|
||||
if (node.users != null) { foreach (string user in node.users) { if (user.ToLower().IndexOf(userSearch) >= 0) { userSearchMatch = true; } } }
|
||||
if (connVisible && ((userSearch == "") || userSearchMatch)) { controlsToAdd.Add(device); }
|
||||
}
|
||||
}
|
||||
|
||||
// Add all controls at once to make it fast.
|
||||
|
||||
@@ -353,6 +353,7 @@ namespace MeshCentralRouter
|
||||
}
|
||||
if (node.ContainsKey("conn")) { n.conn = (int)node["conn"]; }
|
||||
n.icon = (int)node["icon"];
|
||||
if (node.ContainsKey("users")) { n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); } else { n.users = null; }
|
||||
if (node.ContainsKey("rdpport")) { n.rdpport = (int)node["rdpport"]; }
|
||||
ulong nodeRights = 0;
|
||||
if (node.ContainsKey("links"))
|
||||
@@ -491,6 +492,7 @@ namespace MeshCentralRouter
|
||||
}
|
||||
n.name = (string)node["name"];
|
||||
n.meshid = meshid;
|
||||
if (node.ContainsKey("users")) { n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); } else { n.users = null; }
|
||||
if (node.ContainsKey("rdpport")) { n.rdpport = (int)node["rdpport"]; } else { n.rdpport = 3389; }
|
||||
if (node.ContainsKey("conn")) { n.conn = (int)node["conn"]; } else { n.conn = 0; }
|
||||
if (node.ContainsKey("icon")) { n.icon = (int)node["icon"]; }
|
||||
@@ -528,6 +530,8 @@ namespace MeshCentralRouter
|
||||
}
|
||||
n.name = (string)node["name"];
|
||||
n.meshid = meshid;
|
||||
|
||||
if (node.ContainsKey("users")) { n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); } else { n.users = null; }
|
||||
if (node.ContainsKey("rdpport")) { n.rdpport = (int)node["rdpport"]; } else { n.rdpport = 3389; }
|
||||
if (node.ContainsKey("conn")) { n.conn = (int)node["conn"]; } else { n.conn = 0; }
|
||||
if (node.ContainsKey("icon")) { n.icon = (int)node["icon"]; }
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace MeshCentralRouter
|
||||
public KVMViewer desktopViewer;
|
||||
public FileViewer fileViewer;
|
||||
public Dictionary<string, ulong> links;
|
||||
public string[] users;
|
||||
|
||||
public override string ToString() { return name; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user