public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { _locker.EnterReadLock(); try { if (_partitionBits != _partitions[0].Mask.BitCount || Math.Pow(2, _partitionBits) != this.PartitionCount) { details.AddError(ExecutionDetails.TablePartitionBitsWrong, _partitionBits, _partitions[0].Mask.BitCount, this.PartitionCount); } if (this.RunParallel) { Parallel.ForEach(_partitions, (p) => { p.VerifyConsistency(level, details); }); } else { foreach (Partition p in _partitions) { p.VerifyConsistency(level, details); } } } finally { _locker.ExitReadLock(); } }
public void VerifyConsistency(IColumn column, VerificationLevel level, ExecutionDetails details) { foreach (WordIndexBlock block in _blocks) { block.VerifyConsistency(column, level, details); } }
private bool VerifyItems(Array actualItems, Array expectedItems, VerificationLevel verificationLevel) { if (verificationLevel <= _verificationLevel) { if (!Test.Eval(expectedItems.Length, actualItems.Length, "The length of the items")) { return(false); } int actualItemsLowerBounds = actualItems.GetLowerBound(0); int expectedItemsLowerBounds = expectedItems.GetLowerBound(0); for (int i = 0; i < expectedItems.Length; i++) { if (!Test.Eval(_comparer.Equals(actualItems.GetValue(i + actualItemsLowerBounds), expectedItems.GetValue(i + expectedItemsLowerBounds)), "The actual item and expected items differ at {0} actual={1} expected={2}", i, actualItems.GetValue(i + actualItemsLowerBounds), expectedItems.GetValue(i + expectedItemsLowerBounds))) { return(false); } } return(true); } return(true); }
private bool VerifyItems(Object[] actualItems, Object[] expectedItems, VerificationLevel verificationLevel) { if (verificationLevel <= _verificationLevel) { if (!Test.Eval(expectedItems.Length, actualItems.Length, "The length of the items")) { return(false); } for (int i = 0; i < expectedItems.Length; i++) { if (!Test.Eval(_comparer.Equals(actualItems[i], expectedItems[i]), "The actual item and expected items differ at {0} actual={1} expected={2}", i, actualItems[i], expectedItems[i])) { return(false); } } return(true); } return(true); }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { if (details == null) { throw new ArgumentNullException("details"); } // Verify there are enough index items if (_itemCount > _index.Length) { details.AddError(ExecutionDetails.ColumnDoesNotHaveEnoughValues, this.Name, _itemCount, _index.Length); } for (int i = 0; i < _itemCount; ++i) { BlockPosition p = _index[i]; if (p.BatchIndex >= _batchCount) { // Verify every index item points to a valid batch details.AddError(ExecutionDetails.ByteBlockColumnBatchOutOfRange, this.Name, i, p.BatchIndex, _batchCount); } else { // Verify every empty item is represented correctly and every non-oversize item points to a valid array range BlockBatch batch = _batches[p.BatchIndex]; if (p.Length == 0) { if (p.Position != 0) { details.AddError(ExecutionDetails.ByteBlockEmptyValueMisrecorded, this.Name, i, p.Position); } } else if (p.Length == ushort.MaxValue) { if (p.Position != 0) { details.AddError(ExecutionDetails.ByteBlockHugeValueMisrecorded, this.Name, i, p.Position); } } else { if (p.Position >= batch.Array.Length || p.Position + p.Length > batch.Array.Length) { details.AddError(ExecutionDetails.ByteBlockColumnPositionOutOfRange, this.Name, i, p.Position, p.Length, batch.Array.Length); } } } } // Verify all out-of-range items are clear for (int i = _itemCount; i < _index.Length; ++i) { BlockPosition p = _index[i]; if (p.BatchIndex != 0 || p.Position != 0 || p.Length != 0) { details.AddError(ExecutionDetails.ByteBlockColumnUnclearedIndexEntry, this.Name, i, p); } } }
public async Task <RestGuild> CreateGuildAsync( string name, string voiceRegionId = null, Stream icon = null, VerificationLevel verificationLevel = default, DefaultNotificationLevel defaultNotificationLevel = default, ContentFilterLevel contentFilterLevel = default, RestRequestOptions options = null) { var model = await ApiClient.CreateGuildAsync(name, voiceRegionId, icon, verificationLevel, defaultNotificationLevel, contentFilterLevel, options).ConfigureAwait(false); return(new RestGuild(this, model)); }
public Guild(Snowflake id, string name, string?icon, string?splash, string?discoverySplash, bool?owner, Snowflake ownerId, PermissionFlags?permissions, string region, Snowflake?afkChannelId, int afkTimeout, bool?embedEnabled, Snowflake?embedChannelId, VerificationLevel verificationLevel, MessageNotificationLevel defaultMessageNotifictations, ExplicitContentFilterLevel explicitContentFilter, Role[] roles, Emoji[] emojis, string[] features, MFALevel mfaLevel, Snowflake?applicationId, bool?widgedEnabled, Snowflake?widgedChnanelId, Snowflake?systemChannelId, SystemChannelFlags systemChannelFlags, Snowflake?rulesChannelId, DateTime?joinedAt, bool?large, bool?unavailable, int?memberCount, VoiceState[] voiceStates, GuildMember[] members, Channel[] channels, Presence[] presences, int?maxPresences, int?maxMembers, string?vanityUrlCode, string?description, string?banner, PremiumTier premiumTier, int?premiumSubscriptionCount, string prefferedLocale, Snowflake?publicUpdatesChannelId) { Id = id; Name = name; Icon = icon; Splash = splash; DiscoverySplash = discoverySplash; Owner = owner; OwnerId = ownerId; Permissions = permissions; Region = region; AfkChannelId = afkChannelId; AfkTimeout = afkTimeout; EmbedEnabled = embedEnabled; EmbedChannelId = embedChannelId; VerificationLevel = verificationLevel; DefaultMessageNotifictations = defaultMessageNotifictations; ExplicitContentFilter = explicitContentFilter; Roles = roles; Emojis = emojis; Features = features; MFALevel = mfaLevel; ApplicationId = applicationId; WidgedEnabled = widgedEnabled; WidgedChnanelId = widgedChnanelId; SystemChannelId = systemChannelId; SystemChannelFlags = systemChannelFlags; RulesChannelId = rulesChannelId; JoinedAt = joinedAt; Large = large; Unavailable = unavailable; MemberCount = memberCount; VoiceStates = voiceStates; Members = members; Channels = channels; Presences = presences; MaxPresences = maxPresences; MaxMembers = maxMembers; VanityUrlCode = vanityUrlCode; Description = description; Banner = banner; PremiumTier = premiumTier; PremiumSubscriptionCount = premiumSubscriptionCount; PrefferedLocale = prefferedLocale; PublicUpdatesChannelId = publicUpdatesChannelId; }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { if (_itemCount > _values.Length) { if (details != null) { details.AddError(ExecutionDetails.ColumnDoesNotHaveEnoughValues, this.Name, _itemCount, _values.Length); } } }
/// <summary> /// Initializes a new instance of the IEnumerable_Test. /// </summary> /// <param name="collection">The collection to run the tests on.</param> /// <param name="items">The items currently in the collection.</param> /// <param name="modifyCollection">Modifies the collection to invalidate the enumerator.</param> public IEnumerable_Test(IEnumerable collection, Object[] items, ModifyUnderlyingCollection modifyCollection) { _collection = collection; _modifyCollection = modifyCollection; _isGenericCompatibility = false; _isResetNotSupported = false; _verificationLevel = VerificationLevel.Extensive; _collectionOrder = CollectionOrder.Sequential; if (items == null) _items = new Object[0]; else _items = items; _comparer = System.Collections.Generic.EqualityComparer<Object>.Default; }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { if (details == null) { throw new ArgumentNullException("details"); } ushort expectedColumnSize = this.Count; // Verify each column internally foreach (IColumn column in this.Columns.Values) { column.VerifyConsistency(level, details); // Verify columns are all the same item count if (column.Count != expectedColumnSize) { details.AddError(ExecutionDetails.ColumnSizeIsUnexpected, column.Name, column.Count, expectedColumnSize); } } // Verify all IDs are supposed to be in this partition, if this table has data yet // [Tables without data are allowed to not have any columns yet, do IDColumn would be null] if (this.Count > 0) { if (this.IDColumn == null) { details.AddError(ExecutionDetails.PartitionHasNoIDColumn); } else { Value id = Value.Create(null); IColumn <object> idColumn = this.Columns[this.IDColumn.Name]; for (ushort i = 0; i < this.Count; ++i) { id.Assign(idColumn[i]); int hashCode = id.GetHashCode(); if (!this.Mask.Matches(hashCode)) { details.AddError(ExecutionDetails.ItemInWrongPartition, id, hashCode, this.Mask); } } } } }
/// <summary> /// Initializes a new instance of the IEnumerable_Test. /// </summary> /// <param name="collection">The collection to run the tests on.</param> /// <param name="items">The items currently in the collection.</param> /// <param name="modifyCollection">Modifies the collection to invalidate the enumerator.</param> public IEnumerable_Test(IEnumerable collection, Object[] items, ModifyUnderlyingCollection modifyCollection) { _collection = collection; _modifyCollection = modifyCollection; _isGenericCompatibility = false; _isResetNotSupported = false; _verificationLevel = VerificationLevel.Extensive; _collectionOrder = CollectionOrder.Sequential; if (items == null) { _items = new Object[0]; } else { _items = items; } _comparer = System.Collections.Generic.EqualityComparer <Object> .Default; }
public bool IsVerified(VerificationLevel level) { switch (level) { case VerificationLevel.Level1: case VerificationLevel.Level1Pending: case VerificationLevel.Level2Pending: case VerificationLevel.Level3Pending: return(false); case VerificationLevel.Level2: case VerificationLevel.Level3: case VerificationLevel.Legacy: return(true); default: break; } return(false); }
/// <summary> /// Initializes a new instance of the IEnumerable_T_Test. /// </summary> /// <param name="collection">The collection to run the tests on.</param> /// <param name="items"></param> /// <param name="modifyCollection"></param> public IEnumerable_T_Test(Test test, IEnumerable <T> collection, T[] items, ModifyUnderlyingCollection_T <T> modifyCollection) { m_test = test; _collection = collection; _modifyCollection = modifyCollection; _verificationLevel = VerificationLevel.Extensive; _collectionOrder = CollectionOrder.Sequential; _converter = null; _isResetNotSupported = false; _moveNextAtEndThrowsOnModifiedCollection = true; if (items == null) { _items = new T[0]; } else { _items = items; } _comparer = EqualityComparer <T> .Default; }
public void VerifyConsistency(IColumn column, VerificationLevel level, ExecutionDetails details) { if (_words.Count > WordCountLimit) { details.AddError(ExecutionDetails.WordIndexBlockTooFull, column.Name, _words.Count); } if (_words.Count != _sets.Count) { details.AddError(ExecutionDetails.WordIndexBlockSizesMismatch, column.Name, _words.Count, _sets.Count); } if (level == VerificationLevel.Full) { // Validate that all IDs in all sets are valid // NOTE: Replacing with a validating GetInSet would be more thorough; check for duplicate values, padding problems, etc. ShortSet allValidItems = new ShortSet(column.Count); allValidItems.Not(); ShortSet items = new ShortSet(ushort.MaxValue); for (ushort i = 0; i < _words.Count; ++i) { items.Clear(); GetInSet(i, items); items.AndNot(allValidItems); if (items.Count() > 0) { details.AddError(ExecutionDetails.WordIndexInvalidItemID, column.Name, _words[i], String.Join(", ", items.Values)); } } } // Ask the Sets and Words columns to self-verify _sets.VerifyConsistency(level, details); _words.VerifyConsistency(level, details); }
private decimal VerificationLimit(VerificationLevel level) { switch (level) { case VerificationLevel.Legacy: return(0); case VerificationLevel.Level1: case VerificationLevel.Level1Pending: case VerificationLevel.Level2Pending: case VerificationLevel.Level3Pending: return(Constant.VERIFICATION_WITHDRAW_LEVEL1_LIMIT); case VerificationLevel.Level2: return(Constant.VERIFICATION_WITHDRAW_LEVEL2_LIMIT); case VerificationLevel.Level3: return(Constant.VERIFICATION_WITHDRAW_LEVEL3_LIMIT); default: break; } return(0); }
public Task <RestGuild> CreateGuildAsync(string name, string voiceRegionId = null, LocalAttachment icon = null, VerificationLevel verificationLevel = VerificationLevel.None, DefaultNotificationLevel defaultNotificationLevel = DefaultNotificationLevel.AllMessages, ContentFilterLevel contentFilterLevel = ContentFilterLevel.Disabled, RestRequestOptions options = null) => ((IRestDiscordClient)this.RestClient).CreateGuildAsync(name, voiceRegionId, icon, verificationLevel, defaultNotificationLevel, contentFilterLevel, options);
private bool VerifyCollection(ICollection collection, Object[] items, VerificationLevel verificationLevel) { return VerifyCollection(collection, items, 0, items.Length, verificationLevel); }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { this.StartAddressColumn.VerifyConsistency(level, details); this.EndAddressColumn.VerifyConsistency(level, details); }
public VerifyEmailAttribute(VerificationLevel level) { VerificationLevel = level; }
public override void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { base.VerifyConsistency(level, details); // Verify SortedIDCount agrees with ItemCount if (this.SortedIDCount != this.Count) { if (details != null) { details.AddError(ExecutionDetails.ColumnDoesNotHaveEnoughValues, this.Name, this.SortedIDCount, this.Count); } } // Verify that all IDs are in SortedIDs, all values are ordered, and no unexpected values are found ushort lastID = 0; IComparable lastValue = null; ShortSet idsInList = new ShortSet(this.Count); for (int i = 0; i < this.Count; ++i) { ushort id = this.SortedIDs[i]; if (id >= this.Count) { if (details != null) { details.AddError(ExecutionDetails.SortedIdOutOfRange, this.Name, id, this.Count); } } else if (idsInList.Contains(id)) { if (details != null) { details.AddError(ExecutionDetails.SortedIdAppearsMoreThanOnce, this.Name, id); } } else { idsInList.Add(id); IComparable value = (IComparable)this[id]; if (lastValue != null) { int compareResult = lastValue.CompareTo(value); if (compareResult > 0) { if (details != null) { details.AddError(ExecutionDetails.SortedValuesNotInOrder, this.Name, lastID, lastValue, id, value); } } } lastValue = value; lastID = id; } } idsInList.Not(); if (idsInList.Count() > 0) { if (details != null) { details.AddError(ExecutionDetails.SortedColumnMissingIDs, this.Name, String.Join(", ", idsInList.Values)); } } }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { // Nothing to check }
public virtual void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { this.Column.VerifyConsistency(level, details); }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { }
private bool VerifyItems(Object[] actualItems, Object[] expectedItems, VerificationLevel verificationLevel) { if (verificationLevel <= _verificationLevel) { if (!Test.Eval(expectedItems.Length, actualItems.Length, "The length of the items")) { return false; } for (int i = 0; i < expectedItems.Length; i++) { if (!Test.Eval(_comparer.Equals(actualItems[i], expectedItems[i]), "The actual item and expected items differ at {0} actual={1} expected={2}", i, actualItems[i], expectedItems[i])) { return false; } } return true; } return true; }
private bool VerifyItems(Array actualItems, Array expectedItems, VerificationLevel verificationLevel) { if (verificationLevel <= _verificationLevel) { if (!Test.Eval(expectedItems.Length, actualItems.Length, "The length of the items")) { return false; } int actualItemsLowerBounds = actualItems.GetLowerBound(0); int expectedItemsLowerBounds = expectedItems.GetLowerBound(0); for (int i = 0; i < expectedItems.Length; i++) { if (!Test.Eval(_comparer.Equals(actualItems.GetValue(i + actualItemsLowerBounds), expectedItems.GetValue(i + expectedItemsLowerBounds)), "The actual item and expected items differ at {0} actual={1} expected={2}", i, actualItems.GetValue(i + actualItemsLowerBounds), expectedItems.GetValue(i + expectedItemsLowerBounds))) { return false; } } return true; } return true; }
private bool VerifyCollection(ICollection collection, Object[] items, int index, int count, VerificationLevel verificationLevel) { bool retValue = true; if (verificationLevel <= _verificationLevel) { retValue &= Verify_Count(collection, items, index, count); retValue &= Verify_CopyTo(collection, items, index, count); retValue &= base.VerifyCollection(collection, items, index, count); } return retValue; }
public void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { _column.VerifyConsistency(level, details); }
private bool VerifyCollection(ICollection collection, Object[] items, VerificationLevel verificationLevel) { return(VerifyCollection(collection, items, 0, items.Length, verificationLevel)); }
public override void VerifyConsistency(VerificationLevel level, ExecutionDetails details) { base.VerifyConsistency(level, details); _index.VerifyConsistency(this, level, details); }
private bool VerifyCollection(ICollection collection, Object[] items, int index, int count, VerificationLevel verificationLevel) { bool retValue = true; if (verificationLevel <= _verificationLevel) { retValue &= Verify_Count(collection, items, index, count); retValue &= Verify_CopyTo(collection, items, index, count); retValue &= base.VerifyCollection(collection, items, index, count); } return(retValue); }