public override void Validate(T item)
 {
     ArgumentNullException.ThrowIfNull(item);
 }
Exemple #2
0
 public GotoExpressionProxy(GotoExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
Exemple #3
0
 public InvocationExpressionProxy(InvocationExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
Exemple #4
0
        public override int GetHashCode(string obj)
        {
            ArgumentNullException.ThrowIfNull(obj);

            return(_compareInfo.GetHashCode(obj, _options));
        }
    /// <summary>
    /// Updates the localized gamestrings to the selected <see cref="Localization"/>.
    /// </summary>
    /// <param name="boost">The data to be updated.</param>
    /// <param name="gameStringDocument">Instance of a <see cref="GameStringDocument"/>.</param>
    /// <exception cref="ArgumentNullException"><paramref name="gameStringDocument"/> is null.</exception>
    public static void UpdateGameStrings(this Boost boost, GameStringDocument gameStringDocument)
    {
        ArgumentNullException.ThrowIfNull(gameStringDocument, nameof(gameStringDocument));

        gameStringDocument.UpdateGameStrings(boost);
    }
Exemple #6
0
    /// <inheritdoc/>
    static void IEndpointMetadataProvider.PopulateMetadata(EndpointMetadataContext context)
    {
        ArgumentNullException.ThrowIfNull(context);

        context.EndpointMetadata.Add(new ProducesResponseTypeMetadata(typeof(TValue), StatusCodes.Status202Accepted, "application/json"));
    }
Exemple #7
0
        private Dictionary <LazyMemberInfo, MemberInfo[]> BuildMembersTable(List <LazyMemberInfo> members)
        {
            ArgumentNullException.ThrowIfNull(members);

            Dictionary <LazyMemberInfo, MemberInfo[]> membersTable = new Dictionary <LazyMemberInfo, MemberInfo[]>();
            Dictionary <int, MemberInfo> specializedPartMembers    = new Dictionary <int, MemberInfo>();

            Type closedGenericPartType = GetPartType();

            specializedPartMembers[closedGenericPartType.MetadataToken] = closedGenericPartType;
            foreach (MethodInfo method in closedGenericPartType.GetAllMethods())
            {
                specializedPartMembers[method.MetadataToken] = method;
            }

            foreach (FieldInfo field in closedGenericPartType.GetAllFields())
            {
                specializedPartMembers[field.MetadataToken] = field;
            }

            foreach (var iface in closedGenericPartType.GetInterfaces())
            {
                specializedPartMembers[iface.MetadataToken] = iface;
            }

            foreach (var type in closedGenericPartType.GetNestedTypes())
            {
                specializedPartMembers[type.MetadataToken] = type;
            }

            //Walk the base class list
            var baseType = closedGenericPartType.BaseType;

            while (baseType != null && baseType != typeof(object))
            {
                specializedPartMembers[baseType.MetadataToken] = baseType;
                baseType = baseType.BaseType;
            }

            //
            // Now go through the members table and resolve them into the new closed type based on the tokens
            //
            foreach (LazyMemberInfo lazyMemberInfo in members)
            {
                MemberInfo[] genericAccessors = lazyMemberInfo.GetAccessors();
                MemberInfo[] accessors        = new MemberInfo[genericAccessors.Length];

                for (int i = 0; i < genericAccessors.Length; i++)
                {
                    if (genericAccessors[i] != null)
                    {
                        specializedPartMembers.TryGetValue(genericAccessors[i].MetadataToken, out accessors[i] !);
                        if (accessors[i] == null)
                        {
                            throw new Exception(SR.Diagnostic_InternalExceptionMessage);
                        }
                    }
                }

                membersTable[lazyMemberInfo] = accessors;
            }

            return(membersTable);
        }
    /// <summary>
    /// Updates the localized gamestrings to the selected <see cref="Localization"/>.
    /// </summary>
    /// <param name="spray">The data to be updated.</param>
    /// <param name="gameStringDocument">Instance of a <see cref="GameStringDocument"/>.</param>
    /// <exception cref="ArgumentNullException"><paramref name="gameStringDocument"/> is null.</exception>
    public static void UpdateGameStrings(this Spray spray, GameStringDocument gameStringDocument)
    {
        ArgumentNullException.ThrowIfNull(gameStringDocument, nameof(gameStringDocument));

        gameStringDocument.UpdateGameStrings(spray);
    }
Exemple #9
0
 public UpdaterStartup(ISerializer serializer)
 {
     ArgumentNullException.ThrowIfNull(serializer);
     _serializer = serializer;
 }
    public void LogGenericException(Exception exception, [CallerMemberName] string?previousMethodName = null)
    {
        ArgumentNullException.ThrowIfNull(exception);

        Logger.Error(exception, $"{previousMethodName}()");
    }
 public ServerObjectCollectionNode(ServerNode serverNode)
 {
     ArgumentNullException.ThrowIfNull(serverNode);
     _server = serverNode;
 }
Exemple #12
0
        public unsafe DCMapping(Gdi32.HDC hdc, Rectangle bounds)
        {
            ArgumentNullException.ThrowIfNull(hdc);

            _hdc        = hdc;
            _savedState = Gdi32.SaveDC(hdc);

            // Retrieve the x-coordinates and y-coordinates of the viewport origin for the specified device context.
            bool success = Gdi32.GetViewportOrgEx(hdc, out Point viewportOrg).IsTrue();

            Debug.Assert(success, "GetViewportOrgEx() failed.");

            // Create a new rectangular clipping region based off of the bounds specified, shifted over by the x & y specified in the viewport origin.
            var hClippingRegion = new Gdi32.RegionScope(
                viewportOrg.X + bounds.Left,
                viewportOrg.Y + bounds.Top,
                viewportOrg.X + bounds.Right,
                viewportOrg.Y + bounds.Bottom);

            Debug.Assert(!hClippingRegion.IsNull, "CreateRectRgn() failed.");

            try
            {
                var hOriginalClippingRegion = new Gdi32.RegionScope(hdc);

                // Shift the viewpoint origin by coordinates specified in "bounds".
                var lastViewPort = new Point();
                success = Gdi32.SetViewportOrgEx(
                    hdc,
                    viewportOrg.X + bounds.Left,
                    viewportOrg.Y + bounds.Top,
                    &lastViewPort).IsTrue();
                Debug.Assert(success, "SetViewportOrgEx() failed.");

                RegionType originalRegionType;
                if (!hOriginalClippingRegion.IsNull)
                {
                    // Get the original clipping region so we can determine its type (we'll check later if we've restored the region back properly.)
                    RECT originalClipRect = new RECT();
                    originalRegionType = Gdi32.GetRgnBox(hOriginalClippingRegion, ref originalClipRect);
                    Debug.Assert(
                        originalRegionType != RegionType.ERROR,
                        "ERROR returned from SelectClipRgn while selecting the original clipping region..");

                    if (originalRegionType == RegionType.SIMPLEREGION)
                    {
                        // Find the intersection of our clipping region and the current clipping region (our parent's)

                        RegionType combineResult = Gdi32.CombineRgn(
                            hClippingRegion,
                            hClippingRegion,
                            hOriginalClippingRegion,
                            Gdi32.RGN.AND);

                        Debug.Assert(
                            (combineResult == RegionType.SIMPLEREGION) || (combineResult == RegionType.NULLREGION),
                            "SIMPLEREGION or NULLREGION expected.");
                    }
                }
                else
                {
                    // If there was no clipping region, then the result is a simple region.
                    originalRegionType = RegionType.SIMPLEREGION;
                }

                // Select the new clipping region; make sure it's a SIMPLEREGION or NULLREGION
                RegionType selectResult = Gdi32.SelectClipRgn(hdc, hClippingRegion);
                Debug.Assert(
                    selectResult == RegionType.SIMPLEREGION || selectResult == RegionType.NULLREGION,
                    "SIMPLEREGION or NULLLREGION expected.");
            }
            catch (Exception ex) when(!ClientUtils.IsCriticalException(ex))
            {
            }
        }
Exemple #13
0
        /// <summary>
        /// Returns an enumerable collection of annotations of the specified type
        /// for this <see cref="XObject"/>.
        /// </summary>
        /// <param name="type">The type of the annotations to retrieve.</param>
        /// <returns>An enumerable collection of annotations for this XObject.</returns>
        public IEnumerable <object> Annotations(Type type)
        {
            ArgumentNullException.ThrowIfNull(type);

            return(AnnotationsIterator(type));
        }
        /// <summary>
        /// Describes how to clear the repository configuration or the specified repository from tenant
        /// properties in form suitable for passing as the <c>propertiesToRemove</c> argument to
        /// <see cref="ITenantStore.UpdateTenantAsync(string, string?, IEnumerable{KeyValuePair{string, object}}?, IEnumerable{string}?)"/>.
        /// </summary>
        /// <param name="definition">The definition of the repository for which to remove the configuration.</param>
        /// <returns>
        /// A single-entry list of properties that can be passed to
        /// <see cref="ITenantStore.UpdateTenantAsync(string, string?, IEnumerable{KeyValuePair{string, object}}?, IEnumerable{string}?)"/>
        /// to remove the storage configuration.
        /// </returns>
        public static IEnumerable <string> RemoveBlobStorageConfiguration(this BlobStorageContainerDefinition definition)
        {
            ArgumentNullException.ThrowIfNull(definition);

            return(new string[] { GetConfigurationKey(definition) });
        }
Exemple #15
0
            public StackDebugView(Stack stack)
            {
                ArgumentNullException.ThrowIfNull(stack);

                _stack = stack;
            }
Exemple #16
0
        /// <summary>
        /// Gets an <see cref="XNamespace"/> created from the specified namespace name.
        /// </summary>
        /// <remarks>
        /// The returned <see cref="XNamespace"/> object is guaranteed to be atomic
        /// (i.e. the only one in the system for that particular namespace name).
        /// </remarks>
        public static XNamespace Get(string namespaceName)
        {
            ArgumentNullException.ThrowIfNull(namespaceName);

            return(Get(namespaceName, 0, namespaceName.Length));
        }
Exemple #17
0
        public QueueDebugView(Queue <T> queue)
        {
            ArgumentNullException.ThrowIfNull(queue);

            _queue = queue;
        }
Exemple #18
0
        /// <summary>
        /// Combines an <see cref="XNamespace"/> object with a local name to create an <see cref="XName"/>.
        /// </summary>
        /// <param name="ns">The namespace for the expanded name.</param>
        /// <param name="localName">The local name for the expanded name.</param>
        /// <returns>The new XName constructed from the namespace and local name.</returns>
        public static XName operator +(XNamespace ns, string localName)
        {
            ArgumentNullException.ThrowIfNull(ns);

            return(ns.GetName(localName));
        }
Exemple #19
0
    public static IEnumerable <IEnumerable <T> > Permutations <T>(this IEnumerable <T> source)
    {
        ArgumentNullException.ThrowIfNull(source);

        return(PermutationsImpl(source));
Exemple #20
0
        /// <summary>
        /// Returns an <see cref="XName"/> object created from the current instance and the specified local name.
        /// </summary>
        /// <remarks>
        /// The returned <see cref="XName"/> object is guaranteed to be atomic (i.e. the only one in the system for this
        /// particular expanded name).
        /// </remarks>
        public XName GetName(string localName)
        {
            ArgumentNullException.ThrowIfNull(localName);

            return(GetName(localName, 0, localName.Length));
        }
Exemple #21
0
        public void DumpMissingHashes()
        {
            ArgumentNullException.ThrowIfNull(s_bm);

            var parsers      = _host.Services.GetRequiredService <Red4ParserService>();
            var _hashService = _host.Services.GetRequiredService <IHashService>();

            var resultDir = Path.Combine(Environment.CurrentDirectory, s_testResultsDirectory);

            Directory.CreateDirectory(resultDir);

            // load new hashes
            var newHashesPath = Path.Combine(s_testResultsDirectory, "new_hashes.txt");
            var newHashes     = new Dictionary <ulong, string>();

            if (File.Exists(newHashesPath))
            {
                var lines = File.ReadAllLines(newHashesPath);
                foreach (var line in lines)
                {
                    var hash = FNV1A64HashAlgorithm.HashString(line);
                    if (!_hashService.Contains(hash))
                    {
                        if (!newHashes.ContainsKey(hash))
                        {
                            newHashes.Add(hash, line);
                        }
                    }
                }
                Console.WriteLine($"Loaded {newHashes.Count} new hashes from {newHashesPath}");
            }

            {
                List <ulong> newAdded     = new();
                List <ulong> used         = new();
                List <ulong> missing      = new();
                var          info_missing = new Dictionary <string, List <ulong> >();

                var archives = s_bm.Archives.KeyValues.Select(_ => _.Value).ToList();

                for (var i = 0; i < archives.Count; i++)
                {
                    var ar     = archives[i];
                    var hashes = new List <ulong>();
                    info_missing.Add(ar.Name, new List <ulong>());

                    foreach (var(hash, fileInfoEntry) in ar.Files)
                    {
                        if (hash == 6507781686736237035)
                        {
                        }

                        hashes.Add(hash);
                        if (fileInfoEntry is FileEntry fe && fe.NameOrHash == hash.ToString())
                        {
                            if (newHashes.ContainsKey(hash))
                            {
                                used.Add(hash);
                                newAdded.Add(hash);
                            }
                            else
                            {
                                missing.Add(hash);
                                info_missing[ar.Name].Add(hash);
                            }
                        }
        /// <summary>
        /// Create a serializer that uses the JSON.net serializer.
        /// </summary>
        /// <param name="jsonSerializerSettings">The Json serializer settings.</param>
        /// <remarks>
        /// This is internal to reduce exposure of JSON.net types so
        /// it is easier to convert to System.Text.Json.
        /// </remarks>
        internal CorvusJsonDotNetCosmosSerializer(JsonSerializerSettings jsonSerializerSettings)
        {
            ArgumentNullException.ThrowIfNull(jsonSerializerSettings);

            this.serializer = JsonSerializer.Create(jsonSerializerSettings);
        }
Exemple #23
0
        // Helper to return AssemblyName corresponding to the path of an IL assembly
        public static AssemblyName GetAssemblyName(string assemblyPath)
        {
            ArgumentNullException.ThrowIfNull(assemblyPath);

            return(AssemblyName.GetAssemblyName(assemblyPath));
        }
Exemple #24
0
    public LoggedDbConnection(IDbConnection connection)
    {
        ArgumentNullException.ThrowIfNull(connection);

        _connection = connection;
    }
Exemple #25
0
 public DefaultExpressionProxy(DefaultExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
        public ReflectionComposablePartDefinition(IReflectionPartCreationInfo creationInfo)
        {
            ArgumentNullException.ThrowIfNull(creationInfo);

            _creationInfo = creationInfo;
        }
Exemple #27
0
 public BinaryExpressionProxy(BinaryExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
Exemple #28
0
        // Returns a synchronized Stack.
        //
        public static Stack Synchronized(Stack stack)
        {
            ArgumentNullException.ThrowIfNull(stack);

            return(new SyncStack(stack));
        }
Exemple #29
0
 public LambdaExpressionProxy(LambdaExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
Exemple #30
0
 /// <summary>
 ///     Throws an ArgumentException of the validation context is null
 /// </summary>
 /// <param name="validationContext">The context to check</param>
 private static void EnsureValidationContext(ValidationContext validationContext)
 {
     ArgumentNullException.ThrowIfNull(validationContext);
 }