public void ReleaseLocksWithPrefix(string prefix) { var removeList = ServerLocks .Where(l => l.Key.StartsWith(prefix) && (l.Value == SettingsSystem.CurrentSettings.PlayerName)) .Select(l => l.Key) .ToArray(); foreach (var removeValue in removeList) { ReleaseLock(removeValue); ServerLocks.Remove(removeValue); FireReleaseEvent(SettingsSystem.CurrentSettings.PlayerName, removeValue); } }
/// <summary> /// Release the specified control lock excepts the ones you pass. /// You must send the full control lock name, not the prefix /// </summary> public void ReleaseControlLocksExcept(params string[] lockNames) { var removeList = ServerLocks .Where(l => !lockNames.Contains(l.Key) && l.Key.StartsWith("control-") && (l.Value == SettingsSystem.CurrentSettings.PlayerName)) .Select(l => l.Key) .ToArray(); foreach (var removeValue in removeList) { ReleaseLock(removeValue); ServerLocks.Remove(removeValue); FireReleaseEvent(SettingsSystem.CurrentSettings.PlayerName, removeValue); } }
public string[] GetLocksWithPrefix(string lockPrefix) { return(ServerLocks.Where(l => l.Key.StartsWith(lockPrefix)).Select(l => l.Key).ToArray()); }
public string[] GetPlayerLocksPrefix(string playerName, string lockPrefix) { return(ServerLocks.Where(l => l.Value == playerName && l.Key.StartsWith(lockPrefix)).Select(l => l.Key).ToArray()); }
public string[] GetPlayerLocks(string playerName) { return(ServerLocks.Where(l => l.Value == playerName).Select(l => l.Key).ToArray()); }
public string[] GetOwnedLocksPrefix(string lockPrefix) { return(ServerLocks.Where(l => l.Value == SettingsSystem.CurrentSettings.PlayerName && l.Key.StartsWith(lockPrefix)) .Select(l => l.Key).ToArray()); }