/// <summary> /// Search for the first argument with the given name. Returns true if found the parameter, false otherse. /// The resulting parameter will be on the out Pair argument. /// </summary> public static bool TryGetArgumentByName(SimpleList <Pair <string, string> > arguments, string parameterName, out Pair <string, string> parameter) { parameter = SList.Find(arguments, pair => string.Equals(pair.Key, parameterName, StringComparison.InvariantCultureIgnoreCase)); // since pair is a struct (always not null), we need to validate if the key AND value is null return(!(string.IsNullOrEmpty(parameter.Key) && string.IsNullOrEmpty(parameter.Value))); }
public static Window GetWindowFromWindowComponent(WindowComponent windowComponent) { var window = SList.Find(CurrentlyOpenWindows, w => w.SceneWindow == windowComponent); DebugUtil.Assert(window == null, "CLOSING A INVALID WINDOW"); return(window); }
public static AccessPermission GetAccessPermissionForUser(HashFile file, string username) { var permissionPair = SList.Find(file.UserPermission, p => string.Equals(p.Key, username)); if (permissionPair != null) { return(permissionPair.Value); } else { return(AccessPermission.Editable); } }