Fixed issues with TTS voice changes. Added proper handling for slave clients. Fixed several stores. Fixed database saving to safely save foreign keys.
This commit is contained in:
@ -47,6 +47,9 @@ namespace HermesSocketServer.Store
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.Name, nameof(value.Name));
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.Type, nameof(value.Type));
|
||||
ArgumentNullException.ThrowIfNull(value.Data, nameof(value.Data));
|
||||
|
||||
if (value.Name.Length > 36)
|
||||
throw new ArgumentException("Action name cannot be longer than 36 characters.");
|
||||
}
|
||||
|
||||
protected override void OnInitialModify(string key, RedeemableAction oldValue, RedeemableAction newValue)
|
||||
|
@ -54,6 +54,9 @@ namespace HermesSocketServer.Store
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.Scope, nameof(value.Scope));
|
||||
ArgumentNullException.ThrowIfNull(value.ExpiresAt, nameof(value.ExpiresAt));
|
||||
ArgumentNullException.ThrowIfNull(value.Default, nameof(value.Default));
|
||||
|
||||
if (value.Name.Length > 36)
|
||||
throw new ArgumentException("Action name cannot be longer than 36 characters.");
|
||||
}
|
||||
|
||||
protected override void OnInitialModify(string key, Connection oldValue, Connection newValue)
|
||||
@ -70,6 +73,8 @@ namespace HermesSocketServer.Store
|
||||
ArgumentNullException.ThrowIfNull(newValue.Default, nameof(newValue.Default));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.UserId, newValue.UserId, nameof(oldValue.UserId));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.Name, newValue.Name, nameof(oldValue.Name));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.Type, newValue.Type, nameof(oldValue.Type));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.ClientId, newValue.ClientId, nameof(oldValue.ClientId));
|
||||
}
|
||||
}
|
||||
}
|
@ -48,6 +48,8 @@ namespace HermesSocketServer.Store
|
||||
ArgumentNullException.ThrowIfNull(value.GroupId, nameof(value.GroupId));
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.Path, nameof(value.Path));
|
||||
|
||||
if (value.Path.Length > 100)
|
||||
throw new ArgumentException("The path cannot be longer than 100 characters.");
|
||||
if (_groups.Get(value.GroupId.ToString()) == null)
|
||||
throw new ArgumentException("The group id does not exist.");
|
||||
}
|
||||
@ -60,6 +62,9 @@ namespace HermesSocketServer.Store
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(newValue.Path, nameof(newValue.Path));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.UserId, newValue.UserId, nameof(oldValue.UserId));
|
||||
ArgumentOutOfRangeException.ThrowIfNotEqual(oldValue.GroupId, newValue.GroupId, nameof(oldValue.GroupId));
|
||||
|
||||
if (oldValue.Path != newValue.Path && newValue.Path.Length > 100)
|
||||
throw new ArgumentException("The path cannot be longer than 100 characters.");
|
||||
}
|
||||
|
||||
protected override void OnPostRemove(string key, GroupPermission value)
|
||||
|
@ -50,7 +50,9 @@ namespace HermesSocketServer.Store
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.Id, nameof(value.Id));
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(value.UserId, nameof(value.UserId));
|
||||
ArgumentNullException.ThrowIfNull(value.Enabled, nameof(value.Enabled));
|
||||
ArgumentNullException.ThrowIfNull(_voices.Get(value.Id));
|
||||
|
||||
if (_voices.Get(value.Id) == null)
|
||||
throw new ArgumentException("The voice does not exist.");
|
||||
}
|
||||
|
||||
protected override void OnInitialModify(string key, TTSVoiceState oldValue, TTSVoiceState newValue)
|
||||
|
Reference in New Issue
Block a user