content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the workspaces-2015-04-08.normal.json service model. */ using System; using System.Collections.Generic; using Amazon.Runtime; using Amazon.WorkSpaces.Model; namespace Amazon.WorkSpaces { /// <summary> /// Interface for accessing WorkSpaces /// /// Amazon WorkSpaces Service /// <para> /// Amazon WorkSpaces enables you to provision virtual, cloud-based Microsoft Windows /// and Amazon Linux desktops for your users. /// </para> /// </summary> public partial interface IAmazonWorkSpaces : IAmazonService, IDisposable { #region AssociateIpGroups /// <summary> /// Associates the specified IP access control group with the specified directory. /// </summary> /// <param name="request">Container for the necessary parameters to execute the AssociateIpGroups service method.</param> /// /// <returns>The response from the AssociateIpGroups service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AssociateIpGroups">REST API Reference for AssociateIpGroups Operation</seealso> AssociateIpGroupsResponse AssociateIpGroups(AssociateIpGroupsRequest request); /// <summary> /// Initiates the asynchronous execution of the AssociateIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateIpGroups operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndAssociateIpGroups /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AssociateIpGroups">REST API Reference for AssociateIpGroups Operation</seealso> IAsyncResult BeginAssociateIpGroups(AssociateIpGroupsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the AssociateIpGroups operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginAssociateIpGroups.</param> /// /// <returns>Returns a AssociateIpGroupsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AssociateIpGroups">REST API Reference for AssociateIpGroups Operation</seealso> AssociateIpGroupsResponse EndAssociateIpGroups(IAsyncResult asyncResult); #endregion #region AuthorizeIpRules /// <summary> /// Adds one or more rules to the specified IP access control group. /// /// /// <para> /// This action gives users permission to access their WorkSpaces from the CIDR address /// ranges specified in the rules. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AuthorizeIpRules service method.</param> /// /// <returns>The response from the AuthorizeIpRules service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AuthorizeIpRules">REST API Reference for AuthorizeIpRules Operation</seealso> AuthorizeIpRulesResponse AuthorizeIpRules(AuthorizeIpRulesRequest request); /// <summary> /// Initiates the asynchronous execution of the AuthorizeIpRules operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AuthorizeIpRules operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndAuthorizeIpRules /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AuthorizeIpRules">REST API Reference for AuthorizeIpRules Operation</seealso> IAsyncResult BeginAuthorizeIpRules(AuthorizeIpRulesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the AuthorizeIpRules operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginAuthorizeIpRules.</param> /// /// <returns>Returns a AuthorizeIpRulesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AuthorizeIpRules">REST API Reference for AuthorizeIpRules Operation</seealso> AuthorizeIpRulesResponse EndAuthorizeIpRules(IAsyncResult asyncResult); #endregion #region CopyWorkspaceImage /// <summary> /// Copies the specified image from the specified Region to the current Region. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CopyWorkspaceImage service method.</param> /// /// <returns>The response from the CopyWorkspaceImage service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceAlreadyExistsException"> /// The specified resource already exists. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CopyWorkspaceImage">REST API Reference for CopyWorkspaceImage Operation</seealso> CopyWorkspaceImageResponse CopyWorkspaceImage(CopyWorkspaceImageRequest request); /// <summary> /// Initiates the asynchronous execution of the CopyWorkspaceImage operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CopyWorkspaceImage operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCopyWorkspaceImage /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CopyWorkspaceImage">REST API Reference for CopyWorkspaceImage Operation</seealso> IAsyncResult BeginCopyWorkspaceImage(CopyWorkspaceImageRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the CopyWorkspaceImage operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginCopyWorkspaceImage.</param> /// /// <returns>Returns a CopyWorkspaceImageResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CopyWorkspaceImage">REST API Reference for CopyWorkspaceImage Operation</seealso> CopyWorkspaceImageResponse EndCopyWorkspaceImage(IAsyncResult asyncResult); #endregion #region CreateIpGroup /// <summary> /// Creates an IP access control group. /// /// /// <para> /// An IP access control group provides you with the ability to control the IP addresses /// from which users are allowed to access their WorkSpaces. To specify the CIDR address /// ranges, add rules to your IP access control group and then associate the group with /// your directory. You can add rules when you create the group or at any time using <a>AuthorizeIpRules</a>. /// </para> /// /// <para> /// There is a default IP access control group associated with your directory. If you /// don't associate an IP access control group with your directory, the default group /// is used. The default group includes a default rule that allows users to access their /// WorkSpaces from anywhere. You cannot modify the default IP access control group for /// your directory. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateIpGroup service method.</param> /// /// <returns>The response from the CreateIpGroup service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceAlreadyExistsException"> /// The specified resource already exists. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceCreationFailedException"> /// The resource could not be created. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateIpGroup">REST API Reference for CreateIpGroup Operation</seealso> CreateIpGroupResponse CreateIpGroup(CreateIpGroupRequest request); /// <summary> /// Initiates the asynchronous execution of the CreateIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIpGroup operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateIpGroup /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateIpGroup">REST API Reference for CreateIpGroup Operation</seealso> IAsyncResult BeginCreateIpGroup(CreateIpGroupRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the CreateIpGroup operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateIpGroup.</param> /// /// <returns>Returns a CreateIpGroupResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateIpGroup">REST API Reference for CreateIpGroup Operation</seealso> CreateIpGroupResponse EndCreateIpGroup(IAsyncResult asyncResult); #endregion #region CreateTags /// <summary> /// Creates the specified tags for the specified WorkSpaces resource. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateTags service method.</param> /// /// <returns>The response from the CreateTags service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateTags">REST API Reference for CreateTags Operation</seealso> CreateTagsResponse CreateTags(CreateTagsRequest request); /// <summary> /// Initiates the asynchronous execution of the CreateTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTags operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateTags /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateTags">REST API Reference for CreateTags Operation</seealso> IAsyncResult BeginCreateTags(CreateTagsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the CreateTags operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateTags.</param> /// /// <returns>Returns a CreateTagsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateTags">REST API Reference for CreateTags Operation</seealso> CreateTagsResponse EndCreateTags(IAsyncResult asyncResult); #endregion #region CreateWorkspaces /// <summary> /// Creates one or more WorkSpaces. /// /// /// <para> /// This operation is asynchronous and returns before the WorkSpaces are created. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateWorkspaces service method.</param> /// /// <returns>The response from the CreateWorkspaces service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateWorkspaces">REST API Reference for CreateWorkspaces Operation</seealso> CreateWorkspacesResponse CreateWorkspaces(CreateWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the CreateWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateWorkspaces">REST API Reference for CreateWorkspaces Operation</seealso> IAsyncResult BeginCreateWorkspaces(CreateWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the CreateWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateWorkspaces.</param> /// /// <returns>Returns a CreateWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateWorkspaces">REST API Reference for CreateWorkspaces Operation</seealso> CreateWorkspacesResponse EndCreateWorkspaces(IAsyncResult asyncResult); #endregion #region DeleteIpGroup /// <summary> /// Deletes the specified IP access control group. /// /// /// <para> /// You cannot delete an IP access control group that is associated with a directory. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteIpGroup service method.</param> /// /// <returns>The response from the DeleteIpGroup service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceAssociatedException"> /// The resource is associated with a directory. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteIpGroup">REST API Reference for DeleteIpGroup Operation</seealso> DeleteIpGroupResponse DeleteIpGroup(DeleteIpGroupRequest request); /// <summary> /// Initiates the asynchronous execution of the DeleteIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteIpGroup operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteIpGroup /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteIpGroup">REST API Reference for DeleteIpGroup Operation</seealso> IAsyncResult BeginDeleteIpGroup(DeleteIpGroupRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DeleteIpGroup operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteIpGroup.</param> /// /// <returns>Returns a DeleteIpGroupResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteIpGroup">REST API Reference for DeleteIpGroup Operation</seealso> DeleteIpGroupResponse EndDeleteIpGroup(IAsyncResult asyncResult); #endregion #region DeleteTags /// <summary> /// Deletes the specified tags from the specified WorkSpaces resource. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteTags service method.</param> /// /// <returns>The response from the DeleteTags service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteTags">REST API Reference for DeleteTags Operation</seealso> DeleteTagsResponse DeleteTags(DeleteTagsRequest request); /// <summary> /// Initiates the asynchronous execution of the DeleteTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteTags operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteTags /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteTags">REST API Reference for DeleteTags Operation</seealso> IAsyncResult BeginDeleteTags(DeleteTagsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DeleteTags operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteTags.</param> /// /// <returns>Returns a DeleteTagsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteTags">REST API Reference for DeleteTags Operation</seealso> DeleteTagsResponse EndDeleteTags(IAsyncResult asyncResult); #endregion #region DeleteWorkspaceImage /// <summary> /// Deletes the specified image from your account. To delete an image, you must first /// delete any bundles that are associated with the image and unshare the image if it /// is shared with other accounts. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteWorkspaceImage service method.</param> /// /// <returns>The response from the DeleteWorkspaceImage service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceAssociatedException"> /// The resource is associated with a directory. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteWorkspaceImage">REST API Reference for DeleteWorkspaceImage Operation</seealso> DeleteWorkspaceImageResponse DeleteWorkspaceImage(DeleteWorkspaceImageRequest request); /// <summary> /// Initiates the asynchronous execution of the DeleteWorkspaceImage operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteWorkspaceImage operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteWorkspaceImage /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteWorkspaceImage">REST API Reference for DeleteWorkspaceImage Operation</seealso> IAsyncResult BeginDeleteWorkspaceImage(DeleteWorkspaceImageRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DeleteWorkspaceImage operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteWorkspaceImage.</param> /// /// <returns>Returns a DeleteWorkspaceImageResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteWorkspaceImage">REST API Reference for DeleteWorkspaceImage Operation</seealso> DeleteWorkspaceImageResponse EndDeleteWorkspaceImage(IAsyncResult asyncResult); #endregion #region DeregisterWorkspaceDirectory /// <summary> /// Deregisters the specified directory. This operation is asynchronous and returns before /// the WorkSpace directory is deregistered. If any WorkSpaces are registered to this /// directory, you must remove them before you can deregister the directory. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeregisterWorkspaceDirectory service method.</param> /// /// <returns>The response from the DeregisterWorkspaceDirectory service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeregisterWorkspaceDirectory">REST API Reference for DeregisterWorkspaceDirectory Operation</seealso> DeregisterWorkspaceDirectoryResponse DeregisterWorkspaceDirectory(DeregisterWorkspaceDirectoryRequest request); /// <summary> /// Initiates the asynchronous execution of the DeregisterWorkspaceDirectory operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeregisterWorkspaceDirectory operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeregisterWorkspaceDirectory /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeregisterWorkspaceDirectory">REST API Reference for DeregisterWorkspaceDirectory Operation</seealso> IAsyncResult BeginDeregisterWorkspaceDirectory(DeregisterWorkspaceDirectoryRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DeregisterWorkspaceDirectory operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeregisterWorkspaceDirectory.</param> /// /// <returns>Returns a DeregisterWorkspaceDirectoryResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeregisterWorkspaceDirectory">REST API Reference for DeregisterWorkspaceDirectory Operation</seealso> DeregisterWorkspaceDirectoryResponse EndDeregisterWorkspaceDirectory(IAsyncResult asyncResult); #endregion #region DescribeAccount /// <summary> /// Retrieves a list that describes the configuration of Bring Your Own License (BYOL) /// for the specified account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccount service method.</param> /// /// <returns>The response from the DescribeAccount service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccount">REST API Reference for DescribeAccount Operation</seealso> DescribeAccountResponse DescribeAccount(DescribeAccountRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeAccount operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAccount operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeAccount /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccount">REST API Reference for DescribeAccount Operation</seealso> IAsyncResult BeginDescribeAccount(DescribeAccountRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeAccount operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeAccount.</param> /// /// <returns>Returns a DescribeAccountResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccount">REST API Reference for DescribeAccount Operation</seealso> DescribeAccountResponse EndDescribeAccount(IAsyncResult asyncResult); #endregion #region DescribeAccountModifications /// <summary> /// Retrieves a list that describes modifications to the configuration of Bring Your Own /// License (BYOL) for the specified account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccountModifications service method.</param> /// /// <returns>The response from the DescribeAccountModifications service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccountModifications">REST API Reference for DescribeAccountModifications Operation</seealso> DescribeAccountModificationsResponse DescribeAccountModifications(DescribeAccountModificationsRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeAccountModifications operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAccountModifications operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeAccountModifications /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccountModifications">REST API Reference for DescribeAccountModifications Operation</seealso> IAsyncResult BeginDescribeAccountModifications(DescribeAccountModificationsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeAccountModifications operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeAccountModifications.</param> /// /// <returns>Returns a DescribeAccountModificationsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccountModifications">REST API Reference for DescribeAccountModifications Operation</seealso> DescribeAccountModificationsResponse EndDescribeAccountModifications(IAsyncResult asyncResult); #endregion #region DescribeClientProperties /// <summary> /// Retrieves a list that describes one or more specified Amazon WorkSpaces clients. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeClientProperties service method.</param> /// /// <returns>The response from the DescribeClientProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeClientProperties">REST API Reference for DescribeClientProperties Operation</seealso> DescribeClientPropertiesResponse DescribeClientProperties(DescribeClientPropertiesRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeClientProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeClientProperties operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeClientProperties /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeClientProperties">REST API Reference for DescribeClientProperties Operation</seealso> IAsyncResult BeginDescribeClientProperties(DescribeClientPropertiesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeClientProperties operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeClientProperties.</param> /// /// <returns>Returns a DescribeClientPropertiesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeClientProperties">REST API Reference for DescribeClientProperties Operation</seealso> DescribeClientPropertiesResponse EndDescribeClientProperties(IAsyncResult asyncResult); #endregion #region DescribeIpGroups /// <summary> /// Describes one or more of your IP access control groups. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeIpGroups service method.</param> /// /// <returns>The response from the DescribeIpGroups service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeIpGroups">REST API Reference for DescribeIpGroups Operation</seealso> DescribeIpGroupsResponse DescribeIpGroups(DescribeIpGroupsRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeIpGroups operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeIpGroups /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeIpGroups">REST API Reference for DescribeIpGroups Operation</seealso> IAsyncResult BeginDescribeIpGroups(DescribeIpGroupsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeIpGroups operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeIpGroups.</param> /// /// <returns>Returns a DescribeIpGroupsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeIpGroups">REST API Reference for DescribeIpGroups Operation</seealso> DescribeIpGroupsResponse EndDescribeIpGroups(IAsyncResult asyncResult); #endregion #region DescribeTags /// <summary> /// Describes the specified tags for the specified WorkSpaces resource. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeTags service method.</param> /// /// <returns>The response from the DescribeTags service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeTags">REST API Reference for DescribeTags Operation</seealso> DescribeTagsResponse DescribeTags(DescribeTagsRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeTags operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeTags /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeTags">REST API Reference for DescribeTags Operation</seealso> IAsyncResult BeginDescribeTags(DescribeTagsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeTags operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeTags.</param> /// /// <returns>Returns a DescribeTagsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeTags">REST API Reference for DescribeTags Operation</seealso> DescribeTagsResponse EndDescribeTags(IAsyncResult asyncResult); #endregion #region DescribeWorkspaceBundles /// <summary> /// Retrieves a list that describes the available WorkSpace bundles. /// /// /// <para> /// You can filter the results using either bundle ID or owner, but not both. /// </para> /// </summary> /// /// <returns>The response from the DescribeWorkspaceBundles service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> DescribeWorkspaceBundlesResponse DescribeWorkspaceBundles(); /// <summary> /// Retrieves a list that describes the available WorkSpace bundles. /// /// /// <para> /// You can filter the results using either bundle ID or owner, but not both. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceBundles service method.</param> /// /// <returns>The response from the DescribeWorkspaceBundles service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> DescribeWorkspaceBundlesResponse DescribeWorkspaceBundles(DescribeWorkspaceBundlesRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceBundles operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceBundles operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaceBundles /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> IAsyncResult BeginDescribeWorkspaceBundles(DescribeWorkspaceBundlesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaceBundles operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaceBundles.</param> /// /// <returns>Returns a DescribeWorkspaceBundlesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> DescribeWorkspaceBundlesResponse EndDescribeWorkspaceBundles(IAsyncResult asyncResult); #endregion #region DescribeWorkspaceDirectories /// <summary> /// Describes the available directories that are registered with Amazon WorkSpaces. /// </summary> /// /// <returns>The response from the DescribeWorkspaceDirectories service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> DescribeWorkspaceDirectoriesResponse DescribeWorkspaceDirectories(); /// <summary> /// Describes the available directories that are registered with Amazon WorkSpaces. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceDirectories service method.</param> /// /// <returns>The response from the DescribeWorkspaceDirectories service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> DescribeWorkspaceDirectoriesResponse DescribeWorkspaceDirectories(DescribeWorkspaceDirectoriesRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceDirectories operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceDirectories operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaceDirectories /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> IAsyncResult BeginDescribeWorkspaceDirectories(DescribeWorkspaceDirectoriesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaceDirectories operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaceDirectories.</param> /// /// <returns>Returns a DescribeWorkspaceDirectoriesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> DescribeWorkspaceDirectoriesResponse EndDescribeWorkspaceDirectories(IAsyncResult asyncResult); #endregion #region DescribeWorkspaceImagePermissions /// <summary> /// Describes the permissions that the owner of an image has granted to other AWS accounts /// for an image. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceImagePermissions service method.</param> /// /// <returns>The response from the DescribeWorkspaceImagePermissions service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImagePermissions">REST API Reference for DescribeWorkspaceImagePermissions Operation</seealso> DescribeWorkspaceImagePermissionsResponse DescribeWorkspaceImagePermissions(DescribeWorkspaceImagePermissionsRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceImagePermissions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceImagePermissions operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaceImagePermissions /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImagePermissions">REST API Reference for DescribeWorkspaceImagePermissions Operation</seealso> IAsyncResult BeginDescribeWorkspaceImagePermissions(DescribeWorkspaceImagePermissionsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaceImagePermissions operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaceImagePermissions.</param> /// /// <returns>Returns a DescribeWorkspaceImagePermissionsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImagePermissions">REST API Reference for DescribeWorkspaceImagePermissions Operation</seealso> DescribeWorkspaceImagePermissionsResponse EndDescribeWorkspaceImagePermissions(IAsyncResult asyncResult); #endregion #region DescribeWorkspaceImages /// <summary> /// Retrieves a list that describes one or more specified images, if the image identifiers /// are provided. Otherwise, all images in the account are described. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceImages service method.</param> /// /// <returns>The response from the DescribeWorkspaceImages service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImages">REST API Reference for DescribeWorkspaceImages Operation</seealso> DescribeWorkspaceImagesResponse DescribeWorkspaceImages(DescribeWorkspaceImagesRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceImages operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceImages operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaceImages /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImages">REST API Reference for DescribeWorkspaceImages Operation</seealso> IAsyncResult BeginDescribeWorkspaceImages(DescribeWorkspaceImagesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaceImages operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaceImages.</param> /// /// <returns>Returns a DescribeWorkspaceImagesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImages">REST API Reference for DescribeWorkspaceImages Operation</seealso> DescribeWorkspaceImagesResponse EndDescribeWorkspaceImages(IAsyncResult asyncResult); #endregion #region DescribeWorkspaces /// <summary> /// Describes the specified WorkSpaces. /// /// /// <para> /// You can filter the results by using the bundle identifier, directory identifier, or /// owner, but you can specify only one filter at a time. /// </para> /// </summary> /// /// <returns>The response from the DescribeWorkspaces service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> DescribeWorkspacesResponse DescribeWorkspaces(); /// <summary> /// Describes the specified WorkSpaces. /// /// /// <para> /// You can filter the results by using the bundle identifier, directory identifier, or /// owner, but you can specify only one filter at a time. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaces service method.</param> /// /// <returns>The response from the DescribeWorkspaces service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> DescribeWorkspacesResponse DescribeWorkspaces(DescribeWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> IAsyncResult BeginDescribeWorkspaces(DescribeWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaces.</param> /// /// <returns>Returns a DescribeWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> DescribeWorkspacesResponse EndDescribeWorkspaces(IAsyncResult asyncResult); #endregion #region DescribeWorkspacesConnectionStatus /// <summary> /// Describes the connection status of the specified WorkSpaces. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspacesConnectionStatus service method.</param> /// /// <returns>The response from the DescribeWorkspacesConnectionStatus service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspacesConnectionStatus">REST API Reference for DescribeWorkspacesConnectionStatus Operation</seealso> DescribeWorkspacesConnectionStatusResponse DescribeWorkspacesConnectionStatus(DescribeWorkspacesConnectionStatusRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspacesConnectionStatus operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspacesConnectionStatus operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspacesConnectionStatus /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspacesConnectionStatus">REST API Reference for DescribeWorkspacesConnectionStatus Operation</seealso> IAsyncResult BeginDescribeWorkspacesConnectionStatus(DescribeWorkspacesConnectionStatusRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspacesConnectionStatus operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspacesConnectionStatus.</param> /// /// <returns>Returns a DescribeWorkspacesConnectionStatusResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspacesConnectionStatus">REST API Reference for DescribeWorkspacesConnectionStatus Operation</seealso> DescribeWorkspacesConnectionStatusResponse EndDescribeWorkspacesConnectionStatus(IAsyncResult asyncResult); #endregion #region DescribeWorkspaceSnapshots /// <summary> /// Describes the snapshots for the specified WorkSpace. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceSnapshots service method.</param> /// /// <returns>The response from the DescribeWorkspaceSnapshots service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceSnapshots">REST API Reference for DescribeWorkspaceSnapshots Operation</seealso> DescribeWorkspaceSnapshotsResponse DescribeWorkspaceSnapshots(DescribeWorkspaceSnapshotsRequest request); /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceSnapshots operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceSnapshots operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeWorkspaceSnapshots /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceSnapshots">REST API Reference for DescribeWorkspaceSnapshots Operation</seealso> IAsyncResult BeginDescribeWorkspaceSnapshots(DescribeWorkspaceSnapshotsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DescribeWorkspaceSnapshots operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeWorkspaceSnapshots.</param> /// /// <returns>Returns a DescribeWorkspaceSnapshotsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceSnapshots">REST API Reference for DescribeWorkspaceSnapshots Operation</seealso> DescribeWorkspaceSnapshotsResponse EndDescribeWorkspaceSnapshots(IAsyncResult asyncResult); #endregion #region DisassociateIpGroups /// <summary> /// Disassociates the specified IP access control group from the specified directory. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DisassociateIpGroups service method.</param> /// /// <returns>The response from the DisassociateIpGroups service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DisassociateIpGroups">REST API Reference for DisassociateIpGroups Operation</seealso> DisassociateIpGroupsResponse DisassociateIpGroups(DisassociateIpGroupsRequest request); /// <summary> /// Initiates the asynchronous execution of the DisassociateIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DisassociateIpGroups operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDisassociateIpGroups /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DisassociateIpGroups">REST API Reference for DisassociateIpGroups Operation</seealso> IAsyncResult BeginDisassociateIpGroups(DisassociateIpGroupsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the DisassociateIpGroups operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginDisassociateIpGroups.</param> /// /// <returns>Returns a DisassociateIpGroupsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DisassociateIpGroups">REST API Reference for DisassociateIpGroups Operation</seealso> DisassociateIpGroupsResponse EndDisassociateIpGroups(IAsyncResult asyncResult); #endregion #region ImportWorkspaceImage /// <summary> /// Imports the specified Windows 7 or Windows 10 Bring Your Own License (BYOL) image /// into Amazon WorkSpaces. The image must be an already licensed EC2 image that is in /// your AWS account, and you must own the image. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ImportWorkspaceImage service method.</param> /// /// <returns>The response from the ImportWorkspaceImage service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceAlreadyExistsException"> /// The specified resource already exists. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ImportWorkspaceImage">REST API Reference for ImportWorkspaceImage Operation</seealso> ImportWorkspaceImageResponse ImportWorkspaceImage(ImportWorkspaceImageRequest request); /// <summary> /// Initiates the asynchronous execution of the ImportWorkspaceImage operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ImportWorkspaceImage operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndImportWorkspaceImage /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ImportWorkspaceImage">REST API Reference for ImportWorkspaceImage Operation</seealso> IAsyncResult BeginImportWorkspaceImage(ImportWorkspaceImageRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ImportWorkspaceImage operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginImportWorkspaceImage.</param> /// /// <returns>Returns a ImportWorkspaceImageResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ImportWorkspaceImage">REST API Reference for ImportWorkspaceImage Operation</seealso> ImportWorkspaceImageResponse EndImportWorkspaceImage(IAsyncResult asyncResult); #endregion #region ListAvailableManagementCidrRanges /// <summary> /// Retrieves a list of IP address ranges, specified as IPv4 CIDR blocks, that you can /// use for the network management interface when you enable Bring Your Own License (BYOL). /// /// /// /// <para> /// The management network interface is connected to a secure Amazon WorkSpaces management /// network. It is used for interactive streaming of the WorkSpace desktop to Amazon WorkSpaces /// clients, and to allow Amazon WorkSpaces to manage the WorkSpace. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListAvailableManagementCidrRanges service method.</param> /// /// <returns>The response from the ListAvailableManagementCidrRanges service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ListAvailableManagementCidrRanges">REST API Reference for ListAvailableManagementCidrRanges Operation</seealso> ListAvailableManagementCidrRangesResponse ListAvailableManagementCidrRanges(ListAvailableManagementCidrRangesRequest request); /// <summary> /// Initiates the asynchronous execution of the ListAvailableManagementCidrRanges operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListAvailableManagementCidrRanges operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListAvailableManagementCidrRanges /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ListAvailableManagementCidrRanges">REST API Reference for ListAvailableManagementCidrRanges Operation</seealso> IAsyncResult BeginListAvailableManagementCidrRanges(ListAvailableManagementCidrRangesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ListAvailableManagementCidrRanges operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginListAvailableManagementCidrRanges.</param> /// /// <returns>Returns a ListAvailableManagementCidrRangesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ListAvailableManagementCidrRanges">REST API Reference for ListAvailableManagementCidrRanges Operation</seealso> ListAvailableManagementCidrRangesResponse EndListAvailableManagementCidrRanges(IAsyncResult asyncResult); #endregion #region MigrateWorkspace /// <summary> /// Migrates a WorkSpace from one operating system or bundle type to another, while retaining /// the data on the user volume. /// /// /// <para> /// The migration process recreates the WorkSpace by using a new root volume from the /// target bundle image and the user volume from the last available snapshot of the original /// WorkSpace. During migration, the original <code>D:\Users\%USERNAME%</code> user profile /// folder is renamed to <code>D:\Users\%USERNAME%MMddyyTHHmmss%.NotMigrated</code>. A /// new <code>D:\Users\%USERNAME%\</code> folder is generated by the new OS. Certain files /// in the old user profile are moved to the new user profile. /// </para> /// /// <para> /// For available migration scenarios, details about what happens during migration, and /// best practices, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/migrate-workspaces.html">Migrate /// a WorkSpace</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the MigrateWorkspace service method.</param> /// /// <returns>The response from the MigrateWorkspace service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationInProgressException"> /// The properties of this WorkSpace are currently being modified. Try again in a moment. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/MigrateWorkspace">REST API Reference for MigrateWorkspace Operation</seealso> MigrateWorkspaceResponse MigrateWorkspace(MigrateWorkspaceRequest request); /// <summary> /// Initiates the asynchronous execution of the MigrateWorkspace operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the MigrateWorkspace operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndMigrateWorkspace /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/MigrateWorkspace">REST API Reference for MigrateWorkspace Operation</seealso> IAsyncResult BeginMigrateWorkspace(MigrateWorkspaceRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the MigrateWorkspace operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginMigrateWorkspace.</param> /// /// <returns>Returns a MigrateWorkspaceResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/MigrateWorkspace">REST API Reference for MigrateWorkspace Operation</seealso> MigrateWorkspaceResponse EndMigrateWorkspace(IAsyncResult asyncResult); #endregion #region ModifyAccount /// <summary> /// Modifies the configuration of Bring Your Own License (BYOL) for the specified account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyAccount service method.</param> /// /// <returns>The response from the ModifyAccount service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyAccount">REST API Reference for ModifyAccount Operation</seealso> ModifyAccountResponse ModifyAccount(ModifyAccountRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyAccount operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyAccount operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyAccount /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyAccount">REST API Reference for ModifyAccount Operation</seealso> IAsyncResult BeginModifyAccount(ModifyAccountRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyAccount operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyAccount.</param> /// /// <returns>Returns a ModifyAccountResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyAccount">REST API Reference for ModifyAccount Operation</seealso> ModifyAccountResponse EndModifyAccount(IAsyncResult asyncResult); #endregion #region ModifyClientProperties /// <summary> /// Modifies the properties of the specified Amazon WorkSpaces clients. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyClientProperties service method.</param> /// /// <returns>The response from the ModifyClientProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyClientProperties">REST API Reference for ModifyClientProperties Operation</seealso> ModifyClientPropertiesResponse ModifyClientProperties(ModifyClientPropertiesRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyClientProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyClientProperties operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyClientProperties /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyClientProperties">REST API Reference for ModifyClientProperties Operation</seealso> IAsyncResult BeginModifyClientProperties(ModifyClientPropertiesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyClientProperties operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyClientProperties.</param> /// /// <returns>Returns a ModifyClientPropertiesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyClientProperties">REST API Reference for ModifyClientProperties Operation</seealso> ModifyClientPropertiesResponse EndModifyClientProperties(IAsyncResult asyncResult); #endregion #region ModifySelfservicePermissions /// <summary> /// Modifies the self-service WorkSpace management capabilities for your users. For more /// information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/enable-user-self-service-workspace-management.html">Enable /// Self-Service WorkSpace Management Capabilities for Your Users</a>. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifySelfservicePermissions service method.</param> /// /// <returns>The response from the ModifySelfservicePermissions service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifySelfservicePermissions">REST API Reference for ModifySelfservicePermissions Operation</seealso> ModifySelfservicePermissionsResponse ModifySelfservicePermissions(ModifySelfservicePermissionsRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifySelfservicePermissions operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifySelfservicePermissions operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifySelfservicePermissions /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifySelfservicePermissions">REST API Reference for ModifySelfservicePermissions Operation</seealso> IAsyncResult BeginModifySelfservicePermissions(ModifySelfservicePermissionsRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifySelfservicePermissions operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifySelfservicePermissions.</param> /// /// <returns>Returns a ModifySelfservicePermissionsResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifySelfservicePermissions">REST API Reference for ModifySelfservicePermissions Operation</seealso> ModifySelfservicePermissionsResponse EndModifySelfservicePermissions(IAsyncResult asyncResult); #endregion #region ModifyWorkspaceAccessProperties /// <summary> /// Specifies which devices and operating systems users can use to access their WorkSpaces. /// For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/update-directory-details.html#control-device-access"> /// Control Device Access</a>. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceAccessProperties service method.</param> /// /// <returns>The response from the ModifyWorkspaceAccessProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceAccessProperties">REST API Reference for ModifyWorkspaceAccessProperties Operation</seealso> ModifyWorkspaceAccessPropertiesResponse ModifyWorkspaceAccessProperties(ModifyWorkspaceAccessPropertiesRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceAccessProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceAccessProperties operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyWorkspaceAccessProperties /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceAccessProperties">REST API Reference for ModifyWorkspaceAccessProperties Operation</seealso> IAsyncResult BeginModifyWorkspaceAccessProperties(ModifyWorkspaceAccessPropertiesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyWorkspaceAccessProperties operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyWorkspaceAccessProperties.</param> /// /// <returns>Returns a ModifyWorkspaceAccessPropertiesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceAccessProperties">REST API Reference for ModifyWorkspaceAccessProperties Operation</seealso> ModifyWorkspaceAccessPropertiesResponse EndModifyWorkspaceAccessProperties(IAsyncResult asyncResult); #endregion #region ModifyWorkspaceCreationProperties /// <summary> /// Modify the default properties used to create WorkSpaces. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceCreationProperties service method.</param> /// /// <returns>The response from the ModifyWorkspaceCreationProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceCreationProperties">REST API Reference for ModifyWorkspaceCreationProperties Operation</seealso> ModifyWorkspaceCreationPropertiesResponse ModifyWorkspaceCreationProperties(ModifyWorkspaceCreationPropertiesRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceCreationProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceCreationProperties operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyWorkspaceCreationProperties /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceCreationProperties">REST API Reference for ModifyWorkspaceCreationProperties Operation</seealso> IAsyncResult BeginModifyWorkspaceCreationProperties(ModifyWorkspaceCreationPropertiesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyWorkspaceCreationProperties operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyWorkspaceCreationProperties.</param> /// /// <returns>Returns a ModifyWorkspaceCreationPropertiesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceCreationProperties">REST API Reference for ModifyWorkspaceCreationProperties Operation</seealso> ModifyWorkspaceCreationPropertiesResponse EndModifyWorkspaceCreationProperties(IAsyncResult asyncResult); #endregion #region ModifyWorkspaceProperties /// <summary> /// Modifies the specified WorkSpace properties. For important information about how to /// modify the size of the root and user volumes, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html"> /// Modify a WorkSpace</a>. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties service method.</param> /// /// <returns>The response from the ModifyWorkspaceProperties service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationInProgressException"> /// The properties of this WorkSpace are currently being modified. Try again in a moment. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.UnsupportedWorkspaceConfigurationException"> /// The configuration of this WorkSpace is not supported for this operation. For more /// information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/required-service-components.html">Required /// Configuration and Service Components for WorkSpaces </a>. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceProperties">REST API Reference for ModifyWorkspaceProperties Operation</seealso> ModifyWorkspacePropertiesResponse ModifyWorkspaceProperties(ModifyWorkspacePropertiesRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyWorkspaceProperties /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceProperties">REST API Reference for ModifyWorkspaceProperties Operation</seealso> IAsyncResult BeginModifyWorkspaceProperties(ModifyWorkspacePropertiesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyWorkspaceProperties operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyWorkspaceProperties.</param> /// /// <returns>Returns a ModifyWorkspacePropertiesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceProperties">REST API Reference for ModifyWorkspaceProperties Operation</seealso> ModifyWorkspacePropertiesResponse EndModifyWorkspaceProperties(IAsyncResult asyncResult); #endregion #region ModifyWorkspaceState /// <summary> /// Sets the state of the specified WorkSpace. /// /// /// <para> /// To maintain a WorkSpace without being interrupted, set the WorkSpace state to <code>ADMIN_MAINTENANCE</code>. /// WorkSpaces in this state do not respond to requests to reboot, stop, start, rebuild, /// or restore. An AutoStop WorkSpace in this state is not stopped. Users cannot log into /// a WorkSpace in the <code>ADMIN_MAINTENANCE</code> state. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceState service method.</param> /// /// <returns>The response from the ModifyWorkspaceState service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceState">REST API Reference for ModifyWorkspaceState Operation</seealso> ModifyWorkspaceStateResponse ModifyWorkspaceState(ModifyWorkspaceStateRequest request); /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceState operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceState operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyWorkspaceState /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceState">REST API Reference for ModifyWorkspaceState Operation</seealso> IAsyncResult BeginModifyWorkspaceState(ModifyWorkspaceStateRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the ModifyWorkspaceState operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginModifyWorkspaceState.</param> /// /// <returns>Returns a ModifyWorkspaceStateResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceState">REST API Reference for ModifyWorkspaceState Operation</seealso> ModifyWorkspaceStateResponse EndModifyWorkspaceState(IAsyncResult asyncResult); #endregion #region RebootWorkspaces /// <summary> /// Reboots the specified WorkSpaces. /// /// /// <para> /// You cannot reboot a WorkSpace unless its state is <code>AVAILABLE</code> or <code>UNHEALTHY</code>. /// </para> /// /// <para> /// This operation is asynchronous and returns before the WorkSpaces have rebooted. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RebootWorkspaces service method.</param> /// /// <returns>The response from the RebootWorkspaces service method, as returned by WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebootWorkspaces">REST API Reference for RebootWorkspaces Operation</seealso> RebootWorkspacesResponse RebootWorkspaces(RebootWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the RebootWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebootWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRebootWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebootWorkspaces">REST API Reference for RebootWorkspaces Operation</seealso> IAsyncResult BeginRebootWorkspaces(RebootWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the RebootWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginRebootWorkspaces.</param> /// /// <returns>Returns a RebootWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebootWorkspaces">REST API Reference for RebootWorkspaces Operation</seealso> RebootWorkspacesResponse EndRebootWorkspaces(IAsyncResult asyncResult); #endregion #region RebuildWorkspaces /// <summary> /// Rebuilds the specified WorkSpace. /// /// /// <para> /// You cannot rebuild a WorkSpace unless its state is <code>AVAILABLE</code>, <code>ERROR</code>, /// <code>UNHEALTHY</code>, <code>STOPPED</code>, or <code>REBOOTING</code>. /// </para> /// /// <para> /// Rebuilding a WorkSpace is a potentially destructive action that can result in the /// loss of data. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/reset-workspace.html">Rebuild /// a WorkSpace</a>. /// </para> /// /// <para> /// This operation is asynchronous and returns before the WorkSpaces have been completely /// rebuilt. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces service method.</param> /// /// <returns>The response from the RebuildWorkspaces service method, as returned by WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebuildWorkspaces">REST API Reference for RebuildWorkspaces Operation</seealso> RebuildWorkspacesResponse RebuildWorkspaces(RebuildWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the RebuildWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRebuildWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebuildWorkspaces">REST API Reference for RebuildWorkspaces Operation</seealso> IAsyncResult BeginRebuildWorkspaces(RebuildWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the RebuildWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginRebuildWorkspaces.</param> /// /// <returns>Returns a RebuildWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebuildWorkspaces">REST API Reference for RebuildWorkspaces Operation</seealso> RebuildWorkspacesResponse EndRebuildWorkspaces(IAsyncResult asyncResult); #endregion #region RegisterWorkspaceDirectory /// <summary> /// Registers the specified directory. This operation is asynchronous and returns before /// the WorkSpace directory is registered. If this is the first time you are registering /// a directory, you will need to create the workspaces_DefaultRole role before you can /// register a directory. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role"> /// Creating the workspaces_DefaultRole Role</a>. /// </summary> /// <param name="request">Container for the necessary parameters to execute the RegisterWorkspaceDirectory service method.</param> /// /// <returns>The response from the RegisterWorkspaceDirectory service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.UnsupportedNetworkConfigurationException"> /// The configuration of this network is not supported for this operation, or your network /// configuration conflicts with the Amazon WorkSpaces management network IP range. For /// more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/amazon-workspaces-vpc.html"> /// Configure a VPC for Amazon WorkSpaces</a>. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.WorkspacesDefaultRoleNotFoundException"> /// The workspaces_DefaultRole role could not be found. If this is the first time you /// are registering a directory, you will need to create the workspaces_DefaultRole role /// before you can register a directory. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role">Creating /// the workspaces_DefaultRole Role</a>. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RegisterWorkspaceDirectory">REST API Reference for RegisterWorkspaceDirectory Operation</seealso> RegisterWorkspaceDirectoryResponse RegisterWorkspaceDirectory(RegisterWorkspaceDirectoryRequest request); /// <summary> /// Initiates the asynchronous execution of the RegisterWorkspaceDirectory operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RegisterWorkspaceDirectory operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRegisterWorkspaceDirectory /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RegisterWorkspaceDirectory">REST API Reference for RegisterWorkspaceDirectory Operation</seealso> IAsyncResult BeginRegisterWorkspaceDirectory(RegisterWorkspaceDirectoryRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the RegisterWorkspaceDirectory operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginRegisterWorkspaceDirectory.</param> /// /// <returns>Returns a RegisterWorkspaceDirectoryResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RegisterWorkspaceDirectory">REST API Reference for RegisterWorkspaceDirectory Operation</seealso> RegisterWorkspaceDirectoryResponse EndRegisterWorkspaceDirectory(IAsyncResult asyncResult); #endregion #region RestoreWorkspace /// <summary> /// Restores the specified WorkSpace to its last known healthy state. /// /// /// <para> /// You cannot restore a WorkSpace unless its state is <code> AVAILABLE</code>, <code>ERROR</code>, /// <code>UNHEALTHY</code>, or <code>STOPPED</code>. /// </para> /// /// <para> /// Restoring a WorkSpace is a potentially destructive action that can result in the loss /// of data. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/restore-workspace.html">Restore /// a WorkSpace</a>. /// </para> /// /// <para> /// This operation is asynchronous and returns before the WorkSpace is completely restored. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RestoreWorkspace service method.</param> /// /// <returns>The response from the RestoreWorkspace service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RestoreWorkspace">REST API Reference for RestoreWorkspace Operation</seealso> RestoreWorkspaceResponse RestoreWorkspace(RestoreWorkspaceRequest request); /// <summary> /// Initiates the asynchronous execution of the RestoreWorkspace operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreWorkspace operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRestoreWorkspace /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RestoreWorkspace">REST API Reference for RestoreWorkspace Operation</seealso> IAsyncResult BeginRestoreWorkspace(RestoreWorkspaceRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the RestoreWorkspace operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginRestoreWorkspace.</param> /// /// <returns>Returns a RestoreWorkspaceResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RestoreWorkspace">REST API Reference for RestoreWorkspace Operation</seealso> RestoreWorkspaceResponse EndRestoreWorkspace(IAsyncResult asyncResult); #endregion #region RevokeIpRules /// <summary> /// Removes one or more rules from the specified IP access control group. /// </summary> /// <param name="request">Container for the necessary parameters to execute the RevokeIpRules service method.</param> /// /// <returns>The response from the RevokeIpRules service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RevokeIpRules">REST API Reference for RevokeIpRules Operation</seealso> RevokeIpRulesResponse RevokeIpRules(RevokeIpRulesRequest request); /// <summary> /// Initiates the asynchronous execution of the RevokeIpRules operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeIpRules operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRevokeIpRules /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RevokeIpRules">REST API Reference for RevokeIpRules Operation</seealso> IAsyncResult BeginRevokeIpRules(RevokeIpRulesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the RevokeIpRules operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginRevokeIpRules.</param> /// /// <returns>Returns a RevokeIpRulesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RevokeIpRules">REST API Reference for RevokeIpRules Operation</seealso> RevokeIpRulesResponse EndRevokeIpRules(IAsyncResult asyncResult); #endregion #region StartWorkspaces /// <summary> /// Starts the specified WorkSpaces. /// /// /// <para> /// You cannot start a WorkSpace unless it has a running mode of <code>AutoStop</code> /// and a state of <code>STOPPED</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the StartWorkspaces service method.</param> /// /// <returns>The response from the StartWorkspaces service method, as returned by WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StartWorkspaces">REST API Reference for StartWorkspaces Operation</seealso> StartWorkspacesResponse StartWorkspaces(StartWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the StartWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StartWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStartWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StartWorkspaces">REST API Reference for StartWorkspaces Operation</seealso> IAsyncResult BeginStartWorkspaces(StartWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the StartWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginStartWorkspaces.</param> /// /// <returns>Returns a StartWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StartWorkspaces">REST API Reference for StartWorkspaces Operation</seealso> StartWorkspacesResponse EndStartWorkspaces(IAsyncResult asyncResult); #endregion #region StopWorkspaces /// <summary> /// Stops the specified WorkSpaces. /// /// /// <para> /// You cannot stop a WorkSpace unless it has a running mode of <code>AutoStop</code> /// and a state of <code>AVAILABLE</code>, <code>IMPAIRED</code>, <code>UNHEALTHY</code>, /// or <code>ERROR</code>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the StopWorkspaces service method.</param> /// /// <returns>The response from the StopWorkspaces service method, as returned by WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StopWorkspaces">REST API Reference for StopWorkspaces Operation</seealso> StopWorkspacesResponse StopWorkspaces(StopWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the StopWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StopWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStopWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StopWorkspaces">REST API Reference for StopWorkspaces Operation</seealso> IAsyncResult BeginStopWorkspaces(StopWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the StopWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginStopWorkspaces.</param> /// /// <returns>Returns a StopWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StopWorkspaces">REST API Reference for StopWorkspaces Operation</seealso> StopWorkspacesResponse EndStopWorkspaces(IAsyncResult asyncResult); #endregion #region TerminateWorkspaces /// <summary> /// Terminates the specified WorkSpaces. /// /// /// <para> /// Terminating a WorkSpace is a permanent action and cannot be undone. The user's data /// is destroyed. If you need to archive any user data, contact Amazon Web Services before /// terminating the WorkSpace. /// </para> /// /// <para> /// You can terminate a WorkSpace that is in any state except <code>SUSPENDED</code>. /// </para> /// /// <para> /// This operation is asynchronous and returns before the WorkSpaces have been completely /// terminated. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the TerminateWorkspaces service method.</param> /// /// <returns>The response from the TerminateWorkspaces service method, as returned by WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/TerminateWorkspaces">REST API Reference for TerminateWorkspaces Operation</seealso> TerminateWorkspacesResponse TerminateWorkspaces(TerminateWorkspacesRequest request); /// <summary> /// Initiates the asynchronous execution of the TerminateWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the TerminateWorkspaces operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTerminateWorkspaces /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/TerminateWorkspaces">REST API Reference for TerminateWorkspaces Operation</seealso> IAsyncResult BeginTerminateWorkspaces(TerminateWorkspacesRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the TerminateWorkspaces operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginTerminateWorkspaces.</param> /// /// <returns>Returns a TerminateWorkspacesResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/TerminateWorkspaces">REST API Reference for TerminateWorkspaces Operation</seealso> TerminateWorkspacesResponse EndTerminateWorkspaces(IAsyncResult asyncResult); #endregion #region UpdateRulesOfIpGroup /// <summary> /// Replaces the current rules of the specified IP access control group with the specified /// rules. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateRulesOfIpGroup service method.</param> /// /// <returns>The response from the UpdateRulesOfIpGroup service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidResourceStateException"> /// The state of the resource is not valid for this operation. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceLimitExceededException"> /// Your resource limits have been exceeded. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateRulesOfIpGroup">REST API Reference for UpdateRulesOfIpGroup Operation</seealso> UpdateRulesOfIpGroupResponse UpdateRulesOfIpGroup(UpdateRulesOfIpGroupRequest request); /// <summary> /// Initiates the asynchronous execution of the UpdateRulesOfIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateRulesOfIpGroup operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateRulesOfIpGroup /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateRulesOfIpGroup">REST API Reference for UpdateRulesOfIpGroup Operation</seealso> IAsyncResult BeginUpdateRulesOfIpGroup(UpdateRulesOfIpGroupRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the UpdateRulesOfIpGroup operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateRulesOfIpGroup.</param> /// /// <returns>Returns a UpdateRulesOfIpGroupResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateRulesOfIpGroup">REST API Reference for UpdateRulesOfIpGroup Operation</seealso> UpdateRulesOfIpGroupResponse EndUpdateRulesOfIpGroup(IAsyncResult asyncResult); #endregion #region UpdateWorkspaceImagePermission /// <summary> /// Shares or unshares an image with one account by specifying whether that account has /// permission to copy the image. If the copy image permission is granted, the image is /// shared with that account. If the copy image permission is revoked, the image is unshared /// with the account. /// /// <note> <ul> <li> /// <para> /// To delete an image that has been shared, you must unshare the image before you delete /// it. /// </para> /// </li> <li> /// <para> /// Sharing Bring Your Own License (BYOL) images across AWS accounts isn't supported at /// this time in the AWS GovCloud (US-West) Region. To share BYOL images across accounts /// in the AWS GovCloud (US-West) Region, contact AWS Support. /// </para> /// </li> </ul> </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateWorkspaceImagePermission service method.</param> /// /// <returns>The response from the UpdateWorkspaceImagePermission service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.AccessDeniedException"> /// The user is not authorized to access a resource. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.OperationNotSupportedException"> /// This operation is not supported. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceNotFoundException"> /// The resource could not be found. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateWorkspaceImagePermission">REST API Reference for UpdateWorkspaceImagePermission Operation</seealso> UpdateWorkspaceImagePermissionResponse UpdateWorkspaceImagePermission(UpdateWorkspaceImagePermissionRequest request); /// <summary> /// Initiates the asynchronous execution of the UpdateWorkspaceImagePermission operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateWorkspaceImagePermission operation on AmazonWorkSpacesClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateWorkspaceImagePermission /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateWorkspaceImagePermission">REST API Reference for UpdateWorkspaceImagePermission Operation</seealso> IAsyncResult BeginUpdateWorkspaceImagePermission(UpdateWorkspaceImagePermissionRequest request, AsyncCallback callback, object state); /// <summary> /// Finishes the asynchronous execution of the UpdateWorkspaceImagePermission operation. /// </summary> /// /// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateWorkspaceImagePermission.</param> /// /// <returns>Returns a UpdateWorkspaceImagePermissionResult from WorkSpaces.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateWorkspaceImagePermission">REST API Reference for UpdateWorkspaceImagePermission Operation</seealso> UpdateWorkspaceImagePermissionResponse EndUpdateWorkspaceImagePermission(IAsyncResult asyncResult); #endregion } }
59.738314
201
0.685949
[ "Apache-2.0" ]
alefranz/aws-sdk-net
sdk/src/Services/WorkSpaces/Generated/_bcl35/IAmazonWorkSpaces.cs
143,133
C#
using System; using System.Collections.Generic; using WJStore.Domain.Interfaces.Validation; namespace WJStore.Domain.Validation { public class Validation<TEntity> : IValidation<TEntity> where TEntity : class { private readonly Dictionary<string, IValidationRule<TEntity>> _validationsRules; public Validation() { _validationsRules = new Dictionary<string, IValidationRule<TEntity>>(); } protected virtual void AddRule(IValidationRule<TEntity> validationRule) { var ruleName = validationRule.GetType() + Guid.NewGuid().ToString("D"); _validationsRules.Add(ruleName, validationRule); } protected virtual void RemoveRule(string ruleName) { _validationsRules.Remove(ruleName); } public virtual ValidationResult Valid(TEntity entity) { var result = new ValidationResult(); foreach (var key in _validationsRules.Keys) { var rule = _validationsRules[key]; if (!rule.Valid(entity)) result.Add(new ValidationError(rule.ErrorMessage)); } return result; } } }
30.95
88
0.613086
[ "MIT" ]
MrWooJ/WJStore
WJStore.Domain/Validation/Validation.cs
1,240
C#
using System; namespace FontAwesome { /// <summary> /// The unicode values for all FontAwesome icons. /// <para/> /// See https://fontawesome.com/cheatsheet /// <para/> /// This code was automatically generated by FA2CS (https://github.com/michaelswells/fa2cs a modified fork from https://github.com/matthewrdev/fa2cs). /// </summary> public static partial class Unicode { /// <summary> /// fa-baseball-ball unicode value ("\uf433"). /// <para/> /// This icon supports the following styles: Light (Pro), Regular (Pro), Solid, Duotone (Pro) /// <para/> /// See https://fontawesome.com/icons/baseball-ball /// </summary> public const string BaseballBall = "\uf433"; } /// <summary> /// The Css values for all FontAwesome icons. /// <para/> /// See https://fontawesome.com/cheatsheet /// <para/> /// This code was automatically generated by FA2CS (https://github.com/michaelswells/fa2cs a modified fork from https://github.com/matthewrdev/fa2cs). /// </summary> public static partial class Css { /// <summary> /// BaseballBall unicode value ("fa-baseball-ball"). /// <para/> /// This icon supports the following styles: Light (Pro), Regular (Pro), Solid, Duotone (Pro) /// <para/> /// See https://fontawesome.com/icons/baseball-ball /// </summary> public const string BaseballBall = "fa-baseball-ball"; } /// <summary> /// The Icon names for all FontAwesome icons. /// <para/> /// See https://fontawesome.com/cheatsheet /// <para/> /// This code was automatically generated by FA2CS (https://github.com/michaelswells/fa2cs a modified fork from https://github.com/matthewrdev/fa2cs). /// </summary> public static partial class Icon { /// <summary> /// fa-baseball-ball unicode value ("\uf433"). /// <para/> /// This icon supports the following styles: Light (Pro), Regular (Pro), Solid, Duotone (Pro) /// <para/> /// See https://fontawesome.com/icons/baseball-ball /// </summary> public const string BaseballBall = "BaseballBall"; } }
36.803279
154
0.598664
[ "MIT" ]
michaelswells/FontAwesomeAttribute
FontAwesome/FontAwesome.BaseballBall.cs
2,245
C#
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; using System; using System.Collections.Generic; using System.Management.Automation; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets { /// <summary> /// Gets recovery points created for the provided item protected by the recovery services vault /// </summary> [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesBackupRecoveryLogChain", DefaultParameterSetName = NoFilterParameterSet), OutputType(typeof(PointInTimeBase))] public class GetAzureRmRecoveryServicesBackupRecoveryLogChain : RSBackupVaultCmdletBase { internal const string DateTimeFilterParameterSet = "DateTimeFilter"; internal const string NoFilterParameterSet = "NoFilterParameterSet"; /// <summary> /// Start time of Time range for which recovery point needs to be fetched /// </summary> [Parameter(Mandatory = false, ParameterSetName = DateTimeFilterParameterSet, ValueFromPipeline = false, Position = 0, HelpMessage = ParamHelpMsgs.RecoveryPoint.StartDate)] [ValidateNotNullOrEmpty] public DateTime? StartDate { get; set; } /// <summary> /// End time of Time range for which recovery points need to be fetched /// </summary> [Parameter( Mandatory = false, ParameterSetName = DateTimeFilterParameterSet, ValueFromPipeline = false, Position = 1, HelpMessage = ParamHelpMsgs.RecoveryPoint.EndDate)] [ValidateNotNullOrEmpty] public DateTime? EndDate { get; set; } /// <summary> /// Protected Item object for which recovery points need to be fetched /// </summary> [Parameter( Mandatory = true, ParameterSetName = DateTimeFilterParameterSet, ValueFromPipeline = true, Position = 2, HelpMessage = ParamHelpMsgs.RecoveryPoint.Item)] [Parameter( Mandatory = true, ParameterSetName = NoFilterParameterSet, ValueFromPipeline = true, Position = 0, HelpMessage = ParamHelpMsgs.RecoveryPoint.Item)] [ValidateNotNullOrEmpty] public ItemBase Item { get; set; } public override void ExecuteCmdlet() { ExecutionBlock(() => { //Validate start time < end time base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string resourceGroupName = resourceIdentifier.ResourceGroupName; // initialize values to default DateTime rangeEnd = DateTime.UtcNow; DateTime rangeStart = rangeEnd.AddDays(-30); Dictionary<Enum, object> providerParameters = new Dictionary<Enum, object>(); providerParameters.Add(VaultParams.VaultName, vaultName); providerParameters.Add(VaultParams.ResourceGroupName, resourceGroupName); providerParameters.Add(RecoveryPointParams.Item, Item); if (ParameterSetName == DateTimeFilterParameterSet || ParameterSetName == NoFilterParameterSet) { // if both start and end date are given by user if (StartDate.HasValue && EndDate.HasValue) { rangeStart = StartDate.Value; rangeEnd = EndDate.Value; } // if only start date is given by user else if (StartDate.HasValue && EndDate.HasValue == false) { rangeStart = StartDate.Value; rangeEnd = rangeStart.AddDays(30); } // if only end date is given by user else if (EndDate.HasValue && StartDate.HasValue == false) { rangeEnd = EndDate.Value; rangeStart = rangeEnd.AddDays(-30); } //User want list of RPs between given time range WriteDebug(string.Format("ParameterSet = DateTimeFilterParameterSet. \n" + "StartDate = {0} EndDate = {1}, Item.Name = {2}, Item.ContainerName = {3}", rangeStart, rangeEnd, Item.Name, Item.ContainerName)); if (rangeStart >= rangeEnd) { throw new ArgumentException(Resources.RecoveryPointEndDateShouldBeGreater); } if (rangeStart.Kind != DateTimeKind.Utc || rangeEnd.Kind != DateTimeKind.Utc) { throw new ArgumentException(Resources.GetRPErrorInputDatesShouldBeInUTC); } if (rangeStart > DateTime.UtcNow) { throw new ArgumentException( Resources.GetRPErrorStartTimeShouldBeLessThanUTCNow); } providerParameters.Add(RecoveryPointParams.StartDate, rangeStart); providerParameters.Add(RecoveryPointParams.EndDate, rangeEnd); providerParameters.Add(RecoveryPointParams.RestorePointQueryType, "Log"); PsBackupProviderManager providerManager = new PsBackupProviderManager(providerParameters, ServiceClientAdapter); IPsBackupProvider psBackupProvider = providerManager.GetProviderInstance(Item.ContainerType, Item.BackupManagementType); var rpList = psBackupProvider.GetLogChains(); WriteObject(rpList, enumerateCollection: true); } else { throw new Exception(Resources.RecoveryPointUnsupportedParamet); } }); } } }
47.487013
203
0.576918
[ "MIT" ]
3quanfeng/azure-powershell
src/RecoveryServices/RecoveryServices.Backup/Cmdlets/RecoveryPoint/GetAzureRmRecoveryServicesBackupRecoveryLogChain.cs
7,162
C#
using System; namespace DataManager.Areas.HelpPage.ModelDescriptions { /// <summary> /// Use this attribute to change the name of the <see cref="ModelDescription"/> generated for a type. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false, Inherited = false)] public sealed class ModelNameAttribute : Attribute { public ModelNameAttribute(string name) { Name = name; } public string Name { get; private set; } } }
31.222222
136
0.66726
[ "MIT" ]
inanfatih/retail-manager
DataManager/Areas/HelpPage/ModelDescriptions/ModelNameAttribute.cs
562
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by \generate-code.bat. // // Changes to this file will be lost when the code is regenerated. // The build server regenerates the code before each build and a pre-build // step will regenerate the code on each local build. // // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. // Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // </auto-generated> //------------------------------------------------------------------------------ // Licensed under MIT No Attribution, see LICENSE file at the root. // Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. using System; #nullable enable namespace UnitsNet.NumberExtensions.NumberToReciprocalArea { /// <summary> /// A number to ReciprocalArea Extensions /// </summary> public static class NumberToReciprocalAreaExtensions { /// <inheritdoc cref="ReciprocalArea.FromInverseSquareCentimeters(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareCentimeters<T>(this T value) => ReciprocalArea.FromInverseSquareCentimeters(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareDecimeters(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareDecimeters<T>(this T value) => ReciprocalArea.FromInverseSquareDecimeters(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareFeet(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareFeet<T>(this T value) => ReciprocalArea.FromInverseSquareFeet(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareInches(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareInches<T>(this T value) => ReciprocalArea.FromInverseSquareInches(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareKilometers(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareKilometers<T>(this T value) => ReciprocalArea.FromInverseSquareKilometers(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareMeters(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareMeters<T>(this T value) => ReciprocalArea.FromInverseSquareMeters(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareMicrometers(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareMicrometers<T>(this T value) => ReciprocalArea.FromInverseSquareMicrometers(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareMiles(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareMiles<T>(this T value) => ReciprocalArea.FromInverseSquareMiles(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareMillimeters(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareMillimeters<T>(this T value) => ReciprocalArea.FromInverseSquareMillimeters(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseSquareYards(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseSquareYards<T>(this T value) => ReciprocalArea.FromInverseSquareYards(Convert.ToDouble(value)); /// <inheritdoc cref="ReciprocalArea.FromInverseUsSurveySquareFeet(UnitsNet.QuantityValue)" /> public static ReciprocalArea InverseUsSurveySquareFeet<T>(this T value) => ReciprocalArea.FromInverseUsSurveySquareFeet(Convert.ToDouble(value)); } }
52.896104
125
0.708569
[ "MIT-feh" ]
AIKICo/UnitsNet
UnitsNet.NumberExtensions/GeneratedCode/NumberToReciprocalAreaExtensions.g.cs
4,073
C#
using System; using System.Drawing; using System.Windows.Forms; namespace WebCam { public class Calibration { #region declerations public bool EnableContinualCalibration = true; /// <summary>How far tracker must move in the x or y direction to be considered an actual move</summary> public float deadZone = 2; /// <summary>The x offset of the 2 markers while in a neutral head position</summary> float offsetx = 0; /// <summary>The y offset of the 2 markers while in a neutral head position</summary> float offsety = 0; /// <summary>This is the total distance between markers in the x direction. Value will be negative.</summary> float MaxLeft = 0; /// <summary>This is the total distance between markers in the x direction. Value will be positive</summary> float MaxRight = 0; /// <summary>This is the total distance between markers in the y direction. Value will be smaller than MaxDown.</summary> float MaxUp = 0; /// <summary>This is the total distance between markers in the y direction. Value will be larger than MaxUp</summary> float MaxDown = 0; /// <summary>This is the amount of pixels that make up the 'left' rotation. It takes into account the offset.</summary> float amountLeft; /// <summary>This is the amount of pixels that make up the 'right' rotation. It takes into account the offset.</summary> float amountRight; /// <summary>This is the amount of pixels that make up the 'up' rotation. It takes into account the offset.</summary> float amountUp; /// <summary>This is the amount of pixels that make up the 'down' rotation. It takes into account the offset.</summary> float amountDown; #endregion /// <summary>Sets the offsets while the head is in a neutral position</summary> public void SetCenter(Point topMarker, Point bottomMarker) { offsetx = topMarker.X - bottomMarker.X; offsety = topMarker.Y - bottomMarker.Y; Console.WriteLine("offsetX: " + offsetx + " offsetY: " + offsety); } public void SetMaxLeftRotation(Point topMarker, Point bottomMarker) { MaxLeft = topMarker.X - bottomMarker.X; //should return a negative number amountLeft = MaxLeft - offsetx; Console.WriteLine("MaxLeft: " + MaxLeft); } public void SetMaxRightRotation(Point topMarker, Point bottomMarker) { MaxRight = topMarker.X - bottomMarker.X; //should return a positive number amountRight = MaxRight - offsetx; Console.WriteLine("MaxRight: " + MaxRight); } public void SetMaxUpRotation(Point topMarker, Point bottomMarker) { MaxUp = topMarker.Y - bottomMarker.Y; //should return a positive number (but smaller than MaxDown) amountUp = Math.Abs(offsety) - MaxUp; Console.WriteLine("MaxUp: " + MaxUp); } public void SetMaxDownRotation(Point topMarker, Point bottomMarker) { MaxDown = topMarker.Y - bottomMarker.Y; //should return a positive number amountDown = MaxDown - Math.Abs(offsety); Console.WriteLine("MaxDown: " + MaxDown); } /// <returns>The percent of maximum rotation. (1 = 100%)</returns> public float GetRotationLeftRight(Point topMarker, Point bottomMarker) { float currentDistance = (topMarker.X - bottomMarker.X); #region Continual Calibration if (EnableContinualCalibration) { if (currentDistance < MaxLeft) { MaxLeft = currentDistance; amountLeft = MaxLeft - offsetx; } else if (currentDistance > MaxRight) { MaxRight = currentDistance; amountRight = MaxRight - offsetx; } } #endregion currentDistance -= offsetx; if (currentDistance < 0) return (currentDistance / amountLeft)* -1f; else return (currentDistance / amountRight); } /// <returns>The percent of maximum rotation.(1 = 100%)</returns> public float GetRotationUpDown(Point topMarker, Point bottomMarker) { float offset = Math.Abs(offsety); float currentDistance = (topMarker.Y - bottomMarker.Y); #region Continual Calibration if (EnableContinualCalibration) { if (currentDistance < MaxUp) { MaxUp = currentDistance; //should return a positive number (but smaller than MaxDown) amountUp = offset - MaxUp; } else if (currentDistance > MaxDown) { MaxDown = currentDistance; //should return a positive number amountDown = MaxDown - offset; } } #endregion currentDistance -= offset; if (currentDistance < 0) return currentDistance / amountUp; else return currentDistance / amountDown; } } }
40.328358
129
0.586047
[ "MIT" ]
ScienceExp/Web-Cam-Marker-Tracker
WebCam/Calibration.cs
5,406
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TileMap : MonoBehaviour { /// <summary> /// ProceduralWall Model /// </summary> [Range(0.01f,10)] [SerializeField] private float mapCellScale = 1.0f; [Range(1,10)] [SerializeField] private int cellsPerPathWidth = 3; [Range(1,10)] [SerializeField] private int cellsPerWallWidth = 1; [SerializeField] private bool isDrawDebugger = false; Vector2Int mapDimensions; /// <summary> /// Initialize the TileMap with starting cell /// </summary> public void InitilizeMap() { // Initialise TileMap and status variables mapDimensions = new Vector2Int(6,6); } private void Start() { Debug.Log("Initializing Tile Map"); InitilizeMap(); } /// <summary> /// TileMap View /// </summary> /// <summary> /// Draw TileMap Debuger /// </summary> private void OnDrawGizmos() { if(isDrawDebugger) { // Draw Base Axis (Base wall tiles) Gizmos.color = Color.red; for (int x = 0; x < mapDimensions.x; x++) { // Draw bottom row wall tiles Vector3 position = new Vector3(-mapDimensions.x/2 + x + 0.5f, 0, -mapDimensions.y/2 - 1 + 0.5f); position *= mapCellScale; for (int px = 0; px < cellsPerPathWidth+cellsPerWallWidth; px++) { for (int py = 0; py < cellsPerPathWidth+cellsPerWallWidth; py++) { // Draw Wall tiles if(px%(cellsPerWallWidth)==cellsPerPathWidth || py%(cellsPerPathWidth+cellsPerWallWidth)==cellsPerPathWidth) { Vector3 pathPosition = new Vector3(px,0,py); pathPosition *= mapCellScale; pathPosition = position*(cellsPerPathWidth+cellsPerWallWidth)+pathPosition; Gizmos.DrawWireCube(pathPosition, Vector3.one*mapCellScale); } } } // Draw left row wall tiles position = new Vector3(-mapDimensions.x/2 - 1 + 0.5f, 0, -mapDimensions.y/2 + x + 0.5f); position *= mapCellScale; for (int px = 0; px < cellsPerPathWidth+cellsPerWallWidth; px++) { for (int py = 0; py < cellsPerPathWidth+cellsPerWallWidth; py++) { // Draw Wall tiles if(px%(cellsPerPathWidth+cellsPerWallWidth)==cellsPerPathWidth || py%(cellsPerWallWidth)==cellsPerPathWidth) { Vector3 pathPosition = new Vector3(px,0,py); pathPosition *= mapCellScale; pathPosition = position*(cellsPerPathWidth+cellsPerWallWidth)+pathPosition; Gizmos.DrawWireCube(pathPosition, Vector3.one*mapCellScale); } } } } // Draw TileMap for (int x = 0; x < mapDimensions.x; x++) { // Debug.Log("Drawing Maze Row" + x); for (int y = 0; y < mapDimensions.y; y++) { Vector3 position = new Vector3(-mapDimensions.x/2 + x + 0.5f, 0, -mapDimensions.y/2 + y + 0.5f); position *= mapCellScale; for (int px = 0; px < cellsPerPathWidth+cellsPerWallWidth; px++) { for (int py = 0; py < cellsPerPathWidth+cellsPerWallWidth; py++) { // Draw path tiles Vector3 pathPosition = new Vector3(px,0,py); pathPosition *= mapCellScale; pathPosition = position*(cellsPerPathWidth+cellsPerWallWidth)+pathPosition; Gizmos.DrawWireCube(pathPosition, Vector3.one*mapCellScale); } } } } } } }
39.106557
133
0.440998
[ "CC0-1.0" ]
rohitwesley/CityBuilder
Assets/Scripts/TileMap.cs
4,773
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; namespace Microsoft.Owin.Hosting.Starter { /// <summary> /// Performs any necessary environment setup prior to executing the IHostingEngine. /// </summary> public interface IHostingStarter { /// <summary> /// Performs any necessary environment setup prior to executing the IHostingEngine. /// </summary> /// <param name="options"></param> /// <returns></returns> IDisposable Start(StartOptions options); } }
32.4
133
0.645062
[ "Apache-2.0" ]
mickey2009/KatanaProject
src/Microsoft.Owin.Hosting/Starter/IHostingStarter.cs
648
C#
namespace TomsToolbox.Wpf { using System.Collections.Generic; using System.Windows; using TomsToolbox.Essentials; /// <summary> /// Helper methods to interchange data via clipboard. /// </summary> public static class ClipboardHelper { /// <summary> /// Gets the clipboard data as a table. /// </summary> /// <returns>The parsed clipboard data as a table, or <c>null</c> if the clipboard is empty or does not contain normalized table data.</returns> /// <remarks>If no TEXT is present in the clipboard, CSV data is used.</remarks> public static IList<IList<string>>? GetClipboardDataAsTable() { var text = Clipboard.GetText(); if (!text.IsNullOrEmpty()) return text.ParseTable(TableHelper.TextColumnSeparator); var csv = Clipboard.GetData(DataFormats.CommaSeparatedValue) as string; if (!csv.IsNullOrEmpty()) return csv.ParseTable(TableHelper.CsvColumnSeparator); return null; } /// <summary> /// Sets the clipboard data for the specified table. /// </summary> /// <param name="table">The table.</param> /// <remarks> /// This method sets the TEXT (tab delimited) and CSV data. Like in Excel the CSV delimiter is either comma or semicolon, depending on the current culture. /// </remarks> public static void SetClipboardData(this IList<IList<string>>? table) { if (table == null) { Clipboard.Clear(); return; } var textString = table.ToTextString(); var csvString = table.ToCsvString(); var dataObject = new DataObject(); dataObject.SetText(textString); dataObject.SetText(csvString, TextDataFormat.CommaSeparatedValue); Clipboard.SetDataObject(dataObject); } } }
34.224138
163
0.592947
[ "MIT" ]
ali50m/TomsToolbox
src/TomsToolbox.Wpf/ClipboardHelper.cs
1,987
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using Silk.NET.Core.Attributes; #pragma warning disable 1591 namespace Silk.NET.DXVA { [NativeName("Name", "_DXVA_VideoProcessCaps")] public enum VideoProcessCaps : int { [NativeName("Name", "DXVA_VideoProcess_None")] VideoProcessNone = 0x0, [NativeName("Name", "DXVA_VideoProcess_YUV2RGB")] VideoProcessYuv2Rgb = 0x1, [NativeName("Name", "DXVA_VideoProcess_StretchX")] VideoProcessStretchX = 0x2, [NativeName("Name", "DXVA_VideoProcess_StretchY")] VideoProcessStretchY = 0x4, [NativeName("Name", "DXVA_VideoProcess_AlphaBlend")] VideoProcessAlphaBlend = 0x8, [NativeName("Name", "DXVA_VideoProcess_SubRects")] VideoProcessSubRects = 0x10, [NativeName("Name", "DXVA_VideoProcess_SubStreams")] VideoProcessSubStreams = 0x20, [NativeName("Name", "DXVA_VideoProcess_SubStreamsExtended")] VideoProcessSubStreamsExtended = 0x40, [NativeName("Name", "DXVA_VideoProcess_YUV2RGBExtended")] VideoProcessYuv2Rgbextended = 0x80, [NativeName("Name", "DXVA_VideoProcess_AlphaBlendExtended")] VideoProcessAlphaBlendExtended = 0x100, } }
36.594595
71
0.693501
[ "MIT" ]
DmitryGolubenkov/Silk.NET
src/Microsoft/Silk.NET.DXVA/Enums/VideoProcessCaps.gen.cs
1,354
C#
 // cannot get exported types of Anonymously Hosted DynamicMethods Assembly namespace CallSharp { using System; using System.Diagnostics; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; public class StaticMemberDatabase : IMemberDatabase { private readonly IFragmentationEngine fragEngine = new FragmentationEngine(); public void FindCandidates( Action<string> visitor, object origin, object input, object output, int depth, CancellationToken token, string callChain = "input") { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Trace.WriteLine(callChain); var inputType = input.GetType(); var outputType = output.GetType(); if (input.Equals(output)) { visitor(callChain); return; } // here we try to brute-force conversion of input to output // if it succeeds, we break as before object newValue = null; try { newValue = Convert.ChangeType(output, inputType); } catch (Exception) { } if (input.Equals(newValue)) { visitor(callChain); return; } bool foundSomething = false; Action<string> visitorWithCheck = x => { visitor(x); foundSomething = true; }; // contains all calls that didn't yield the right result var failCookies = new List<MethodCallCookie>(); // note: technically, we collect fail cookies. or used to. // 1) Look for all matching constructors. if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.String && input is System.Char[]) { var instance = new System.String((System.Char[])input); if (instance == (System.String)output && !Equals(instance,origin)) { visitorWithCheck($"new string({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.DateTime && input is System.Int64) { var instance = new System.DateTime((System.Int64)input); if (instance == (System.DateTime)output && !Equals(instance,origin)) { visitorWithCheck($"new DateTime({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.Int32) { var instance = new System.Decimal((System.Int32)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.UInt32) { var instance = new System.Decimal((System.UInt32)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.Int64) { var instance = new System.Decimal((System.Int64)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.UInt64) { var instance = new System.Decimal((System.UInt64)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.Single) { var instance = new System.Decimal((System.Single)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.Double) { var instance = new System.Decimal((System.Double)input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.Decimal && input is System.Int32[]) { var instance = new System.Decimal((System.Int32[])input); if (instance == (System.Decimal)output && !Equals(instance,origin)) { visitorWithCheck($"new decimal({callChain})"); } } if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (output is System.TimeSpan && input is System.Int64) { var instance = new System.TimeSpan((System.Int64)input); if (instance == (System.TimeSpan)output && !Equals(instance,origin)) { visitorWithCheck($"new TimeSpan({callChain})"); } } // 2) 1-to-1 instance functions. if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Length; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Length", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.CharEnumerator).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).GetEnumerator(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetEnumerator()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToLower(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLower()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToLowerInvariant(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLowerInvariant()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToUpper(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToUpper()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToUpperInvariant(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToUpperInvariant()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.Object).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Clone(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Clone()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Trim(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Trim()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.Char[]).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).ToCharArray(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToCharArray()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String[]).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Split(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Split()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Trim(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Trim()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).TrimStart(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TrimStart()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).TrimEnd(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TrimEnd()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).IsNormalized(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.IsNormalized()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.String)input).Normalize(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Normalize()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Day; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Day", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Hour; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Hour", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Month; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Month", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Minute; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Minute", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Second; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Second", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Year; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Year", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int64).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Ticks; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Ticks", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).TimeOfDay; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TimeOfDay", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToOADate(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToOADate()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int64).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToFileTime(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToFileTime()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int64).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToFileTimeUtc(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToFileTimeUtc()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToLocalTime(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLocalTime()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToLongDateString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLongDateString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToLongTimeString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLongTimeString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToShortDateString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToShortDateString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToShortTimeString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToShortTimeString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToUniversalTime(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToUniversalTime()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.String[]).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).GetDateTimeFormats(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetDateTimeFormats()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Boolean).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).IsDaylightSavingTime(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.IsDaylightSavingTime()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int64).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).ToBinary(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToBinary()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Date; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Date", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.DayOfWeek).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).DayOfWeek; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.DayOfWeek", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).DayOfYear; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.DayOfYear", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.DateTimeKind).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Kind; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Kind", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.DateTime)input).Millisecond; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Millisecond", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Boolean && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Boolean)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Boolean && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Boolean)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Boolean && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Boolean)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Byte && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Byte)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Byte && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Byte)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Byte && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Byte)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Char && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Char)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Char && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Char)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Char && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Char)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Decimal && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Decimal)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Decimal && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Decimal)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Decimal && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Decimal)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Double && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Double)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Double && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Double)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Double && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Double)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int16 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int16)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int16 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int16)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int16 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int16)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int32 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int32)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int32 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int32)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int32 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int32)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int64 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int64)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int64 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int64)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Int64 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Int64)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is SByte && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.SByte)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is SByte && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.SByte)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is SByte && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.SByte)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Single && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Single)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Single && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Single)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Single && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Single)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int64).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Ticks; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Ticks", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Days; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Days", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Hours; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Hours", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Milliseconds; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Milliseconds", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Minutes; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Minutes", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Seconds; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Seconds", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).TotalDays; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TotalDays", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).TotalHours; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TotalHours", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).TotalMilliseconds; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TotalMilliseconds", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).TotalMinutes; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TotalMinutes", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Double).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).TotalSeconds; if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.TotalSeconds", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Duration(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Duration()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).Negate(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Negate()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is TimeSpan && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.TimeSpan)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt16 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt16)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt16 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt16)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt16 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt16)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt32 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt32)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt32 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt32)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt32 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt32)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt64 && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt64)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt64 && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt64)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is UInt64 && typeof(System.TypeCode).IsConvertibleTo(outputType)) { // invoke! var result = ((System.UInt64)input).GetTypeCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetTypeCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.String).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).ToString(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Int32).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetHashCode(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetHashCode()", callChain)); } } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (input is Object && typeof(System.Type).IsConvertibleTo(outputType)) { // invoke! var result = ((System.Object)input).GetType(); if (Equals(result, output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetType()", callChain)); } } }); // 3. Search static members if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String[])) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.Concat((System.String[])input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.Concat({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.Intern((System.String)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.Intern({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.IsInterned((System.String)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.IsInterned({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.Copy((System.String)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.Copy({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Object)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.Concat((System.Object)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.Concat({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Object[])) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.Concat((System.Object[])input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("string.Concat({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.IsNullOrEmpty((System.String)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("string.IsNullOrEmpty({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.String)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.String.IsNullOrWhiteSpace((System.String)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("string.IsNullOrWhiteSpace({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int32)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.DateTime.IsLeapYear((System.Int32)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("DateTime.IsLeapYear({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.DateTime).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.DateTime.FromBinary((System.Int64)input); if (result == (System.DateTime)output && !Equals(result,origin)) retVal = string.Format("DateTime.FromBinary({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.DateTime).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.DateTime.FromFileTime((System.Int64)input); if (result == (System.DateTime)output && !Equals(result,origin)) retVal = string.Format("DateTime.FromFileTime({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.DateTime).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.DateTime.FromFileTimeUtc((System.Int64)input); if (result == (System.DateTime)output && !Equals(result,origin)) retVal = string.Format("DateTime.FromFileTimeUtc({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.DateTime).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.DateTime.FromOADate((System.Double)input); if (result == (System.DateTime)output && !Equals(result,origin)) retVal = string.Format("DateTime.FromOADate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Char).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ToLower((System.Char)input); if (result == (System.Char)output && !Equals(result,origin)) retVal = string.Format("char.ToLower({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsNumber((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsNumber({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsSeparator((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsSeparator({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsSurrogate((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsSurrogate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsSymbol((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsSymbol({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Globalization.UnicodeCategory).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.GetUnicodeCategory((System.Char)input); if (result == (System.Globalization.UnicodeCategory)output && !Equals(result,origin)) retVal = string.Format("char.GetUnicodeCategory({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.GetNumericValue((System.Char)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("char.GetNumericValue({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsHighSurrogate((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsHighSurrogate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsLowSurrogate((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsLowSurrogate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int32)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ConvertFromUtf32((System.Int32)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("char.ConvertFromUtf32({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.String).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ToString((System.Char)input); if (result == (System.String)output && !Equals(result,origin)) retVal = string.Format("char.ToString({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsDigit((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsDigit({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsLetter((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsLetter({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsWhiteSpace((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsWhiteSpace({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsUpper((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsUpper({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsLower((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsLower({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsPunctuation((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsPunctuation({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsLetterOrDigit((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsLetterOrDigit({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Char).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ToUpper((System.Char)input); if (result == (System.Char)output && !Equals(result,origin)) retVal = string.Format("char.ToUpper({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Char).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ToUpperInvariant((System.Char)input); if (result == (System.Char)output && !Equals(result,origin)) retVal = string.Format("char.ToUpperInvariant({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Char).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.ToLowerInvariant((System.Char)input); if (result == (System.Char)output && !Equals(result,origin)) retVal = string.Format("char.ToLowerInvariant({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Char)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Char.IsControl((System.Char)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("char.IsControl({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.UInt32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToUInt32((System.Decimal)input); if (result == (System.UInt32)output && !Equals(result,origin)) retVal = string.Format("decimal.ToUInt32({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.UInt64).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToUInt64((System.Decimal)input); if (result == (System.UInt64)output && !Equals(result,origin)) retVal = string.Format("decimal.ToUInt64({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Single).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToSingle((System.Decimal)input); if (result == (System.Single)output && !Equals(result,origin)) retVal = string.Format("decimal.ToSingle({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.Truncate((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.Truncate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int64).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToOACurrency((System.Decimal)input); if (result == (System.Int64)output && !Equals(result,origin)) retVal = string.Format("decimal.ToOACurrency({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.FromOACurrency((System.Int64)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.FromOACurrency({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.Ceiling((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.Ceiling({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.Floor((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.Floor({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int32[]).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.GetBits((System.Decimal)input); if (result == (System.Int32[])output && !Equals(result,origin)) retVal = string.Format("decimal.GetBits({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.Negate((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.Negate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.Round((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("decimal.Round({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Byte).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToByte((System.Decimal)input); if (result == (System.Byte)output && !Equals(result,origin)) retVal = string.Format("decimal.ToByte({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.SByte).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToSByte((System.Decimal)input); if (result == (System.SByte)output && !Equals(result,origin)) retVal = string.Format("decimal.ToSByte({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int16).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToInt16((System.Decimal)input); if (result == (System.Int16)output && !Equals(result,origin)) retVal = string.Format("decimal.ToInt16({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToDouble((System.Decimal)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("decimal.ToDouble({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToInt32((System.Decimal)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("decimal.ToInt32({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int64).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToInt64((System.Decimal)input); if (result == (System.Int64)output && !Equals(result,origin)) retVal = string.Format("decimal.ToInt64({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.UInt16).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Decimal.ToUInt16((System.Decimal)input); if (result == (System.UInt16)output && !Equals(result,origin)) retVal = string.Format("decimal.ToUInt16({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Double.IsInfinity((System.Double)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("double.IsInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Double.IsPositiveInfinity((System.Double)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("double.IsPositiveInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Double.IsNegativeInfinity((System.Double)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("double.IsNegativeInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Double.IsNaN((System.Double)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("double.IsNaN({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Round((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Round({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Round((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("Math.Round({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Floor((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("Math.Floor({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Floor((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Floor({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Ceiling((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("Math.Ceiling({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Ceiling((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Ceiling({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Acos((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Acos({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Asin((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Asin({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Atan((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Atan({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Cos((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Cos({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Cosh((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Cosh({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sin((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Sin({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Tan((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Tan({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sinh((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Sinh({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Tanh((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Tanh({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Truncate((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("Math.Truncate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Truncate((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Truncate({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sqrt((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Sqrt({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Log((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Log({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Log10((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Log10({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Exp((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Exp({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.SByte)) && typeof(System.SByte).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.SByte)input); if (result == (System.SByte)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int16)) && typeof(System.Int16).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Int16)input); if (result == (System.Int16)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int32)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Int32)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.Int64).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Int64)input); if (result == (System.Int64)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Single).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Single)input); if (result == (System.Single)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Double).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Double)input); if (result == (System.Double)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Decimal).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Abs((System.Decimal)input); if (result == (System.Decimal)output && !Equals(result,origin)) retVal = string.Format("Math.Abs({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.SByte)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.SByte)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int16)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Int16)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int32)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Int32)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Int64)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Single)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Double)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Decimal)) && typeof(System.Int32).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Math.Sign((System.Decimal)input); if (result == (System.Int32)output && !Equals(result,origin)) retVal = string.Format("Math.Sign({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Single.IsInfinity((System.Single)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("float.IsInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Single.IsPositiveInfinity((System.Single)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("float.IsPositiveInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Single.IsNegativeInfinity((System.Single)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("float.IsNegativeInfinity({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Single)) && typeof(System.Boolean).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.Single.IsNaN((System.Single)input); if (result == (System.Boolean)output && !Equals(result,origin)) retVal = string.Format("float.IsNaN({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromDays((System.Double)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromDays({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromHours((System.Double)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromHours({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromMilliseconds((System.Double)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromMilliseconds({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromMinutes((System.Double)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromMinutes({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Double)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromSeconds((System.Double)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromSeconds({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } Task.Factory.StartNew(() => { if (inputType.IsConvertibleTo(typeof(System.Int64)) && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { string retVal = null; try { var result = System.TimeSpan.FromTicks((System.Int64)input); if (result == (System.TimeSpan)output && !Equals(result,origin)) retVal = string.Format("TimeSpan.FromTicks({0})", callChain); } catch {} if (retVal != null) visitor(retVal); } }); // 4. Single-argument fragmentation (1-to-2 instance) if (!foundSomething) { Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).CompareTo((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).Contains((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Contains({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).EndsWith((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.EndsWith({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOf((System.Char)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.IndexOf({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char[])), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOfAny((System.Char[])arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.IndexOfAny({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOf((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.IndexOf({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOf((System.Char)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.LastIndexOf({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char[])), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOfAny((System.Char[])arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.LastIndexOfAny({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOf((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.LastIndexOf({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).PadLeft((System.Int32)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.PadLeft({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).PadRight((System.Int32)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.PadRight({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).StartsWith((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.StartsWith({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Globalization.CultureInfo)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).ToLower((System.Globalization.CultureInfo)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToLower({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Globalization.CultureInfo)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).ToUpper((System.Globalization.CultureInfo)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToUpper({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Remove((System.Int32)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Remove({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).Equals((System.String)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Substring((System.Int32)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Substring({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Text.NormalizationForm)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).IsNormalized((System.Text.NormalizationForm)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.IsNormalized({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Text.NormalizationForm)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Normalize((System.Text.NormalizationForm)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.Normalize({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.DateTime)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = ((System.DateTime)input).Subtract((System.DateTime)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Subtract({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).Subtract((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Subtract({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.DateTime)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.DateTime)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.DateTime)input).GetDateTimeFormats((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetDateTimeFormats({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.DateTime)input).GetDateTimeFormats((System.Char)arg); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.GetDateTimeFormats({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).Add((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Add({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddDays((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddDays({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddHours((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddHours({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddMilliseconds((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddMilliseconds({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddMinutes((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddMinutes({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddMonths((System.Int32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddMonths({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddSeconds((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddSeconds({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int64)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddTicks((System.Int64)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddTicks({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.DateTime).IsConvertibleTo(outputType)) { System.DateTime? result = new System.DateTime?(); try { result = ((System.DateTime)input).AddYears((System.Int32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.AddYears({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.DateTime)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.DateTime)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.DateTime)input).CompareTo((System.DateTime)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.DateTime)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.DateTime)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.DateTime)input).Equals((System.DateTime)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Boolean && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Boolean)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Boolean && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Boolean)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Boolean)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Boolean && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Boolean)input).Equals((System.Boolean)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Boolean && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Boolean)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Boolean)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Boolean && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Boolean)input).CompareTo((System.Boolean)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Byte)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Byte)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Byte)input).CompareTo((System.Byte)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Byte)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Byte)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Byte)input).Equals((System.Byte)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Byte)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Byte)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Char && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Char)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Char && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Char)input).Equals((System.Char)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Char && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Char)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Char)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Char && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Char)input).CompareTo((System.Char)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Char && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Char)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Decimal)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Decimal)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Decimal)input).CompareTo((System.Decimal)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Decimal)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Decimal)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Decimal)input).Equals((System.Decimal)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Decimal)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Decimal)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Double)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Double)input).CompareTo((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Double)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Double)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Double)input).Equals((System.Double)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Double)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Double)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int16)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int16)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int16)input).CompareTo((System.Int16)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int16)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int16)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int16)input).Equals((System.Int16)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int16)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int16)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int32)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int32)input).CompareTo((System.Int32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int32)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int32)input).Equals((System.Int32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int32)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int32)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int64)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int64)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Int64)input).CompareTo((System.Int64)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int64)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Int64)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Int64)input).Equals((System.Int64)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int64)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int64)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Object && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Object)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.SByte)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.SByte)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.SByte)input).CompareTo((System.SByte)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.SByte)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.SByte)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.SByte)input).Equals((System.SByte)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.SByte)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.SByte)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Single)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Single)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.Single)input).CompareTo((System.Single)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Single)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Single)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Single)input).Equals((System.Single)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Single)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Single)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = ((System.TimeSpan)input).Add((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Add({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.TimeSpan)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.TimeSpan)input).CompareTo((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.TimeSpan)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.TimeSpan)input).Equals((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.TimeSpan)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.TimeSpan).IsConvertibleTo(outputType)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = ((System.TimeSpan)input).Subtract((System.TimeSpan)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Subtract({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.TimeSpan)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt16)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt16)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt16)input).CompareTo((System.UInt16)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt16)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt16)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt16)input).Equals((System.UInt16)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt16)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt16)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt32)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt32)input).CompareTo((System.UInt32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt32)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt32)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt32)input).Equals((System.UInt32)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt32)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt32)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt64)input).CompareTo((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt64)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.UInt64)input).CompareTo((System.UInt64)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.CompareTo({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt64)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.UInt64)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.UInt64)input).Equals((System.UInt64)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.IFormatProvider)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt64)input).ToString((System.IFormatProvider)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.String)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt64)input).ToString((System.String)arg); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output) && !Equals(result, origin)) { visitorWithCheck(string.Format("{0}.ToString({1})", callChain, arg.ToLiteral())); } } } }); Parallel.ForEach (fragEngine.Frag(input, typeof(System.Object)), arg => { { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Object && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.Object)input).Equals((System.Object)arg); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output) && !Equals(result.Value, origin)) { visitorWithCheck(string.Format("{0}.Equals({1})", callChain, arg.ToLiteral())); } } } }); // 5. Two-argument fragmentation; like the above but with quad the complexity. if (!foundSomething) { foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringComparison))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).EndsWith( (System.String)arg1, (System.StringComparison)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { visitorWithCheck(string.Format("{0}.EndsWith({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOf( (System.Char)arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.IndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char[]))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOfAny( (System.Char[])arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.IndexOfAny({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOf( (System.String)arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.IndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringComparison))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).IndexOf( (System.String)arg1, (System.StringComparison)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.IndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOf( (System.Char)arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.LastIndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char[]))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOfAny( (System.Char[])arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.LastIndexOfAny({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOf( (System.String)arg1, (System.Int32)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.LastIndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringComparison))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Int32).IsConvertibleTo(outputType)) { System.Int32? result = new System.Int32?(); try { result = ((System.String)input).LastIndexOf( (System.String)arg1, (System.StringComparison)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { visitorWithCheck(string.Format("{0}.LastIndexOf({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Char))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).PadLeft( (System.Int32)arg1, (System.Char)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.PadLeft({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Char))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).PadRight( (System.Int32)arg1, (System.Char)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.PadRight({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringComparison))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).StartsWith( (System.String)arg1, (System.StringComparison)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { visitorWithCheck(string.Format("{0}.StartsWith({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.String))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Insert( (System.Int32)arg1, (System.String)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.Insert({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Char))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Replace( (System.Char)arg1, (System.Char)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.Replace({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.String))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Replace( (System.String)arg1, (System.String)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.Replace({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Remove( (System.Int32)arg1, (System.Int32)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.Remove({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringComparison))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Boolean).IsConvertibleTo(outputType)) { System.Boolean? result = new System.Boolean?(); try { result = ((System.String)input).Equals( (System.String)arg1, (System.StringComparison)arg2 ); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { visitorWithCheck(string.Format("{0}.Equals({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.Char[]).IsConvertibleTo(outputType)) { System.Char[] result = null; try { result = ((System.String)input).ToCharArray( (System.Int32)arg1, (System.Int32)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.Char[]) && result.Equals((System.Char[])output)) { visitorWithCheck(string.Format("{0}.ToCharArray({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char[]))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.String)input).Split( (System.Char[])arg1, (System.Int32)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output)) { visitorWithCheck(string.Format("{0}.Split({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char[]))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringSplitOptions))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.String)input).Split( (System.Char[])arg1, (System.StringSplitOptions)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output)) { visitorWithCheck(string.Format("{0}.Split({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String[]))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.StringSplitOptions))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.String)input).Split( (System.String[])arg1, (System.StringSplitOptions)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output)) { visitorWithCheck(string.Format("{0}.Split({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Int32))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.Int32))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is String && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.String)input).Substring( (System.Int32)arg1, (System.Int32)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.Substring({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.DateTime)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.Char))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is DateTime && typeof(System.String[]).IsConvertibleTo(outputType)) { System.String[] result = null; try { result = ((System.DateTime)input).GetDateTimeFormats( (System.Char)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String[]) && result.Equals((System.String[])output)) { visitorWithCheck(string.Format("{0}.GetDateTimeFormats({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Byte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Byte)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Decimal && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Decimal)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Double && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Double)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int16)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int32)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Int64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Int64)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is SByte && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.SByte)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is Single && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.Single)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is TimeSpan && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.TimeSpan)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt16 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt16)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt32 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt32)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } foreach (var arg1 in fragEngine.Frag(input, typeof(System.String))) foreach (var arg2 in fragEngine.Frag(input, typeof(System.IFormatProvider))) { if (token.IsCancellationRequested) { Trace.WriteLine("Cancellation requested"); return; } if (input is UInt64 && typeof(System.String).IsConvertibleTo(outputType)) { System.String result = null; try { result = ((System.UInt64)input).ToString( (System.String)arg1, (System.IFormatProvider)arg2 ); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { visitorWithCheck(string.Format("{0}.ToString({1}, {2})", callChain, arg1.ToLiteral(), arg2.ToLiteral())); } } } // 5. Assuming we found nothing and aren't in too deep (any-to-1), look for // methods which do NOT yield outputType if (!foundSomething && depth < 2) { // recursive invocation on String happening here! if (input is String && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.String)input).Length; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Length", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.String)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.CharEnumerator) != outputType) { System.CharEnumerator result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).GetEnumerator(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetEnumerator()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToLower(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToLower()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToLowerInvariant(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToLowerInvariant()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToUpper(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToUpper()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToUpperInvariant(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToUpperInvariant()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).Trim(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.Trim()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.Char[]) != outputType) { System.Char[] result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).ToCharArray(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToCharArray()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.String)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String[]) != outputType) { System.String[] result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).Split(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.Split()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).Trim(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.Trim()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).TrimStart(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.TrimStart()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).TrimEnd(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.TrimEnd()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.Boolean) != outputType) { System.Boolean? result = new System.Boolean?(); try { // invoke in the hope it yields something useful down the line result = ((System.String)input).IsNormalized(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.IsNormalized()", callChain)); } } // recursive invocation on String happening here! if (input is String && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.String)input).Normalize(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.Normalize()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Day; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Day", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Hour; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Hour", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Month; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Month", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Minute; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Minute", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Second; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Second", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Year; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Year", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int64) != outputType) { System.Int64? result = new System.Int64?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Ticks; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Ticks", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.TimeSpan) != outputType) { System.TimeSpan? result = new System.TimeSpan?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).TimeOfDay; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TimeOfDay", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToOADate(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToOADate()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int64) != outputType) { System.Int64? result = new System.Int64?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToFileTime(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToFileTime()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int64) != outputType) { System.Int64? result = new System.Int64?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToFileTimeUtc(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToFileTimeUtc()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.DateTime) != outputType) { System.DateTime? result = new System.DateTime?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToLocalTime(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToLocalTime()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToLongDateString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToLongDateString()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToLongTimeString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToLongTimeString()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToShortDateString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToShortDateString()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToShortTimeString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToShortTimeString()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.DateTime) != outputType) { System.DateTime? result = new System.DateTime?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToUniversalTime(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToUniversalTime()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.String[]) != outputType) { System.String[] result = null; try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).GetDateTimeFormats(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetDateTimeFormats()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Boolean) != outputType) { System.Boolean? result = new System.Boolean?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).IsDaylightSavingTime(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.IsDaylightSavingTime()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int64) != outputType) { System.Int64? result = new System.Int64?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).ToBinary(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.ToBinary()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.DateTime) != outputType) { System.DateTime? result = new System.DateTime?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Date; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Date", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.DayOfWeek) != outputType) { System.DayOfWeek? result = new System.DayOfWeek?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).DayOfWeek; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.DayOfWeek", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).DayOfYear; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.DayOfYear", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.DateTimeKind) != outputType) { System.DateTimeKind? result = new System.DateTimeKind?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Kind; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Kind", callChain)); } } // recursive invocation on DateTime happening here! if (input is DateTime && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.DateTime)input).Millisecond; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Millisecond", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Boolean happening here! if (input is Boolean && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Boolean)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Boolean happening here! if (input is Boolean && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Boolean)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Boolean happening here! if (input is Boolean && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Boolean)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Byte happening here! if (input is Byte && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Byte)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Byte happening here! if (input is Byte && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Byte)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Byte happening here! if (input is Byte && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Byte)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Char happening here! if (input is Char && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Char)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Char happening here! if (input is Char && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Char)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Char happening here! if (input is Char && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Char)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Decimal happening here! if (input is Decimal && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Decimal)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Decimal happening here! if (input is Decimal && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Decimal)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Decimal happening here! if (input is Decimal && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Decimal)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Double happening here! if (input is Double && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Double)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Double happening here! if (input is Double && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Double)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Double happening here! if (input is Double && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Double)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Int16 happening here! if (input is Int16 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int16)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Int16 happening here! if (input is Int16 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Int16)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Int16 happening here! if (input is Int16 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int16)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Int32 happening here! if (input is Int32 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int32)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Int32 happening here! if (input is Int32 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Int32)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Int32 happening here! if (input is Int32 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int32)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Int64 happening here! if (input is Int64 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int64)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Int64 happening here! if (input is Int64 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Int64)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Int64 happening here! if (input is Int64 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Int64)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on SByte happening here! if (input is SByte && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.SByte)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on SByte happening here! if (input is SByte && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.SByte)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on SByte happening here! if (input is SByte && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.SByte)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Single happening here! if (input is Single && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Single)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Single happening here! if (input is Single && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Single)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Single happening here! if (input is Single && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.Single)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int64) != outputType) { System.Int64? result = new System.Int64?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Ticks; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Ticks", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Days; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Days", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Hours; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Hours", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Milliseconds; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Milliseconds", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Minutes; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Minutes", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Seconds; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Seconds", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).TotalDays; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TotalDays", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).TotalHours; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TotalHours", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).TotalMilliseconds; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TotalMilliseconds", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).TotalMinutes; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TotalMinutes", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Double) != outputType) { System.Double? result = new System.Double?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).TotalSeconds; } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.TotalSeconds", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.TimeSpan) != outputType) { System.TimeSpan? result = new System.TimeSpan?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Duration(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Duration()", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.TimeSpan) != outputType) { System.TimeSpan? result = new System.TimeSpan?(); try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).Negate(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.Negate()", callChain)); } } // recursive invocation on TimeSpan happening here! if (input is TimeSpan && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.TimeSpan)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on UInt16 happening here! if (input is UInt16 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt16)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on UInt16 happening here! if (input is UInt16 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.UInt16)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on UInt16 happening here! if (input is UInt16 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt16)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on UInt32 happening here! if (input is UInt32 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt32)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on UInt32 happening here! if (input is UInt32 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.UInt32)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on UInt32 happening here! if (input is UInt32 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt32)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on UInt64 happening here! if (input is UInt64 && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt64)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on UInt64 happening here! if (input is UInt64 && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.UInt64)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on UInt64 happening here! if (input is UInt64 && typeof(System.TypeCode) != outputType) { System.TypeCode? result = new System.TypeCode?(); try { // invoke in the hope it yields something useful down the line result = ((System.UInt64)input).GetTypeCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetTypeCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.String) != outputType) { System.String result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).ToString(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.ToString()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Int32) != outputType) { System.Int32? result = new System.Int32?(); try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetHashCode(); } catch { /* cannot reasonably handle this */} if (result.HasValue && !Equals(result.Value, input) && !Equals(result.Value, origin)) { FindCandidates(visitor, origin, result.Value, output, depth+1, token, string.Format("{0}.GetHashCode()", callChain)); } } // recursive invocation on Object happening here! if (input is Object && typeof(System.Type) != outputType) { System.Type result = null; try { // invoke in the hope it yields something useful down the line result = ((System.Object)input).GetType(); } catch { /* cannot reasonably handle this */} if (result != null && !Equals(result, input) && !Equals(result, origin)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("{0}.GetType()", callChain)); } } // 6. Look for similar, but static calls. Here we go again. // static recursive check if (inputType == typeof(System.String[])) { System.String result = null; try { result = System.String.Concat((System.String[])input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.Concat({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.String result = null; try { result = System.String.Intern((System.String)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.Intern({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.String result = null; try { result = System.String.IsInterned((System.String)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.IsInterned({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.String result = null; try { result = System.String.Copy((System.String)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.Copy({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Object)) { System.String result = null; try { result = System.String.Concat((System.Object)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.Concat({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Object[])) { System.String result = null; try { result = System.String.Concat((System.Object[])input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("string.Concat({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Boolean? result = new System.Boolean?(); try { result = System.String.IsNullOrEmpty((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("string.IsNullOrEmpty({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Boolean? result = new System.Boolean?(); try { result = System.String.IsNullOrWhiteSpace((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("string.IsNullOrWhiteSpace({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int32)) { System.Boolean? result = new System.Boolean?(); try { result = System.DateTime.IsLeapYear((System.Int32)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.IsLeapYear({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.DateTime? result = new System.DateTime?(); try { result = System.DateTime.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.DateTime? result = new System.DateTime?(); try { result = System.DateTime.FromBinary((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.FromBinary({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.DateTime? result = new System.DateTime?(); try { result = System.DateTime.FromFileTime((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.FromFileTime({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.DateTime? result = new System.DateTime?(); try { result = System.DateTime.FromFileTimeUtc((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.FromFileTimeUtc({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.DateTime? result = new System.DateTime?(); try { result = System.DateTime.FromOADate((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.DateTime) && result.Value.Equals((System.DateTime)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("DateTime.FromOADate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Boolean? result = new System.Boolean?(); try { result = System.Boolean.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("bool.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Byte? result = new System.Byte?(); try { result = System.Byte.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Byte) && result.Value.Equals((System.Byte)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("byte.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Char? result = new System.Char?(); try { result = System.Char.ToLower((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Char) && result.Value.Equals((System.Char)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.ToLower({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsNumber((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsNumber({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsSeparator((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsSeparator({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsSurrogate((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsSurrogate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsSymbol((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsSymbol({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Globalization.UnicodeCategory? result = new System.Globalization.UnicodeCategory?(); try { result = System.Char.GetUnicodeCategory((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Globalization.UnicodeCategory) && result.Value.Equals((System.Globalization.UnicodeCategory)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.GetUnicodeCategory({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Double? result = new System.Double?(); try { result = System.Char.GetNumericValue((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.GetNumericValue({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsHighSurrogate((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsHighSurrogate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsLowSurrogate((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsLowSurrogate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int32)) { System.String result = null; try { result = System.Char.ConvertFromUtf32((System.Int32)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("char.ConvertFromUtf32({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.String result = null; try { result = System.Char.ToString((System.Char)input); } catch {} if (result != null && output.GetType() == typeof(System.String) && result.Equals((System.String)output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("char.ToString({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Char? result = new System.Char?(); try { result = System.Char.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Char) && result.Value.Equals((System.Char)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsDigit((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsDigit({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsLetter((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsLetter({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsWhiteSpace((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsWhiteSpace({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsUpper((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsUpper({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsLower((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsLower({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsPunctuation((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsPunctuation({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsLetterOrDigit((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsLetterOrDigit({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Char? result = new System.Char?(); try { result = System.Char.ToUpper((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Char) && result.Value.Equals((System.Char)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.ToUpper({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Char? result = new System.Char?(); try { result = System.Char.ToUpperInvariant((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Char) && result.Value.Equals((System.Char)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.ToUpperInvariant({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Char? result = new System.Char?(); try { result = System.Char.ToLowerInvariant((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Char) && result.Value.Equals((System.Char)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.ToLowerInvariant({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Char)) { System.Boolean? result = new System.Boolean?(); try { result = System.Char.IsControl((System.Char)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("char.IsControl({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.UInt32? result = new System.UInt32?(); try { result = System.Decimal.ToUInt32((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt32) && result.Value.Equals((System.UInt32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToUInt32({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.UInt64? result = new System.UInt64?(); try { result = System.Decimal.ToUInt64((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt64) && result.Value.Equals((System.UInt64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToUInt64({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Single? result = new System.Single?(); try { result = System.Decimal.ToSingle((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Single) && result.Value.Equals((System.Single)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToSingle({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Truncate((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Truncate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int64? result = new System.Int64?(); try { result = System.Decimal.ToOACurrency((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int64) && result.Value.Equals((System.Int64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToOACurrency({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.FromOACurrency((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.FromOACurrency({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Ceiling((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Ceiling({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Floor((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Floor({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int32[] result = null; try { result = System.Decimal.GetBits((System.Decimal)input); } catch {} if (result != null && output.GetType() == typeof(System.Int32[]) && result.Equals((System.Int32[])output)) { FindCandidates(visitorWithCheck, origin, result, output, depth+1, token, string.Format("decimal.GetBits({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Negate((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Negate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Decimal.Round((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.Round({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Byte? result = new System.Byte?(); try { result = System.Decimal.ToByte((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Byte) && result.Value.Equals((System.Byte)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToByte({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.SByte? result = new System.SByte?(); try { result = System.Decimal.ToSByte((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.SByte) && result.Value.Equals((System.SByte)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToSByte({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int16? result = new System.Int16?(); try { result = System.Decimal.ToInt16((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int16) && result.Value.Equals((System.Int16)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToInt16({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Double? result = new System.Double?(); try { result = System.Decimal.ToDouble((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToDouble({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int32? result = new System.Int32?(); try { result = System.Decimal.ToInt32((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToInt32({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int64? result = new System.Int64?(); try { result = System.Decimal.ToInt64((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int64) && result.Value.Equals((System.Int64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToInt64({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.UInt16? result = new System.UInt16?(); try { result = System.Decimal.ToUInt16((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt16) && result.Value.Equals((System.UInt16)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("decimal.ToUInt16({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Boolean? result = new System.Boolean?(); try { result = System.Double.IsInfinity((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("double.IsInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Boolean? result = new System.Boolean?(); try { result = System.Double.IsPositiveInfinity((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("double.IsPositiveInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Boolean? result = new System.Boolean?(); try { result = System.Double.IsNegativeInfinity((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("double.IsNegativeInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Boolean? result = new System.Boolean?(); try { result = System.Double.IsNaN((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("double.IsNaN({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Double? result = new System.Double?(); try { result = System.Double.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("double.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Int16? result = new System.Int16?(); try { result = System.Int16.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int16) && result.Value.Equals((System.Int16)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("short.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Int32? result = new System.Int32?(); try { result = System.Int32.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("int.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Int64? result = new System.Int64?(); try { result = System.Int64.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int64) && result.Value.Equals((System.Int64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("long.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Round((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Round({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Math.Round((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Round({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Math.Floor((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Floor({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Floor((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Floor({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Math.Ceiling((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Ceiling({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Ceiling((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Ceiling({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Acos((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Acos({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Asin((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Asin({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Atan((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Atan({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Cos((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Cos({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Cosh((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Cosh({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Sin((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sin({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Tan((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Tan({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Sinh((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sinh({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Tanh((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Tanh({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Math.Truncate((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Truncate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Truncate((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Truncate({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Sqrt((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sqrt({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Log((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Log({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Log10((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Log10({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Exp((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Exp({0})", callChain)); } } // static recursive check if (inputType == typeof(System.SByte)) { System.SByte? result = new System.SByte?(); try { result = System.Math.Abs((System.SByte)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.SByte) && result.Value.Equals((System.SByte)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int16)) { System.Int16? result = new System.Int16?(); try { result = System.Math.Abs((System.Int16)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int16) && result.Value.Equals((System.Int16)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int32)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Abs((System.Int32)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.Int64? result = new System.Int64?(); try { result = System.Math.Abs((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int64) && result.Value.Equals((System.Int64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Single? result = new System.Single?(); try { result = System.Math.Abs((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Single) && result.Value.Equals((System.Single)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Double? result = new System.Double?(); try { result = System.Math.Abs((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Double) && result.Value.Equals((System.Double)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Decimal? result = new System.Decimal?(); try { result = System.Math.Abs((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Decimal) && result.Value.Equals((System.Decimal)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Abs({0})", callChain)); } } // static recursive check if (inputType == typeof(System.SByte)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.SByte)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int16)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Int16)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int32)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Int32)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Decimal)) { System.Int32? result = new System.Int32?(); try { result = System.Math.Sign((System.Decimal)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Int32) && result.Value.Equals((System.Int32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("Math.Sign({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.SByte? result = new System.SByte?(); try { result = System.SByte.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.SByte) && result.Value.Equals((System.SByte)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("sbyte.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Boolean? result = new System.Boolean?(); try { result = System.Single.IsInfinity((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("float.IsInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Boolean? result = new System.Boolean?(); try { result = System.Single.IsPositiveInfinity((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("float.IsPositiveInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Boolean? result = new System.Boolean?(); try { result = System.Single.IsNegativeInfinity((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("float.IsNegativeInfinity({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Single)) { System.Boolean? result = new System.Boolean?(); try { result = System.Single.IsNaN((System.Single)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Boolean) && result.Value.Equals((System.Boolean)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("float.IsNaN({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.Single? result = new System.Single?(); try { result = System.Single.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.Single) && result.Value.Equals((System.Single)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("float.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromDays((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromDays({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromHours((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromHours({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromMilliseconds((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromMilliseconds({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromMinutes((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromMinutes({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Double)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromSeconds((System.Double)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromSeconds({0})", callChain)); } } // static recursive check if (inputType == typeof(System.Int64)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.FromTicks((System.Int64)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.FromTicks({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.TimeSpan? result = new System.TimeSpan?(); try { result = System.TimeSpan.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.TimeSpan) && result.Value.Equals((System.TimeSpan)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("TimeSpan.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.UInt16? result = new System.UInt16?(); try { result = System.UInt16.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt16) && result.Value.Equals((System.UInt16)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("ushort.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.UInt32? result = new System.UInt32?(); try { result = System.UInt32.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt32) && result.Value.Equals((System.UInt32)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("uint.Parse({0})", callChain)); } } // static recursive check if (inputType == typeof(System.String)) { System.UInt64? result = new System.UInt64?(); try { result = System.UInt64.Parse((System.String)input); } catch {} if (result.HasValue && output.GetType() == typeof(System.UInt64) && result.Value.Equals((System.UInt64)output)) { FindCandidates(visitorWithCheck, origin, result.Value, output, depth+1, token, string.Format("ulong.Parse({0})", callChain)); } } } } } } } }
34.040779
165
0.55337
[ "MIT" ]
nesteruk/CallSharp
src/CallSharp/Db/StaticMemberDatabase.cs
410,704
C#
using System.Collections; using UnityEngine.Assertions; using Video.Plugin; namespace Video.Plugin { public class VideoPluginWrapper_Mock : IVideoPluginWrapper { public bool isCreated = false; public bool isReady = false; public float currentTime = 0; private VideoState state; public void Create(string id, string url, bool useHls) { isCreated = true; CoroutineStarter.Start(ReadyWithDelay()); } private IEnumerator ReadyWithDelay() { yield return null; yield return null; yield return null; isReady = true; } public void Remove(string id) { Assert.IsTrue(isCreated); isReady = false; } public void TextureUpdate(string id) { Assert.IsTrue(isCreated); } public int GetTexture(string id) { Assert.IsTrue(isCreated); return 0; } public void Play(string id, float startTime) { Assert.IsTrue(isCreated, "Video should be created first!"); Assert.IsTrue(isReady, "Play never should be called if video is not ready."); currentTime = startTime; } public void Pause(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); } public void SetVolume(string id, float volume) { Assert.IsTrue(isCreated, "Video should be created first!"); } public int GetHeight(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return 250; } public int GetWidth(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return 250; } public float GetTime(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return currentTime; } public float GetDuration(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return 0; } public int GetState(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return (int)state; } public string GetError(string id) { Assert.IsTrue(isCreated, "Video should be created first!"); return "error"; } public void SetTime(string id, float second) { Assert.IsTrue(isCreated, "Video should be created first!"); } public void SetPlaybackRate(string id, float playbackRate) { Assert.IsTrue(isCreated, "Video should be created first!"); } public void SetLoop(string id, bool loop) { Assert.IsTrue(isCreated, "Video should be created first!"); } } }
26.298246
89
0.548699
[ "MIT" ]
BrianAmadori/unity-web-hls-plugin
Assets/WebVideoPlayer/Tests/VideoPluginWrapper_Mock.cs
3,000
C#
$PostFXManager::Settings::ColorCorrectionRamp = "scripts/client/postFx/null_color_ramp.png"; $PostFXManager::Settings::DOF::BlurCurveFar = "50"; $PostFXManager::Settings::DOF::BlurCurveNear = "50"; $PostFXManager::Settings::DOF::BlurMax = "0.15"; $PostFXManager::Settings::DOF::BlurMin = "0.07"; $PostFXManager::Settings::DOF::EnableAutoFocus = "1"; $PostFXManager::Settings::DOF::FocusRangeMax = "500"; $PostFXManager::Settings::DOF::FocusRangeMin = "100"; $PostFXManager::Settings::EnableDOF = "1"; $PostFXManager::Settings::EnableHDR = "1"; $PostFXManager::Settings::EnableLightRays = "1"; $PostFXManager::Settings::EnablePostFX = "1"; $PostFXManager::Settings::EnableSSAO = "1"; $PostFXManager::Settings::EnableSunBokeh = "0"; $PostFXManager::Settings::EnableVignette = "1"; $PostFXManager::Settings::HDR::adaptRate = "2"; $PostFXManager::Settings::HDR::blueShiftColor = "0.498039 0.929412 0.980392 1"; $PostFXManager::Settings::HDR::brightPassThreshold = "1.2"; $PostFXManager::Settings::HDR::enableBloom = "1"; $PostFXManager::Settings::HDR::enableBlueShift = "0.294737"; $PostFXManager::Settings::HDR::enableToneMapping = "0.3"; $PostFXManager::Settings::HDR::gaussMean = "0.1"; $PostFXManager::Settings::HDR::gaussMultiplier = "0.2"; $PostFXManager::Settings::HDR::gaussStdDev = "3"; $PostFXManager::Settings::HDR::keyValue = "0.4"; $PostFXManager::Settings::HDR::minLuminace = "0"; $PostFXManager::Settings::HDR::whiteCutoff = "0"; $PostFXManager::Settings::LightRays::brightScalar = "0.75"; $PostFXManager::Settings::LightRays::decay = "1"; $PostFXManager::Settings::LightRays::density = "0.871378"; $PostFXManager::Settings::LightRays::numSamples = "20"; $PostFXManager::Settings::LightRays::weight = "9.37638"; $PostFXManager::Settings::SSAO::blurDepthTol = "0.3"; $PostFXManager::Settings::SSAO::blurNormalTol = "0.95"; $PostFXManager::Settings::SSAO::lDepthMax = "3"; $PostFXManager::Settings::SSAO::lDepthMin = "0.3"; $PostFXManager::Settings::SSAO::lDepthPow = "0.2"; $PostFXManager::Settings::SSAO::lNormalPow = "2"; $PostFXManager::Settings::SSAO::lNormalTol = "-0.5"; $PostFXManager::Settings::SSAO::lRadius = "0.4"; $PostFXManager::Settings::SSAO::lStrength = "2"; $PostFXManager::Settings::SSAO::overallStrength = "10"; $PostFXManager::Settings::SSAO::quality = "2"; $PostFXManager::Settings::SSAO::sDepthMax = "3.8"; $PostFXManager::Settings::SSAO::sDepthMin = "0.5"; $PostFXManager::Settings::SSAO::sDepthPow = "1"; $PostFXManager::Settings::SSAO::sNormalPow = "1"; $PostFXManager::Settings::SSAO::sNormalTol = "0"; $PostFXManager::Settings::SSAO::sRadius = "0.15"; $PostFXManager::Settings::SSAO::sStrength = "2.7"; $PostFXManager::Settings::SunBokeh::bokehSize = "550"; $PostFXManager::Settings::SunBokeh::edgeAmount = "0.3"; $PostFXManager::Settings::SunBokeh::haloAmount = "0.3"; $PostFXManager::Settings::SunBokeh::sunAmount = "0.3"; $PostFXManager::Settings::SunBokeh::sunSize = "0.125"; $PostFXManager::Settings::Vignette::VMax = "2";
52.017544
92
0.728836
[ "Unlicense" ]
Duion/Uebergame
levels/Pazifik/Pazifik_Watertown/Pazifik_Watertown_dawn.postfxpreset.cs
2,965
C#
using UnityEngine; using UnityEngine.Events; #if UNITY_EDITOR using UnityEditor; #endif namespace Lean.Transition.Extras { /// <summary>This component executes the specified transitions at regular intervals.</summary> [HelpURL(LeanTransition.HelpUrlPrefix + "LeanAnimationRepeater")] [AddComponentMenu(LeanTransition.ComponentMenuPrefix + "Lean Animation Repeater")] public class LeanAnimationRepeater : LeanAnimationOnce { /// <summary>The time in seconds between each animation.</summary> public float TimeInterval { set { timeInterval = value; } get { return timeInterval; } } [SerializeField] [UnityEngine.Serialization.FormerlySerializedAs("TimeInterval")] private float timeInterval = 3.0f; protected override void Start() { if (remainingTime <= 0.0f) { BeginTransitionsAndEvent(); } } protected override void Update() { remainingTime -= Time.deltaTime; if (remainingTime <= 0.0f) { BeginTransitionsAndEvent(); } } private void BeginTransitionsAndEvent() { remainingTime = timeInterval + remainingTime % timeInterval; BeginTransitions(); if (onAnimation != null) { onAnimation.Invoke(); } } } } #if UNITY_EDITOR namespace Lean.Transition.Extras { [CanEditMultipleObjects] [CustomEditor(typeof(LeanAnimationRepeater))] public class LeanAnimationRepeater_Inspector : Lean.Common.LeanInspector<LeanAnimationRepeater> { protected override void DrawInspector() { Draw("remainingTime", "When this reaches 0, the transitions will begin."); Draw("timeInterval", "The time in seconds between each animation."); EditorGUILayout.Separator(); Draw("transitions", "This stores the Transforms containing all the transitions that will be performed."); EditorGUILayout.Separator(); Draw("onAnimation"); } } } #endif
25.676056
207
0.737795
[ "MIT" ]
DrScatman/vr-mod
Assets/Lean/Transition/Extras/Scripts/LeanAnimationRepeater.cs
1,825
C#
using System; using CSharpFunctionalExtensions; namespace Logic.Entities { public class CustomerName : ValueObject<CustomerName> { public string Value { get; } private CustomerName(string value) { this.Value = value; } public static Result<CustomerName> Create(string customerName) { customerName = (customerName ?? string.Empty).Trim(); if (customerName.Length == 0) return Result.Failure<CustomerName>("Customer name should not be empty"); if (customerName.Length > 100) return Result.Failure<CustomerName>("Name is too long"); return Result.Ok(new CustomerName(customerName)); } protected override bool EqualsCore(CustomerName other) { return Value.Equals(other.Value, System.StringComparison.InvariantCultureIgnoreCase); } protected override int GetHashCodeCore() { return Value.GetHashCode(); } public static implicit operator string(CustomerName customerName) { return customerName.Value; } public static explicit operator CustomerName(string customerName) { var customerNameOrError = Create(customerName); if (customerNameOrError.IsFailure) throw new InvalidCastException(customerNameOrError.Error); return customerNameOrError.Value; } } }
28.339623
97
0.616511
[ "MIT" ]
luis-eduardo/AnemicDomainModel
BeforeCore/src/Logic/Entities/CustomerName.cs
1,502
C#
// c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\d3dumddi.h(789,9) using System.Runtime.InteropServices; namespace DirectN { [StructLayout(LayoutKind.Sequential)] public partial struct _D3DDDI_COLORFILLFLAGS { public _D3DDDI_COLORFILLFLAGS__union_0 __union_0; } }
25.583333
84
0.742671
[ "MIT" ]
bbday/DirectN
DirectN/DirectN/Generated/_D3DDDI_COLORFILLFLAGS.cs
309
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Drawing; using System.Windows.Forms.VisualStyles; namespace System.Windows.Forms { public partial class DataGridViewRowHeaderCell { private class DataGridViewRowHeaderCellRenderer { private static VisualStyleRenderer visualStyleRenderer; private DataGridViewRowHeaderCellRenderer() { } public static VisualStyleRenderer VisualStyleRenderer { get { if (visualStyleRenderer is null) { visualStyleRenderer = new VisualStyleRenderer(s_headerElement); } return visualStyleRenderer; } } public static void DrawHeader(Graphics g, Rectangle bounds, int headerState) { VisualStyleRenderer.SetParameters(s_headerElement.ClassName, s_headerElement.Part, headerState); VisualStyleRenderer.DrawBackground(g, bounds, Rectangle.Truncate(g.ClipBounds)); } } } }
30.883721
112
0.609187
[ "MIT" ]
ArtemTatarinov/winforms
src/System.Windows.Forms/src/System/Windows/Forms/DataGridViewRowHeaderCell.DataGridViewRowHeaderCellRenderer.cs
1,330
C#
using MahApps.Metro.Controls; using Seemon.Vault.Core.Contracts.ViewModels; using Seemon.Vault.Core.Contracts.Views; using System.Windows; namespace Seemon.Vault.Helpers.Views { public class WindowBase : MetroWindow, IWindow { public IViewModel ViewModel => DataContext as IViewModel; public void CloseDialog(bool? response = null) { DialogResult = response; Close(); } public bool? ShowDialog(IWindow owner) { Owner = (Window)owner; return ShowDialog(); } } }
23.24
65
0.621343
[ "MIT" ]
mattseemon/Vault
src/UX/Helpers/Views/WindowBase.cs
583
C#
// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Textures.Formats.Dds; using SixLabors.ImageSharp.Textures.Tests.Enums; using SixLabors.ImageSharp.Textures.Tests.TestUtilities.Attributes; using SixLabors.ImageSharp.Textures.Tests.TestUtilities.TextureProviders; using Xunit; namespace SixLabors.ImageSharp.Textures.Tests.Formats.Dds { [Trait("Format", "Dds")] public class DdsDecoderVolumeTests { [Theory] [WithFile(TestTextureFormat.Dds, TestTextureType.Volume, TestTextureTool.NvDxt, "volume has-mips.dds")] public void DdsDecoder_CanDecode_Volume_NvDxt_Has_Mips(TestTextureProvider provider) { using Texture texture = provider.GetTexture(new DdsDecoder()); provider.SaveTextures(texture); } [Theory] [WithFile(TestTextureFormat.Dds, TestTextureType.Volume, TestTextureTool.NvDxt, "volume no-mips.dds")] public void DdsDecoder_CanDecode_Volume_NvDxt_No_Mips(TestTextureProvider provider) { using Texture texture = provider.GetTexture(new DdsDecoder()); provider.SaveTextures(texture); } } }
37.4375
111
0.722871
[ "Apache-2.0" ]
SixLabors/ImageSharp.Textures
tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderVolumeTests.cs
1,198
C#
using PlayersAndMonsters.Repositories.Contracts; using System; using System.Collections.Generic; using System.Text; namespace PlayersAndMonsters.Models.Players { public class Advanced : Player { private const int HEALTH = 250; public Advanced(string username) : base(username, HEALTH) { } } }
19.5
49
0.666667
[ "MIT" ]
ITonev/SoftUni
C#-OOP/Exams/18 April 2019/Structure_Business_Logic/PlayersAndMonsters/Models/Players/Advanced.cs
353
C#
using Shared.Common.Enums; using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; namespace Shared.Models.Base { /// <summary> /// Generic repsonse class /// </summary> /// <typeparam name="T"></typeparam> public class ApiResponses<T> { /// <summary> /// Generic data type, In this propery we will send data to in response of any request /// </summary> public T Data { get; set; } /// <summary> /// Response code is just the code, which gives us the status of request as ok or error or validation etc. /// </summary> public short ResponseCode { get; set; } /// <summary> /// This property will be used when response is ok and need to show the message in ui /// </summary> public string SuccessMsg { get; set; } /// <summary> /// This property will be used when response is error and need to show the message in ui /// </summary> public string FailureMsg { get; set; } /// <summary> /// All validation error are listed in this, validation errors get from model of a request automatically /// </summary> public List<string> ValidationErrors { get; set; } /// <summary> /// we can use this property to tell the request about api which we have called /// </summary> public string ApiName { get; set; } public ApiResponses() { } public ApiResponses(ResponseMsg responseCode, T data, List<string> validationErrors, string successMsg = "", string failureMsg = "", string apiName = "") { ResponseCode = (short)responseCode; Data = data; SuccessMsg = successMsg; FailureMsg = failureMsg; ValidationErrors = validationErrors; ApiName = apiName; } } #region Response Enum Extension public static class ResponseExtensions { public static string ToDescriptionString(this Enum val) { DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); return attributes.Length > 0 ? attributes[0].Description : string.Empty; } } #endregion Response Enum Extension }
32.90411
168
0.609908
[ "MIT" ]
kishanchdry/Core5.0Dapper
Shared/Models/Base/ApiResponses.cs
2,404
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Globalization { /// <summary> /// JapaneseCalendar is based on Gregorian calendar. The month and day values are the same as /// Gregorian calendar. However, the year value is an offset to the Gregorian /// year based on the era. /// /// This system is adopted by Emperor Meiji in 1868. The year value is counted based on the reign of an emperor, /// and the era begins on the day an emperor ascends the throne and continues until his death. /// The era changes at 12:00AM. /// /// For example, the current era is Reiwa. It started on 2019/5/1 A.D. Therefore, Gregorian year 2019 is also Reiwa 1st. /// 2019/5/1 A.D. is also Reiwa 1st 5/1. /// /// Any date in the year during which era is changed can be reckoned in either era. For example, /// 2019/1/1 can be 1/1 Reiwa 1st year or 1/1 Heisei 31st year. /// /// Note: /// The DateTime can be represented by the JapaneseCalendar are limited to two factors: /// 1. The min value and max value of DateTime class. /// 2. The available era information. /// </summary> /// <remarks> /// Calendar support range: /// Calendar Minimum Maximum /// ========== ========== ========== /// Gregorian 1868/09/08 9999/12/31 /// Japanese Meiji 01/01 Reiwa 7981/12/31 /// </remarks> public partial class JapaneseCalendar : Calendar { private static readonly DateTime s_calendarMinValue = new DateTime(1868, 9, 8); public override DateTime MinSupportedDateTime => s_calendarMinValue; public override DateTime MaxSupportedDateTime => DateTime.MaxValue; public override CalendarAlgorithmType AlgorithmType => CalendarAlgorithmType.SolarCalendar; // Using a field initializer rather than a static constructor so that the whole class can be lazy // init. private static volatile EraInfo[]? s_japaneseEraInfo; // m_EraInfo must be listed in reverse chronological order. The most recent era // should be the first element. // That is, m_EraInfo[0] contains the most recent era. // // We know about 4 built-in eras, however users may add additional era(s) from the // registry, by adding values to HKLM\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras // we don't read the registry and instead we call WinRT to get the needed information // // Registry values look like: // yyyy.mm.dd=era_abbrev_english_englishabbrev // // Where yyyy.mm.dd is the registry value name, and also the date of the era start. // yyyy, mm, and dd are the year, month & day the era begins (4, 2 & 2 digits long) // era is the Japanese Era name // abbrev is the Abbreviated Japanese Era Name // english is the English name for the Era (unused) // englishabbrev is the Abbreviated English name for the era. // . is a delimiter, but the value of . doesn't matter. // '_' marks the space between the japanese era name, japanese abbreviated era name // english name, and abbreviated english names. internal static EraInfo[] GetEraInfo() { // See if we need to build it return s_japaneseEraInfo ?? ( s_japaneseEraInfo = GlobalizationMode.UseNls ? NlsGetJapaneseEras() : IcuGetJapaneseEras() ) ?? // See if we have to use the built-in eras ( s_japaneseEraInfo = new EraInfo[] { new EraInfo( 5, 2019, 5, 1, 2018, 1, GregorianCalendar.MaxYear - 2018, "\x4ee4\x548c", "\x4ee4", "R" ), new EraInfo( 4, 1989, 1, 8, 1988, 1, 2019 - 1988, "\x5e73\x6210", "\x5e73", "H" ), new EraInfo( 3, 1926, 12, 25, 1925, 1, 1989 - 1925, "\x662d\x548c", "\x662d", "S" ), new EraInfo( 2, 1912, 7, 30, 1911, 1, 1926 - 1911, "\x5927\x6b63", "\x5927", "T" ), new EraInfo( 1, 1868, 1, 1, 1867, 1, 1912 - 1867, "\x660e\x6cbb", "\x660e", "M" ) } ); } internal static volatile Calendar? s_defaultInstance; internal GregorianCalendarHelper _helper; internal static Calendar GetDefaultInstance() => s_defaultInstance ??= new JapaneseCalendar(); public JapaneseCalendar() { try { new CultureInfo("ja-JP"); } catch (ArgumentException e) { throw new TypeInitializationException(this.GetType().ToString(), e); } _helper = new GregorianCalendarHelper(this, GetEraInfo()); } internal override CalendarId ID => CalendarId.JAPAN; public override DateTime AddMonths(DateTime time, int months) { return _helper.AddMonths(time, months); } public override DateTime AddYears(DateTime time, int years) { return _helper.AddYears(time, years); } public override int GetDaysInMonth(int year, int month, int era) { return _helper.GetDaysInMonth(year, month, era); } public override int GetDaysInYear(int year, int era) { return _helper.GetDaysInYear(year, era); } public override int GetDayOfMonth(DateTime time) { return _helper.GetDayOfMonth(time); } public override DayOfWeek GetDayOfWeek(DateTime time) { return _helper.GetDayOfWeek(time); } public override int GetDayOfYear(DateTime time) { return _helper.GetDayOfYear(time); } public override int GetMonthsInYear(int year, int era) { return _helper.GetMonthsInYear(year, era); } public override int GetWeekOfYear( DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek ) { return _helper.GetWeekOfYear(time, rule, firstDayOfWeek); } public override int GetEra(DateTime time) { return _helper.GetEra(time); } public override int GetMonth(DateTime time) { return _helper.GetMonth(time); } public override int GetYear(DateTime time) { return _helper.GetYear(time); } public override bool IsLeapDay(int year, int month, int day, int era) { return _helper.IsLeapDay(year, month, day, era); } public override bool IsLeapYear(int year, int era) { return _helper.IsLeapYear(year, era); } public override int GetLeapMonth(int year, int era) { return _helper.GetLeapMonth(year, era); } public override bool IsLeapMonth(int year, int month, int era) { return _helper.IsLeapMonth(year, month, era); } public override DateTime ToDateTime( int year, int month, int day, int hour, int minute, int second, int millisecond, int era ) { return _helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era); } /// <summary> /// For Japanese calendar, four digit year is not used. Few emperors will live for more than one hundred years. /// Therefore, for any two digit number, we just return the original number. /// </summary> public override int ToFourDigitYear(int year) { if (year <= 0) { throw new ArgumentOutOfRangeException( nameof(year), year, SR.ArgumentOutOfRange_NeedPosNum ); } if (year > _helper.MaxYear) { throw new ArgumentOutOfRangeException( nameof(year), year, SR.Format(SR.ArgumentOutOfRange_Range, 1, _helper.MaxYear) ); } return year; } public override int[] Eras => _helper.Eras; /// <summary> /// Return the various era strings /// Note: The arrays are backwards of the eras /// </summary> internal static string[] EraNames() { EraInfo[] eras = GetEraInfo(); string[] eraNames = new string[eras.Length]; for (int i = 0; i < eras.Length; i++) { // Strings are in chronological order, eras are backwards order. eraNames[i] = eras[eras.Length - i - 1].eraName!; } return eraNames; } internal static string[] AbbrevEraNames() { EraInfo[] eras = GetEraInfo(); string[] erasAbbrev = new string[eras.Length]; for (int i = 0; i < eras.Length; i++) { // Strings are in chronological order, eras are backwards order. erasAbbrev[i] = eras[eras.Length - i - 1].abbrevEraName!; } return erasAbbrev; } internal static string[] EnglishEraNames() { EraInfo[] eras = GetEraInfo(); string[] erasEnglish = new string[eras.Length]; for (int i = 0; i < eras.Length; i++) { // Strings are in chronological order, eras are backwards order. erasEnglish[i] = eras[eras.Length - i - 1].englishEraName!; } return erasEnglish; } private const int DefaultTwoDigitYearMax = 99; internal override bool IsValidYear(int year, int era) { return _helper.IsValidYear(year, era); } public override int TwoDigitYearMax { get { if (_twoDigitYearMax == -1) { _twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DefaultTwoDigitYearMax); } return _twoDigitYearMax; } set { VerifyWritable(); if (value < 99 || value > _helper.MaxYear) { throw new ArgumentOutOfRangeException( nameof(value), value, SR.Format(SR.ArgumentOutOfRange_Range, 99, _helper.MaxYear) ); } _twoDigitYearMax = value; } } } }
33.695187
125
0.478654
[ "MIT" ]
belav/runtime
src/libraries/System.Private.CoreLib/src/System/Globalization/JapaneseCalendar.cs
12,602
C#
// Released under the MIT License. // // Copyright (c) 2018 Ntreev Soft co., Ltd. // Copyright (c) 2020 Jeesu Choi // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Forked from https://github.com/NtreevSoft/Crema // Namespaces and files starting with "Ntreev" have been renamed to "JSSoft". using JSSoft.Crema.Presentation.Framework; using JSSoft.Crema.Presentation.Users.Dialogs.ViewModels; using JSSoft.Crema.Presentation.Users.Properties; using JSSoft.Crema.ServiceModel; using JSSoft.Crema.Services; using JSSoft.Library; using JSSoft.ModernUI.Framework; using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; namespace JSSoft.Crema.Presentation.Users.BrowserItems.ViewModels { [Export(typeof(IBrowserItem))] [Export(typeof(UserBrowserViewModel))] [ParentType("JSSoft.Crema.Presentation.Tables.IBrowserService, JSSoft.Crema.Presentation.Tables, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null")] [ParentType("JSSoft.Crema.Presentation.Types.IBrowserService, JSSoft.Crema.Presentation.Types, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null")] [ParentType("JSSoft.Crema.Presentation.Home.IBrowserService, JSSoft.Crema.Presentation.Home, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null")] class UserBrowserViewModel : TreeViewBase, IBrowserItem { private readonly Authenticator authenticator; private readonly ICremaAppHost cremaAppHost; private readonly IShell shell; private readonly IEnumerable<IPropertyService> propertyServices; private readonly DelegateCommand deleteCommand; [ImportingConstructor] public UserBrowserViewModel(Authenticator authenticator, ICremaAppHost cremaAppHost, IShell shell, [ImportMany] IEnumerable<IPropertyService> propertyServices) { this.authenticator = authenticator; this.cremaAppHost = cremaAppHost; this.cremaAppHost.Opened += CremaAppHost_Opened; this.cremaAppHost.Closed += CremaAppHost_Closed; this.shell = shell; this.propertyServices = propertyServices; this.deleteCommand = new DelegateCommand(this.Delete_Execute, this.Delete_CanExecute); this.DisplayName = Resources.Title_Users; this.Dispatcher.InvokeAsync(() => { foreach (var item in this.propertyServices) { this.AttachPropertyService(item); } }); } public async Task NotifyMessageAsync() { var userContext = this.cremaAppHost.GetService(typeof(IUserContext)) as IUserContext; var dialog = await NotifyMessageViewModel.CreateInstanceAsync(this.authenticator, userContext); if (dialog != null) await dialog.ShowDialogAsync(); } public bool IsVisible => this.cremaAppHost.IsOpened; public bool IsAdmin => this.authenticator.Authority == Authority.Admin; public ICommand DeleteCommand => this.deleteCommand; protected override bool Predicate(IPropertyService propertyService) { return this.shell.SelectedService.GetType().Assembly == propertyService.GetType().Assembly; } private void CremaAppHost_Closed(object sender, EventArgs e) { this.cremaAppHost.UserConfigs.Commit(this); this.FilterExpression = string.Empty; this.Items.Clear(); } private async void CremaAppHost_Opened(object sender, EventArgs e) { if (this.cremaAppHost.GetService(typeof(IUserContext)) is IUserContext userContext) { var userCollection = userContext.GetService(typeof(IUserCollection)) as IUserCollection; var userCategoryCollection = userContext.GetService(typeof(IUserCategoryCollection)) as IUserCategoryCollection; var viewModel = await userContext.Dispatcher.InvokeAsync(() => { userCollection.MessageReceived += Users_MessageReceived; return new UserCategoryTreeViewItemViewModel(this.authenticator, userCategoryCollection.Root, this); }); this.Items.Add(viewModel); this.cremaAppHost.UserConfigs.Update(this); } } private async void Users_MessageReceived(object sender, MessageEventArgs e) { var message = e.Message; var messageType = e.MessageType; var sendUserID = e.UserID; var userIDs = e.Items.Select(item => item.ID).ToArray(); if (messageType == MessageType.Notification) { if (e.UserID != this.authenticator.ID && (userIDs.Any() == false || userIDs.Any(item => item == this.authenticator.ID) == true)) { await this.Dispatcher.InvokeAsync(() => { }); var title = string.Format(Resources.Title_AdministratorMessage_Format, sendUserID); if (this.cremaAppHost.GetService(typeof(IFlashService)) is IFlashService flashService) flashService.Flash(); await AppMessageBox.ShowAsync(message, title, MessageBoxButton.OK, MessageBoxImage.Information); } } else if (messageType == MessageType.None) { if (e.UserID != this.authenticator.ID) { var userContext = this.cremaAppHost.GetService(typeof(IUserContext)) as IUserContext; var dialog = await ViewMessageViewModel.CreateInstanceAsync(this.authenticator, userContext, message, sendUserID); if (dialog != null) await dialog.ShowDialogAsync(); } } } private void Delete_Execute(object parameter) { if (parameter is UserTreeViewItemViewModel userViewModel) { userViewModel.DeleteCommand.Execute(parameter); } else if (parameter is UserCategoryTreeViewItemViewModel categoryViewModel) { categoryViewModel.DeleteCommand.Execute(parameter); } } private bool Delete_CanExecute(object parameter) { if (parameter is UserTreeViewItemViewModel userViewModel) { return userViewModel.DeleteCommand.CanExecute(parameter); } else if (parameter is UserCategoryTreeViewItemViewModel categoryViewModel) { return categoryViewModel.DeleteCommand.CanExecute(parameter); } return false; } [ConfigurationProperty(ScopeType = typeof(IUserConfiguration))] [System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:사용되지 않는 private 멤버 제거", Justification = "<보류 중>")] private string[] Settings { get => this.GetSettings(); set => this.SetSettings(value); } } }
45.740331
167
0.656963
[ "MIT" ]
s2quake/JSSoft.Crema
client/JSSoft.Crema.Presentation.Users/BrowserItems/ViewModels/UserBrowserViewModel.cs
8,307
C#
using System; using Windows.UI.Xaml.Data; namespace Famoser.BeerCompanion.Presentation.WindowsUniversal.Converter.Format { public class FormatDouble : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var dub = (double) value; var decim = 2; if (parameter != null && !int.TryParse((string) parameter, out decim)) decim = 2; return Math.Round(dub, decim).ToString("00.00"); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }
29.583333
99
0.619718
[ "MIT" ]
famoser/BeerCompanion
Famoser.BeerCompanion.Presentation.WindowsUniversal/Converter/Format/FormatDouble.cs
712
C#
using ReClassNET.Controls; namespace ReClassNET.Forms { partial class ProcessBrowserForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.processDataGridView = new System.Windows.Forms.DataGridView(); this.iconColumn = new System.Windows.Forms.DataGridViewImageColumn(); this.processNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pidColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pathColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.filterCheckBox = new System.Windows.Forms.CheckBox(); this.refreshButton = new System.Windows.Forms.Button(); this.attachToProcessButton = new System.Windows.Forms.Button(); this.loadSymbolsCheckBox = new System.Windows.Forms.CheckBox(); this.filterGroupBox = new System.Windows.Forms.GroupBox(); this.previousProcessLinkLabel = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.filterTextBox = new System.Windows.Forms.TextBox(); this.bannerBox = new BannerBox(); ((System.ComponentModel.ISupportInitialize)(this.processDataGridView)).BeginInit(); this.filterGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // // processDataGridView // this.processDataGridView.AllowUserToAddRows = false; this.processDataGridView.AllowUserToDeleteRows = false; this.processDataGridView.AllowUserToResizeColumns = false; this.processDataGridView.AllowUserToResizeRows = false; this.processDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.processDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; this.processDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.processDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.iconColumn, this.processNameColumn, this.pidColumn, this.pathColumn}); this.processDataGridView.Location = new System.Drawing.Point(12, 199); this.processDataGridView.MultiSelect = false; this.processDataGridView.Name = "processDataGridView"; this.processDataGridView.ReadOnly = true; this.processDataGridView.RowHeadersVisible = false; this.processDataGridView.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.processDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.processDataGridView.Size = new System.Drawing.Size(549, 291); this.processDataGridView.TabIndex = 0; this.processDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.processDataGridView_CellMouseDoubleClick); // // iconColumn // this.iconColumn.DataPropertyName = "icon"; this.iconColumn.HeaderText = ""; this.iconColumn.MinimumWidth = 18; this.iconColumn.Name = "iconColumn"; this.iconColumn.ReadOnly = true; this.iconColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.iconColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.iconColumn.Width = 18; // // processNameColumn // this.processNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.processNameColumn.DataPropertyName = "name"; this.processNameColumn.HeaderText = "Process"; this.processNameColumn.Name = "processNameColumn"; this.processNameColumn.ReadOnly = true; this.processNameColumn.Width = 70; // // pidColumn // this.pidColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.pidColumn.DataPropertyName = "id"; this.pidColumn.HeaderText = "PID"; this.pidColumn.Name = "pidColumn"; this.pidColumn.ReadOnly = true; this.pidColumn.Width = 50; // // pathColumn // this.pathColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.pathColumn.DataPropertyName = "path"; this.pathColumn.HeaderText = "Path"; this.pathColumn.Name = "pathColumn"; this.pathColumn.ReadOnly = true; // // filterCheckBox // this.filterCheckBox.AutoSize = true; this.filterCheckBox.Checked = true; this.filterCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.filterCheckBox.Location = new System.Drawing.Point(9, 72); this.filterCheckBox.Name = "filterCheckBox"; this.filterCheckBox.Size = new System.Drawing.Size(158, 17); this.filterCheckBox.TabIndex = 1; this.filterCheckBox.Text = "Exclude common processes"; this.filterCheckBox.UseVisualStyleBackColor = true; this.filterCheckBox.CheckedChanged += new System.EventHandler(this.filterCheckBox_CheckedChanged); // // refreshButton // this.refreshButton.Image = global::ReClassNET.Properties.Resources.B16x16_Arrow_Refresh; this.refreshButton.Location = new System.Drawing.Point(9, 99); this.refreshButton.Name = "refreshButton"; this.refreshButton.Size = new System.Drawing.Size(158, 23); this.refreshButton.TabIndex = 2; this.refreshButton.Text = "Refresh"; this.refreshButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.refreshButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.refreshButton.UseVisualStyleBackColor = true; this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); // // attachToProcessButton // this.attachToProcessButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.attachToProcessButton.DialogResult = System.Windows.Forms.DialogResult.OK; this.attachToProcessButton.Image = global::ReClassNET.Properties.Resources.B16x16_Accept; this.attachToProcessButton.Location = new System.Drawing.Point(12, 519); this.attachToProcessButton.Name = "attachToProcessButton"; this.attachToProcessButton.Size = new System.Drawing.Size(549, 23); this.attachToProcessButton.TabIndex = 3; this.attachToProcessButton.Text = "Attach to Process"; this.attachToProcessButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.attachToProcessButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.attachToProcessButton.UseVisualStyleBackColor = true; // // loadSymbolsCheckBox // this.loadSymbolsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.loadSymbolsCheckBox.AutoSize = true; this.loadSymbolsCheckBox.Location = new System.Drawing.Point(12, 496); this.loadSymbolsCheckBox.Name = "loadSymbolsCheckBox"; this.loadSymbolsCheckBox.Size = new System.Drawing.Size(92, 17); this.loadSymbolsCheckBox.TabIndex = 4; this.loadSymbolsCheckBox.Text = "Load Symbols"; this.loadSymbolsCheckBox.UseVisualStyleBackColor = true; // // filterGroupBox // this.filterGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.filterGroupBox.Controls.Add(this.previousProcessLinkLabel); this.filterGroupBox.Controls.Add(this.label2); this.filterGroupBox.Controls.Add(this.label1); this.filterGroupBox.Controls.Add(this.filterCheckBox); this.filterGroupBox.Controls.Add(this.refreshButton); this.filterGroupBox.Controls.Add(this.filterTextBox); this.filterGroupBox.Location = new System.Drawing.Point(12, 60); this.filterGroupBox.Name = "filterGroupBox"; this.filterGroupBox.Size = new System.Drawing.Size(549, 133); this.filterGroupBox.TabIndex = 5; this.filterGroupBox.TabStop = false; this.filterGroupBox.Text = "Filter"; // // previousProcessLinkLabel // this.previousProcessLinkLabel.AutoSize = true; this.previousProcessLinkLabel.Location = new System.Drawing.Point(103, 47); this.previousProcessLinkLabel.Name = "previousProcessLinkLabel"; this.previousProcessLinkLabel.Size = new System.Drawing.Size(19, 13); this.previousProcessLinkLabel.TabIndex = 3; this.previousProcessLinkLabel.TabStop = true; this.previousProcessLinkLabel.Text = "<>"; this.previousProcessLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.previousProcessLinkLabel_LinkClicked); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 47); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(92, 13); this.label2.TabIndex = 2; this.label2.Text = "Previous Process:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 22); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(79, 13); this.label1.TabIndex = 1; this.label1.Text = "Process Name:"; // // filterTextBox // this.filterTextBox.Location = new System.Drawing.Point(103, 19); this.filterTextBox.Name = "filterTextBox"; this.filterTextBox.Size = new System.Drawing.Size(270, 20); this.filterTextBox.TabIndex = 0; this.filterTextBox.TextChanged += new System.EventHandler(this.filterTextBox_TextChanged); // // bannerBox // this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Magnifier; this.bannerBox.Location = new System.Drawing.Point(0, 0); this.bannerBox.Name = "bannerBox"; this.bannerBox.Size = new System.Drawing.Size(573, 48); this.bannerBox.TabIndex = 6; this.bannerBox.Text = "Select the process to which LoliConCentral is to be attached."; this.bannerBox.Title = "Attach to Process"; // // ProcessBrowserForm // this.AcceptButton = this.attachToProcessButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(573, 554); this.Controls.Add(this.bannerBox); this.Controls.Add(this.filterGroupBox); this.Controls.Add(this.loadSymbolsCheckBox); this.Controls.Add(this.attachToProcessButton); this.Controls.Add(this.processDataGridView); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ProcessBrowserForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "LoliConCentral - Attach to Process"; ((System.ComponentModel.ISupportInitialize)(this.processDataGridView)).EndInit(); this.filterGroupBox.ResumeLayout(false); this.filterGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.DataGridView processDataGridView; private System.Windows.Forms.CheckBox filterCheckBox; private System.Windows.Forms.Button refreshButton; private System.Windows.Forms.Button attachToProcessButton; private System.Windows.Forms.CheckBox loadSymbolsCheckBox; private System.Windows.Forms.DataGridViewImageColumn iconColumn; private System.Windows.Forms.DataGridViewTextBoxColumn processNameColumn; private System.Windows.Forms.DataGridViewTextBoxColumn pidColumn; private System.Windows.Forms.DataGridViewTextBoxColumn pathColumn; private System.Windows.Forms.GroupBox filterGroupBox; private System.Windows.Forms.LinkLabel previousProcessLinkLabel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox filterTextBox; private BannerBox bannerBox; } }
46.460432
161
0.758284
[ "MIT" ]
Akandesh/ReClass.NET
ReClass.NET/Forms/ProcessBrowserForm.Designer.cs
12,916
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Globalization; using System.Text; namespace SpecificationTranslator.Query { /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public class SqlServerSqlGenerationHelper : RelationalSqlGenerationHelper { private const string DateTimeFormatConst = "yyyy-MM-ddTHH:mm:ss.fffK"; private const string DateTimeFormatStringConst = "'{0:" + DateTimeFormatConst + "}'"; private const string DateTimeOffsetFormatConst = "yyyy-MM-ddTHH:mm:ss.fffzzz"; private const string DateTimeOffsetFormatStringConst = "'{0:" + DateTimeOffsetFormatConst + "}'"; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override string BatchTerminator => "GO" + Environment.NewLine + Environment.NewLine; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string DateTimeFormat => DateTimeFormatConst; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string DateTimeFormatString => DateTimeFormatStringConst; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string DateTimeOffsetFormat => DateTimeOffsetFormatConst; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string DateTimeOffsetFormatString => DateTimeOffsetFormatStringConst; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override string EscapeIdentifier(string identifier) => identifier.Replace("]", "]]"); /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override void EscapeIdentifier(StringBuilder builder, string identifier) { var initialLength = builder.Length; builder.Append(identifier); builder.Replace("]", "]]", initialLength, identifier.Length); } /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override string DelimitIdentifier(string identifier) => $"[{EscapeIdentifier(identifier)}]"; // Interpolation okay; strings /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override void DelimitIdentifier(StringBuilder builder, string identifier) { builder.Append('['); EscapeIdentifier(builder, identifier); builder.Append(']'); } /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override void GenerateLiteralValue(StringBuilder builder, byte[] value) { builder.Append("0x"); foreach (var @byte in value) { builder.Append(@byte.ToString("X2", CultureInfo.InvariantCulture)); } } /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string GenerateLiteralValue(string value) => $"N'{EscapeLiteral(value)}'"; /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override string GenerateLiteralValue(DateTime value) => $"'{value.ToString(DateTimeFormat, CultureInfo.InvariantCulture)}'"; // Interpolation okay; strings /// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> protected override string GenerateLiteralValue(DateTimeOffset value) => $"'{value.ToString(DateTimeOffsetFormat, CultureInfo.InvariantCulture)}'"; // Interpolation okay; strings } }
50.113821
120
0.647469
[ "MIT" ]
ShadowTracker/SpecificationTranslator
src/SpecificationTranslator/Query/SqlServerSqlGenerationHelper.cs
6,164
C#
namespace BezelEngineArchiveEditor { partial class Credits { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.label6 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(1, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(108, 13); this.label1.TabIndex = 0; this.label1.Text = "Author : KillzXGaming"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(1, 54); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(58, 13); this.label2.TabIndex = 1; this.label2.Text = "Thanks to:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(1, 81); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(229, 13); this.label3.TabIndex = 2; this.label3.Text = "Aluigi (Bms script to reference layout on the file)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(1, 103); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(143, 13); this.label4.TabIndex = 3; this.label4.Text = "Syroot/Ray for Library File IO"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(1, 177); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(117, 13); this.label5.TabIndex = 4; this.label5.Text = "ZstdNet (Compression)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(1, 125); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(167, 13); this.label7.TabIndex = 6; this.label7.Text = "Exelix (Sarc lib for some functions)"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(1, 200); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(152, 13); this.label9.TabIndex = 8; this.label9.Text = "Be.HexEditor by Bernhard Elbl"; // // linkLabel1 // this.linkLabel1.AutoSize = true; this.linkLabel1.Location = new System.Drawing.Point(1, 225); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(128, 13); this.linkLabel1.TabIndex = 10; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "Treeview Icons by icons8"; this.linkLabel1.Click += new System.EventHandler(this.linkLabel1_Click); // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(1, 150); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(214, 13); this.label6.TabIndex = 11; this.label6.Text = "Leoetlino (helped with dictionary generation)"; // // Credits // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(246, 259); this.Controls.Add(this.label6); this.Controls.Add(this.linkLabel1); this.Controls.Add(this.label9); this.Controls.Add(this.label7); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "Credits"; this.Text = "Credits"; this.Load += new System.EventHandler(this.Credits_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label9; private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.Label label6; } }
40.352201
107
0.547382
[ "BSD-3-Clause" ]
CVFireDragon/BEA-Library-Editor
BezelEngineArchiveEditor/Credits.Designer.cs
6,418
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; using Azure.Security.Attestation.Models; namespace Azure.Security.Attestation { internal partial class AttestationRestClient { private string instanceUrl; private string apiVersion; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; /// <summary> Initializes a new instance of AttestationRestClient. </summary> /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> /// <param name="instanceUrl"> The attestation instance base URI, for example https://mytenant.attest.azure.net. </param> /// <param name="apiVersion"> Api Version. </param> /// <exception cref="ArgumentNullException"> <paramref name="instanceUrl"/> or <paramref name="apiVersion"/> is null. </exception> public AttestationRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string instanceUrl, string apiVersion = "2020-10-01") { if (instanceUrl == null) { throw new ArgumentNullException(nameof(instanceUrl)); } if (apiVersion == null) { throw new ArgumentNullException(nameof(apiVersion)); } this.instanceUrl = instanceUrl; this.apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } internal HttpMessage CreateAttestOpenEnclaveRequest(AttestOpenEnclaveRequest request) { var message = _pipeline.CreateMessage(); var request0 = message.Request; request0.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(instanceUrl, false); uri.AppendPath("/attest/OpenEnclave", false); uri.AppendQuery("api-version", apiVersion, true); request0.Uri = uri; request0.Headers.Add("Content-Type", "application/json"); request0.Headers.Add("Accept", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(request); request0.Content = content; return message; } /// <summary> Processes an OpenEnclave report , producing an artifact. The type of artifact produced is dependent upon attestation policy. </summary> /// <param name="request"> Request object containing the quote. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public async Task<Response<AttestationResponse>> AttestOpenEnclaveAsync(AttestOpenEnclaveRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestOpenEnclaveRequest(request); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { AttestationResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = AttestationResponse.DeserializeAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// <summary> Processes an OpenEnclave report , producing an artifact. The type of artifact produced is dependent upon attestation policy. </summary> /// <param name="request"> Request object containing the quote. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public Response<AttestationResponse> AttestOpenEnclave(AttestOpenEnclaveRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestOpenEnclaveRequest(request); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { AttestationResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); value = AttestationResponse.DeserializeAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } internal HttpMessage CreateAttestSgxEnclaveRequest(AttestSgxEnclaveRequest request) { var message = _pipeline.CreateMessage(); var request0 = message.Request; request0.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(instanceUrl, false); uri.AppendPath("/attest/SgxEnclave", false); uri.AppendQuery("api-version", apiVersion, true); request0.Uri = uri; request0.Headers.Add("Content-Type", "application/json"); request0.Headers.Add("Accept", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(request); request0.Content = content; return message; } /// <summary> Processes an SGX enclave quote, producing an artifact. The type of artifact produced is dependent upon attestation policy. </summary> /// <param name="request"> Request object containing the quote. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public async Task<Response<AttestationResponse>> AttestSgxEnclaveAsync(AttestSgxEnclaveRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestSgxEnclaveRequest(request); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { AttestationResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = AttestationResponse.DeserializeAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// <summary> Processes an SGX enclave quote, producing an artifact. The type of artifact produced is dependent upon attestation policy. </summary> /// <param name="request"> Request object containing the quote. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public Response<AttestationResponse> AttestSgxEnclave(AttestSgxEnclaveRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestSgxEnclaveRequest(request); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { AttestationResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); value = AttestationResponse.DeserializeAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } internal HttpMessage CreateAttestTpmRequest(TpmAttestationRequest request) { var message = _pipeline.CreateMessage(); var request0 = message.Request; request0.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.AppendRaw(instanceUrl, false); uri.AppendPath("/attest/Tpm", false); uri.AppendQuery("api-version", apiVersion, true); request0.Uri = uri; request0.Headers.Add("Content-Type", "application/json"); request0.Headers.Add("Accept", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(request); request0.Content = content; return message; } /// <summary> Processes attestation evidence from a VBS enclave, producing an attestation result. The attestation result produced is dependent upon the attestation policy. </summary> /// <param name="request"> Request object. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public async Task<Response<TpmAttestationResponse>> AttestTpmAsync(TpmAttestationRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestTpmRequest(request); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { TpmAttestationResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = TpmAttestationResponse.DeserializeTpmAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// <summary> Processes attestation evidence from a VBS enclave, producing an attestation result. The attestation result produced is dependent upon the attestation policy. </summary> /// <param name="request"> Request object. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="request"/> is null. </exception> public Response<TpmAttestationResponse> AttestTpm(TpmAttestationRequest request, CancellationToken cancellationToken = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } using var message = CreateAttestTpmRequest(request); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { TpmAttestationResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); value = TpmAttestationResponse.DeserializeTpmAttestationResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } } }
50.503759
190
0.621706
[ "MIT" ]
ChenglongLiu/azure-sdk-for-net
sdk/attestation/Azure.Security.Attestation/src/Generated/AttestationRestClient.cs
13,434
C#
namespace Sudoku.Data; /// <summary> /// Defines a chain node, with basic information about the node. At the same time you can get the root node /// of the chain, using the current node as the tail node. /// </summary> /// <remarks> /// The data structure uses an <see cref="int"/> value to represent an instance. The bit usage details is as below: /// <code><![CDATA[ /// | (4) | (3) | (2) | (1) | /// |-------|-------|-------|-------| /// 32 24 16 8 0 /// ]]></code> /// Where: /// <list type="table"> /// <item> /// <term>Part <c>(1)</c>, bits 0..8</term> /// <description>The mask of the digit used. The value only uses 4 bits.</description> /// </item> /// <item> /// <term>Part <c>(2)</c>, bits 8..16</term> /// <description>The mask of the cell used. The value only uses 7 bits.</description> /// </item> /// <item> /// <term>Part <c>(3)</c>, bits 16..24</term> /// <description> /// The mask of the on/off status indicating whether the node is currently on. The value only uses 1 bit. /// </description> /// </item> /// <item> /// <term>Part <c>(4)</c>, bits 24..32</term> /// <description>The mask of the number of parent nodes stored. The value only uses 3 bits.</description> /// </item> /// </list> /// </remarks> /// <param name="Mask">Indicates the mask that handles and stores the basic information of the current node.</param> [AutoEquality(nameof(Mask))] [AutoDeconstructLambda(nameof(Candidate), nameof(IsOn))] [AutoDeconstruct(nameof(Cell), nameof(Digit), nameof(IsOn))] public unsafe partial record struct ChainNode(int Mask) : IValueEquatable<ChainNode> { /// <summary> /// Indicates the undefined instance that is used for providing with a value that only used in an invalid case. /// </summary> public static readonly ChainNode Undefined; /// <summary> /// Indicates the parents. /// </summary> private ChainNode[]? _rawParents = null; /// <summary> /// Initializes a <see cref="ChainNode"/> instance using the specified cell, digit and the status /// value as a <see cref="bool"/> value. /// </summary> /// <param name="cell">The cell used.</param> /// <param name="digit">The digit used.</param> /// <param name="isOn">A <see cref="bool"/> result indicating whether the node is on.</param> [MethodImpl(MethodImplOptions.AggressiveInlining)] public ChainNode(byte cell, byte digit, bool isOn) : this(ConstructMask(cell, digit, isOn)) { } /// <summary> /// Initializes a <see cref="ChainNode"/> instance using the specified cell, digit, /// the status value as a <see cref="bool"/> value, and a parent node. /// </summary> /// <param name="cell">The cell used.</param> /// <param name="digit">The digit used.</param> /// <param name="isOn">A <see cref="bool"/> result indicating whether the node is on.</param> /// <param name="parent">The parent node.</param> [MethodImpl(MethodImplOptions.AggressiveInlining)] public ChainNode(byte cell, byte digit, bool isOn, in ChainNode parent) : this(ConstructMask(cell, digit, isOn, 1)) { _rawParents = new ChainNode[7]; _rawParents[0] = parent; } /// <summary> /// Initializes a <see cref="ChainNode"/> instance using the specified cell, digit, /// the status value as a <see cref="bool"/> value, and the parent nodes. /// </summary> /// <param name="cell">The cell used.</param> /// <param name="digit">The digit used.</param> /// <param name="isOn">A <see cref="bool"/> result indicating whether the node is on.</param> /// <param name="parents">The parent nodes.</param> [MethodImpl(MethodImplOptions.AggressiveInlining)] internal ChainNode(byte cell, byte digit, bool isOn, ChainNode[] parents) : this(ConstructMask(cell, digit, isOn, (byte)parents.Length)) => _rawParents = parents; /// <summary> /// Gets the possible useful parents. /// </summary> public readonly ChainNode[]? Parents { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _rawParents?[..ParentsCount]; } /// <summary> /// Indicates whether the node is at the <b>on</b> status. /// </summary> /// <remarks> /// The possible <b>status</b>es of the node are <b>on</b> and <b>off</b>, where: /// <list type="table"> /// <listheader> /// <term>Status</term> /// <description>Meaning</description> /// </listheader> /// <item> /// <term>On</term> /// <description> /// The digit is true in the cell, which means the digit should be filled in this cell. /// </description> /// </item> /// <item> /// <term>Off</term> /// <description> /// The digit is false in the cell, which means the digit should be eliminated from this cell. /// </description> /// </item> /// </list> /// </remarks> public readonly bool IsOn { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (Mask >> 16 & 1) != 0; } /// <summary> /// Indicates the cell used. /// </summary> public readonly byte Cell { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (byte)(Mask >> 8 & 255); } /// <summary> /// Indicates the digit used. /// </summary> public readonly byte Digit { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (byte)(Mask & 255); } /// <summary> /// Indicates the total number of parent nodes. /// </summary> /// <!--<value>The number of cells to assign.</value>--> /// <!--<returns>The number of parents.</returns>--> public byte ParentsCount { [MethodImpl(MethodImplOptions.AggressiveInlining)] readonly get => (byte)(Mask >> 24 & 7); [MethodImpl(MethodImplOptions.AggressiveInlining)] private set => Mask = Mask & ((1 << 24) - 1) | value << 24; } /// <summary> /// Indicates the total number of the ancestors. /// </summary> public readonly int AncestorsCount { get { var ancestors = new List<ChainNode>(); for (List<ChainNode> todo = new() { this }, next; todo.Count != 0; todo = next) { next = new(); foreach (var p in todo) { bool alreadyContains = false; foreach (var ancestor in ancestors) { if (ancestor == p) { alreadyContains = true; break; } } if (!alreadyContains) { ancestors.Add(p); for (int i = 0, count = p.ParentsCount; i < count; i++) { next.Add(p._rawParents![i]); } } } } return ancestors.Count; } } /// <summary> /// Indicates the candidate used. /// </summary> public readonly short Candidate { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (short)(Mask & 1023); } /// <summary> /// <para>Indicates the root of the current chain.</para> /// <para> /// If the property <see cref="Parents"/> isn't <see langword="null"/>, /// then the property will search for the parent node and check its parent node recursively /// (i.e. checks the grandparents, great-grandparents, etc.). /// </para> /// </summary> /// <returns>Returns the root of the chain.</returns> /// <seealso cref="Parents"/> /// <seealso cref="ParentsCount"/> public readonly ChainNode Root { get { if (ParentsCount == 0) { return Undefined; } var result = _rawParents![0]; while (result._rawParents is { } p) { result = p[0]; } return result; } } /// <summary> /// Indicates the nodes that the current node lies in. /// </summary> public readonly IReadOnlyList<ChainNode> WholeChain { get { List<ChainNode> todo = new() { this }, tempList = new(), done = new(), next = new(); while (todo.Count != 0) { next.Clear(); foreach (var p in todo) { bool contains = false; foreach (var node in done) { if (node == p) { contains = true; break; } } if (!contains) { done.Add(p); tempList.Add(p); for (int i = 0, count = p.ParentsCount; i < count; i++) { next.Add(p._rawParents![i]); } } } todo = next; } return tempList; } } /// <summary> /// Determine whether the node is the parent of the specified node. /// </summary> /// <param name="node">The chain node.</param> /// <returns>A <see cref="bool"/> result.</returns> public readonly bool IsParentOf(ChainNode node) { var temp = node; while (temp.ParentsCount != 0) { temp = temp._rawParents![0]; if (temp == this) { return true; } } return false; } /// <inheritdoc cref="object.GetHashCode"/> [MethodImpl(MethodImplOptions.AggressiveInlining)] public override readonly int GetHashCode() => Mask; /// <inheritdoc cref="object.ToString"/> public override readonly string ToString() { if (ParentsCount == 0) { return $"Candidate: {new Cells { Cell }}({Digit + 1})"; } else { var nodes = Candidates.Empty; for (int i = 0; i < ParentsCount; i++) { var parent = _rawParents![i]; nodes.AddAnyway(parent.Candidate); } return $"Candidate: {new Cells { Cell }}({Digit + 1}), Parent(s): {nodes}"; } } /// <summary> /// Append a chain node into the collection, as one of the parent nodes. /// </summary> /// <param name="chain">The chain node to be added.</param> /// <exception cref="InvalidOperationException"> /// Throws when the inner parent nodes collection is full. /// </exception> [MethodImpl(MethodImplOptions.AggressiveInlining)] public void AddParent(ChainNode chain) { switch (ParentsCount) { case 0: { _rawParents = new ChainNode[7]; ParentsCount = 1; break; } case >= 7: { throw new InvalidOperationException( "Can't append any elements into the collection due to the list being full." ); } default: { _rawParents![ParentsCount++] = chain; break; } } } /// <summary> /// Constructs the mask. /// </summary> /// <param name="cell">The cell.</param> /// <param name="digit">The digit.</param> /// <param name="isOn">The on/off status.</param> /// <param name="parentsCount">The number of parents.</param> /// <returns>The mask.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int ConstructMask(byte cell, byte digit, bool isOn, byte parentsCount = 0) => parentsCount << 24 | (isOn ? 1 : 0) << 16 | cell << 8 | digit; }
27.048
116
0.625752
[ "MIT" ]
SunnieShine/Sudoku
src/Sudoku.Core/Data/ChainNode.cs
10,145
C#
// <copyright file="DivergenceStopCriteriumTest.cs" company="Math.NET"> // Math.NET Numerics, part of the Math.NET Project // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // // Copyright (c) 2009-2013 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // </copyright> namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.Solvers.StopCriterium { using System; using LinearAlgebra.Complex32; using LinearAlgebra.Complex32.Solvers.StopCriterium; using LinearAlgebra.Generic.Solvers.Status; using NUnit.Framework; using Complex32 = Numerics.Complex32; /// <summary> /// Divergence stop criterium test. /// </summary> [TestFixture] public sealed class DivergenceStopCriteriumTest { /// <summary> /// Create with negative maximum increase throws <c>ArgumentOutOfRangeException</c>. /// </summary> [Test] public void CreateWithNegativeMaximumIncreaseThrowsArgumentOutOfRangeException() { Assert.Throws<ArgumentOutOfRangeException>(() => new DivergenceStopCriterium(-0.1)); } /// <summary> /// Create with illegal minimum iterations throws <c>ArgumentOutOfRangeException</c>. /// </summary> [Test] public void CreateWithIllegalMinimumIterationsThrowsArgumentOutOfRangeException() { Assert.Throws<ArgumentOutOfRangeException>(() => new DivergenceStopCriterium(2)); } /// <summary> /// Can create stop criterium. /// </summary> [Test] public void Create() { var criterium = new DivergenceStopCriterium(0.1, 3); Assert.IsNotNull(criterium, "There should be a criterium"); Assert.AreEqual(0.1, criterium.MaximumRelativeIncrease, "Incorrect maximum"); Assert.AreEqual(3, criterium.MinimumNumberOfIterations, "Incorrect iteration count"); } /// <summary> /// Can reset maximum increase. /// </summary> [Test] public void ResetMaximumIncrease() { var criterium = new DivergenceStopCriterium(0.5, 3); Assert.IsNotNull(criterium, "There should be a criterium"); Assert.AreEqual(0.5, criterium.MaximumRelativeIncrease, "Incorrect maximum"); criterium.ResetMaximumRelativeIncreaseToDefault(); Assert.AreEqual(DivergenceStopCriterium.DefaultMaximumRelativeIncrease, criterium.MaximumRelativeIncrease, "Incorrect value"); } /// <summary> /// Can reset minimum iterations below maximum. /// </summary> [Test] public void ResetMinimumIterationsBelowMaximum() { var criterium = new DivergenceStopCriterium(0.5, 15); Assert.IsNotNull(criterium, "There should be a criterium"); Assert.AreEqual(15, criterium.MinimumNumberOfIterations, "Incorrect iteration count"); criterium.ResetNumberOfIterationsToDefault(); Assert.AreEqual(DivergenceStopCriterium.DefaultMinimumNumberOfIterations, criterium.MinimumNumberOfIterations, "Incorrect value"); } /// <summary> /// Determine status with illegal iteration number throws <c>ArgumentOutOfRangeException</c>. /// </summary> [Test] public void DetermineStatusWithIllegalIterationNumberThrowsArgumentOutOfRangeException() { var criterium = new DivergenceStopCriterium(0.5, 15); Assert.Throws<ArgumentOutOfRangeException>(() => criterium.DetermineStatus( -1, DenseVector.Create(3, i => 4), DenseVector.Create(3, i => 5), DenseVector.Create(3, i => 6))); } /// <summary> /// Determine status with <c>null</c> residual vector throws <c>ArgumentNullException</c>. /// </summary> [Test] public void DetermineStatusWithNullResidualVectorThrowsArgumentNullException() { var criterium = new DivergenceStopCriterium(0.5, 15); Assert.Throws<ArgumentNullException>(() => criterium.DetermineStatus( 1, DenseVector.Create(3, i => 4), DenseVector.Create(3, i => 5), null)); } /// <summary> /// Can determine status with too few iterations. /// </summary> [Test] public void DetermineStatusWithTooFewIterations() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); // Add residuals. We should not diverge because we'll have to few iterations for (var i = 0; i < Iterations - 1; i++) { criterium.DetermineStatus( i, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32((i + 1)*(Increase + 0.1f), 0)})); Assert.IsInstanceOf(typeof (CalculationRunning), criterium.Status, "Status check fail."); } } /// <summary> /// Can determine status with no divergence. /// </summary> [Test] public void DetermineStatusWithNoDivergence() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); // Add residuals. We should not diverge because we won't have enough increase for (var i = 0; i < Iterations*2; i++) { criterium.DetermineStatus( i, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32((i + 1)*(Increase - 0.01f), 0)})); Assert.IsInstanceOf(typeof (CalculationRunning), criterium.Status, "Status check fail."); } } /// <summary> /// Can determine status with divergence through NaN. /// </summary> [Test] public void DetermineStatusWithDivergenceThroughNaN() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); // Add residuals. We should not diverge because we'll have to few iterations for (var i = 0; i < Iterations - 5; i++) { criterium.DetermineStatus( i, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32((i + 1)*(Increase - 0.01f), 0)})); Assert.IsInstanceOf(typeof (CalculationRunning), criterium.Status, "Status check fail."); } // Now make it fail by throwing in a NaN criterium.DetermineStatus( Iterations, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(float.NaN, 0)})); Assert.IsInstanceOf(typeof (CalculationDiverged), criterium.Status, "Status check fail."); } /// <summary> /// Can determine status with divergence. /// </summary> [Test] public void DetermineStatusWithDivergence() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); // Add residuals. We should not diverge because we'll have one to few iterations float previous = 1; for (var i = 0; i < Iterations - 1; i++) { previous *= 1 + Increase + 0.01f; criterium.DetermineStatus( i, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(previous, 0)})); Assert.IsInstanceOf(typeof (CalculationRunning), criterium.Status, "Status check fail."); } // Add the final residual. Now we should have divergence previous *= 1 + Increase + 0.01f; criterium.DetermineStatus( Iterations - 1, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(previous, 0)})); Assert.IsInstanceOf(typeof (CalculationDiverged), criterium.Status, "Status check fail."); } /// <summary> /// Can reset calculation state. /// </summary> [Test] public void ResetCalculationState() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); // Add residuals. Blow it up instantly criterium.DetermineStatus( 1, new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(1.0f, 0)}), new DenseVector(new[] {new Complex32(float.NaN, 0)})); Assert.IsInstanceOf(typeof (CalculationDiverged), criterium.Status, "Status check fail."); // Reset the state criterium.ResetToPrecalculationState(); Assert.AreEqual(Increase, criterium.MaximumRelativeIncrease, "Incorrect maximum"); Assert.AreEqual(Iterations, criterium.MinimumNumberOfIterations, "Incorrect iteration count"); Assert.IsInstanceOf(typeof (CalculationIndetermined), criterium.Status, "Status check fail."); } /// <summary> /// Can clone stop criterium. /// </summary> [Test] public void Clone() { const float Increase = 0.5f; const int Iterations = 10; var criterium = new DivergenceStopCriterium(Increase, Iterations); Assert.IsNotNull(criterium, "There should be a criterium"); var clone = criterium.Clone(); Assert.IsInstanceOf(typeof (DivergenceStopCriterium), clone, "Wrong criterium type"); var clonedCriterium = clone as DivergenceStopCriterium; Assert.IsNotNull(clonedCriterium); // ReSharper disable PossibleNullReferenceException Assert.AreEqual(criterium.MaximumRelativeIncrease, clonedCriterium.MaximumRelativeIncrease, "Incorrect maximum"); Assert.AreEqual(criterium.MinimumNumberOfIterations, clonedCriterium.MinimumNumberOfIterations, "Incorrect iteration count"); // ReSharper restore PossibleNullReferenceException } } }
40.291803
142
0.602978
[ "MIT" ]
Plankankul/Framework-w-WebApp
Original/mathnet-numerics/src/UnitTests/LinearAlgebraTests/Complex32/Solvers/StopCriterium/DivergenceStopCriteriumTest.cs
12,289
C#
// SPDX-License-Identifier: Apache-2.0 // Licensed to the Ed-Fi Alliance under one or more agreements. // The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. // See the LICENSE and NOTICES files in the project root for more information. using System; using System.Globalization; using System.Text; using System.Text.RegularExpressions; namespace EdFi.Ods.AdminApp.Web.Helpers { public static class StringExtensions { public static string ToTitleCase(this string text) { return new CultureInfo("en-US", false).TextInfo.ToTitleCase(text); } public static string RemoveWhitespace(this string text) { return Regex.Replace(text, @"\s+", ""); } public static Version ToVersion(this string versionText) { Version version; return Version.TryParse(versionText, out version) ? version : null; } public static string SafeDecodeBase64String(this string input) { if (string.IsNullOrWhiteSpace(input)) return ""; try { return Encoding.UTF8.GetString(Convert.FromBase64String(input)); } catch (Exception) { return null; } } } }
29.108696
86
0.606423
[ "Apache-2.0" ]
stephenfuqua/Ed-Fi-ODS-AdminApp
Application/EdFi.Ods.AdminApp.Web/Helpers/StringExtensions.cs
1,341
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; namespace Azure.Core.Amqp { /// <summary> /// Represents the AMQP message properties. /// <seealso href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties" /> /// </summary> public class AmqpMessageProperties { /// <summary> /// Initializes a new <see cref="AmqpMessageProperties"/> instance. /// </summary> internal AmqpMessageProperties() { } /// <summary> /// The message-id value from the AMQP properties. /// </summary> public AmqpMessageId? MessageId { get; set; } /// <summary> /// The user-id value from the AMQP properties. /// </summary> public ReadOnlyMemory<byte>? UserId { get; set; } /// <summary> /// The to value from the AMQP properties. /// </summary> public AmqpAddress? To { get; set; } /// <summary> /// The subject value from the AMQP properties. /// </summary> public string? Subject { get; set; } /// <summary> /// The reply-to value from the AMQP properties. /// </summary> public AmqpAddress? ReplyTo { get; set; } /// <summary> /// The correlation-id value from the AMQP properties. /// </summary> public AmqpMessageId? CorrelationId { get; set; } /// <summary> /// The content-type value from the AMQP properties. /// </summary> public string? ContentType { get; set; } /// <summary> /// The content-encoding value from the AMQP properties. /// </summary> public string? ContentEncoding { get; set; } /// <summary> /// The absolute-expiry-time value from the AMQP properties. /// </summary> public DateTimeOffset? AbsoluteExpiryTime { get; set; } /// <summary> /// The creation-time value from the AMQP properties. /// </summary> public DateTimeOffset? CreationTime { get; set; } /// <summary> /// The group-id value from the AMQP properties. /// </summary> public string? GroupId { get; set; } /// <summary> /// The group-sequence value from the AMQP properties. /// </summary> public uint? GroupSequence { get; set; } /// <summary> /// The reply-to-group-id value from the AMQP properties. /// </summary> public string? ReplyToGroupId { get; set; } } }
30.929412
120
0.56105
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/core/Azure.Core.Amqp/src/AmqpMessageProperties.cs
2,631
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace albion_data_reader_new.handlers { public class PartyJoinEvent { public string PlayerJoinedId { get; set; } public string PlayerJoinedName { get; set; } } }
20.8
52
0.721154
[ "MIT" ]
ItsNotMyFault/AlbionDataReader
albion-data-reader-new/handlers/party/events/PartyJoinEvent.cs
314
C#
using System; using slang.Compilation; using slang.Compiler.Core.Compilation; using System.Linq; using sc.Terminal; namespace sc { class MainClass { public static void Main (string[] args) { Messages.WriteLogo (); Messages.WriteHeader (); ValidateArgs (args); var solution = BuildCompilationRoot (args[0]); try { SlangCompiler.Compile (solution); } catch (Exception e) { Messages.WriteError ("{0}", e.Message); Environment.Exit (e.HResult); } Environment.Exit (0); } static void ValidateArgs (string [] args) { if (args.Length < 1) { Messages.WriteError ("No project.json file specified."); Messages.WriteUsage (); Environment.Exit (1); } } static CompilationRoot BuildCompilationRoot (string projectName) { var projectMetadata = new CompilationMetadata (projectName, string.Empty, AssemblyType.Executable); var project = new CompilationUnit (projectMetadata, Enumerable.Empty<string> ()); return new CompilationRoot (new [] { project }); } } }
28.6
111
0.554002
[ "MIT" ]
jagrem/slang
src/Tools/sc/Program.cs
1,289
C#
using System; using System.Text.RegularExpressions; namespace _1.ExtractPersonsInformationME { class Program { static void Main(string[] args) { int numberOfLines = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfLines; i++) { string input = Console.ReadLine(); Regex namePattern = new Regex(@"@(?<name>[\S\s]*?)[|]"); Regex agePattern = new Regex(@"#(?<age>\d+)[*]"); if (namePattern.IsMatch(input) && agePattern.IsMatch(input)) { Console.WriteLine($"{namePattern.Match(input).Groups["name"].ToString()}" + $" is {agePattern.Match(input).Groups["age"].ToString()} years old."); } } } } }
29.607143
95
0.496984
[ "MIT" ]
deedeedextor/Software-University
C#TechnologyFundamentals/StringAndTextProcessingLEME/1.ExtractPersonsInformationME/Program.cs
831
C#
using System; using NetRuntimeSystem = System; using System.ComponentModel; using NetOffice.Attributes; namespace NetOffice.AccessApi { #region Delegates #pragma warning disable #pragma warning restore #endregion /// <summary> /// CoClass TempVar /// SupportByVersion Access, 12,14,15,16 /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff193475.aspx </remarks> [SupportByVersion("Access", 12,14,15,16)] [EntityType(EntityType.IsCoClass)] public class TempVar : _TempVar { #pragma warning disable #region Fields private NetRuntimeSystem.Runtime.InteropServices.ComTypes.IConnectionPoint _connectPoint; private string _activeSinkId; private static Type _type; #endregion #region Type Information /// <summary> /// Instance Type /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden] public override Type InstanceType { get { return LateBindingApiWrapperType; } } /// <summary> /// Type Cache /// </summary> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public static Type LateBindingApiWrapperType { get { if (null == _type) _type = typeof(TempVar); return _type; } } #endregion #region Construction ///<param name="factory">current used factory core</param> ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> public TempVar(Core factory, ICOMObject parentObject, object comProxy) : base(factory, parentObject, comProxy) { } ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> public TempVar(ICOMObject parentObject, object comProxy) : base(parentObject, comProxy) { } ///<param name="factory">current used factory core</param> ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> ///<param name="comProxyType">Type of inner wrapped COM proxy"</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public TempVar(Core factory, ICOMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(factory, parentObject, comProxy, comProxyType) { } ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> ///<param name="comProxyType">Type of inner wrapped COM proxy"</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public TempVar(ICOMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(parentObject, comProxy, comProxyType) { } ///<param name="replacedObject">object to replaced. replacedObject are not usable after this action</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public TempVar(ICOMObject replacedObject) : base(replacedObject) { } /// <summary> /// Creates a new instance of TempVar /// </summary> public TempVar():base("Access.TempVar") { } /// <summary> /// Creates a new instance of TempVar /// </summary> ///<param name="progId">registered ProgID</param> public TempVar(string progId):base(progId) { } #endregion #region Static CoClass Methods #endregion #region Events #endregion #pragma warning restore } }
27.862319
162
0.655917
[ "MIT" ]
DominikPalo/NetOffice
Source/Access/Classes/TempVar.cs
3,847
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the opsworks-2013-02-18.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; using System.Text; using System.Xml.Serialization; using Amazon.OpsWorks.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.OpsWorks.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for CreateApp operation /// </summary> public class CreateAppResponseUnmarshaller : JsonResponseUnmarshaller { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateAppResponse response = new CreateAppResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("AppId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.AppId = unmarshaller.Unmarshall(context); continue; } } return response; } /// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ValidationException")) { return ValidationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } } return new AmazonOpsWorksException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); } private static CreateAppResponseUnmarshaller _instance = new CreateAppResponseUnmarshaller(); internal static CreateAppResponseUnmarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static CreateAppResponseUnmarshaller Instance { get { return _instance; } } } }
37.947368
192
0.625751
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/OpsWorks/Generated/Model/Internal/MarshallTransformations/CreateAppResponseUnmarshaller.cs
4,326
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/MsHTML.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. using NUnit.Framework; using System; using System.Runtime.InteropServices; using static TerraFX.Interop.Windows.IID; namespace TerraFX.Interop.Windows.UnitTests; /// <summary>Provides validation of the <see cref="HTMLNextIdElement" /> struct.</summary> public static unsafe partial class HTMLNextIdElementTests { /// <summary>Validates that the <see cref="Guid" /> of the <see cref="HTMLNextIdElement" /> struct is correct.</summary> [Test] public static void GuidOfTest() { Assert.That(typeof(HTMLNextIdElement).GUID, Is.EqualTo(IID_HTMLNextIdElement)); } /// <summary>Validates that the <see cref="HTMLNextIdElement" /> struct is blittable.</summary> [Test] public static void IsBlittableTest() { Assert.That(Marshal.SizeOf<HTMLNextIdElement>(), Is.EqualTo(sizeof(HTMLNextIdElement))); } /// <summary>Validates that the <see cref="HTMLNextIdElement" /> struct has the right <see cref="LayoutKind" />.</summary> [Test] public static void IsLayoutSequentialTest() { Assert.That(typeof(HTMLNextIdElement).IsLayoutSequential, Is.True); } /// <summary>Validates that the <see cref="HTMLNextIdElement" /> struct has the correct size.</summary> [Test] public static void SizeOfTest() { Assert.That(sizeof(HTMLNextIdElement), Is.EqualTo(1)); } }
37.318182
145
0.713764
[ "MIT" ]
IngmarBitter/terrafx.interop.windows
tests/Interop/Windows/Windows/um/MsHTML/HTMLNextIdElementTests.cs
1,644
C#
/* * LUSID API * * # Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages and frameworks: * [C#](https://github.com/finbourne/lusid-sdk-csharp) * [Java](https://github.com/finbourne/lusid-sdk-java) * [JavaScript](https://github.com/finbourne/lusid-sdk-js) * [Python](https://github.com/finbourne/lusid-sdk-python) * [Angular](https://github.com/finbourne/lusid-sdk-angular) The LUSID platform is made up of a number of sub-applications. You can find the API / swagger documentation by following the links in the table below. | Application | Description | API / Swagger Documentation | | - -- -- | - -- -- | - -- - | | LUSID | Open, API-first, developer-friendly investment data platform. | [Swagger](https://www.lusid.com/api/swagger/index.html) | | Web app | User-facing front end for LUSID. | [Swagger](https://www.lusid.com/app/swagger/index.html) | | Scheduler | Automated job scheduler. | [Swagger](https://www.lusid.com/scheduler2/swagger/index.html) | | Insights |Monitoring and troubleshooting service. | [Swagger](https://www.lusid.com/insights/swagger/index.html) | | Identity | Identity management for LUSID (in conjuction with Access) | [Swagger](https://www.lusid.com/identity/swagger/index.html) | | Access | Access control for LUSID (in conjunction with Identity) | [Swagger](https://www.lusid.com/access/swagger/index.html) | | Drive | Secure file repository and manager for collaboration. | [Swagger](https://www.lusid.com/drive/swagger/index.html) | | Luminesce | Data virtualisation service (query data from multiple providers, including LUSID) | [Swagger](https://www.lusid.com/honeycomb/swagger/index.html) | | Notification | Notification service. | [Swagger](https://www.lusid.com/notifications/swagger/index.html) | | Configuration | File store for secrets and other sensitive information. | [Swagger](https://www.lusid.com/configuration/swagger/index.html) | # Error Codes | Code|Name|Description | | - --|- --|- -- | | <a name=\"-10\">-10</a>|Server Configuration Error| | | <a name=\"-1\">-1</a>|Unknown error|An unexpected error was encountered on our side. | | <a name=\"102\">102</a>|Version Not Found| | | <a name=\"103\">103</a>|Api Rate Limit Violation| | | <a name=\"104\">104</a>|Instrument Not Found| | | <a name=\"105\">105</a>|Property Not Found| | | <a name=\"106\">106</a>|Portfolio Recursion Depth| | | <a name=\"108\">108</a>|Group Not Found| | | <a name=\"109\">109</a>|Portfolio Not Found| | | <a name=\"110\">110</a>|Property Schema Not Found| | | <a name=\"111\">111</a>|Portfolio Ancestry Not Found| | | <a name=\"112\">112</a>|Portfolio With Id Already Exists| | | <a name=\"113\">113</a>|Orphaned Portfolio| | | <a name=\"119\">119</a>|Missing Base Claims| | | <a name=\"121\">121</a>|Property Not Defined| | | <a name=\"122\">122</a>|Cannot Delete System Property| | | <a name=\"123\">123</a>|Cannot Modify Immutable Property Field| | | <a name=\"124\">124</a>|Property Already Exists| | | <a name=\"125\">125</a>|Invalid Property Life Time| | | <a name=\"126\">126</a>|Property Constraint Style Excludes Properties| | | <a name=\"127\">127</a>|Cannot Modify Default Data Type| | | <a name=\"128\">128</a>|Group Already Exists| | | <a name=\"129\">129</a>|No Such Data Type| | | <a name=\"130\">130</a>|Undefined Value For Data Type| | | <a name=\"131\">131</a>|Unsupported Value Type Defined On Data Type| | | <a name=\"132\">132</a>|Validation Error| | | <a name=\"133\">133</a>|Loop Detected In Group Hierarchy| | | <a name=\"134\">134</a>|Undefined Acceptable Values| | | <a name=\"135\">135</a>|Sub Group Already Exists| | | <a name=\"138\">138</a>|Price Source Not Found| | | <a name=\"139\">139</a>|Analytic Store Not Found| | | <a name=\"141\">141</a>|Analytic Store Already Exists| | | <a name=\"143\">143</a>|Client Instrument Already Exists| | | <a name=\"144\">144</a>|Duplicate In Parameter Set| | | <a name=\"147\">147</a>|Results Not Found| | | <a name=\"148\">148</a>|Order Field Not In Result Set| | | <a name=\"149\">149</a>|Operation Failed| | | <a name=\"150\">150</a>|Elastic Search Error| | | <a name=\"151\">151</a>|Invalid Parameter Value| | | <a name=\"153\">153</a>|Command Processing Failure| | | <a name=\"154\">154</a>|Entity State Construction Failure| | | <a name=\"155\">155</a>|Entity Timeline Does Not Exist| | | <a name=\"156\">156</a>|Concurrency Conflict Failure| | | <a name=\"157\">157</a>|Invalid Request| | | <a name=\"158\">158</a>|Event Publish Unknown| | | <a name=\"159\">159</a>|Event Query Failure| | | <a name=\"160\">160</a>|Blob Did Not Exist| | | <a name=\"162\">162</a>|Sub System Request Failure| | | <a name=\"163\">163</a>|Sub System Configuration Failure| | | <a name=\"165\">165</a>|Failed To Delete| | | <a name=\"166\">166</a>|Upsert Client Instrument Failure| | | <a name=\"167\">167</a>|Illegal As At Interval| | | <a name=\"168\">168</a>|Illegal Bitemporal Query| | | <a name=\"169\">169</a>|Invalid Alternate Id| | | <a name=\"170\">170</a>|Cannot Add Source Portfolio Property Explicitly| | | <a name=\"171\">171</a>|Entity Already Exists In Group| | | <a name=\"173\">173</a>|Entity With Id Already Exists| | | <a name=\"174\">174</a>|Derived Portfolio Details Do Not Exist| | | <a name=\"176\">176</a>|Portfolio With Name Already Exists| | | <a name=\"177\">177</a>|Invalid Transactions| | | <a name=\"178\">178</a>|Reference Portfolio Not Found| | | <a name=\"179\">179</a>|Duplicate Id| | | <a name=\"180\">180</a>|Command Retrieval Failure| | | <a name=\"181\">181</a>|Data Filter Application Failure| | | <a name=\"182\">182</a>|Search Failed| | | <a name=\"183\">183</a>|Movements Engine Configuration Key Failure| | | <a name=\"184\">184</a>|Fx Rate Source Not Found| | | <a name=\"185\">185</a>|Accrual Source Not Found| | | <a name=\"186\">186</a>|Access Denied| | | <a name=\"187\">187</a>|Invalid Identity Token| | | <a name=\"188\">188</a>|Invalid Request Headers| | | <a name=\"189\">189</a>|Price Not Found| | | <a name=\"190\">190</a>|Invalid Sub Holding Keys Provided| | | <a name=\"191\">191</a>|Duplicate Sub Holding Keys Provided| | | <a name=\"192\">192</a>|Cut Definition Not Found| | | <a name=\"193\">193</a>|Cut Definition Invalid| | | <a name=\"194\">194</a>|Time Variant Property Deletion Date Unspecified| | | <a name=\"195\">195</a>|Perpetual Property Deletion Date Specified| | | <a name=\"196\">196</a>|Time Variant Property Upsert Date Unspecified| | | <a name=\"197\">197</a>|Perpetual Property Upsert Date Specified| | | <a name=\"200\">200</a>|Invalid Unit For Data Type| | | <a name=\"201\">201</a>|Invalid Type For Data Type| | | <a name=\"202\">202</a>|Invalid Value For Data Type| | | <a name=\"203\">203</a>|Unit Not Defined For Data Type| | | <a name=\"204\">204</a>|Units Not Supported On Data Type| | | <a name=\"205\">205</a>|Cannot Specify Units On Data Type| | | <a name=\"206\">206</a>|Unit Schema Inconsistent With Data Type| | | <a name=\"207\">207</a>|Unit Definition Not Specified| | | <a name=\"208\">208</a>|Duplicate Unit Definitions Specified| | | <a name=\"209\">209</a>|Invalid Units Definition| | | <a name=\"210\">210</a>|Invalid Instrument Identifier Unit| | | <a name=\"211\">211</a>|Holdings Adjustment Does Not Exist| | | <a name=\"212\">212</a>|Could Not Build Excel Url| | | <a name=\"213\">213</a>|Could Not Get Excel Version| | | <a name=\"214\">214</a>|Instrument By Code Not Found| | | <a name=\"215\">215</a>|Entity Schema Does Not Exist| | | <a name=\"216\">216</a>|Feature Not Supported On Portfolio Type| | | <a name=\"217\">217</a>|Quote Not Found| | | <a name=\"218\">218</a>|Invalid Quote Identifier| | | <a name=\"219\">219</a>|Invalid Metric For Data Type| | | <a name=\"220\">220</a>|Invalid Instrument Definition| | | <a name=\"221\">221</a>|Instrument Upsert Failure| | | <a name=\"222\">222</a>|Reference Portfolio Request Not Supported| | | <a name=\"223\">223</a>|Transaction Portfolio Request Not Supported| | | <a name=\"224\">224</a>|Invalid Property Value Assignment| | | <a name=\"230\">230</a>|Transaction Type Not Found| | | <a name=\"231\">231</a>|Transaction Type Duplication| | | <a name=\"232\">232</a>|Portfolio Does Not Exist At Given Date| | | <a name=\"233\">233</a>|Query Parser Failure| | | <a name=\"234\">234</a>|Duplicate Constituent| | | <a name=\"235\">235</a>|Unresolved Instrument Constituent| | | <a name=\"236\">236</a>|Unresolved Instrument In Transition| | | <a name=\"237\">237</a>|Missing Side Definitions| | | <a name=\"299\">299</a>|Invalid Recipe| | | <a name=\"300\">300</a>|Missing Recipe| | | <a name=\"301\">301</a>|Dependencies| | | <a name=\"304\">304</a>|Portfolio Preprocess Failure| | | <a name=\"310\">310</a>|Valuation Engine Failure| | | <a name=\"311\">311</a>|Task Factory Failure| | | <a name=\"312\">312</a>|Task Evaluation Failure| | | <a name=\"313\">313</a>|Task Generation Failure| | | <a name=\"314\">314</a>|Engine Configuration Failure| | | <a name=\"315\">315</a>|Model Specification Failure| | | <a name=\"320\">320</a>|Market Data Key Failure| | | <a name=\"321\">321</a>|Market Resolver Failure| | | <a name=\"322\">322</a>|Market Data Failure| | | <a name=\"330\">330</a>|Curve Failure| | | <a name=\"331\">331</a>|Volatility Surface Failure| | | <a name=\"332\">332</a>|Volatility Cube Failure| | | <a name=\"350\">350</a>|Instrument Failure| | | <a name=\"351\">351</a>|Cash Flows Failure| | | <a name=\"352\">352</a>|Reference Data Failure| | | <a name=\"360\">360</a>|Aggregation Failure| | | <a name=\"361\">361</a>|Aggregation Measure Failure| | | <a name=\"370\">370</a>|Result Retrieval Failure| | | <a name=\"371\">371</a>|Result Processing Failure| | | <a name=\"372\">372</a>|Vendor Result Processing Failure| | | <a name=\"373\">373</a>|Vendor Result Mapping Failure| | | <a name=\"374\">374</a>|Vendor Library Unauthorised| | | <a name=\"375\">375</a>|Vendor Connectivity Error| | | <a name=\"376\">376</a>|Vendor Interface Error| | | <a name=\"377\">377</a>|Vendor Pricing Failure| | | <a name=\"378\">378</a>|Vendor Translation Failure| | | <a name=\"379\">379</a>|Vendor Key Mapping Failure| | | <a name=\"380\">380</a>|Vendor Reflection Failure| | | <a name=\"381\">381</a>|Vendor Process Failure| | | <a name=\"382\">382</a>|Vendor System Failure| | | <a name=\"390\">390</a>|Attempt To Upsert Duplicate Quotes| | | <a name=\"391\">391</a>|Corporate Action Source Does Not Exist| | | <a name=\"392\">392</a>|Corporate Action Source Already Exists| | | <a name=\"393\">393</a>|Instrument Identifier Already In Use| | | <a name=\"394\">394</a>|Properties Not Found| | | <a name=\"395\">395</a>|Batch Operation Aborted| | | <a name=\"400\">400</a>|Invalid Iso4217 Currency Code| | | <a name=\"401\">401</a>|Cannot Assign Instrument Identifier To Currency| | | <a name=\"402\">402</a>|Cannot Assign Currency Identifier To Non Currency| | | <a name=\"403\">403</a>|Currency Instrument Cannot Be Deleted| | | <a name=\"404\">404</a>|Currency Instrument Cannot Have Economic Definition| | | <a name=\"405\">405</a>|Currency Instrument Cannot Have Lookthrough Portfolio| | | <a name=\"406\">406</a>|Cannot Create Currency Instrument With Multiple Identifiers| | | <a name=\"407\">407</a>|Specified Currency Is Undefined| | | <a name=\"410\">410</a>|Index Does Not Exist| | | <a name=\"411\">411</a>|Sort Field Does Not Exist| | | <a name=\"413\">413</a>|Negative Pagination Parameters| | | <a name=\"414\">414</a>|Invalid Search Syntax| | | <a name=\"415\">415</a>|Filter Execution Timeout| | | <a name=\"420\">420</a>|Side Definition Inconsistent| | | <a name=\"450\">450</a>|Invalid Quote Access Metadata Rule| | | <a name=\"451\">451</a>|Access Metadata Not Found| | | <a name=\"452\">452</a>|Invalid Access Metadata Identifier| | | <a name=\"460\">460</a>|Standard Resource Not Found| | | <a name=\"461\">461</a>|Standard Resource Conflict| | | <a name=\"462\">462</a>|Calendar Not Found| | | <a name=\"463\">463</a>|Date In A Calendar Not Found| | | <a name=\"464\">464</a>|Invalid Date Source Data| | | <a name=\"465\">465</a>|Invalid Timezone| | | <a name=\"601\">601</a>|Person Identifier Already In Use| | | <a name=\"602\">602</a>|Person Not Found| | | <a name=\"603\">603</a>|Cannot Set Identifier| | | <a name=\"617\">617</a>|Invalid Recipe Specification In Request| | | <a name=\"618\">618</a>|Inline Recipe Deserialisation Failure| | | <a name=\"619\">619</a>|Identifier Types Not Set For Entity| | | <a name=\"620\">620</a>|Cannot Delete All Client Defined Identifiers| | | <a name=\"650\">650</a>|The Order requested was not found.| | | <a name=\"654\">654</a>|The Allocation requested was not found.| | | <a name=\"655\">655</a>|Cannot build the fx forward target with the given holdings.| | | <a name=\"656\">656</a>|Group does not contain expected entities.| | | <a name=\"667\">667</a>|Relation definition already exists| | | <a name=\"673\">673</a>|Missing entitlements for entities in Group| | | <a name=\"674\">674</a>|Next Best Action not found| | | <a name=\"676\">676</a>|Relation definition not defined| | | <a name=\"677\">677</a>|Invalid entity identifier for relation| | | <a name=\"681\">681</a>|Sorting by specified field not supported|One or more of the provided fields to order by were either invalid or not supported. | | <a name=\"682\">682</a>|Too many fields to sort by|The number of fields to sort the data by exceeds the number allowed by the endpoint | | <a name=\"684\">684</a>|Sequence Not Found| | | <a name=\"685\">685</a>|Sequence Already Exists| | | <a name=\"686\">686</a>|Non-cycling sequence has been exhausted| | | <a name=\"687\">687</a>|Legal Entity Identifier Already In Use| | | <a name=\"688\">688</a>|Legal Entity Not Found| | | <a name=\"689\">689</a>|The supplied pagination token is invalid| | | <a name=\"690\">690</a>|Property Type Is Not Supported| | | <a name=\"691\">691</a>|Multiple Tax-lots For Currency Type Is Not Supported| | | <a name=\"692\">692</a>|This endpoint does not support impersonation| | | <a name=\"693\">693</a>|Entity type is not supported for Relationship| | | <a name=\"694\">694</a>|Relationship Validation Failure| | | <a name=\"695\">695</a>|Relationship Not Found| | | <a name=\"697\">697</a>|Derived Property Formula No Longer Valid| | | <a name=\"698\">698</a>|Story is not available| | | <a name=\"703\">703</a>|Corporate Action Does Not Exist| | | <a name=\"720\">720</a>|The provided sort and filter combination is not valid| | | <a name=\"721\">721</a>|A2B generation failed| | | <a name=\"722\">722</a>|Aggregated Return Calculation Failure| | | <a name=\"723\">723</a>|Custom Entity Definition Identifier Already In Use| | | <a name=\"724\">724</a>|Custom Entity Definition Not Found| | | <a name=\"725\">725</a>|The Placement requested was not found.| | | <a name=\"726\">726</a>|The Execution requested was not found.| | | <a name=\"727\">727</a>|The Block requested was not found.| | | <a name=\"728\">728</a>|The Participation requested was not found.| | | <a name=\"729\">729</a>|The Package requested was not found.| | | <a name=\"730\">730</a>|The OrderInstruction requested was not found.| | | <a name=\"732\">732</a>|Custom Entity not found.| | | <a name=\"733\">733</a>|Custom Entity Identifier already in use.| | | <a name=\"735\">735</a>|Calculation Failed.| | | <a name=\"736\">736</a>|An expected key on HttpResponse is missing.| | | <a name=\"737\">737</a>|A required fee detail is missing.| | | <a name=\"738\">738</a>|Zero rows were returned from Luminesce| | | <a name=\"739\">739</a>|Provided Weekend Mask was invalid| | | <a name=\"742\">742</a>|Custom Entity fields do not match the definition| | | <a name=\"746\">746</a>|The provided sequence is not valid.| | | <a name=\"751\">751</a>|The type of the Custom Entity is different than the type provided in the definition.| | | <a name=\"752\">752</a>|Luminesce process returned an error.| | * * The version of the OpenAPI document: 0.11.3648 * Contact: info@finbourne.com * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Lusid.Sdk.Client.OpenAPIDateConverter; namespace Lusid.Sdk.Model { /// <summary> /// Defines AssetClass /// </summary> [JsonConverter(typeof(StringEnumConverter))] public enum AssetClass { /// <summary> /// Enum InterestRates for value: InterestRates /// </summary> [EnumMember(Value = "InterestRates")] InterestRates = 1, /// <summary> /// Enum FX for value: FX /// </summary> [EnumMember(Value = "FX")] FX = 2, /// <summary> /// Enum Inflation for value: Inflation /// </summary> [EnumMember(Value = "Inflation")] Inflation = 3, /// <summary> /// Enum Equities for value: Equities /// </summary> [EnumMember(Value = "Equities")] Equities = 4, /// <summary> /// Enum Credit for value: Credit /// </summary> [EnumMember(Value = "Credit")] Credit = 5, /// <summary> /// Enum Commodities for value: Commodities /// </summary> [EnumMember(Value = "Commodities")] Commodities = 6, /// <summary> /// Enum Unknown for value: Unknown /// </summary> [EnumMember(Value = "Unknown")] Unknown = 7 } }
221.341463
16,252
0.640331
[ "MIT" ]
finbourne/lusid-sdk-csharp-preview
sdk/Lusid.Sdk/Model/AssetClass.cs
18,150
C#
namespace GenericGameBridge.Service { using System.Collections.Generic; public delegate bool NetSegmentHandler(ushort segmentId, ref NetSegment segment); public delegate bool NetSegmentLaneHandler(uint laneId, ref NetLane lane, NetInfo.Lane laneInfo, ushort segmentId, ref NetSegment segment, byte laneIndex); public interface INetService { bool CheckLaneFlags(uint laneId, NetLane.Flags flagMask, NetLane.Flags? expectedResult = default); bool CheckNodeFlags(ushort nodeId, NetNode.Flags flagMask, NetNode.Flags? expectedResult = default); bool CheckSegmentFlags(ushort segmentId, NetSegment.Flags flagMask, NetSegment.Flags? expectedResult = default); NetInfo.Direction GetFinalSegmentEndDirection(ushort segmentId, bool startNode); NetInfo.Direction GetFinalSegmentEndDirection(ushort segmentId, ref NetSegment segment, bool startNode); ushort GetSegmentNodeId(ushort segmentId, bool startNode); /// <summary> /// Assembles a geometrically sorted list of lanes for the given segment. /// If the <paramref name="startNode"/> parameter is set only lanes supporting traffic to flow towards the given node are added to the list, otherwise all matched lanes are added. /// </summary> /// <param name="segmentId">segment id</param> /// <param name="segment">segment data</param> /// <param name="startNode">reference node (optional)</param> /// <param name="laneTypeFilter">lane type filter, lanes must match this filter mask</param> /// <param name="vehicleTypeFilter">vehicle type filter, lanes must match this filter mask</param> /// <param name="reverse">if true, lanes are ordered from right to left (relative to the /// segment's start node / the given node), otherwise from left to right</param> /// <param name="sort">if false, no sorting takes place /// regardless of <paramref name="reverse"/></param> /// <returns>sorted list of lanes for the given segment</returns> IList<LanePos> GetSortedLanes(ushort segmentId, ref NetSegment segment, bool? startNode, NetInfo.LaneType? laneTypeFilter = default, VehicleInfo.VehicleType? vehicleTypeFilter = default, bool reverse = false, bool sort = true); bool IsLaneAndItsSegmentValid(uint laneId); bool IsNodeValid(ushort nodeId); bool IsSegmentValid(ushort segmentId); void IterateSegmentLanes(ushort segmentId, NetSegmentLaneHandler handler); void IterateSegmentLanes(ushort segmentId, ref NetSegment segment, NetSegmentLaneHandler handler); GetNodeSegmentIdsEnumerable GetNodeSegmentIds(ushort nodeId, ClockDirection clockDirection); void PublishSegmentChanges(ushort segmentId); bool? IsStartNode(ushort segmentId, ushort nodeId); /// <summary>tail node>-------->head node</summary> ushort GetHeadNode(ushort segmentId); /// <summary>tail node>-------->head node</summary> ushort GetHeadNode(ref NetSegment segment); /// <summary>tail node>-------->head node</summary> ushort GetTailNode(ushort segmentId); /// <summary>tail node>-------->head node</summary> ushort GetTailNode(ref NetSegment segment); } public struct LanePos { public uint laneId; public byte laneIndex; public float position; public VehicleInfo.VehicleType vehicleType; public NetInfo.LaneType laneType; public LanePos(uint laneId, byte laneIndex, float position, VehicleInfo.VehicleType vehicleType, NetInfo.LaneType laneType) { this.laneId = laneId; this.laneIndex = laneIndex; this.position = position; this.vehicleType = vehicleType; this.laneType = laneType; } } public enum ClockDirection { Clockwise, CounterClockwise, } }
43.678571
187
0.55785
[ "MIT" ]
MightyWizard/TMPE
TLM/TMPE.GenericGameBridge/Service/INetService.cs
4,892
C#
using System; namespace Plugin.FilePicker.Abstractions { public class FilePickerEventArgs : EventArgs { public byte [] FileByte { get; set; } public string FileName { get; set; } public string FilePath { get; set; } public FilePickerEventArgs () { } public FilePickerEventArgs (byte [] fileByte) { FileByte = fileByte; } public FilePickerEventArgs (byte [] fileByte, string fileName) : this (fileByte) { FileName = fileName; } public FilePickerEventArgs (byte [] fileByte, string fileName, string filePath) : this (fileByte, fileName) { FilePath = filePath; } } }
21.828571
87
0.551047
[ "MIT" ]
Happypig375/FilePicker-Plugin-for-Xamarin-and-Windows
src/Plugin.FilePicker/Plugin.FilePicker.Abstractions/FilePickerEventArgs.cs
766
C#
using System; using Eto.Forms; using Eto.Drawing; using System.Diagnostics; #if XAMMAC2 using AppKit; using Foundation; using CoreGraphics; using ObjCRuntime; using CoreAnimation; using CoreImage; #else using MonoMac.AppKit; using MonoMac.Foundation; using MonoMac.CoreGraphics; using MonoMac.ObjCRuntime; using MonoMac.CoreAnimation; using MonoMac.CoreImage; #if Mac64 using nfloat = System.Double; using nint = System.Int64; using nuint = System.UInt64; #else using nfloat = System.Single; using nint = System.Int32; using nuint = System.UInt32; #endif #if SDCOMPAT using CGSize = System.Drawing.SizeF; using CGRect = System.Drawing.RectangleF; using CGPoint = System.Drawing.PointF; #endif #endif namespace Eto.Mac.Forms.Controls { public class MacEventView : NSBox, IMacControl { public MacEventView() { BoxType = NSBoxType.NSBoxCustom; Transparent = true; BorderWidth = 0; BorderType = NSBorderType.NoBorder; ContentViewMargins = CGSize.Empty; } public MacEventView(IntPtr handle) : base(handle) { } public WeakReference WeakHandler { get; set; } public IMacViewHandler Handler { get { return (IMacViewHandler)WeakHandler.Target; } set { WeakHandler = new WeakReference(value); } } public Control Widget { get { return Handler == null ? null : Handler.Widget; } } public static bool KeyDown(Control control, NSEvent theEvent) { var handler = control?.Handler as IMacViewHandler; if (handler == null) return false; var kpea = theEvent.ToEtoKeyEventArgs(); handler.OnKeyDown(kpea); return kpea.Handled; } public static bool FlagsChanged(Control control, NSEvent theEvent) { var handler = control?.Handler as IMacViewHandler; if (handler == null) return false; Keys key; NSEventModifierMask requiredModifier; // check which key is being pressed currently and figure out correct modifier mask for that key alone switch (theEvent.KeyCode) { case 56: key = Keys.LeftShift; requiredModifier = (NSEventModifierMask)0x20002; break; case 60: key = Keys.RightShift; requiredModifier = (NSEventModifierMask)0x20004; break; case 59: key = Keys.LeftControl; requiredModifier = (NSEventModifierMask)0x40001; break; case 57: key = Keys.RightControl; requiredModifier = (NSEventModifierMask)0x40002; // correct? I don't have a keyboard with right control key. break; case 58: key = Keys.LeftAlt; requiredModifier = (NSEventModifierMask)0x80020; break; case 61: key = Keys.RightAlt; requiredModifier = (NSEventModifierMask)0x80040; break; case 55: key = Keys.LeftApplication; requiredModifier = (NSEventModifierMask)0x100008; break; case 54: key = Keys.RightApplication; requiredModifier = (NSEventModifierMask)0x100010; break; default: Debug.WriteLine($"Unknown FlagsChanged Key: {theEvent.KeyCode}, Modifiers: {theEvent.ModifierFlags}"); return false; } // test the modifier to see if the key was pressed or released var modifierFlags = theEvent.ModifierFlags; var type = modifierFlags.HasFlag(requiredModifier) ? KeyEventType.KeyDown : KeyEventType.KeyUp; key |= modifierFlags.ToEto(); var kpea = new KeyEventArgs(key, type); if (type == KeyEventType.KeyDown) handler.OnKeyDown(kpea); else handler.OnKeyUp(kpea); return kpea.Handled; } public static bool KeyUp(Control control, NSEvent theEvent) { var handler = control?.Handler as IMacViewHandler; if (handler == null) return false; var kpea = theEvent.ToEtoKeyEventArgs(); handler.Callback.OnKeyUp(control, kpea); return kpea.Handled; } public override void ResetCursorRects() { var handler = Handler; if (handler == null) return; var cursor = handler.CurrentCursor; if (cursor != null) { AddCursorRect(new CGRect(CGPoint.Empty, Frame.Size), cursor.ControlObject as NSCursor); } } public override bool AcceptsFirstMouse(NSEvent theEvent) { return Handler?.OnAcceptsFirstMouse(theEvent) ?? base.AcceptsFirstMouse(theEvent); } } }
24.674556
114
0.708633
[ "BSD-3-Clause" ]
Fullbrik/Eto
src/Eto.Mac/Forms/Controls/MacEventView.cs
4,170
C#
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Generated code. DO NOT EDIT! namespace Google.Cloud.Compute.V1.Snippets { // [START compute_v1_generated_NetworkEndpointGroups_Insert_async_flattened] using Google.Cloud.Compute.V1; using System.Threading.Tasks; using lro = Google.LongRunning; public sealed partial class GeneratedNetworkEndpointGroupsClientSnippets { /// <summary>Snippet for InsertAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task InsertAsync() { // Create client NetworkEndpointGroupsClient networkEndpointGroupsClient = await NetworkEndpointGroupsClient.CreateAsync(); // Initialize request argument(s) string project = ""; string zone = ""; NetworkEndpointGroup networkEndpointGroupResource = new NetworkEndpointGroup(); // Make the request lro::Operation<Operation, Operation> response = await networkEndpointGroupsClient.InsertAsync(project, zone, networkEndpointGroupResource); // Poll until the returned long-running operation is complete lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation<Operation, Operation> retrievedResponse = await networkEndpointGroupsClient.PollOnceInsertAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } } } // [END compute_v1_generated_NetworkEndpointGroups_Insert_async_flattened] }
45.606557
151
0.692308
[ "Apache-2.0" ]
AlexandrTrf/google-cloud-dotnet
apis/Google.Cloud.Compute.V1/Google.Cloud.Compute.V1.GeneratedSnippets/NetworkEndpointGroupsClient.InsertAsyncSnippet.g.cs
2,782
C#
using System.Collections; using System.Collections.Generic; using JetBrains.Annotations; using UnityEngine; public static class MathExtensions { [PublicAPI] public static float Distance(this MonoBehaviour from, in Vector3 to) => Vector3.Distance(a: from.transform.position, b: to); [PublicAPI] public static float Distance(this Transform from, in Vector3 to) => Vector3.Distance(a: from.position, b: to); [PublicAPI] public static float Distance(this Vector3 from, in Vector3 to) => Vector3.Distance(a: from, b: to); }
28.95
72
0.699482
[ "MIT" ]
Walter-Haynes/vrtwix-unchained
Assets/_VRtwix/Scripts/Utilities/MathExtensions.cs
581
C#
#pragma warning disable CS0618 using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using DSharpPlus.Entities; using DSharpPlus.EventArgs; using DSharpPlus.Exceptions; using DSharpPlus.Net; using DSharpPlus.Net.Abstractions; using DSharpPlus.Net.Serialization; using DSharpPlus.Net.WebSocket; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace DSharpPlus { /// <summary> /// A Discord api wrapper /// </summary> public class DiscordClient : BaseDiscordClient { #region Internal Variables internal static UTF8Encoding UTF8 = new UTF8Encoding(false); internal static DateTimeOffset DiscordEpoch = new DateTimeOffset(2015, 1, 1, 0, 0, 0, TimeSpan.Zero); internal CancellationTokenSource _cancelTokenSource; internal CancellationToken _cancelToken; internal List<BaseExtension> _extensions = new List<BaseExtension>(); internal BaseWebSocketClient _webSocketClient; internal string _sessionToken = ""; internal string _sessionId = ""; internal int _heartbeatInterval; internal Task _heartbeatTask; internal DateTimeOffset _lastHeartbeat; internal long _lastSequence; internal int _skippedHeartbeats = 0; internal bool _guildDownloadCompleted = false; internal RingBuffer<DiscordMessage> MessageCache { get; } internal StatusUpdate _status = null; #endregion #region Public Variables /// <summary> /// Gets the gateway protocol version. /// </summary> public int GatewayVersion => this._gatewayVersion; internal int _gatewayVersion; /// <summary> /// Gets the gateway URL. /// </summary> public Uri GatewayUri => this._gatewayUri; internal Uri _gatewayUri; /// <summary> /// Gets the total number of shards the bot is connected to. /// </summary> public int ShardCount => this.Configuration.ShardCount; internal int _shardCount = 1; /// <summary> /// Gets the currently connected shard ID. /// </summary> public int ShardId => this.Configuration.ShardId; /// <summary> /// Gets a dictionary of DM channels that have been cached by this client. The dictionary's key is the channel /// ID. /// </summary> public IReadOnlyDictionary<ulong, DiscordDmChannel> PrivateChannels { get; } internal ConcurrentDictionary<ulong, DiscordDmChannel> _privateChannels = new ConcurrentDictionary<ulong, DiscordDmChannel>(); /// <summary> /// Gets a dictionary of guilds that this client is in. The dictionary's key is the guild ID. Note that the /// guild objects in this dictionary will not be filled in if the specific guilds aren't available (the /// <see cref="GuildAvailable"/> or <see cref="GuildDownloadCompleted"/> events haven't been fired yet) /// </summary> public override IReadOnlyDictionary<ulong, DiscordGuild> Guilds { get; } internal ConcurrentDictionary<ulong, DiscordGuild> _guilds = new ConcurrentDictionary<ulong, DiscordGuild>(); /// <summary> /// Gets the WS latency for this client. /// </summary> public int Ping => Volatile.Read(ref this._ping); private int _ping; /// <summary> /// Gets the collection of presences held by this client. /// </summary> public IReadOnlyDictionary<ulong, DiscordPresence> Presences => this._presencesLazy.Value; internal Dictionary<ulong, DiscordPresence> _presences = new Dictionary<ulong, DiscordPresence>(); private Lazy<IReadOnlyDictionary<ulong, DiscordPresence>> _presencesLazy; #endregion #region Connection semaphore internal static ConcurrentDictionary<ulong, SocketLock> SocketLocks { get; } = new ConcurrentDictionary<ulong, SocketLock>(); private ManualResetEventSlim ConnectionLock { get; } = new ManualResetEventSlim(true); private ManualResetEventSlim SessionLock { get; } = new ManualResetEventSlim(true); #endregion /// <summary> /// Initializes a new instance of DiscordClient. /// </summary> /// <param name="config">Specifies configuration parameters.</param> public DiscordClient(DiscordConfiguration config) : base(config) { if (this.Configuration.MessageCacheSize > 0) this.MessageCache = new RingBuffer<DiscordMessage>(this.Configuration.MessageCacheSize); InternalSetup(); this.Guilds = new ReadOnlyConcurrentDictionary<ulong, DiscordGuild>(_guilds); this.PrivateChannels = new ReadOnlyConcurrentDictionary<ulong, DiscordDmChannel>(_privateChannels); } internal void InternalSetup() { this._clientErrored = new AsyncEvent<ClientErrorEventArgs>(this.Goof, "CLIENT_ERRORED"); this._socketErrored = new AsyncEvent<SocketErrorEventArgs>(this.Goof, "SOCKET_ERRORED"); this._socketOpened = new AsyncEvent(this.EventErrorHandler, "SOCKET_OPENED"); this._socketClosed = new AsyncEvent<SocketCloseEventArgs>(this.EventErrorHandler, "SOCKET_CLOSED"); this._ready = new AsyncEvent<ReadyEventArgs>(this.EventErrorHandler, "READY"); this._resumed = new AsyncEvent<ReadyEventArgs>(this.EventErrorHandler, "RESUMED"); this._channelCreated = new AsyncEvent<ChannelCreateEventArgs>(this.EventErrorHandler, "CHANNEL_CREATED"); this._dmChannelCreated = new AsyncEvent<DmChannelCreateEventArgs>(this.EventErrorHandler, "DM_CHANNEL_CREATED"); this._channelUpdated = new AsyncEvent<ChannelUpdateEventArgs>(this.EventErrorHandler, "CHANNEL_UPDATED"); this._channelDeleted = new AsyncEvent<ChannelDeleteEventArgs>(this.EventErrorHandler, "CHANNEL_DELETED"); this._dmChannelDeleted = new AsyncEvent<DmChannelDeleteEventArgs>(this.EventErrorHandler, "DM_CHANNEL_DELETED"); this._channelPinsUpdated = new AsyncEvent<ChannelPinsUpdateEventArgs>(this.EventErrorHandler, "CHANNEL_PINS_UPDATEED"); this._guildCreated = new AsyncEvent<GuildCreateEventArgs>(this.EventErrorHandler, "GUILD_CREATED"); this._guildAvailable = new AsyncEvent<GuildCreateEventArgs>(this.EventErrorHandler, "GUILD_AVAILABLE"); this._guildUpdated = new AsyncEvent<GuildUpdateEventArgs>(this.EventErrorHandler, "GUILD_UPDATED"); this._guildDeleted = new AsyncEvent<GuildDeleteEventArgs>(this.EventErrorHandler, "GUILD_DELETED"); this._guildUnavailable = new AsyncEvent<GuildDeleteEventArgs>(this.EventErrorHandler, "GUILD_UNAVAILABLE"); this._guildDownloadCompletedEv = new AsyncEvent<GuildDownloadCompletedEventArgs>(this.EventErrorHandler, "GUILD_DOWNLOAD_COMPLETED"); this._messageCreated = new AsyncEvent<MessageCreateEventArgs>(this.EventErrorHandler, "MESSAGE_CREATED"); this._presenceUpdated = new AsyncEvent<PresenceUpdateEventArgs>(this.EventErrorHandler, "PRESENCE_UPDATED"); this._guildBanAdded = new AsyncEvent<GuildBanAddEventArgs>(this.EventErrorHandler, "GUILD_BAN_ADD"); this._guildBanRemoved = new AsyncEvent<GuildBanRemoveEventArgs>(this.EventErrorHandler, "GUILD_BAN_REMOVED"); this._guildEmojisUpdated = new AsyncEvent<GuildEmojisUpdateEventArgs>(this.EventErrorHandler, "GUILD_EMOJI_UPDATED"); this._guildIntegrationsUpdated = new AsyncEvent<GuildIntegrationsUpdateEventArgs>(this.EventErrorHandler, "GUILD_INTEGRATIONS_UPDATED"); this._guildMemberAdded = new AsyncEvent<GuildMemberAddEventArgs>(this.EventErrorHandler, "GUILD_MEMBER_ADD"); this._guildMemberRemoved = new AsyncEvent<GuildMemberRemoveEventArgs>(this.EventErrorHandler, "GUILD_MEMBER_REMOVED"); this._guildMemberUpdated = new AsyncEvent<GuildMemberUpdateEventArgs>(this.EventErrorHandler, "GUILD_MEMBER_UPDATED"); this._guildRoleCreated = new AsyncEvent<GuildRoleCreateEventArgs>(this.EventErrorHandler, "GUILD_ROLE_CREATED"); this._guildRoleUpdated = new AsyncEvent<GuildRoleUpdateEventArgs>(this.EventErrorHandler, "GUILD_ROLE_UPDATED"); this._guildRoleDeleted = new AsyncEvent<GuildRoleDeleteEventArgs>(this.EventErrorHandler, "GUILD_ROLE_DELETED"); this._messageAcknowledged = new AsyncEvent<MessageAcknowledgeEventArgs>(this.EventErrorHandler, "MESSAGE_ACKNOWLEDGED"); this._messageUpdated = new AsyncEvent<MessageUpdateEventArgs>(this.EventErrorHandler, "MESSAGE_UPDATED"); this._messageDeleted = new AsyncEvent<MessageDeleteEventArgs>(this.EventErrorHandler, "MESSAGE_DELETED"); this._messagesBulkDeleted = new AsyncEvent<MessageBulkDeleteEventArgs>(this.EventErrorHandler, "MESSAGE_BULK_DELETED"); this._typingStarted = new AsyncEvent<TypingStartEventArgs>(this.EventErrorHandler, "TYPING_STARTED"); this._userSettingsUpdated = new AsyncEvent<UserSettingsUpdateEventArgs>(this.EventErrorHandler, "USER_SETTINGS_UPDATED"); this._userUpdated = new AsyncEvent<UserUpdateEventArgs>(this.EventErrorHandler, "USER_UPDATED"); this._voiceStateUpdated = new AsyncEvent<VoiceStateUpdateEventArgs>(this.EventErrorHandler, "VOICE_STATE_UPDATED"); this._voiceServerUpdated = new AsyncEvent<VoiceServerUpdateEventArgs>(this.EventErrorHandler, "VOICE_SERVER_UPDATED"); this._guildMembersChunked = new AsyncEvent<GuildMembersChunkEventArgs>(this.EventErrorHandler, "GUILD_MEMBERS_CHUNKED"); this._unknownEvent = new AsyncEvent<UnknownEventArgs>(this.EventErrorHandler, "UNKNOWN_EVENT"); this._messageReactionAdded = new AsyncEvent<MessageReactionAddEventArgs>(this.EventErrorHandler, "MESSAGE_REACTION_ADDED"); this._messageReactionRemoved = new AsyncEvent<MessageReactionRemoveEventArgs>(this.EventErrorHandler, "MESSAGE_REACTION_REMOVED"); this._messageReactionsCleared = new AsyncEvent<MessageReactionsClearEventArgs>(this.EventErrorHandler, "MESSAGE_REACTIONS_CLEARED"); this._webhooksUpdated = new AsyncEvent<WebhooksUpdateEventArgs>(this.EventErrorHandler, "WEBHOOKS_UPDATED"); this._heartbeated = new AsyncEvent<HeartbeatEventArgs>(this.EventErrorHandler, "HEARTBEATED"); this._guilds.Clear(); this._presencesLazy = new Lazy<IReadOnlyDictionary<ulong, DiscordPresence>>(() => new ReadOnlyDictionary<ulong, DiscordPresence>(this._presences)); if (Configuration.UseInternalLogHandler) DebugLogger.LogMessageReceived += (sender, e) => DebugLogger.LogHandler(sender, e); } /// <summary> /// Registers an extension with this client. /// </summary> /// <param name="ext">Extension to register.</param> /// <returns></returns> public void AddExtension(BaseExtension ext) { ext.Setup(this); _extensions.Add(ext); } /// <summary> /// Retrieves a previously-registered extension from this client. /// </summary> /// <typeparam name="T">Type of extension to retrieve.</typeparam> /// <returns>The requested extension.</returns> public T GetExtension<T>() where T : BaseExtension => _extensions.FirstOrDefault(x => x.GetType() == typeof(T)) as T; /// <summary> /// Connects to the gateway /// </summary> /// <returns></returns> public async Task ConnectAsync(DiscordActivity activity = null, UserStatus ? status = null, DateTimeOffset? idlesince = null) { // Check if connection lock is already set, and set it if it isn't if (!this.ConnectionLock.Wait(0)) throw new InvalidOperationException("This client is already connected."); this.ConnectionLock.Reset(); var w = 7500; var i = 5; var s = false; Exception cex = null; if (activity == null && status == null && idlesince == null) this._status = null; else { var since_unix = idlesince != null ? (long?)Utilities.GetUnixTime(idlesince.Value) : null; this._status = new StatusUpdate() { Activity = new TransportActivity(activity), Status = status ?? UserStatus.Online, IdleSince = since_unix, IsAFK = idlesince != null }; } if (this.Configuration.TokenType != TokenType.Bot) this.DebugLogger.LogMessage(LogLevel.Warning, "DSharpPlus", "You are logging in with a token that is not a bot token. This is not officially supported by Discord, and can result in your account being terminated if you aren't careful.", DateTime.Now); this.DebugLogger.LogMessage(LogLevel.Info, "DSharpPlus", $"DSharpPlus, version {this.VersionString}", DateTime.Now); while (i-- > 0 || this.Configuration.ReconnectIndefinitely) { try { await this.InternalConnectAsync().ConfigureAwait(false); s = true; break; } catch (UnauthorizedException e) { FailConnection(this.ConnectionLock); throw new Exception("Authentication failed. Check your token and try again.", e); } catch (PlatformNotSupportedException) { FailConnection(this.ConnectionLock); throw; } catch (NotImplementedException) { FailConnection(this.ConnectionLock); throw; } catch (Exception ex) { FailConnection(null); cex = ex; if (i <= 0 && !this.Configuration.ReconnectIndefinitely) break; this.DebugLogger.LogMessage(LogLevel.Error, "DSharpPlus", $"Connection attempt failed, retrying in {w / 1000}s", DateTime.Now, ex); await Task.Delay(w).ConfigureAwait(false); if (i > 0) w *= 2; } } if (!s && cex != null) { this.ConnectionLock.Set(); throw new Exception("Could not connect to Discord.", cex); } // non-closure, hence args void FailConnection(ManualResetEventSlim cl) { // unlock this (if applicable) so we can let others attempt to connect cl?.Set(); } } public Task ReconnectAsync(bool startNewSession = false) { if (startNewSession) _sessionId = ""; return _webSocketClient.DisconnectAsync(null); } internal Task InternalReconnectAsync() => ConnectAsync(); internal async Task InternalConnectAsync() { SocketLock socketLock = null; try { await this.InternalUpdateGatewayAsync().ConfigureAwait(false); await this.InitializeAsync().ConfigureAwait(false); socketLock = this.GetSocketLock(); await socketLock.LockAsync().ConfigureAwait(false); } catch { socketLock?.UnlockAfter(TimeSpan.Zero); throw; } if (!this.Presences.ContainsKey(this.CurrentUser.Id)) { this._presences[this.CurrentUser.Id] = new DiscordPresence { Discord = this, RawActivity = new TransportActivity(), Activity = new DiscordActivity(), Status = UserStatus.Online, InternalUser = new TransportUser { Id = this.CurrentUser.Id, Username = this.CurrentUser.Username, Discriminator = this.CurrentUser.Discriminator, AvatarHash = this.CurrentUser.AvatarHash } }; } else { var pr = this._presences[this.CurrentUser.Id]; pr.RawActivity = new TransportActivity(); pr.Activity = new DiscordActivity(); pr.Status = UserStatus.Online; } Volatile.Write(ref this._skippedHeartbeats, 0); _webSocketClient = this.Configuration.WebSocketClientFactory(this.Configuration.Proxy); _cancelTokenSource = new CancellationTokenSource(); _cancelToken = _cancelTokenSource.Token; _webSocketClient.Connected += SocketOnConnect; _webSocketClient.Disconnected += SocketOnDisconnect; _webSocketClient.MessageReceived += SocketOnMessage; _webSocketClient.Errored += SocketOnError; var gwuri = new UriBuilder(this._gatewayUri) { Query = this.Configuration.GatewayCompressionLevel == GatewayCompressionLevel.Stream ? "v=6&encoding=json&compress=zlib-stream" : "v=6&encoding=json" }; await _webSocketClient.ConnectAsync(gwuri.Uri).ConfigureAwait(false); Task SocketOnConnect() => this._socketOpened.InvokeAsync(); async Task SocketOnMessage(SocketMessageEventArgs e) { try { await HandleSocketMessageAsync(e.Message); } catch (Exception ex) { DebugLogger.LogMessage(LogLevel.Error, "Websocket", $"Socket swallowed an exception:", DateTime.Now, ex); } } Task SocketOnError(SocketErrorEventArgs e) => this._socketErrored.InvokeAsync(new SocketErrorEventArgs(this) { Exception = e.Exception }); async Task SocketOnDisconnect(SocketCloseEventArgs e) { // release session and connection this.ConnectionLock.Set(); this.SessionLock.Set(); _cancelTokenSource.Cancel(); this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", $"Connection closed. ({e.CloseCode.ToString(CultureInfo.InvariantCulture)}, '{e.CloseMessage}')", DateTime.Now); await this._socketClosed.InvokeAsync(new SocketCloseEventArgs(this) { CloseCode = e.CloseCode, CloseMessage = e.CloseMessage }).ConfigureAwait(false); if (Configuration.AutoReconnect) { DebugLogger.LogMessage(LogLevel.Critical, "Websocket", $"Socket connection terminated ({e.CloseCode.ToString(CultureInfo.InvariantCulture)}, '{e.CloseMessage}'). Reconnecting.", DateTime.Now); await ConnectAsync().ConfigureAwait(false); } } } /// <summary> /// Disconnects from the gateway /// </summary> /// <returns></returns> public async Task DisconnectAsync() { Configuration.AutoReconnect = false; if (this._webSocketClient != null) await _webSocketClient.DisconnectAsync(null).ConfigureAwait(false); } #region Public Functions /// <summary> /// Gets a user /// </summary> /// <param name="userId">Id of the user</param> /// <returns></returns> public async Task<DiscordUser> GetUserAsync(ulong userId) { var usr = this.InternalGetCachedUser(userId); if (usr != null) return usr; usr = await this.ApiClient.GetUserAsync(userId).ConfigureAwait(false); usr = this.UserCache.AddOrUpdate(userId, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); return usr; } /// <summary> /// Gets a channel /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task<DiscordChannel> GetChannelAsync(ulong id) => this.InternalGetCachedChannel(id) ?? await this.ApiClient.GetChannelAsync(id).ConfigureAwait(false); /// <summary> /// Sends a message /// </summary> /// <param name="channel"></param> /// <param name="content"></param> /// <param name="isTTS"></param> /// <param name="embed"></param> /// <returns></returns> public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, string content = null, bool isTTS = false, DiscordEmbed embed = null) => this.ApiClient.CreateMessageAsync(channel.Id, content, isTTS, embed); /// <summary> /// Creates a guild. This requires the bot to be in less than 10 guilds total. /// </summary> /// <param name="name">Name of the guild.</param> /// <param name="region">Voice region of the guild.</param> /// <param name="icon">Stream containing the icon for the guild.</param> /// <param name="verificationLevel">Verification level for the guild.</param> /// <param name="defaultMessageNotifications">Default message notification settings for the guild.</param> /// <returns>The created guild.</returns> public Task<DiscordGuild> CreateGuildAsync(string name, string region = null, Optional<Stream> icon = default, VerificationLevel? verificationLevel = null, DefaultMessageNotifications? defaultMessageNotifications = null) { var iconb64 = Optional.FromNoValue<string>(); if (icon.HasValue && icon.Value != null) using (var imgtool = new ImageTool(icon.Value)) iconb64 = imgtool.GetBase64(); else if (icon.HasValue) iconb64 = null; return this.ApiClient.CreateGuildAsync(name, region, iconb64, verificationLevel, defaultMessageNotifications); } /// <summary> /// Gets a guild /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task<DiscordGuild> GetGuildAsync(ulong id) { if (this._guilds.TryGetValue(id, out var guild)) return guild; guild = await this.ApiClient.GetGuildAsync(id).ConfigureAwait(false); var channels = await this.ApiClient.GetGuildChannelsAsync(guild.Id).ConfigureAwait(false); foreach (var channel in channels) guild._channels[channel.Id] = channel; return guild; } /// <summary> /// Gets an invite /// </summary> /// <param name="code"></param> /// <returns></returns> public Task<DiscordInvite> GetInviteByCodeAsync(string code) => this.ApiClient.GetInviteAsync(code); /// <summary> /// Gets a list of connections /// </summary> /// <returns></returns> public Task<IReadOnlyList<DiscordConnection>> GetConnectionsAsync() => this.ApiClient.GetUsersConnectionsAsync(); /// <summary> /// Gets a webhook /// </summary> /// <param name="id"></param> /// <returns></returns> public Task<DiscordWebhook> GetWebhookAsync(ulong id) => this.ApiClient.GetWebhookAsync(id); /// <summary> /// Gets a webhook /// </summary> /// <param name="id"></param> /// <param name="token"></param> /// <returns></returns> public Task<DiscordWebhook> GetWebhookWithTokenAsync(ulong id, string token) => this.ApiClient.GetWebhookWithTokenAsync(id, token); /// <summary> /// Updates current user's activity and status. /// </summary> /// <param name="activity">Activity to set.</param> /// <param name="userStatus">Status of the user.</param> /// <param name="idleSince">Since when is the client performing the specified activity.</param> /// <returns></returns> public Task UpdateStatusAsync(DiscordActivity activity = null, UserStatus? userStatus = null, DateTimeOffset? idleSince = null) => this.InternalUpdateStatusAsync(activity, userStatus, idleSince); /// <summary> /// Gets information about specified API application. /// </summary> /// <param name="id">ID of the application.</param> /// <returns>Information about specified API application.</returns> public Task<DiscordApplication> GetApplicationAsync(ulong id) => this.ApiClient.GetApplicationInfoAsync(id); /// <summary> /// Edits current user. /// </summary> /// <param name="username">New username.</param> /// <param name="avatar">New avatar.</param> /// <returns></returns> public async Task<DiscordUser> UpdateCurrentUserAsync(string username = null, Optional<Stream> avatar = default) { var av64 = Optional.FromNoValue<string>(); if (avatar.HasValue && avatar.Value != null) using (var imgtool = new ImageTool(avatar.Value)) av64 = imgtool.GetBase64(); else if (avatar.HasValue) av64 = null; var usr = await this.ApiClient.ModifyCurrentUserAsync(username, av64).ConfigureAwait(false); this.CurrentUser.Username = usr.Username; this.CurrentUser.Discriminator = usr.Discriminator; this.CurrentUser.AvatarHash = usr.AvatarHash; return this.CurrentUser; } /// <summary> /// Requests guild sync for specified guilds. Guild sync sends information about members and presences for a given guild, and makes gateway dispatch additional events. /// /// This can only be done for user tokens. /// </summary> /// <param name="guilds">Guilds to send a sync request for.</param> /// <returns></returns> public Task SyncGuildsAsync(params DiscordGuild[] guilds) { if (this.Configuration.TokenType != TokenType.User) throw new InvalidOperationException("This can only be done for user tokens."); var to_sync = guilds.Where(xg => !xg.IsSynced).Select(xg => xg.Id); if (!to_sync.Any()) return Task.Delay(0); var guild_sync = new GatewayPayload { OpCode = GatewayOpCode.GuildSync, Data = to_sync }; var guild_syncstr = JsonConvert.SerializeObject(guild_sync); this._webSocketClient.SendMessage(guild_syncstr); return Task.Delay(0); } #endregion #region Websocket (Events) internal async Task HandleSocketMessageAsync(string data) { var payload = JsonConvert.DeserializeObject<GatewayPayload>(data); switch (payload.OpCode) { case GatewayOpCode.Dispatch: await HandleDispatchAsync(payload).ConfigureAwait(false); break; case GatewayOpCode.Heartbeat: await OnHeartbeatAsync((long)payload.Data).ConfigureAwait(false); break; case GatewayOpCode.Reconnect: await OnReconnectAsync().ConfigureAwait(false); break; case GatewayOpCode.InvalidSession: await OnInvalidateSessionAsync((bool)payload.Data).ConfigureAwait(false); break; case GatewayOpCode.Hello: await OnHelloAsync((payload.Data as JObject).ToObject<GatewayHello>()).ConfigureAwait(false); break; case GatewayOpCode.HeartbeatAck: await OnHeartbeatAckAsync().ConfigureAwait(false); break; default: DebugLogger.LogMessage(LogLevel.Warning, "Websocket", $"Unknown OP-Code: {((int)payload.OpCode).ToString(CultureInfo.InvariantCulture)}\n{payload.Data}", DateTime.Now); break; } } internal async Task HandleDispatchAsync(GatewayPayload payload) { if (!(payload.Data is JObject dat)) { DebugLogger.LogMessage(LogLevel.Warning, "Websocket:Dispatch", $"Invalid payload body, you can probably ignore this message: {payload.OpCode}:{payload.EventName}\n{payload.Data}", DateTime.Now); return; } DiscordChannel chn; ulong gid; ulong cid; TransportUser usr; switch (payload.EventName.ToLowerInvariant()) { case "ready": var glds = (JArray)dat["guilds"]; var dmcs = (JArray)dat["private_channels"]; await OnReadyEventAsync(dat.ToObject<ReadyPayload>(), glds, dmcs).ConfigureAwait(false); break; case "resumed": await OnResumedAsync().ConfigureAwait(false); break; case "channel_create": chn = dat.ToObject<DiscordChannel>(); await OnChannelCreateEventAsync(chn.IsPrivate ? dat.ToObject<DiscordDmChannel>() : chn, dat["recipients"] as JArray).ConfigureAwait(false); break; case "channel_update": await OnChannelUpdateEventAsync(dat.ToObject<DiscordChannel>()).ConfigureAwait(false); break; case "channel_delete": chn = dat.ToObject<DiscordChannel>(); await OnChannelDeleteEventAsync(chn.IsPrivate ? dat.ToObject<DiscordDmChannel>() : chn).ConfigureAwait(false); break; case "channel_pins_update": cid = (ulong)dat["channel_id"]; var ts = (string)dat["last_pin_timestamp"]; await this.OnChannelPinsUpdate(this.InternalGetCachedChannel(cid), ts != null ? DateTimeOffset.Parse(ts, CultureInfo.InvariantCulture) : default(DateTimeOffset?)).ConfigureAwait(false); break; case "guild_create": await OnGuildCreateEventAsync(dat.ToObject<DiscordGuild>(), (JArray)dat["members"], dat["presences"].ToObject<IEnumerable<DiscordPresence>>()).ConfigureAwait(false); break; case "guild_update": await OnGuildUpdateEventAsync(dat.ToObject<DiscordGuild>(), (JArray)dat["members"]).ConfigureAwait(false); break; case "guild_delete": await OnGuildDeleteEventAsync(dat.ToObject<DiscordGuild>(), (JArray)dat["members"]).ConfigureAwait(false); break; case "guild_sync": gid = (ulong)dat["id"]; await this.OnGuildSyncEventAsync(this._guilds[gid], (bool)dat["large"], (JArray)dat["members"], dat["presences"].ToObject<IEnumerable<DiscordPresence>>()).ConfigureAwait(false); break; case "guild_ban_add": usr = dat["user"].ToObject<TransportUser>(); gid = (ulong)dat["guild_id"]; await OnGuildBanAddEventAsync(usr, this._guilds[gid]).ConfigureAwait(false); break; case "guild_ban_remove": usr = dat["user"].ToObject<TransportUser>(); gid = (ulong)dat["guild_id"]; await OnGuildBanRemoveEventAsync(usr, this._guilds[gid]).ConfigureAwait(false); break; case "guild_emojis_update": gid = (ulong)dat["guild_id"]; var ems = dat["emojis"].ToObject<IEnumerable<DiscordEmoji>>(); await OnGuildEmojisUpdateEventAsync(this._guilds[gid], ems).ConfigureAwait(false); break; case "guild_integrations_update": gid = (ulong)dat["guild_id"]; await OnGuildIntegrationsUpdateEventAsync(this._guilds[gid]).ConfigureAwait(false); break; case "guild_member_add": gid = (ulong)dat["guild_id"]; await OnGuildMemberAddEventAsync(dat.ToObject<TransportMember>(), this._guilds[gid]).ConfigureAwait(false); break; case "guild_member_remove": gid = (ulong)dat["guild_id"]; if (!this._guilds.ContainsKey(gid)) { this.DebugLogger.LogMessage(LogLevel.Error, "Websocket:Dispatch", $"Could not find {gid.ToString(CultureInfo.InvariantCulture)} in guild cache.", DateTime.Now); return; } await OnGuildMemberRemoveEventAsync(dat["user"].ToObject<TransportUser>(), this._guilds[gid]).ConfigureAwait(false); break; case "guild_member_update": gid = (ulong)dat["guild_id"]; await OnGuildMemberUpdateEventAsync(dat["user"].ToObject<TransportUser>(), this._guilds[gid], dat["roles"].ToObject<IEnumerable<ulong>>(), (string)dat["nick"]).ConfigureAwait(false); break; case "guild_members_chunk": gid = (ulong)dat["guild_id"]; await OnGuildMembersChunkEventAsync(dat["members"].ToObject<IEnumerable<TransportMember>>(), this._guilds[gid]).ConfigureAwait(false); break; case "guild_role_create": gid = (ulong)dat["guild_id"]; await OnGuildRoleCreateEventAsync(dat["role"].ToObject<DiscordRole>(), this._guilds[gid]).ConfigureAwait(false); break; case "guild_role_update": gid = (ulong)dat["guild_id"]; await OnGuildRoleUpdateEventAsync(dat["role"].ToObject<DiscordRole>(), this._guilds[gid]).ConfigureAwait(false); break; case "guild_role_delete": gid = (ulong)dat["guild_id"]; await OnGuildRoleDeleteEventAsync((ulong)dat["role_id"], this._guilds[gid]).ConfigureAwait(false); break; case "message_ack": cid = (ulong)dat["channel_id"]; var mid = (ulong)dat["message_id"]; await OnMessageAckEventAsync(this.InternalGetCachedChannel(cid), mid).ConfigureAwait(false); break; case "message_create": await OnMessageCreateEventAsync(dat.ToDiscordObject<DiscordMessage>(), dat["author"].ToObject<TransportUser>()).ConfigureAwait(false); break; case "message_update": await OnMessageUpdateEventAsync(dat.ToDiscordObject<DiscordMessage>(), dat["author"]?.ToObject<TransportUser>()).ConfigureAwait(false); break; // delete event does *not* include message object case "message_delete": await OnMessageDeleteEventAsync((ulong)dat["id"], this.InternalGetCachedChannel((ulong)dat["channel_id"])).ConfigureAwait(false); break; case "message_delete_bulk": await OnMessageBulkDeleteEventAsync(dat["ids"].ToObject<IEnumerable<ulong>>(), this.InternalGetCachedChannel((ulong)dat["channel_id"])).ConfigureAwait(false); break; case "presence_update": await OnPresenceUpdateEventAsync(dat, (JObject)dat["user"]).ConfigureAwait(false); break; case "typing_start": cid = (ulong)dat["channel_id"]; await OnTypingStartEventAsync((ulong)dat["user_id"], this.InternalGetCachedChannel(cid), Utilities.GetDateTimeOffset((long)dat["timestamp"])).ConfigureAwait(false); break; case "user_settings_update": await OnUserSettingsUpdateEventAsync(dat.ToObject<TransportUser>()).ConfigureAwait(false); break; case "user_update": await OnUserUpdateEventAsync(dat.ToObject<TransportUser>()).ConfigureAwait(false); break; case "voice_state_update": await OnVoiceStateUpdateEventAsync(dat).ConfigureAwait(false); break; case "voice_server_update": gid = (ulong)dat["guild_id"]; await OnVoiceServerUpdateEventAsync((string)dat["endpoint"], (string)dat["token"], this._guilds[gid]).ConfigureAwait(false); break; case "message_reaction_add": cid = (ulong)dat["channel_id"]; await OnMessageReactionAddAsync((ulong)dat["user_id"], (ulong)dat["message_id"], this.InternalGetCachedChannel(cid), dat["emoji"].ToObject<DiscordEmoji>()).ConfigureAwait(false); break; case "message_reaction_remove": cid = (ulong)dat["channel_id"]; await OnMessageReactionRemoveAsync((ulong)dat["user_id"], (ulong)dat["message_id"], this.InternalGetCachedChannel(cid), dat["emoji"].ToObject<DiscordEmoji>()).ConfigureAwait(false); break; case "message_reaction_remove_all": cid = (ulong)dat["channel_id"]; await OnMessageReactionRemoveAllAsync((ulong)dat["message_id"], this.InternalGetCachedChannel(cid)).ConfigureAwait(false); break; case "webhooks_update": gid = (ulong)dat["guild_id"]; cid = (ulong)dat["channel_id"]; await OnWebhooksUpdateAsync(this._guilds[gid].GetChannel(cid), this._guilds[gid]).ConfigureAwait(false); break; default: await OnUnknownEventAsync(payload).ConfigureAwait(false); DebugLogger.LogMessage(LogLevel.Warning, "Websocket:Dispatch", $"Unknown event: {payload.EventName}\n{payload.Data}", DateTime.Now); break; } } #region Events internal async Task OnReadyEventAsync(ReadyPayload ready, JArray rawGuilds, JArray rawDmChannels) { //ready.CurrentUser.Discord = this; var rusr = ready.CurrentUser; this.CurrentUser.Username = rusr.Username; this.CurrentUser.Discriminator = rusr.Discriminator; this.CurrentUser.AvatarHash = rusr.AvatarHash; this.CurrentUser.MfaEnabled = rusr.MfaEnabled; this.CurrentUser.Verified = rusr.Verified; this.CurrentUser.IsBot = rusr.IsBot; this._gatewayVersion = ready.GatewayVersion; this._sessionId = ready.SessionId; var raw_guild_index = rawGuilds.ToDictionary(xt => (ulong)xt["id"], xt => (JObject)xt); this._privateChannels.Clear(); foreach (var rawChannel in rawDmChannels) { var channel = rawChannel.ToObject<DiscordDmChannel>(); channel.Discord = this; //xdc._recipients = // .Select(xtu => this.InternalGetCachedUser(xtu.Id) ?? new DiscordUser(xtu) { Discord = this }) // .ToList(); var recips_raw = rawChannel["recipients"].ToObject<IEnumerable<TransportUser>>(); channel._recipients = new List<DiscordUser>(); foreach (var xr in recips_raw) { var xu = new DiscordUser(xr) { Discord = this }; xu = this.UserCache.AddOrUpdate(xr.Id, xu, (id, old) => { old.Username = xu.Username; old.Discriminator = xu.Discriminator; old.AvatarHash = xu.AvatarHash; return old; }); channel._recipients.Add(xu); } this._privateChannels[channel.Id] = channel; } this._guilds.Clear(); foreach (var guild in ready.Guilds) { guild.Discord = this; if (guild._channels == null) guild._channels = new ConcurrentDictionary<ulong, DiscordChannel>(); foreach (var xc in guild.Channels.Values) { xc.GuildId = guild.Id; xc.Discord = this; foreach (var xo in xc._permissionOverwrites) { xo.Discord = this; xo._channel_id = xc.Id; } } if (guild._roles == null) guild._roles = new ConcurrentDictionary<ulong, DiscordRole>(); foreach (var xr in guild.Roles.Values) { xr.Discord = this; xr._guild_id = guild.Id; } var raw_guild = raw_guild_index[guild.Id]; var raw_members = (JArray)raw_guild["members"]; if (guild._members != null) guild._members.Clear(); else guild._members = new ConcurrentDictionary<ulong, DiscordMember>(); if (raw_members != null) { foreach (var xj in raw_members) { var xtm = xj.ToObject<TransportMember>(); var xu = new DiscordUser(xtm.User) {Discord = this}; xu = this.UserCache.AddOrUpdate(xtm.User.Id, xu, (id, old) => { old.Username = xu.Username; old.Discriminator = xu.Discriminator; old.AvatarHash = xu.AvatarHash; return old; }); guild._members[xtm.User.Id] = new DiscordMember(xtm) {Discord = this, _guild_id = guild.Id}; } } if (guild._emojis == null) guild._emojis = new ConcurrentDictionary<ulong, DiscordEmoji>(); foreach (var xe in guild.Emojis.Values) xe.Discord = this; if (guild._voiceStates == null) guild._voiceStates = new ConcurrentDictionary<ulong, DiscordVoiceState>(); foreach (var xvs in guild.VoiceStates.Values) xvs.Discord = this; this._guilds[guild.Id] = guild; } if (this.Configuration.TokenType == TokenType.User && this.Configuration.AutomaticGuildSync) await this.SendGuildSyncAsync().ConfigureAwait(false); else if (this.Configuration.TokenType == TokenType.User) Volatile.Write(ref this._guildDownloadCompleted, true); await this._ready.InvokeAsync(new ReadyEventArgs(this)).ConfigureAwait(false); } internal Task OnResumedAsync() { this.DebugLogger.LogMessage(LogLevel.Info, "DSharpPlus", "Session resumed.", DateTime.Now); return this._resumed.InvokeAsync(new ReadyEventArgs(this)); } internal async Task OnChannelCreateEventAsync(DiscordChannel channel, JArray rawRecipients) { channel.Discord = this; if (channel.Type == ChannelType.Group || channel.Type == ChannelType.Private) { var dmChannel = channel as DiscordDmChannel; var recips = rawRecipients.ToObject<IEnumerable<TransportUser>>() .Select(xtu => this.InternalGetCachedUser(xtu.Id) ?? new DiscordUser(xtu) { Discord = this }); dmChannel._recipients = recips.ToList(); _privateChannels[dmChannel.Id] = dmChannel; await this._dmChannelCreated.InvokeAsync(new DmChannelCreateEventArgs(this) { Channel = dmChannel }).ConfigureAwait(false); } else { channel.Discord = this; foreach (var xo in channel._permissionOverwrites) { xo.Discord = this; xo._channel_id = channel.Id; } _guilds[channel.GuildId]._channels[channel.Id] = channel; await this._channelCreated.InvokeAsync(new ChannelCreateEventArgs(this) { Channel = channel, Guild = channel.Guild }).ConfigureAwait(false); } } internal async Task OnChannelUpdateEventAsync(DiscordChannel channel) { if (channel == null) return; channel.Discord = this; var gld = channel.Guild; var channel_new = this.InternalGetCachedChannel(channel.Id); DiscordChannel channel_old = null; if (channel_new != null) { channel_old = new DiscordChannel { Bitrate = channel_new.Bitrate, Discord = this, GuildId = channel_new.GuildId, Id = channel_new.Id, //IsPrivate = channel_new.IsPrivate, LastMessageId = channel_new.LastMessageId, Name = channel_new.Name, _permissionOverwrites = new List<DiscordOverwrite>(channel_new._permissionOverwrites), Position = channel_new.Position, Topic = channel_new.Topic, Type = channel_new.Type, UserLimit = channel_new.UserLimit, ParentId = channel_new.ParentId, IsNSFW = channel_new.IsNSFW, PerUserRateLimit = channel_new.PerUserRateLimit }; } else { gld._channels[channel.Id] = channel; } channel_new.Bitrate = channel.Bitrate; channel_new.Name = channel.Name; channel_new.Position = channel.Position; channel_new.Topic = channel.Topic; channel_new.UserLimit = channel.UserLimit; channel_new.ParentId = channel.ParentId; channel_new.IsNSFW = channel.IsNSFW; channel_new.PerUserRateLimit = channel.PerUserRateLimit; channel_new._permissionOverwrites.Clear(); foreach (var po in channel._permissionOverwrites) { po.Discord = this; po._channel_id = channel.Id; } channel_new._permissionOverwrites.AddRange(channel._permissionOverwrites); await this._channelUpdated.InvokeAsync(new ChannelUpdateEventArgs(this) { ChannelAfter = channel_new, Guild = gld, ChannelBefore = channel_old }).ConfigureAwait(false); } internal async Task OnChannelDeleteEventAsync(DiscordChannel channel) { if (channel == null) return; channel.Discord = this; //if (channel.IsPrivate) if (channel.Type == ChannelType.Group || channel.Type == ChannelType.Private) { var dmChannel = channel as DiscordDmChannel; if (this._privateChannels.TryRemove(dmChannel.Id, out var cachedDmChannel)) dmChannel = cachedDmChannel; await this._dmChannelDeleted.InvokeAsync(new DmChannelDeleteEventArgs(this) { Channel = dmChannel }).ConfigureAwait(false); } else { var gld = channel.Guild; if (gld._channels.TryRemove(channel.Id, out var cachedChannel)) channel = cachedChannel; await this._channelDeleted.InvokeAsync(new ChannelDeleteEventArgs(this) { Channel = channel, Guild = gld }).ConfigureAwait(false); } } internal async Task OnChannelPinsUpdate(DiscordChannel channel, DateTimeOffset? lastPinTimestamp) { if (channel == null) return; var ea = new ChannelPinsUpdateEventArgs(this) { Channel = channel, LastPinTimestamp = lastPinTimestamp }; await this._channelPinsUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildCreateEventAsync(DiscordGuild guild, JArray rawMembers, IEnumerable<DiscordPresence> presences) { if (presences != null) { foreach (var xp in presences) { xp.Discord = this; xp.Activity = new DiscordActivity(xp.RawActivity); this._presences[xp.InternalUser.Id] = xp; } } var exists = this._guilds.TryGetValue(guild.Id, out var foundGuild); guild.Discord = this; guild.IsUnavailable = false; var eventGuild = guild; if (exists) guild = foundGuild; if (guild._channels == null) guild._channels = new ConcurrentDictionary<ulong, DiscordChannel>(); if (guild._roles == null) guild._roles = new ConcurrentDictionary<ulong, DiscordRole>(); if (guild._emojis == null) guild._emojis = new ConcurrentDictionary<ulong, DiscordEmoji>(); if (guild._voiceStates == null) guild._voiceStates = new ConcurrentDictionary<ulong, DiscordVoiceState>(); if (guild._members == null) guild._members = new ConcurrentDictionary<ulong, DiscordMember>(); this.UpdateCachedGuild(eventGuild, rawMembers); guild.JoinedAt = eventGuild.JoinedAt; guild.IsLarge = eventGuild.IsLarge; guild.MemberCount = Math.Max(eventGuild.MemberCount, guild._members.Count); guild.IsUnavailable = eventGuild.IsUnavailable; foreach (var kvp in eventGuild._voiceStates) guild._voiceStates[kvp.Key] = kvp.Value; foreach (var xc in guild._channels.Values) { xc.GuildId = guild.Id; xc.Discord = this; foreach (var xo in xc._permissionOverwrites) { xo.Discord = this; xo._channel_id = xc.Id; } } foreach (var xe in guild._emojis.Values) xe.Discord = this; foreach (var xvs in guild._voiceStates.Values) xvs.Discord = this; foreach (var xr in guild._roles.Values) { xr.Discord = this; xr._guild_id = guild.Id; } var old = Volatile.Read(ref this._guildDownloadCompleted); var dcompl = this._guilds.Values.All(xg => !xg.IsUnavailable); Volatile.Write(ref this._guildDownloadCompleted, dcompl); if (exists) await this._guildAvailable.InvokeAsync(new GuildCreateEventArgs(this) { Guild = guild }).ConfigureAwait(false); else await this._guildCreated.InvokeAsync(new GuildCreateEventArgs(this) { Guild = guild }).ConfigureAwait(false); if (dcompl && !old) await this._guildDownloadCompletedEv.InvokeAsync(new GuildDownloadCompletedEventArgs(this)).ConfigureAwait(false); } internal async Task OnGuildUpdateEventAsync(DiscordGuild guild, JArray rawMembers) { DiscordGuild oldGuild; if (!this._guilds.ContainsKey(guild.Id)) { this._guilds[guild.Id] = guild; oldGuild = null; } else { var gld = this._guilds[guild.Id]; oldGuild = new DiscordGuild { Discord = gld.Discord, Name = gld.Name, AfkChannelId = gld.AfkChannelId, AfkTimeout = gld.AfkTimeout, DefaultMessageNotifications = gld.DefaultMessageNotifications, EmbedChannelId = gld.EmbedChannelId, EmbedEnabled = gld.EmbedEnabled, ExplicitContentFilter = gld.ExplicitContentFilter, Features = gld.Features, IconHash = gld.IconHash, Id = gld.Id, IsLarge = gld.IsLarge, IsSynced = gld.IsSynced, IsUnavailable = gld.IsUnavailable, JoinedAt = gld.JoinedAt, MemberCount = gld.MemberCount, MfaLevel = gld.MfaLevel, OwnerId = gld.OwnerId, SplashHash = gld.SplashHash, SystemChannelId = gld.SystemChannelId, VerificationLevel = gld.VerificationLevel, VoiceRegionId = gld.VoiceRegionId, _channels = new ConcurrentDictionary<ulong, DiscordChannel>(), _emojis = new ConcurrentDictionary<ulong, DiscordEmoji>(), _members = new ConcurrentDictionary<ulong, DiscordMember>(), _roles = new ConcurrentDictionary<ulong, DiscordRole>(), _voiceStates = new ConcurrentDictionary<ulong, DiscordVoiceState>() }; foreach (var kvp in gld._channels) oldGuild._channels[kvp.Key] = kvp.Value; foreach (var kvp in gld._emojis) oldGuild._emojis[kvp.Key] = kvp.Value; foreach (var kvp in gld._roles) oldGuild._roles[kvp.Key] = kvp.Value; foreach (var kvp in gld._voiceStates) oldGuild._voiceStates[kvp.Key] = kvp.Value; foreach (var kvp in gld._members) oldGuild._members[kvp.Key] = kvp.Value; } guild.Discord = this; guild.IsUnavailable = false; var eventGuild = guild; guild = this._guilds[eventGuild.Id]; if (guild._channels == null) guild._channels = new ConcurrentDictionary<ulong, DiscordChannel>(); if (guild._roles == null) guild._roles = new ConcurrentDictionary<ulong, DiscordRole>(); if (guild._emojis == null) guild._emojis = new ConcurrentDictionary<ulong, DiscordEmoji>(); if (guild._voiceStates == null) guild._voiceStates = new ConcurrentDictionary<ulong, DiscordVoiceState>(); if (guild._members == null) guild._members = new ConcurrentDictionary<ulong, DiscordMember>(); this.UpdateCachedGuild(eventGuild, rawMembers); foreach (var xc in guild._channels.Values) { xc.GuildId = guild.Id; xc.Discord = this; foreach (var xo in xc._permissionOverwrites) { xo.Discord = this; xo._channel_id = xc.Id; } } foreach (var xe in guild._emojis.Values) xe.Discord = this; foreach (var xvs in guild._voiceStates.Values) xvs.Discord = this; foreach (var xr in guild._roles.Values) { xr.Discord = this; xr._guild_id = guild.Id; } await this._guildUpdated.InvokeAsync(new GuildUpdateEventArgs(this) { GuildBefore = oldGuild, GuildAfter = guild }).ConfigureAwait(false); } internal async Task OnGuildDeleteEventAsync(DiscordGuild guild, JArray rawMembers) { if (guild.IsUnavailable) { if (!this._guilds.TryGetValue(guild.Id, out var gld)) return; gld.IsUnavailable = true; await this._guildUnavailable.InvokeAsync(new GuildDeleteEventArgs(this) { Guild = guild, Unavailable = true }).ConfigureAwait(false); } else { if (!this._guilds.TryRemove(guild.Id, out var gld)) return; await this._guildDeleted.InvokeAsync(new GuildDeleteEventArgs(this) { Guild = gld }).ConfigureAwait(false); } } internal async Task OnGuildSyncEventAsync(DiscordGuild guild, bool isLarge, JArray rawMembers, IEnumerable<DiscordPresence> presences) { presences = presences.Select(xp => { xp.Discord = this; xp.Activity = new DiscordActivity(xp.RawActivity); return xp; }); foreach (var xp in presences) this._presences[xp.InternalUser.Id] = xp; guild.IsSynced = true; guild.IsLarge = isLarge; this.UpdateCachedGuild(guild, rawMembers); if (this.Configuration.AutomaticGuildSync) { var dcompl = this._guilds.Values.All(xg => xg.IsSynced); Volatile.Write(ref this._guildDownloadCompleted, dcompl); } await this._guildAvailable.InvokeAsync(new GuildCreateEventArgs(this) { Guild = guild }).ConfigureAwait(false); } internal async Task OnPresenceUpdateEventAsync(JObject rawPresence, JObject rawUser) { var uid = (ulong)rawUser["id"]; DiscordPresence old = null; if (this._presences.TryGetValue(uid, out var presence)) { old = new DiscordPresence(presence); DiscordJson.PopulateObject(rawPresence, presence); if (rawPresence["game"] == null || rawPresence["game"].Type == JTokenType.Null) presence.RawActivity = null; if (presence.Activity != null) presence.Activity.UpdateWith(presence.RawActivity); else presence.Activity = new DiscordActivity(presence.RawActivity); } else { presence = rawPresence.ToObject<DiscordPresence>(); presence.Discord = this; presence.Activity = new DiscordActivity(presence.RawActivity); this._presences[presence.InternalUser.Id] = presence; } // reuse arrays / avoid linq (this is a hot zone) if (presence.Activities == null || rawPresence["activities"] == null) { #if !NET45 && !NETSTANDARD1_1 presence.InternalActivities = Array.Empty<DiscordActivity>(); #else presence.InternalActivities = new DiscordActivity[0]; #endif } else { if (presence.InternalActivities.Length != presence.RawActivities.Length) presence.InternalActivities = new DiscordActivity[presence.RawActivities.Length]; for (var i = 0; i < presence.InternalActivities.Length; i++) presence.InternalActivities[i] = new DiscordActivity(presence.RawActivities[i]); } if (this.UserCache.TryGetValue(uid, out var usr)) { if (old != null) { old.InternalUser.Username = usr.Username; old.InternalUser.Discriminator = usr.Discriminator; old.InternalUser.AvatarHash = usr.AvatarHash; } if (rawUser["username"] is object) usr.Username = (string)rawUser["username"]; if (rawUser["discriminator"] is object) usr.Discriminator = (string)rawUser["discriminator"]; if (rawUser["avatar"] is object) usr.AvatarHash = (string)rawUser["avatar"]; presence.InternalUser.Username = usr.Username; presence.InternalUser.Discriminator = usr.Discriminator; presence.InternalUser.AvatarHash = usr.AvatarHash; } var usrafter = usr ?? new DiscordUser(presence.InternalUser); var ea = new PresenceUpdateEventArgs { Client = this, Status = presence.Status, Activity = presence.Activity, User = usr, PresenceBefore = old, PresenceAfter = presence, UserBefore = old != null ? new DiscordUser(old.InternalUser) : usrafter, UserAfter = usrafter }; await this._presenceUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildBanAddEventAsync(TransportUser user, DiscordGuild guild) { var usr = new DiscordUser(user) { Discord = this }; usr = this.UserCache.AddOrUpdate(user.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); if (!guild.Members.TryGetValue(user.Id, out var mbr)) mbr = new DiscordMember(usr) { Discord = this, _guild_id = guild.Id }; var ea = new GuildBanAddEventArgs(this) { Guild = guild, Member = mbr }; await this._guildBanAdded.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildBanRemoveEventAsync(TransportUser user, DiscordGuild guild) { var usr = new DiscordUser(user) { Discord = this }; usr = this.UserCache.AddOrUpdate(user.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); if (!guild.Members.TryGetValue(user.Id, out var mbr)) mbr = new DiscordMember(usr) { Discord = this, _guild_id = guild.Id }; var ea = new GuildBanRemoveEventArgs(this) { Guild = guild, Member = mbr }; await this._guildBanRemoved.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildEmojisUpdateEventAsync(DiscordGuild guild, IEnumerable<DiscordEmoji> newEmojis) { var oldEmojis = new ConcurrentDictionary<ulong, DiscordEmoji>(guild._emojis); guild._emojis.Clear(); foreach (var emoji in newEmojis) { emoji.Discord = this; guild._emojis[emoji.Id] = emoji; } var ea = new GuildEmojisUpdateEventArgs(this) { Guild = guild, EmojisAfter = guild.Emojis, EmojisBefore = new ReadOnlyConcurrentDictionary<ulong, DiscordEmoji>(oldEmojis) }; await this._guildEmojisUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildIntegrationsUpdateEventAsync(DiscordGuild guild) { var ea = new GuildIntegrationsUpdateEventArgs(this) { Guild = guild }; await this._guildIntegrationsUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildMemberAddEventAsync(TransportMember member, DiscordGuild guild) { var usr = new DiscordUser(member.User) { Discord = this }; usr = this.UserCache.AddOrUpdate(member.User.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); var mbr = new DiscordMember(member) { Discord = this, _guild_id = guild.Id }; guild._members[mbr.Id] = mbr; guild.MemberCount++; var ea = new GuildMemberAddEventArgs(this) { Guild = guild, Member = mbr }; await this._guildMemberAdded.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildMemberRemoveEventAsync(TransportUser user, DiscordGuild guild) { if (!guild._members.TryRemove(user.Id, out var mbr)) mbr = new DiscordMember(new DiscordUser(user)) {Discord = this, _guild_id = guild.Id}; guild.MemberCount--; var ea = new GuildMemberRemoveEventArgs(this) { Guild = guild, Member = mbr }; await this._guildMemberRemoved.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildMemberUpdateEventAsync(TransportUser user, DiscordGuild guild, IEnumerable<ulong> roles, string nick) { var usr = new DiscordUser(user) { Discord = this }; usr = this.UserCache.AddOrUpdate(user.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); if (!guild.Members.TryGetValue(user.Id, out var mbr)) mbr = new DiscordMember(usr) { Discord = this, _guild_id = guild.Id }; var nick_old = mbr.Nickname; var roles_old = new ReadOnlyCollection<DiscordRole>(new List<DiscordRole>(mbr.Roles)); mbr.Nickname = nick; mbr._role_ids.Clear(); mbr._role_ids.AddRange(roles); var ea = new GuildMemberUpdateEventArgs(this) { Guild = guild, Member = mbr, NicknameAfter = mbr.Nickname, RolesAfter = new ReadOnlyCollection<DiscordRole>(new List<DiscordRole>(mbr.Roles)), NicknameBefore = nick_old, RolesBefore = roles_old }; await this._guildMemberUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildRoleCreateEventAsync(DiscordRole role, DiscordGuild guild) { role.Discord = this; role._guild_id = guild.Id; guild._roles[role.Id] = role; var ea = new GuildRoleCreateEventArgs(this) { Guild = guild, Role = role }; await this._guildRoleCreated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildRoleUpdateEventAsync(DiscordRole role, DiscordGuild guild) { var newRole = guild.GetRole(role.Id); var oldRole = new DiscordRole { _guild_id = guild.Id, _color = newRole._color, Discord = this, IsHoisted = newRole.IsHoisted, Id = newRole.Id, IsManaged = newRole.IsManaged, IsMentionable = newRole.IsMentionable, Name = newRole.Name, Permissions = newRole.Permissions, Position = newRole.Position }; newRole._guild_id = guild.Id; newRole._color = role._color; newRole.IsHoisted = role.IsHoisted; newRole.IsManaged = role.IsManaged; newRole.IsMentionable = role.IsMentionable; newRole.Name = role.Name; newRole.Permissions = role.Permissions; newRole.Position = role.Position; var ea = new GuildRoleUpdateEventArgs(this) { Guild = guild, RoleAfter = newRole, RoleBefore = oldRole }; await this._guildRoleUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildRoleDeleteEventAsync(ulong roleId, DiscordGuild guild) { if (!guild._roles.TryRemove(roleId, out var role)) throw new InvalidOperationException("Attempted to delete a nonexistent role"); var ea = new GuildRoleDeleteEventArgs(this) { Guild = guild, Role = role }; await this._guildRoleDeleted.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageAckEventAsync(DiscordChannel chn, ulong messageId) { DiscordMessage msg = null; if (this.MessageCache?.TryGet(xm => xm.Id == messageId && xm.ChannelId == chn.Id, out msg) != true) msg = new DiscordMessage { Id = messageId, ChannelId = chn.Id, Discord = this, }; await this._messageAcknowledged.InvokeAsync(new MessageAcknowledgeEventArgs(this) { Message = msg }).ConfigureAwait(false); } internal async Task OnMessageCreateEventAsync(DiscordMessage message, TransportUser author) { message.Discord = this; if (message.Channel == null) DebugLogger.LogMessage(LogLevel.Warning, "Event", "Could not find channel last message belonged to.", DateTime.Now); else message.Channel.LastMessageId = message.Id; var guild = message.Channel?.Guild; var usr = new DiscordUser(author) { Discord = this }; usr = this.UserCache.AddOrUpdate(author.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); if (guild != null) { if (!guild.Members.TryGetValue(author.Id, out var mbr)) mbr = new DiscordMember(usr) { Discord = this, _guild_id = guild.Id }; message.Author = mbr; } else { message.Author = usr; } var mentionedUsers = new List<DiscordUser>(); var mentionedRoles = guild != null ? new List<DiscordRole>() : null; var mentionedChannels = guild != null ? new List<DiscordChannel>() : null; if (!string.IsNullOrWhiteSpace(message.Content)) { if (guild != null) { mentionedUsers = Utilities.GetUserMentions(message).Select(xid => guild._members.TryGetValue(xid, out var member) ? member : null).Cast<DiscordUser>().ToList(); mentionedRoles = Utilities.GetRoleMentions(message).Select(xid => guild.GetRole(xid)).ToList(); mentionedChannels = Utilities.GetChannelMentions(message).Select(xid => guild.GetChannel(xid)).ToList(); } else { mentionedUsers = Utilities.GetUserMentions(message).Select(this.InternalGetCachedUser).ToList(); } } message._mentionedUsers = mentionedUsers; message._mentionedRoles = mentionedRoles; message._mentionedChannels = mentionedChannels; if (message._reactions == null) message._reactions = new List<DiscordReaction>(); foreach (var xr in message._reactions) xr.Emoji.Discord = this; if (this.Configuration.MessageCacheSize > 0 && message.Channel != null) this.MessageCache.Add(message); MessageCreateEventArgs ea = new MessageCreateEventArgs(this) { Message = message, MentionedUsers = new ReadOnlyCollection<DiscordUser>(mentionedUsers), MentionedRoles = mentionedRoles != null ? new ReadOnlyCollection<DiscordRole>(mentionedRoles) : null, MentionedChannels = mentionedChannels != null ? new ReadOnlyCollection<DiscordChannel>(mentionedChannels) : null }; await this._messageCreated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageUpdateEventAsync(DiscordMessage message, TransportUser author) { DiscordGuild guild; message.Discord = this; var event_message = message; DiscordMessage oldmsg = null; if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == event_message.Id && xm.ChannelId == event_message.ChannelId, out message)) { message = event_message; guild = message.Channel?.Guild; if (author != null) { var usr = new DiscordUser(author) { Discord = this }; usr = this.UserCache.AddOrUpdate(author.Id, usr, (id, old) => { old.Username = usr.Username; old.Discriminator = usr.Discriminator; old.AvatarHash = usr.AvatarHash; return old; }); if (guild != null) { if (!guild.Members.TryGetValue(author.Id, out var mbr)) mbr = new DiscordMember(usr) { Discord = this, _guild_id = guild.Id }; message.Author = mbr; } else { message.Author = usr; } } if (message._reactions == null) message._reactions = new List<DiscordReaction>(); foreach (var xr in message._reactions) xr.Emoji.Discord = this; } else { oldmsg = new DiscordMessage(message); guild = message.Channel?.Guild; message.EditedTimestampRaw = event_message.EditedTimestampRaw; if (event_message.Content != null) message.Content = event_message.Content; message._embeds.Clear(); message._embeds.AddRange(event_message._embeds); message.Pinned = event_message.Pinned; message.IsTTS = event_message.IsTTS; } var mentioned_users = new List<DiscordUser>(); var mentioned_roles = guild != null ? new List<DiscordRole>() : null; var mentioned_channels = guild != null ? new List<DiscordChannel>() : null; if (!string.IsNullOrWhiteSpace(message.Content)) { if (guild != null) { mentioned_users = Utilities.GetUserMentions(message).Select(xid => guild._members.TryGetValue(xid, out var member) ? member : null).Cast<DiscordUser>().ToList(); mentioned_roles = Utilities.GetRoleMentions(message).Select(xid => guild.GetRole(xid)).ToList(); mentioned_channels = Utilities.GetChannelMentions(message).Select(xid => guild.GetChannel(xid)).ToList(); } else { mentioned_users = Utilities.GetUserMentions(message).Select(this.InternalGetCachedUser).ToList(); } } message._mentionedUsers = mentioned_users; message._mentionedRoles = mentioned_roles; message._mentionedChannels = mentioned_channels; var ea = new MessageUpdateEventArgs(this) { Message = message, MessageBefore = oldmsg, MentionedUsers = new ReadOnlyCollection<DiscordUser>(mentioned_users), MentionedRoles = mentioned_roles != null ? new ReadOnlyCollection<DiscordRole>(mentioned_roles) : null, MentionedChannels = mentioned_channels != null ? new ReadOnlyCollection<DiscordChannel>(mentioned_channels) : null }; await this._messageUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageDeleteEventAsync(ulong messageId, DiscordChannel channel) { if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == messageId && xm.ChannelId == channel.Id, out var msg)) { msg = new DiscordMessage { Id = messageId, ChannelId = channel.Id, Discord = this, }; } if (this.Configuration.MessageCacheSize > 0) this.MessageCache.Remove(xm => xm.Id == msg.Id && xm.ChannelId == channel.Id); var ea = new MessageDeleteEventArgs(this) { Channel = channel, Message = msg }; await this._messageDeleted.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageBulkDeleteEventAsync(IEnumerable<ulong> messageIds, DiscordChannel channel) { var msgs = new List<DiscordMessage>(messageIds.Count()); foreach (var message_id in messageIds) { DiscordMessage msg = null; if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == message_id && xm.ChannelId == channel.Id, out msg)) { msg = new DiscordMessage { Id = message_id, ChannelId = channel.Id, Discord = this, }; } if (this.Configuration.MessageCacheSize > 0) this.MessageCache.Remove(xm => xm.Id == msg.Id && xm.ChannelId == channel.Id); msgs.Add(msg); } var ea = new MessageBulkDeleteEventArgs(this) { Channel = channel, Messages = new ReadOnlyCollection<DiscordMessage>(msgs) }; await this._messagesBulkDeleted.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnTypingStartEventAsync(ulong userId, DiscordChannel channel, DateTimeOffset started) { if (channel == null) return; if (!this.UserCache.TryGetValue(userId, out var user)) user = new DiscordUser { Id = userId, Discord = this }; if (channel.Guild != null) user = channel.Guild.Members.TryGetValue(userId, out var member) ? member : new DiscordMember(user) { Discord = this, _guild_id = channel.GuildId }; var ea = new TypingStartEventArgs(this) { Channel = channel, User = user, StartedAt = started }; await this._typingStarted.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnUserSettingsUpdateEventAsync(TransportUser user) { var usr = new DiscordUser(user) { Discord = this }; var ea = new UserSettingsUpdateEventArgs(this) { User = usr }; await this._userSettingsUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnUserUpdateEventAsync(TransportUser user) { var usr_old = new DiscordUser { AvatarHash = this.CurrentUser.AvatarHash, Discord = this, Discriminator = this.CurrentUser.Discriminator, Email = this.CurrentUser.Email, Id = this.CurrentUser.Id, IsBot = this.CurrentUser.IsBot, MfaEnabled = this.CurrentUser.MfaEnabled, Username = this.CurrentUser.Username, Verified = this.CurrentUser.Verified }; this.CurrentUser.AvatarHash = user.AvatarHash; this.CurrentUser.Discriminator = user.Discriminator; this.CurrentUser.Email = user.Email; this.CurrentUser.Id = user.Id; this.CurrentUser.IsBot = user.IsBot; this.CurrentUser.MfaEnabled = user.MfaEnabled; this.CurrentUser.Username = user.Username; this.CurrentUser.Verified = user.Verified; var ea = new UserUpdateEventArgs(this) { UserAfter = this.CurrentUser, UserBefore = usr_old }; await this._userUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnVoiceStateUpdateEventAsync(JObject raw) { var gid = (ulong)raw["guild_id"]; var uid = (ulong)raw["user_id"]; var gld = this._guilds[gid]; var vstateHasNew = gld._voiceStates.TryGetValue(uid, out var vstateNew); DiscordVoiceState vstateOld; if (vstateHasNew) { vstateOld = new DiscordVoiceState(vstateNew); DiscordJson.PopulateObject(raw, vstateNew); } else { vstateOld = null; vstateNew = raw.ToObject<DiscordVoiceState>(); vstateNew.Discord = this; gld._voiceStates[vstateNew.UserId] = vstateNew; } if (gld._members.TryGetValue(uid, out var mbr)) { mbr.IsMuted = vstateNew.IsServerMuted; mbr.IsDeafened = vstateNew.IsServerDeafened; } var ea = new VoiceStateUpdateEventArgs(this) { Guild = vstateNew.Guild, Channel = vstateNew.Channel, User = vstateNew.User, SessionId = vstateNew.SessionId, Before = vstateOld, After = vstateNew }; await this._voiceStateUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnVoiceServerUpdateEventAsync(string endpoint, string token, DiscordGuild guild) { var ea = new VoiceServerUpdateEventArgs(this) { Endpoint = endpoint, VoiceToken = token, Guild = guild }; await this._voiceServerUpdated.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnGuildMembersChunkEventAsync(IEnumerable<TransportMember> members, DiscordGuild guild) { var mbrs = new HashSet<DiscordMember>(); foreach (var xtm in members) { var mbr = new DiscordMember(xtm) { Discord = this, _guild_id = guild.Id }; guild._members[mbr.Id] = mbr; mbrs.Add(mbr); } guild.MemberCount = guild._members.Count; var ea = new GuildMembersChunkEventArgs(this) { Guild = guild, Members = new ReadOnlySet<DiscordMember>(mbrs) }; await this._guildMembersChunked.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnUnknownEventAsync(GatewayPayload payload) { var ea = new UnknownEventArgs(this) { EventName = payload.EventName, Json = (payload.Data as JObject)?.ToString() }; await this._unknownEvent.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageReactionAddAsync(ulong userId, ulong messageId, DiscordChannel channel, DiscordEmoji emoji) { emoji.Discord = this; if (!this.UserCache.TryGetValue(userId, out var usr)) usr = new DiscordUser { Id = userId, Discord = this }; if (channel.Guild != null) usr = channel.Guild.Members.TryGetValue(userId, out var member) ? member : new DiscordMember(usr) { Discord = this, _guild_id = channel.GuildId }; if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == messageId && xm.ChannelId == channel.Id, out var msg)) { msg = new DiscordMessage { Id = messageId, ChannelId = channel.Id, Discord = this, _reactions = new List<DiscordReaction>() }; } var react = msg._reactions.FirstOrDefault(xr => xr.Emoji == emoji); if (react == null) { msg._reactions.Add(react = new DiscordReaction { Count = 1, Emoji = emoji, IsMe = this.CurrentUser.Id == userId }); } else { react.Count++; react.IsMe |= this.CurrentUser.Id == userId; } var ea = new MessageReactionAddEventArgs(this) { Message = msg, Channel = channel, User = usr, Emoji = emoji }; await this._messageReactionAdded.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageReactionRemoveAsync(ulong userId, ulong messageId, DiscordChannel channel, DiscordEmoji emoji) { emoji.Discord = this; if (!this.UserCache.TryGetValue(userId, out var usr)) usr = new DiscordUser { Id = userId, Discord = this }; if (channel.Guild != null) usr = channel.Guild.Members.TryGetValue(userId, out var member) ? member : new DiscordMember(usr) { Discord = this, _guild_id = channel.GuildId }; if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == messageId && xm.ChannelId == channel.Id, out var msg)) { msg = new DiscordMessage { Id = messageId, ChannelId = channel.Id, Discord = this }; } var react = msg._reactions?.FirstOrDefault(xr => xr.Emoji == emoji); if (react != null) { react.Count--; react.IsMe &= this.CurrentUser.Id != userId; if (msg._reactions != null && react.Count <= 0) // shit happens for (var i = 0; i < msg._reactions.Count; i++) if (msg._reactions[i].Emoji == emoji) { msg._reactions.RemoveAt(i); break; } } var ea = new MessageReactionRemoveEventArgs(this) { Message = msg, Channel = channel, User = usr, Emoji = emoji }; await this._messageReactionRemoved.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnMessageReactionRemoveAllAsync(ulong messageId, DiscordChannel channel) { DiscordMessage msg = null; if (this.Configuration.MessageCacheSize == 0 || !this.MessageCache.TryGet(xm => xm.Id == messageId && xm.ChannelId == channel.Id, out msg)) { msg = new DiscordMessage { Id = messageId, ChannelId = channel.Id, Discord = this }; } msg._reactions?.Clear(); var ea = new MessageReactionsClearEventArgs(this) { Message = msg, Channel = channel }; await this._messageReactionsCleared.InvokeAsync(ea).ConfigureAwait(false); } internal async Task OnWebhooksUpdateAsync(DiscordChannel channel, DiscordGuild guild) { var ea = new WebhooksUpdateEventArgs(this) { Channel = channel, Guild = guild }; await this._webhooksUpdated.InvokeAsync(ea).ConfigureAwait(false); } #endregion internal async Task OnHeartbeatAsync(long seq) { this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Received Heartbeat - Sending Ack.", DateTime.Now); await SendHeartbeatAsync(seq).ConfigureAwait(false); } internal async Task OnReconnectAsync() { this.DebugLogger.LogMessage(LogLevel.Info, "Websocket", "Received OP 7 - Reconnect.", DateTime.Now); await ReconnectAsync().ConfigureAwait(false); } internal async Task OnInvalidateSessionAsync(bool data) { if (this.SessionLock.Wait(0)) { this.SessionLock.Reset(); var socketLock = this.GetSocketLock(); await socketLock.LockAsync().ConfigureAwait(false); socketLock.UnlockAfter(TimeSpan.FromSeconds(5)); } else { return; } if (data) { this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Received true in OP 9 - Waiting a few second and sending resume again.", DateTime.Now); await Task.Delay(6000).ConfigureAwait(false); await SendResumeAsync().ConfigureAwait(false); } else { this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Received false in OP 9 - Starting a new session.", DateTime.Now); this._sessionId = ""; await SendIdentifyAsync(this._status).ConfigureAwait(false); } } internal async Task OnHelloAsync(GatewayHello hello) { this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Received OP 10 (HELLO) - Trying to either resume or identify.", DateTime.Now); if (this.SessionLock.Wait(0)) { this.SessionLock.Reset(); this.GetSocketLock().UnlockAfter(TimeSpan.FromSeconds(5)); } else { this.DebugLogger.LogMessage(LogLevel.Warning, "DSharpPlus", "Session start attempt was made while another session is active", DateTime.Now); return; } Interlocked.CompareExchange(ref this._skippedHeartbeats, 0, 0); this._heartbeatInterval = hello.HeartbeatInterval; this._heartbeatTask = new Task(StartHeartbeating, _cancelToken, TaskCreationOptions.LongRunning); this._heartbeatTask.Start(); if (this._sessionId == "") await SendIdentifyAsync(_status).ConfigureAwait(false); else await SendResumeAsync().ConfigureAwait(false); } internal async Task OnHeartbeatAckAsync() { Interlocked.Decrement(ref this._skippedHeartbeats); var ping = (int)(DateTime.Now - this._lastHeartbeat).TotalMilliseconds; this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", $"Received WebSocket Heartbeat Ack. Ping: {ping.ToString(CultureInfo.InvariantCulture)}ms", DateTime.Now); Volatile.Write(ref this._ping, ping); var args = new HeartbeatEventArgs(this) { Ping = this.Ping, Timestamp = DateTimeOffset.Now }; await _heartbeated.InvokeAsync(args).ConfigureAwait(false); } //internal async Task StartHeartbeatingAsync() internal void StartHeartbeating() { this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Starting Heartbeat.", DateTime.Now); var token = this._cancelToken; try { while (true) { SendHeartbeatAsync().ConfigureAwait(false).GetAwaiter().GetResult(); Task.Delay(_heartbeatInterval, _cancelToken).ConfigureAwait(false).GetAwaiter().GetResult(); token.ThrowIfCancellationRequested(); } } catch (OperationCanceledException) { } } internal Task InternalUpdateStatusAsync(DiscordActivity activity, UserStatus? userStatus, DateTimeOffset? idleSince) { if (activity != null && activity.Name != null && activity.Name.Length > 128) throw new Exception("Game name can't be longer than 128 characters!"); var since_unix = idleSince != null ? (long?)Utilities.GetUnixTime(idleSince.Value) : null; var act = activity ?? new DiscordActivity(); var status = new StatusUpdate { Activity = new TransportActivity(act), IdleSince = since_unix, IsAFK = idleSince != null, Status = userStatus ?? UserStatus.Online }; // Solution to have status persist between sessions this._status = status; var status_update = new GatewayPayload { OpCode = GatewayOpCode.StatusUpdate, Data = status }; var statusstr = JsonConvert.SerializeObject(status_update); this._webSocketClient.SendMessage(statusstr); if (!this._presences.ContainsKey(this.CurrentUser.Id)) { this._presences[this.CurrentUser.Id] = new DiscordPresence { Discord = this, Activity = act, Status = userStatus ?? UserStatus.Online, InternalUser = new TransportUser { Id = this.CurrentUser.Id } }; } else { var pr = this._presences[this.CurrentUser.Id]; pr.Activity = act; pr.Status = userStatus ?? pr.Status; } return Task.Delay(0); } internal Task SendHeartbeatAsync() { var _last_heartbeat = DateTimeOffset.Now; var _sequence = (long)(_last_heartbeat - DiscordEpoch).TotalMilliseconds; return this.SendHeartbeatAsync(_sequence); } internal async Task SendHeartbeatAsync(long seq) { var more_than_5 = Volatile.Read(ref this._skippedHeartbeats) > 5; var guilds_comp = Volatile.Read(ref this._guildDownloadCompleted); if (guilds_comp && more_than_5) { this.DebugLogger.LogMessage(LogLevel.Critical, "DSharpPlus", "More than 5 heartbeats were skipped. Issuing reconnect.", DateTime.Now); await ReconnectAsync().ConfigureAwait(false); return; } else if (!guilds_comp && more_than_5) { this.DebugLogger.LogMessage(LogLevel.Warning, "DSharpPlus", "More than 5 heartbeats were skipped while the guild download is running.", DateTime.Now); } Volatile.Write(ref this._lastSequence, seq); var _last_heartbeat = DateTimeOffset.Now; this.DebugLogger.LogMessage(LogLevel.Debug, "Websocket", "Sending Heartbeat.", DateTime.Now); var heartbeat = new GatewayPayload { OpCode = GatewayOpCode.Heartbeat, Data = seq }; var heartbeat_str = JsonConvert.SerializeObject(heartbeat); _webSocketClient.SendMessage(heartbeat_str); this._lastHeartbeat = DateTimeOffset.Now; Interlocked.Increment(ref this._skippedHeartbeats); } internal Task SendIdentifyAsync(StatusUpdate status) { var identify = new GatewayIdentify { Token = Utilities.GetFormattedToken(this), Compress = this.Configuration.GatewayCompressionLevel == GatewayCompressionLevel.Payload, LargeThreshold = this.Configuration.LargeThreshold, ShardInfo = new ShardInfo { ShardId = this.Configuration.ShardId, ShardCount = this.Configuration.ShardCount }, Presence = status }; var payload = new GatewayPayload { OpCode = GatewayOpCode.Identify, Data = identify }; var payloadstr = JsonConvert.SerializeObject(payload); _webSocketClient.SendMessage(payloadstr); return Task.Delay(0); } internal Task SendResumeAsync() { var resume = new GatewayResume { Token = Utilities.GetFormattedToken(this), SessionId = this._sessionId, SequenceNumber = Volatile.Read(ref this._lastSequence) }; var resume_payload = new GatewayPayload { OpCode = GatewayOpCode.Resume, Data = resume }; var resumestr = JsonConvert.SerializeObject(resume_payload); _webSocketClient.SendMessage(resumestr); return Task.Delay(0); } internal Task SendGuildSyncAsync() { return this.SyncGuildsAsync(this._guilds.Values.ToArray()); } #endregion internal DiscordChannel InternalGetCachedChannel(ulong channelId) { if (this._privateChannels.TryGetValue(channelId, out var foundDmChannel)) return foundDmChannel; foreach (var guild in this.Guilds.Values) if (guild.Channels.TryGetValue(channelId, out var foundChannel)) return foundChannel; return null; } internal void UpdateCachedGuild(DiscordGuild newGuild, JArray rawMembers) { if (!this._guilds.ContainsKey(newGuild.Id)) this._guilds[newGuild.Id] = newGuild; var guild = this._guilds[newGuild.Id]; if (newGuild._channels != null && newGuild._channels.Count > 0) { foreach (var channel in newGuild._channels.Values) { if (guild._channels.TryGetValue(channel.Id, out _)) continue; foreach (var overwrite in channel._permissionOverwrites) { overwrite.Discord = this; overwrite._channel_id = channel.Id; } guild._channels[channel.Id] = channel; } } foreach (var newEmoji in newGuild._emojis.Values) _ = guild._emojis.GetOrAdd(newEmoji.Id, _ => newEmoji); if (rawMembers != null) { guild._members.Clear(); foreach (var xj in rawMembers) { var xtm = xj.ToObject<TransportMember>(); var xu = new DiscordUser(xtm.User) { Discord = this }; _ = this.UserCache.AddOrUpdate(xtm.User.Id, xu, (id, old) => { old.Username = xu.Username; old.Discriminator = xu.Discriminator; old.AvatarHash = xu.AvatarHash; return old; }); guild._members[xtm.User.Id] = new DiscordMember(xtm) { Discord = this, _guild_id = guild.Id }; } } foreach (var role in newGuild._roles.Values) { if (guild._roles.TryGetValue(role.Id, out _)) continue; role._guild_id = guild.Id; guild._roles[role.Id] = role; } guild.Name = newGuild.Name; guild.AfkChannelId = newGuild.AfkChannelId; guild.AfkTimeout = newGuild.AfkTimeout; guild.DefaultMessageNotifications = newGuild.DefaultMessageNotifications; guild.EmbedChannelId = newGuild.EmbedChannelId; guild.EmbedEnabled = newGuild.EmbedEnabled; guild.Features = newGuild.Features; guild.IconHash = newGuild.IconHash; guild.MfaLevel = newGuild.MfaLevel; guild.OwnerId = newGuild.OwnerId; guild.VoiceRegionId = newGuild.VoiceRegionId; guild.SplashHash = newGuild.SplashHash; guild.VerificationLevel = newGuild.VerificationLevel; guild.ExplicitContentFilter = newGuild.ExplicitContentFilter; // fields not sent for update: // - guild.Channels // - voice states // - guild.JoinedAt = new_guild.JoinedAt; // - guild.Large = new_guild.Large; // - guild.MemberCount = Math.Max(new_guild.MemberCount, guild._members.Count); // - guild.Unavailable = new_guild.Unavailable; } internal async Task InternalUpdateGatewayAsync() { var headers = Utilities.GetBaseHeaders(); var route = Endpoints.GATEWAY; if (Configuration.TokenType == TokenType.Bot) route += Endpoints.BOT; var bucket = this.ApiClient.Rest.GetBucket(RestRequestMethod.GET, route, new { }, out var path); var url = Utilities.GetApiUriFor(path); var request = new RestRequest(this, bucket, url, RestRequestMethod.GET, headers); DebugLogger.LogTaskFault(this.ApiClient.Rest.ExecuteRequestAsync(request), LogLevel.Error, "DSharpPlus", "Error while executing request: "); var response = await request.WaitForCompletionAsync().ConfigureAwait(false); var jo = JObject.Parse(response.Response); this._gatewayUri = new Uri(jo.Value<string>("url")); if (jo["shards"] != null) _shardCount = jo.Value<int>("shards"); } private SocketLock GetSocketLock() => SocketLocks.GetOrAdd(this.CurrentApplication.Id, appId => new SocketLock(appId)); ~DiscordClient() { Dispose(); } private bool disposed; /// <summary> /// Disposes your DiscordClient. /// </summary> public override void Dispose() { if (disposed) return; GC.SuppressFinalize(this); DisconnectAsync().ConfigureAwait(false).GetAwaiter().GetResult(); this.CurrentUser = null; _cancelTokenSource?.Cancel(); _guilds = null; _heartbeatTask = null; _extensions = null; _privateChannels = null; _webSocketClient.DisconnectAsync(null).ConfigureAwait(false).GetAwaiter().GetResult(); _webSocketClient.Dispose(); disposed = true; } #region Events /// <summary> /// Fired whenever an error occurs within an event handler. /// </summary> public event AsyncEventHandler<ClientErrorEventArgs> ClientErrored { add => this._clientErrored.Register(value); remove => this._clientErrored.Unregister(value); } private AsyncEvent<ClientErrorEventArgs> _clientErrored; /// <summary> /// Fired whenever a WebSocket error occurs within the client. /// </summary> public event AsyncEventHandler<SocketErrorEventArgs> SocketErrored { add => this._socketErrored.Register(value); remove => this._socketErrored.Unregister(value); } private AsyncEvent<SocketErrorEventArgs> _socketErrored; /// <summary> /// Fired whenever WebSocket connection is established. /// </summary> public event AsyncEventHandler SocketOpened { add => this._socketOpened.Register(value); remove => this._socketOpened.Unregister(value); } private AsyncEvent _socketOpened; /// <summary> /// Fired whenever WebSocket connection is terminated. /// </summary> public event AsyncEventHandler<SocketCloseEventArgs> SocketClosed { add => this._socketClosed.Register(value); remove => this._socketClosed.Unregister(value); } private AsyncEvent<SocketCloseEventArgs> _socketClosed; /// <summary> /// Fired when the client enters ready state. /// </summary> public event AsyncEventHandler<ReadyEventArgs> Ready { add => this._ready.Register(value); remove => this._ready.Unregister(value); } private AsyncEvent<ReadyEventArgs> _ready; /// <summary> /// Fired whenever a session is resumed. /// </summary> public event AsyncEventHandler<ReadyEventArgs> Resumed { add => this._resumed.Register(value); remove => this._resumed.Unregister(value); } private AsyncEvent<ReadyEventArgs> _resumed; /// <summary> /// Fired when a new channel is created. /// </summary> public event AsyncEventHandler<ChannelCreateEventArgs> ChannelCreated { add => this._channelCreated.Register(value); remove => this._channelCreated.Unregister(value); } private AsyncEvent<ChannelCreateEventArgs> _channelCreated; /// <summary> /// Fired when a new direct message channel is created. /// </summary> public event AsyncEventHandler<DmChannelCreateEventArgs> DmChannelCreated { add => this._dmChannelCreated.Register(value); remove => this._dmChannelCreated.Unregister(value); } private AsyncEvent<DmChannelCreateEventArgs> _dmChannelCreated; /// <summary> /// Fired when a channel is updated. /// </summary> public event AsyncEventHandler<ChannelUpdateEventArgs> ChannelUpdated { add => this._channelUpdated.Register(value); remove => this._channelUpdated.Unregister(value); } private AsyncEvent<ChannelUpdateEventArgs> _channelUpdated; /// <summary> /// Fired when a channel is deleted /// </summary> public event AsyncEventHandler<ChannelDeleteEventArgs> ChannelDeleted { add => this._channelDeleted.Register(value); remove => this._channelDeleted.Unregister(value); } private AsyncEvent<ChannelDeleteEventArgs> _channelDeleted; /// <summary> /// Fired when a dm channel is deleted /// </summary> public event AsyncEventHandler<DmChannelDeleteEventArgs> DmChannelDeleted { add => this._dmChannelDeleted.Register(value); remove => this._dmChannelDeleted.Unregister(value); } private AsyncEvent<DmChannelDeleteEventArgs> _dmChannelDeleted; /// <summary> /// Fired whenever a channel's pinned message list is updated. /// </summary> public event AsyncEventHandler<ChannelPinsUpdateEventArgs> ChannelPinsUpdated { add => this._channelPinsUpdated.Register(value); remove => this._channelPinsUpdated.Unregister(value); } private AsyncEvent<ChannelPinsUpdateEventArgs> _channelPinsUpdated; /// <summary> /// Fired when the user joins a new guild. /// </summary> /// <remarks>[alias="GuildJoined"][alias="JoinedGuild"]</remarks> public event AsyncEventHandler<GuildCreateEventArgs> GuildCreated { add => this._guildCreated.Register(value); remove => this._guildCreated.Unregister(value); } private AsyncEvent<GuildCreateEventArgs> _guildCreated; /// <summary> /// Fired when a guild is becoming available. /// </summary> public event AsyncEventHandler<GuildCreateEventArgs> GuildAvailable { add => this._guildAvailable.Register(value); remove => this._guildAvailable.Unregister(value); } private AsyncEvent<GuildCreateEventArgs> _guildAvailable; /// <summary> /// Fired when a guild is updated. /// </summary> public event AsyncEventHandler<GuildUpdateEventArgs> GuildUpdated { add => this._guildUpdated.Register(value); remove => this._guildUpdated.Unregister(value); } private AsyncEvent<GuildUpdateEventArgs> _guildUpdated; /// <summary> /// Fired when the user leaves or is removed from a guild. /// </summary> public event AsyncEventHandler<GuildDeleteEventArgs> GuildDeleted { add => this._guildDeleted.Register(value); remove => this._guildDeleted.Unregister(value); } private AsyncEvent<GuildDeleteEventArgs> _guildDeleted; /// <summary> /// Fired when a guild becomes unavailable. /// </summary> public event AsyncEventHandler<GuildDeleteEventArgs> GuildUnavailable { add => this._guildUnavailable.Register(value); remove => this._guildUnavailable.Unregister(value); } private AsyncEvent<GuildDeleteEventArgs> _guildUnavailable; /// <summary> /// Fired when all guilds finish streaming from Discord. /// </summary> public event AsyncEventHandler<GuildDownloadCompletedEventArgs> GuildDownloadCompleted { add => this._guildDownloadCompletedEv.Register(value); remove => this._guildDownloadCompletedEv.Unregister(value); } private AsyncEvent<GuildDownloadCompletedEventArgs> _guildDownloadCompletedEv; /// <summary> /// Fired when a message is created. /// </summary> public event AsyncEventHandler<MessageCreateEventArgs> MessageCreated { add => this._messageCreated.Register(value); remove => this._messageCreated.Unregister(value); } private AsyncEvent<MessageCreateEventArgs> _messageCreated; /// <summary> /// Fired when a presence has been updated. /// </summary> public event AsyncEventHandler<PresenceUpdateEventArgs> PresenceUpdated { add => this._presenceUpdated.Register(value); remove => this._presenceUpdated.Unregister(value); } private AsyncEvent<PresenceUpdateEventArgs> _presenceUpdated; /// <summary> /// Fired when a guild ban gets added /// </summary> public event AsyncEventHandler<GuildBanAddEventArgs> GuildBanAdded { add => this._guildBanAdded.Register(value); remove => this._guildBanAdded.Unregister(value); } private AsyncEvent<GuildBanAddEventArgs> _guildBanAdded; /// <summary> /// Fired when a guild ban gets removed /// </summary> public event AsyncEventHandler<GuildBanRemoveEventArgs> GuildBanRemoved { add => this._guildBanRemoved.Register(value); remove => this._guildBanRemoved.Unregister(value); } private AsyncEvent<GuildBanRemoveEventArgs> _guildBanRemoved; /// <summary> /// Fired when a guilds emojis get updated /// </summary> public event AsyncEventHandler<GuildEmojisUpdateEventArgs> GuildEmojisUpdated { add => this._guildEmojisUpdated.Register(value); remove => this._guildEmojisUpdated.Unregister(value); } private AsyncEvent<GuildEmojisUpdateEventArgs> _guildEmojisUpdated; /// <summary> /// Fired when a guild integration is updated. /// </summary> public event AsyncEventHandler<GuildIntegrationsUpdateEventArgs> GuildIntegrationsUpdated { add => this._guildIntegrationsUpdated.Register(value); remove => this._guildIntegrationsUpdated.Unregister(value); } private AsyncEvent<GuildIntegrationsUpdateEventArgs> _guildIntegrationsUpdated; /// <summary> /// Fired when a new user joins a guild. /// </summary> public event AsyncEventHandler<GuildMemberAddEventArgs> GuildMemberAdded { add => this._guildMemberAdded.Register(value); remove => this._guildMemberAdded.Unregister(value); } private AsyncEvent<GuildMemberAddEventArgs> _guildMemberAdded; /// <summary> /// Fired when a user is removed from a guild (leave/kick/ban). /// </summary> public event AsyncEventHandler<GuildMemberRemoveEventArgs> GuildMemberRemoved { add => this._guildMemberRemoved.Register(value); remove => this._guildMemberRemoved.Unregister(value); } private AsyncEvent<GuildMemberRemoveEventArgs> _guildMemberRemoved; /// <summary> /// Fired when a guild member is updated. /// </summary> public event AsyncEventHandler<GuildMemberUpdateEventArgs> GuildMemberUpdated { add => this._guildMemberUpdated.Register(value); remove => this._guildMemberUpdated.Unregister(value); } private AsyncEvent<GuildMemberUpdateEventArgs> _guildMemberUpdated; /// <summary> /// Fired when a guild role is created. /// </summary> public event AsyncEventHandler<GuildRoleCreateEventArgs> GuildRoleCreated { add => this._guildRoleCreated.Register(value); remove => this._guildRoleCreated.Unregister(value); } private AsyncEvent<GuildRoleCreateEventArgs> _guildRoleCreated; /// <summary> /// Fired when a guild role is updated. /// </summary> public event AsyncEventHandler<GuildRoleUpdateEventArgs> GuildRoleUpdated { add => this._guildRoleUpdated.Register(value); remove => this._guildRoleUpdated.Unregister(value); } private AsyncEvent<GuildRoleUpdateEventArgs> _guildRoleUpdated; /// <summary> /// Fired when a guild role is updated. /// </summary> public event AsyncEventHandler<GuildRoleDeleteEventArgs> GuildRoleDeleted { add => this._guildRoleDeleted.Register(value); remove => this._guildRoleDeleted.Unregister(value); } private AsyncEvent<GuildRoleDeleteEventArgs> _guildRoleDeleted; /// <summary> /// Fired when message is acknowledged by the user. /// </summary> public event AsyncEventHandler<MessageAcknowledgeEventArgs> MessageAcknowledged { add => this._messageAcknowledged.Register(value); remove => this._messageAcknowledged.Unregister(value); } private AsyncEvent<MessageAcknowledgeEventArgs> _messageAcknowledged; /// <summary> /// Fired when a message is updated. /// </summary> public event AsyncEventHandler<MessageUpdateEventArgs> MessageUpdated { add => this._messageUpdated.Register(value); remove => this._messageUpdated.Unregister(value); } private AsyncEvent<MessageUpdateEventArgs> _messageUpdated; /// <summary> /// Fired when a message is deleted. /// </summary> public event AsyncEventHandler<MessageDeleteEventArgs> MessageDeleted { add => this._messageDeleted.Register(value); remove => this._messageDeleted.Unregister(value); } private AsyncEvent<MessageDeleteEventArgs> _messageDeleted; /// <summary> /// Fired when multiple messages are deleted at once. /// </summary> public event AsyncEventHandler<MessageBulkDeleteEventArgs> MessagesBulkDeleted { add => this._messagesBulkDeleted.Register(value); remove => this._messagesBulkDeleted.Unregister(value); } private AsyncEvent<MessageBulkDeleteEventArgs> _messagesBulkDeleted; /// <summary> /// Fired when a user starts typing in a channel. /// </summary> public event AsyncEventHandler<TypingStartEventArgs> TypingStarted { add => this._typingStarted.Register(value); remove => this._typingStarted.Unregister(value); } private AsyncEvent<TypingStartEventArgs> _typingStarted; /// <summary> /// Fired when the current user updates their settings. /// </summary> public event AsyncEventHandler<UserSettingsUpdateEventArgs> UserSettingsUpdated { add => this._userSettingsUpdated.Register(value); remove => this._userSettingsUpdated.Unregister(value); } private AsyncEvent<UserSettingsUpdateEventArgs> _userSettingsUpdated; /// <summary> /// Fired when properties about the current user change. /// </summary> /// <remarks> /// NB: This event only applies for changes to the <b>current user</b>, the client that is connected to Discord. /// </remarks> public event AsyncEventHandler<UserUpdateEventArgs> UserUpdated { add => this._userUpdated.Register(value); remove => this._userUpdated.Unregister(value); } private AsyncEvent<UserUpdateEventArgs> _userUpdated; /// <summary> /// Fired when someone joins/leaves/moves voice channels. /// </summary> public event AsyncEventHandler<VoiceStateUpdateEventArgs> VoiceStateUpdated { add => this._voiceStateUpdated.Register(value); remove => this._voiceStateUpdated.Unregister(value); } private AsyncEvent<VoiceStateUpdateEventArgs> _voiceStateUpdated; /// <summary> /// Fired when a guild's voice server is updated. /// </summary> public event AsyncEventHandler<VoiceServerUpdateEventArgs> VoiceServerUpdated { add => this._voiceServerUpdated.Register(value); remove => this._voiceServerUpdated.Unregister(value); } private AsyncEvent<VoiceServerUpdateEventArgs> _voiceServerUpdated; /// <summary> /// Fired in response to Gateway Request Guild Members. /// </summary> public event AsyncEventHandler<GuildMembersChunkEventArgs> GuildMembersChunked { add => this._guildMembersChunked.Register(value); remove => this._guildMembersChunked.Unregister(value); } private AsyncEvent<GuildMembersChunkEventArgs> _guildMembersChunked; /// <summary> /// Fired when an unknown event gets received. /// </summary> public event AsyncEventHandler<UnknownEventArgs> UnknownEvent { add => this._unknownEvent.Register(value); remove => this._unknownEvent.Unregister(value); } private AsyncEvent<UnknownEventArgs> _unknownEvent; /// <summary> /// Fired when a reaction gets added to a message. /// </summary> public event AsyncEventHandler<MessageReactionAddEventArgs> MessageReactionAdded { add => this._messageReactionAdded.Register(value); remove => this._messageReactionAdded.Unregister(value); } private AsyncEvent<MessageReactionAddEventArgs> _messageReactionAdded; /// <summary> /// Fired when a reaction gets removed from a message. /// </summary> public event AsyncEventHandler<MessageReactionRemoveEventArgs> MessageReactionRemoved { add => this._messageReactionRemoved.Register(value); remove => this._messageReactionRemoved.Unregister(value); } private AsyncEvent<MessageReactionRemoveEventArgs> _messageReactionRemoved; /// <summary> /// Fired when all reactions get removed from a message. /// </summary> public event AsyncEventHandler<MessageReactionsClearEventArgs> MessageReactionsCleared { add => this._messageReactionsCleared.Register(value); remove => this._messageReactionsCleared.Unregister(value); } private AsyncEvent<MessageReactionsClearEventArgs> _messageReactionsCleared; /// <summary> /// Fired whenever webhooks update. /// </summary> public event AsyncEventHandler<WebhooksUpdateEventArgs> WebhooksUpdated { add => this._webhooksUpdated.Register(value); remove => this._webhooksUpdated.Unregister(value); } private AsyncEvent<WebhooksUpdateEventArgs> _webhooksUpdated; /// <summary> /// Fired on received heartbeat ACK. /// </summary> public event AsyncEventHandler<HeartbeatEventArgs> Heartbeated { add => this._heartbeated.Register(value); remove => this._heartbeated.Unregister(value); } private AsyncEvent<HeartbeatEventArgs> _heartbeated; internal void EventErrorHandler(string evname, Exception ex) { this.DebugLogger.LogMessage(LogLevel.Error, "DSharpPlus", $"An {ex.GetType()} occurred in {evname}.", DateTime.Now, ex); this._clientErrored.InvokeAsync(new ClientErrorEventArgs(this) { EventName = evname, Exception = ex }).ConfigureAwait(false).GetAwaiter().GetResult(); } private void Goof(string evname, Exception ex) { this.DebugLogger.LogMessage(LogLevel.Critical, "DSharpPlus", $"An {ex.GetType()} occurred in the exception handler.", DateTime.Now, ex); } #endregion } }
41.796008
266
0.574986
[ "MIT" ]
xt449/DSharpPlus
DSharpPlus/DiscordClient.cs
123,551
C#
//------------------------------------------------------------------------------ // <auto-generated /> // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ namespace QuantLib { public class MCDiscreteArithmeticAPEngine : PricingEngine { private global::System.Runtime.InteropServices.HandleRef swigCPtr; internal MCDiscreteArithmeticAPEngine(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NQuantLibcPINVOKE.MCDiscreteArithmeticAPEngine_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(MCDiscreteArithmeticAPEngine obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~MCDiscreteArithmeticAPEngine() { Dispose(); } public override void Dispose() { lock(this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NQuantLibcPINVOKE.delete_MCDiscreteArithmeticAPEngine(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } global::System.GC.SuppressFinalize(this); base.Dispose(); } } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate, bool controlVariate, int requiredSamples, double requiredTolerance, int maxSamples, int seed) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_0(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate, controlVariate, requiredSamples, requiredTolerance, maxSamples, seed), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate, bool controlVariate, int requiredSamples, double requiredTolerance, int maxSamples) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_1(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate, controlVariate, requiredSamples, requiredTolerance, maxSamples), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate, bool controlVariate, int requiredSamples, double requiredTolerance) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_2(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate, controlVariate, requiredSamples, requiredTolerance), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate, bool controlVariate, int requiredSamples) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_3(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate, controlVariate, requiredSamples), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate, bool controlVariate) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_4(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate, controlVariate), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge, bool antitheticVariate) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_5(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge, antitheticVariate), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits, bool brownianBridge) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_6(GeneralizedBlackScholesProcess.getCPtr(process), traits, brownianBridge), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } public MCDiscreteArithmeticAPEngine(GeneralizedBlackScholesProcess process, string traits) : this(NQuantLibcPINVOKE.new_MCDiscreteArithmeticAPEngine__SWIG_7(GeneralizedBlackScholesProcess.getCPtr(process), traits), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } } }
69.701299
468
0.798025
[ "BSD-3-Clause" ]
x-xing/Quantlib-SWIG
CSharp/csharp/MCDiscreteArithmeticAPEngine.cs
5,367
C#
using System; using System.Globalization; using System.Linq; using System.Reflection; namespace WebAPI_01.Areas.HelpPage.ModelDescriptions { internal static class ModelNameHelper { // Modify this to provide custom model name mapping. public static string GetModelName(Type type) { ModelNameAttribute modelNameAttribute = type.GetCustomAttribute<ModelNameAttribute>(); if (modelNameAttribute != null && !String.IsNullOrEmpty(modelNameAttribute.Name)) { return modelNameAttribute.Name; } string modelName = type.Name; if (type.IsGenericType) { // Format the generic type name to something like: GenericOfAgurment1AndArgument2 Type genericType = type.GetGenericTypeDefinition(); Type[] genericArguments = type.GetGenericArguments(); string genericTypeName = genericType.Name; // Trim the generic parameter counts from the name genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`')); string[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray(); modelName = String.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, String.Join("And", argumentTypeNames)); } return modelName; } } }
40.916667
141
0.620502
[ "MIT" ]
jacking75/semina_MobileServer_WCF
Code_AspNetWebAPI/WebAPI_01/WebAPI_01/Areas/HelpPage/ModelDescriptions/ModelNameHelper.cs
1,473
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNextGen.Insights.Latest.Inputs { /// <summary> /// The scheduling constraints for when the profile begins. /// </summary> public sealed class RecurrentScheduleArgs : Pulumi.ResourceArgs { [Input("days", required: true)] private InputList<string>? _days; /// <summary> /// the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. /// </summary> public InputList<string> Days { get => _days ?? (_days = new InputList<string>()); set => _days = value; } [Input("hours", required: true)] private InputList<int>? _hours; /// <summary> /// A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). /// </summary> public InputList<int> Hours { get => _hours ?? (_hours = new InputList<int>()); set => _hours = value; } [Input("minutes", required: true)] private InputList<int>? _minutes; /// <summary> /// A collection of minutes at which the profile takes effect at. /// </summary> public InputList<int> Minutes { get => _minutes ?? (_minutes = new InputList<int>()); set => _minutes = value; } /// <summary> /// the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time /// </summary> [Input("timeZone", required: true)] public Input<string> TimeZone { get; set; } = null!; public RecurrentScheduleArgs() { } } }
71.430769
2,697
0.714409
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/Insights/Latest/Inputs/RecurrentScheduleArgs.cs
4,643
C#
using System; using Yung.Exceptions; namespace Yung.AST { public class Float : INumber { public Float(float value) { Value = value; } public float Value { get; } public INumber Negate() { return new Float(-Value); } public INumber Add(INumber number) { try { return new Float(Value + ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public INumber Subtract(INumber number) { try { return new Float(Value - ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public INumber Multiply(INumber number) { try { return new Float(Value * ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public INumber Divide(INumber number) { try { return new Float(Value / ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public Boolean Less(INumber number) { try { return new Boolean(Value < ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public Boolean LessOrEqual(INumber number) { try { return new Boolean(Value <= ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public Boolean Greater(INumber number) { try { return new Boolean(Value > ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } public Boolean GreaterOrEqual(INumber number) { try { return new Boolean(Value >= ((Float) number).Value); } catch (InvalidCastException) { throw new TypeMismatchException(); } } } }
23.273504
68
0.429673
[ "MIT" ]
Daouki/yung
Yung/AST/Float.cs
2,725
C#
extern alias oldmsgpack; extern alias newmsgpack; using System.Collections.Generic; using ProtoBuf; namespace Benchmark.Models { [ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject] public class FlagOption : IGenericEquality<FlagOption> { [System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)] public int? option_id { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)] public bool? requires_comment { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)] public bool? requires_site { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)] public bool? requires_question_id { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)] public string title { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)] public string description { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)] public List<FlagOption> sub_options { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)] public bool? has_flagged { get; set; } [System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)] public int? count { get; set; } public bool Equals(FlagOption obj) { return count.TrueEquals(obj.count) && description.TrueEqualsString(obj.description) && has_flagged.TrueEquals(obj.has_flagged) && option_id.TrueEquals(obj.option_id) && requires_comment.TrueEquals(obj.requires_comment) && requires_question_id.TrueEquals(obj.requires_question_id) && requires_site.TrueEquals(obj.requires_site) && sub_options.TrueEqualsList(obj.sub_options) && title.TrueEqualsString(obj.title); } public bool EqualsDynamic(dynamic obj) { return count.TrueEquals((int?) obj.count) && description.TrueEqualsString((string) obj.description) && has_flagged.TrueEquals((bool?) obj.has_flagged) && option_id.TrueEquals((int?) obj.option_id) && requires_comment.TrueEquals((bool?) obj.requires_comment) && requires_question_id.TrueEquals((bool?) obj.requires_question_id) && requires_site.TrueEquals((bool?) obj.requires_site) && sub_options.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.sub_options) && title.TrueEqualsString((string) obj.title); } } }
52.106061
169
0.657168
[ "BSD-2-Clause" ]
alefranz/MessagePack-CSharp
benchmark/SerializerBenchmark/Models/FlagOption.cs
3,441
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Uavcan.NET.IO.Can.Drivers.Slcan { /// <summary> /// Represents a CAN filter chain. /// </summary> public class FilterChain { /// <summary> /// Create filter chain with one mask and filters. /// </summary> /// <param name="mask">Mask</param> /// <param name="filters">Filters</param> public FilterChain(FilterMask mask, FilterValue[] filters) { Mask = mask; Filters = filters; } /// <summary> /// Get mask of this filter chain. /// </summary> public FilterMask Mask { get; } /// <summary> /// Get filters of this filter chain. /// </summary> public FilterValue[] Filters { get; } } }
24.694444
66
0.554556
[ "MIT" ]
kolos450/Uavcan.NET
Source/Uavcan.NET.IO.Can.Drivers.Slcan/FilterChain.cs
891
C#
/* * Copyright 2011-2015 Numeric Technology * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using KPBO.Parameters; using KPCore.KPException; using KPData; using KPEnumerator.KPSecurity; using KPExtension; using NHibernate.Validator.Cfg; using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading; using System.Web; using System.Web.Compilation; namespace KPComponents { /// <summary> /// <para>Authors: Juliano Tiago Rinaldi and /// Tiago Antonio Jacobi</para> /// </summary> public abstract class KPGlobal : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { CultureInfo culture; if (Thread.CurrentThread.CurrentCulture.Name != "pt-BR") { culture = CultureInfo.CreateSpecificCulture("pt-BR"); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture; } DataFramework dataFrw = new DataFramework(); //string assemblyNameEntity = FrwParametersHelper.GetValueParam<string>(FrwParamEnum.FRW_ASSEMBLY_NAME_ENTITY); string assemblyNameEntity = "SpecialistEntity"; Assembly assemblyEntity = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == assemblyNameEntity); if (assemblyEntity == null) { assemblyEntity = Assembly.LoadFrom(Path.Combine(System.Web.HttpRuntime.BinDirectory, String.Format("{0}.dll", assemblyNameEntity))); if (assemblyEntity == null) throw new Exception(String.Format("Assembly '{0}' not found.", assemblyNameEntity)); } dataFrw.InitializeDatabases(new Assembly[] { dataFrw.KPEntity, assemblyEntity }); DataFramework.InicializeValidator(LanguageEnum.PORTUGUESE_BRAZIL); #region Atualizar Parâmetros FrwParametersHelper.UpdateDefaultParamValueFrw(); #endregion ApplicationStart(sender, e); } protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); if (HttpContext.Current != null) { HttpContext _context = HttpContext.Current; Uri fileError = ((HttpApplication)sender).Context.Request.Url; #if DEBUG Debugger.Break(); #endif if (_context.Session != null) { KPExceptionSecurity exSecurity = null; try { exSecurity = KPExceptionHelper.GetTypedException<KPExceptionSecurity>(ex); } catch { } if (exSecurity != null) { _context.Session.Add(KPSessionKeyEnum.SESSION_EXCEPTION.ToString(), exSecurity); HttpContext.Current.Response.Redirect("~/ErrorPermission.aspx"); } else { _context.Session.Add(KPSessionKeyEnum.SESSION_EXCEPTION.ToString(), ex); HttpContext.Current.Response.Redirect("~/Error.aspx"); } } else _context.Response.Write(KPExceptionHelper.GetCompleteError(ex as Exception, true)); Server.ClearError(); } ApplicationError(sender, e); } protected void Session_Start(object sender, EventArgs e) { SessionStart(sender, e); } protected void Session_End(object sender, EventArgs e) { SessionEnd(sender, e); } protected abstract void ApplicationStart(object sender, EventArgs e); protected abstract void ApplicationError(object sender, EventArgs e); protected abstract void SessionStart(object sender, EventArgs e); protected abstract void SessionEnd(object sender, EventArgs e); } }
37.046512
153
0.617493
[ "Apache-2.0" ]
NumericTechnology/Platanum.Net
KPComponents/KPGlobal/KPGlobal.cs
4,782
C#
/* =============================================================================== EntitySpaces 2009 by EntitySpaces, LLC Persistence Layer and Business Objects for Microsoft .NET EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC http://www.entityspaces.net =============================================================================== EntitySpaces Version : 2010.0.0.0 EntitySpaces Driver : Oracle Date Generated : 3/21/2010 8:10:00 PM =============================================================================== */ using System; using EntitySpaces.Core; using EntitySpaces.Interfaces; using EntitySpaces.DynamicQuery; namespace BusinessObjects { public partial class OracleTestCollection : esOracleTestCollection { public OracleTestCollection() { } } }
28.766667
79
0.494786
[ "Unlicense" ]
EntitySpaces/EntitySpaces-CompleteSource
Tests/CSharp/TestAllDatabases/TestAllDatabases/BusinessObjects/Custom/Oracle/OracleTestCollection.cs
863
C#
// Copyright (c) "Neo4j" // Neo4j Sweden AB [http://neo4j.com] // // This file is part of Neo4j. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Threading.Tasks; using Neo4j.Driver.Internal.MessageHandling; using Neo4j.Driver.Internal.Messaging; using Neo4j.Driver.Internal.Protocol; namespace Neo4j.Driver.Internal.Connector { internal interface ISocketClient { Task<IBoltProtocol> ConnectAsync(IDictionary<string, string> routingContext); Task SendAsync(IEnumerable<IRequestMessage> messages); Task ReceiveAsync(IResponsePipeline responsePipeline); Task ReceiveOneAsync(IResponsePipeline responsePipeline); bool IsOpen { get; } Task StopAsync(); void SetRecvTimeOut(int seconds); } }
35.702703
85
0.742619
[ "Apache-2.0" ]
AndyHeap-NeoTech/neo4j-dotnet-driver
Neo4j.Driver/Neo4j.Driver/Internal/Connector/ISocketClient.cs
1,321
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KModkit; using rnd = UnityEngine.Random; public class simonScratches : MonoBehaviour { public new KMAudio audio; public KMBombInfo bomb; public KMBombModule module; public KMSelectable startButton; public KMSelectable armButton; public KMSelectable armDial; public Color[] recordColors; public Renderer record; public Transform arm; public GameObject[] ports; public Light[] rjLights; private int[] recordColorIndices = new int[2]; private int portIndex; private bool isCCW; private Coroutine recordMovement; private bool spinning; private bool fullSpeed; private bool armOnRecord; private static readonly string[] colorNames = new string[8] { "red", "green", "blue", "yellow", "cyan", "magenta", "black", "white" }; private static int moduleIdCounter = 1; private int moduleId; private bool moduleSolved; void Awake() { moduleId = moduleIdCounter++; armButton.OnInteract += delegate () { PressArm(); return false; }; startButton.OnInteract += delegate () { PressStart(); return false; }; armDial.OnInteract += delegate () { PressArmDial(); return false; }; } void Start() { float scalar = transform.lossyScale.x; foreach (Light l in rjLights) l.range *= scalar; portIndex = rnd.Range(0, ports.Length); foreach (GameObject port in ports) port.SetActive(Array.IndexOf(ports, port) == portIndex); isCCW = rnd.Range(0, 2) == 0; recordColorIndices[0] = rnd.Range(0, 8); recordColorIndices[1] = rnd.Range(0, 8); while (recordColorIndices[1] == recordColorIndices[0]) recordColorIndices[1] = rnd.Range(0, 8); record.materials[1].color = recordColors[recordColorIndices[0]]; record.materials[0].color = recordColors[recordColorIndices[1]]; for (int i = 0; i < 2; i++) Debug.LogFormat("[Simon Scratches #{0}] The {1} part of the record is {2}.", moduleId, i == 0 ? "inner" : "outer", colorNames[recordColorIndices[i]]); } void PressArm() { if (armOnRecord || !spinning || moduleSolved) return; StartCoroutine(MoveArm(arm.localEulerAngles.y, 30f)); } void PressStart() { audio.PlaySoundAtTransform("click", startButton.transform); startButton.AddInteractionPunch(.1f); if (moduleSolved) return; if (!spinning) StartCoroutine(RecordTransition(0f, 100f, true)); else if (spinning && !fullSpeed) return; else if (spinning && fullSpeed) { StopCoroutine(recordMovement); StartCoroutine(RecordTransition(100f, 0f, false)); } } void PressArmDial() { } IEnumerator RecordTransition(float startSpeed, float endSpeed, bool spinningAfter) { spinning = true; var elapsed = 0f; var duration = 4f; while (elapsed < duration) { var accel = Mathf.Lerp(startSpeed, endSpeed, elapsed / duration); var framerate = 1f / Time.deltaTime; var rotation = accel / framerate; if (isCCW) rotation *= -1; var y = record.transform.localEulerAngles.y; y += rotation; record.transform.localEulerAngles = new Vector3(0f, y, 90f); yield return null; elapsed += Time.deltaTime; } spinning = spinningAfter; if (startSpeed == 0f) recordMovement = StartCoroutine(SpinRecord()); yield break; } IEnumerator SpinRecord() { spinning = true; fullSpeed = true; while (true) { var framerate = 1f / Time.deltaTime; var rotation = 100f / framerate; if (isCCW) rotation *= -1; var y = record.transform.localEulerAngles.y; y += rotation; record.transform.localEulerAngles = new Vector3(0f, y, 90f); yield return null; } } IEnumerator MoveArm(float startRotation, float endRotation) { armOnRecord = true; var elapsed = 0f; var duration = 1f; while (elapsed < duration) { arm.localEulerAngles = new Vector3(0f, Easing.OutSine(elapsed, startRotation, endRotation, duration), 0f); yield return null; elapsed += Time.deltaTime; } arm.localEulerAngles = new Vector3(0f, endRotation, 0f); module.GetComponent<KMSelectable>().Children[0] = null; module.GetComponent<KMSelectable>().UpdateChildren(); } // Twitch Plays #pragma warning disable 414 private readonly string TwitchHelpMessage = "!{0} "; #pragma warning restore 414 IEnumerator ProcessTwitchCommand(string input) { yield return null; } IEnumerator TwitchHandleForcedSolve() { yield return null; } }
29.625
162
0.621861
[ "MIT" ]
tasthing/Simon-Scratches
Assets/simonScratches.cs
4,977
C#
#if ! (UNITY_DASHBOARD_WIDGET || UNITY_WEBPLAYER || UNITY_WII || UNITY_WIIU || UNITY_NACL || UNITY_FLASH || UNITY_BLACKBERRY) // Disable under unsupported platforms. ////////////////////////////////////////////////////////////////////// // // Copyright (c) 2017 Audiokinetic Inc. / All Rights Reserved // ////////////////////////////////////////////////////////////////////// [UnityEngine.AddComponentMenu("Wwise/AkSpatialAudioListener")] [UnityEngine.RequireComponent(typeof(AkAudioListener))] [UnityEngine.RequireComponent(typeof(AkRoomAwareObject))] [UnityEngine.DisallowMultipleComponent] ///@brief Add this script on the game object that represent a listener. This is normally added to the Camera object or the Player object, but can be added to any game object when implementing 3D busses. \c isDefaultListener determines whether the game object will be considered a default listener - a listener that automatically listens to all game objects that do not have listeners attached to their AkGameObjListenerList's. /// \sa /// - <a href="https://www.audiokinetic.com/library/edge/?source=SDK&id=soundengine__listeners.html" target="_blank">Integrating Listeners</a> (Note: This is described in the Wwise SDK documentation.) public class AkSpatialAudioListener : UnityEngine.MonoBehaviour #if UNITY_EDITOR , AK.Wwise.IMigratable #endif { private static AkSpatialAudioListener s_SpatialAudioListener; private static readonly SpatialAudioListenerList spatialAudioListeners = new SpatialAudioListenerList(); private AkAudioListener AkAudioListener; /// <summary> /// Returns the "single" spatial audio listener. /// </summary> public static AkAudioListener TheSpatialAudioListener { get { return s_SpatialAudioListener != null ? s_SpatialAudioListener.AkAudioListener : null; } } /// <summary> /// Returns the list of active Unity Game Objects that are designated to be spatial audio listeners. /// </summary> public static SpatialAudioListenerList SpatialAudioListeners { get { return spatialAudioListeners; } } private void Awake() { AkAudioListener = GetComponent<AkAudioListener>(); } private void OnEnable() { spatialAudioListeners.Add(this); } private void OnDisable() { spatialAudioListeners.Remove(this); } /// <summary> /// This class represents the list of active Unity Game Objects that are designated to be spatial audio listeners. /// Currently, only one spatial audio listener can be active at a time. /// </summary> public class SpatialAudioListenerList { private readonly System.Collections.Generic.List<AkSpatialAudioListener> listenerList = new System.Collections.Generic.List<AkSpatialAudioListener>(); public System.Collections.Generic.List<AkSpatialAudioListener> ListenerList { get { return listenerList; } } /// <summary> /// Uniquely adds listeners to the list /// </summary> /// <param name="listener"></param> /// <returns></returns> public bool Add(AkSpatialAudioListener listener) { if (listener == null) return false; if (listenerList.Contains(listener)) return false; listenerList.Add(listener); Refresh(); return true; } /// <summary> /// Removes listeners from the list /// </summary> /// <param name="listener"></param> /// <returns></returns> public bool Remove(AkSpatialAudioListener listener) { if (listener == null) return false; if (!listenerList.Remove(listener)) return false; Refresh(); return true; } private void Refresh() { if (ListenerList.Count == 1) { if (s_SpatialAudioListener != null) AkSoundEngine.UnregisterSpatialAudioListener(s_SpatialAudioListener.gameObject); s_SpatialAudioListener = ListenerList[0]; AkSoundEngine.RegisterSpatialAudioListener(s_SpatialAudioListener.gameObject); } else if (ListenerList.Count == 0 && s_SpatialAudioListener != null) { AkSoundEngine.UnregisterSpatialAudioListener(s_SpatialAudioListener.gameObject); s_SpatialAudioListener = null; } } } #if UNITY_EDITOR #region WwiseMigration bool AK.Wwise.IMigratable.Migrate(UnityEditor.SerializedObject obj) { if (!AkUtilities.IsMigrationRequired(AkUtilities.MigrationStep.NewScriptableObjectFolder_v2019_2_0)) return false; UnityEditor.Undo.AddComponent<AkRoomAwareObject>(gameObject); return true; } #endregion #endif } #endif // #if ! (UNITY_DASHBOARD_WIDGET || UNITY_WEBPLAYER || UNITY_WII || UNITY_WIIU || UNITY_NACL || UNITY_FLASH || UNITY_BLACKBERRY) // Disable under unsupported platforms.
33.321168
428
0.725301
[ "MIT" ]
Anreol/ReleasedFromTheVoid
Assets/Wwise/Deployment/Components/AkSpatialAudioListener.cs
4,565
C#
#nullable disable using FluentNHibernate.Mapping; using VocaDb.Model.Domain.Discussions; namespace VocaDb.Model.Mapping.Discussions { public class DiscussionFolderMap : ClassMap<DiscussionFolder> { public DiscussionFolderMap() { Schema("discussions"); Table("DiscussionFolders"); Cache.ReadWrite(); Id(m => m.Id); Map(m => m.Deleted).Not.Nullable(); Map(m => m.Description).Not.Nullable().Length(int.MaxValue); Map(m => m.Name).Not.Nullable().Length(200); Map(m => m.SortIndex).Not.Nullable(); HasMany(m => m.Topics).KeyColumn("[Folder]").Inverse().Cache.ReadWrite(); } } }
23.740741
77
0.661466
[ "MIT" ]
AgFlore/vocadb
VocaDbModel/Mapping/Discussions/DiscussionFolderMap.cs
641
C#
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace SignalRCore2Chat { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build(); } }
23.0625
128
0.655827
[ "MIT" ]
hasan190889/SignalRCore2Chat
Program.cs
371
C#
using System.Collections.Generic; using System; using FluentValidation; using System.ComponentModel.DataAnnotations.Schema; using FluentValidation.Attributes; namespace Shared.Models { [Validator(typeof(MenuViewModelValidator))] public class MenuViewModel { public int Id { get; set; } public int? ParentId { get; set; } public Guid? RoleId { get; set; } public string ParentName { get; set; } public string Name { get; set; } public string Url { get; set; } public string Icon { get; set; } public bool IsActive { get; set; } public int Order { get; set; } public bool Checked { get; set; } // in role - checked public string RoleName { get; set; } // in role - checked [NotMapped] public IEnumerable<SelectListViewModel> Parents { get; set; } [NotMapped] public IEnumerable<MenuViewModel> Childrens { get; set; } public List<int> MenuIds { get; set; } } public class MenuViewModelValidator : AbstractValidator<MenuViewModel> { public MenuViewModelValidator() { RuleFor(x => x.Name).NotEmpty().Length(0, 50); RuleFor(x => x.Url).Length(0, 255); RuleFor(x => x.Icon).Length(0, 255); RuleFor(x => x.RoleName).Length(0, 255); } } }
32.428571
74
0.605727
[ "MIT" ]
duyxaoke/Solution
Shared/Models/MenuViewModel.cs
1,364
C#
using AdventOfCode.Days.Tools.Day25; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AdventOfCode.Days { public class Day25 : DayBase { public override string Title => "Combo Breaker"; RfidClient Card; RfidClient Door; public override string Solve(string input, bool part2) { if (part2) return "Part 2 is unavailoable."; List<string> keys = GetLines(input); Card = new RfidClient(long.Parse(keys[0])); Door = new RfidClient(long.Parse(keys[1])); long cardEnc = Card.GetEncriptionKey(Door.PublicKey); long doorEnc = Door.GetEncriptionKey(Card.PublicKey); if (cardEnc == doorEnc) return "The encription key is " + cardEnc; else return "No encription key found!"; } } }
29.225806
78
0.629139
[ "MIT" ]
Crazymine-hub/AdventOfCode
AoC2020/Days/Day25.cs
908
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the runtime.sagemaker-2017-05-13.normal.json service model. */ using System; using System.Collections.Generic; using System.Net; using System.Text; using Amazon.Runtime; namespace Amazon.SageMakerRuntime { ///<summary> /// Common exception for the SageMakerRuntime service. /// </summary> #if !NETSTANDARD [Serializable] #endif public partial class AmazonSageMakerRuntimeException : AmazonServiceException { /// <summary> /// Construct instance of AmazonSageMakerRuntimeException /// </summary> /// <param name="message"></param> public AmazonSageMakerRuntimeException(string message) : base(message) { } /// <summary> /// Construct instance of AmazonSageMakerRuntimeException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public AmazonSageMakerRuntimeException(string message, Exception innerException) : base(message, innerException) { } /// <summary> /// Construct instance of AmazonSageMakerRuntimeException /// </summary> /// <param name="innerException"></param> public AmazonSageMakerRuntimeException(Exception innerException) : base(innerException.Message, innerException) { } /// <summary> /// Construct instance of AmazonSageMakerRuntimeException /// </summary> /// <param name="message"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public AmazonSageMakerRuntimeException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, errorType, errorCode, requestId, statusCode) { } /// <summary> /// Construct instance of AmazonSageMakerRuntimeException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public AmazonSageMakerRuntimeException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) { } #if !NETSTANDARD /// <summary> /// Constructs a new instance of the AmazonSageMakerRuntimeException class with serialized data. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception> protected AmazonSageMakerRuntimeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } #endif } }
41.009524
178
0.659545
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/SageMakerRuntime/Generated/AmazonSageMakerRuntimeException.cs
4,306
C#
// Copyright 2005-2010 Gallio Project - http://www.gallio.org/ // Portions Copyright 2000-2004 Jonathan de Halleux // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Text.RegularExpressions; namespace Gallio.Common.Reflection { /// <summary> /// Describes characteristics used to match an assembly such as an assembly name and version range. /// </summary> [Serializable] public class AssemblySignature { private static readonly Regex ParseRegex = new Regex( @"^(?<name>[a-zA-Z0-9_.]+)(?:\s*,\s*Version\s*=\s*(?<minVersion>\d+\.\d+\.\d+\.\d+)(?:\s*-\s*(?<maxVersion>\d+\.\d+\.\d+\.\d+))?)?$", RegexOptions.CultureInvariant | RegexOptions.Singleline); private readonly string name; private Version minVersion, maxVersion; /// <summary> /// Creates an assembly signature. /// </summary> /// <param name="name">The simple name of the assembly.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref cref="name" /> is null.</exception> public AssemblySignature(string name) { if (name == null) throw new ArgumentNullException("name"); this.name = name; } /// <summary> /// Gets the simple name of the assembly. /// </summary> public string Name { get { return name; } } /// <summary> /// Sets the assembly version to match. /// </summary> /// <param name="version">The version to match, or null if none.</param> public void SetVersion(Version version) { minVersion = version; maxVersion = version; } /// <summary> /// Sets the assembly version range to match. /// </summary> /// <remarks> /// <para> /// <paramref name="minVersion"/> and <paramref name="maxVersion"/> must /// either both be non-null or both be null. /// </para> /// </remarks> /// <param name="minVersion">The minimum assembly version to match inclusively, or null if there is no lower bound.</param> /// <param name="maxVersion">The maximum assembly version to match inclusively, or null if there is no upper bound.</param> /// <exception cref="ArgumentException">Thrown if <paramref name="minVersion"/> is null but /// not <paramref name="maxVersion"/> or vice-versa. Also thrown if <paramref name="minVersion"/> /// is greater than <paramref name="maxVersion"/>.</exception> public void SetVersionRange(Version minVersion, Version maxVersion) { if (minVersion == null && maxVersion != null || minVersion != null && maxVersion == null) throw new ArgumentException("Min and max version must either both be non-null or both be null."); if (minVersion != null && minVersion > maxVersion) throw new ArgumentException("Min version must be less than or equal to max version."); this.minVersion = minVersion; this.maxVersion = maxVersion; } /// <summary> /// Gets the minimum assembly version to match inclusively, or null if there is no lower bound. /// </summary> public Version MinVersion { get { return minVersion; } } /// <summary> /// Gets the maximum assembly version to match inclusively, or null if there is no upper bound. /// </summary> public Version MaxVersion { get { return maxVersion; } } /// <summary> /// Returns true if the signature matches the specified assembly name. /// </summary> /// <remarks> /// <para> /// When the assembly name is a partial name that omits version information, the version /// criteria of the signature are ignored. /// </para> /// </remarks> /// <param name="assemblyName">The assembly name.</param> /// <returns>True if the signature matches the assembly name.</returns> /// <exception cref="ArgumentNullException">Thrown if <paramref name="assemblyName"/> is null.</exception> public bool IsMatch(AssemblyName assemblyName) { if (assemblyName == null) throw new ArgumentNullException("assemblyName"); if (assemblyName.Name != name) return false; if (minVersion != null) { Version assemblyVersion = assemblyName.Version; if (assemblyVersion != null) { if (minVersion > assemblyVersion || maxVersion < assemblyVersion) return false; } } return true; } /// <summary> /// Parses the assembly signature from a string. /// </summary> /// <remarks> /// <para> /// The string takes the form of following forms: /// <list type="bullet"> /// <item>"AssemblyName"</item> /// <item>"AssemblyName, Version=1.2.0.0"</item> /// <item>"AssemblyName, Version=1.2.0.0-1.3.65535.65535"</item> /// </list> /// </para> /// </remarks> /// <param name="str">The string to parse.</param> /// <returns>The parsed signature.</returns> /// <exception cref="ArgumentNullException">Thrown if <paramref name="str"/> is null.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="str"/> is malformed.</exception> public static AssemblySignature Parse(string str) { if (str == null) throw new ArgumentNullException("str"); Match match = ParseRegex.Match(str); if (! match.Success) throw new ArgumentException("The specified assembly signature is not valid.", "str"); string name = match.Groups["name"].Value; string minVersion = match.Groups["minVersion"].Value; string maxVersion = match.Groups["maxVersion"].Value; var signature = new AssemblySignature(name); if (minVersion.Length != 0) { if (maxVersion.Length != 0) { signature.SetVersionRange(new Version(minVersion), new Version(maxVersion)); } else { signature.SetVersion(new Version(minVersion)); } } return signature; } /// <summary> /// Converts the signature to a string. /// </summary> /// <returns>The signature in a format that can be subsequently parsed by <see cref="Parse"/>.</returns> /// <seealso cref="Parse"/> public override string ToString() { if (minVersion == null && maxVersion == null) return name; var builder = new StringBuilder(name); builder.Append(", Version="); builder.Append(minVersion); if (minVersion != maxVersion) { builder.Append('-'); builder.Append(maxVersion); } return builder.ToString(); } } }
37.643192
145
0.565478
[ "ECL-2.0", "Apache-2.0" ]
citizenmatt/gallio
src/Gallio/Gallio/Common/Reflection/AssemblySignature.cs
8,018
C#
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; using MSDF.StudentEngagement.Persistence.EntityFramework; using MSDF.StudentEngagement.Persistence.Models; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace MSDF.StudentEngagement.Persistence.CommandsAndQueries.Queries { public interface ILearningAppQueries { Task<LearningApp> GetAllowedApp(string url); Task<List<LearningApp>> GetAll(); } public class LearningAppQueries : ILearningAppQueries { private readonly DatabaseContext _db; public LearningAppQueries(DatabaseContext db) { this._db = db; } public async Task<List<LearningApp>> GetAll() { return await _db.LearningApps .Where(la => la.TrackingEnabled) .ToListAsync(); } public async Task<LearningApp> GetAllowedApp(string url) { var lApps = await _db.LearningApps .ToListAsync(); var lApp = lApps .Where(la => Regex.IsMatch(url, la.AllowlistRegex) && la.TrackingEnabled) .FirstOrDefault(); return lApp; } } }
29.088889
89
0.640183
[ "Apache-2.0" ]
ValerieRobateau/Ed-Fi-X-StudentEngagement
MSDF.StudentEngagement.Web/MSDF.StudentEngagement.Persistence/CommandsAndQueries/Queries/LearningAppQueries.cs
1,311
C#
// Copyright 2017 the original author or authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace Steeltoe.Stream.StubBinder2 { public class StubBinder2Dependency { } }
33.333333
75
0.745714
[ "Apache-2.0" ]
Karql/steeltoe
src/Stream/test/StubBinder2/StubBinder2Dependency.cs
702
C#
using System.Collections; using System.Collections.Generic; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; using System.Linq; namespace Hinode.Tests.Input { /// <summary> /// <seealso cref="AppendTouchInputData"/> /// </summary> public class TestAppendTouchInputData : TestBase { [SetUp] public void SetUp() { FrameInputData.ClearChildFrameInputDataType(); } /// <summary> /// <seealso cref="AppendTouchInputData.OnAttached(InputRecorder)"/> /// </summary> /// <returns></returns> [UnityTest] public IEnumerator OnAttachedPasses() { var recorder = new GameObject().AddComponent<InputRecorderMonoBehaviour>(); var inputObj = recorder.gameObject.AddComponent<AppendTouchInputData>(); yield return null; var frameInputData = recorder.UseRecorder.FrameDataRecorder as FrameInputData; Assert.IsTrue(frameInputData.ContainsChildRecorder<TouchFrameInputData>()); Assert.IsTrue(frameInputData.GetChildRecorderEnumerable() .Select(_t => _t.child) .OfType<TouchFrameInputData>() .Any()); } /// <summary> /// <seealso cref="AppendTouchInputData.Attach()"/> /// </summary> /// <returns></returns> [UnityTest] public IEnumerator AttachPasses() { var recorder = new GameObject().AddComponent<InputRecorderMonoBehaviour>(); var inputObj = recorder.gameObject.AddComponent<AppendTouchInputData>(); yield return null; inputObj.Attach(); var frameInputData = recorder.UseRecorder.FrameDataRecorder as FrameInputData; Assert.IsTrue(frameInputData.ContainsChildRecorder<TouchFrameInputData>()); Assert.IsTrue(frameInputData.GetChildRecorderEnumerable() .Select(_t => _t.child) .OfType<TouchFrameInputData>() .Any()); } /// <summary> /// <seealso cref="AppendTouchInputData.CreateInputData()"/> /// </summary> /// <returns></returns> [UnityTest] public IEnumerator CreateInputDataPasses() { var inputObj = new GameObject().AddComponent<AppendTouchInputData>(); Assert.IsTrue(inputObj.CreateInputData() is TouchFrameInputData); yield return null; } } }
33.493333
90
0.607484
[ "Apache-2.0" ]
tositeru/hinode
Tests/Runtime/Input/FrameInputData/MonoBehaviour/TestAttachTouchInputData.cs
2,514
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace DanmakU.Fireables { [Serializable] public class Spiral : Fireable { /// <summary> /// Spiral shot count /// </summary> public Range Count; /// <summary> /// Spiral start angle /// </summary> [Radians] public Range StartAngle; /// <summary> /// Angle between each bullet /// </summary> [Radians] public Range ShiftAngle; /// <summary> /// Delay time in seconds between each shot /// </summary> public Range Delay; public Spiral (Range count, Range start, Range shift, Range delay) { Count = count; StartAngle = start; ShiftAngle = shift; Delay = delay; } public override void Fire (DanmakuConfig config) { var emitter = new GameObject ("SpireEmitter", typeof (SpiralEmitter)).GetComponent<SpiralEmitter> (); emitter.SetEmitterParams ( (int) Count.GetValue (), StartAngle.GetValue (), ShiftAngle.GetValue (), Delay.GetValue ()); emitter.Emit (config, Child); } internal class SpiralEmitter : MonoBehaviour { private int _count; private Range _startAngle; private float _shiftAngle; private float _delay; private DanmakuConfig _config; private IFireable _subFire; private bool _emit = false; public void SetEmitterParams (int count, float StartAngle, float ShiftAngle, float Delay) { _count = count; _startAngle = StartAngle; _shiftAngle = ShiftAngle; _delay = Delay; } public void Emit (DanmakuConfig config, IFireable subFire) { _config = config; _subFire = subFire; if (!_emit) { _emit = true; StartCoroutine (EmitCoroutine ()); } } private IEnumerator EmitCoroutine () { if (_count <= 0) yield break; float timer = 0f; for (int i = 0; i < _count; i++) { timer = 0f; while (timer < _delay) { timer += Time.deltaTime; yield return null; } if (_subFire != null) { _subFire.Fire (new DanmakuConfig { Position = _config.Position, Rotation = _startAngle + _shiftAngle * i, Speed = _config.Speed, AngularSpeed = _config.AngularSpeed, Color = _config.Color }); } } Destroy (this.gameObject); } } } }
23.841121
107
0.575069
[ "MIT" ]
hdmmY/DanmakU
Assets/DanmakU/Runtime/Fireables/Shapes/Spiral.cs
2,553
C#
namespace ResidentBookmark.Services { public class QueryService { public async Task<List<Label>> RetrieveAllLabels(ResidentBookmarkContext context) { List<Label> labels = await context.Labels.ToListAsync(); if (labels == null) { throw new FindArgumentNullException(); } else { return await Task.FromResult<List<Label>>(labels); } } public async Task<List<Website>> RetrieveAllWebsitesIncludeLabel(ResidentBookmarkContext context) { List<Website> websites = await context.Websites.Include(Website => Website.Label).ToListAsync(); if (websites == null) { throw new FindArgumentNullException(); } else { return await Task.FromResult<List<Website>>(websites); } } public async Task<List<Website>> RetrieveWebsitesFromLabelName(ResidentBookmarkContext context, string querystring) { List<Website> websites = await context.Websites.Where(l => l.Label.Name == querystring) .Include(l => l.Label) .ToListAsync(); if (websites == null) { throw new FindArgumentNullException(); } else { return await Task.FromResult<List<Website>>(websites); } } public async Task<int> RetrieveLabelIdFromQueryString(ResidentBookmarkContext context, string querystring) { Label label = await context.Labels.Where(l => l.Name == querystring).SingleAsync(); if (label == null) { throw new FindArgumentNullException(); } else { return await Task.FromResult<int>(label.LabelId); } } public async Task<string> RetrieveLabelDescriptionFromQueryString(ResidentBookmarkContext context, string querystring) { Label label = await context.Labels.Where(l => l.Name == querystring).SingleAsync(); if (label == null) { throw new FindInvalidOperationException(); } else { return await Task.FromResult<string>(label.Description); } } } }
31.688312
126
0.539754
[ "MIT" ]
residentsystem/residentbookmark
Services/QueryService.cs
2,440
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.GoogleNative.CloudScheduler.V1.Outputs { /// <summary> /// Pub/Sub target. The job will be delivered by publishing a message to the given Pub/Sub topic. /// </summary> [OutputType] public sealed class PubsubTargetResponse { /// <summary> /// Attributes for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute. /// </summary> public readonly ImmutableDictionary<string, string> Attributes; /// <summary> /// The message payload for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute. /// </summary> public readonly string Data; /// <summary> /// The name of the Cloud Pub/Sub topic to which messages will be published when a job is delivered. The topic name must be in the same format as required by PubSub's [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), for example `projects/PROJECT_ID/topics/TOPIC_ID`. The topic must be in the same project as the Cloud Scheduler job. /// </summary> public readonly string TopicName; [OutputConstructor] private PubsubTargetResponse( ImmutableDictionary<string, string> attributes, string data, string topicName) { Attributes = attributes; Data = data; TopicName = topicName; } } }
39.304348
398
0.669801
[ "Apache-2.0" ]
AaronFriel/pulumi-google-native
sdk/dotnet/CloudScheduler/V1/Outputs/PubsubTargetResponse.cs
1,808
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Drawing; using Xunit; using static Interop.UiaCore; namespace System.Windows.Forms.Tests { public class ToolStripItemAccessibleObjectTests : IClassFixture<ThreadExceptionFixture> { [WinFormsFact] public void ToolStripItemAccessibleObject_Ctor_ToolStripItem() { using var item = new SubToolStripItem { AccessibleDefaultActionDescription = "DefaultActionDescription", AccessibleDescription = "Description", AccessibleName = "Name", AccessibleRole = AccessibleRole.MenuBar }; var accessibleObject = new ToolStripItem.ToolStripItemAccessibleObject(item); Assert.Equal(Rectangle.Empty, accessibleObject.Bounds); Assert.Equal("DefaultActionDescription", accessibleObject.DefaultAction); Assert.Equal("Description", accessibleObject.Description); Assert.Null(accessibleObject.Help); Assert.Empty(accessibleObject.KeyboardShortcut); Assert.Equal("Name", accessibleObject.Name); Assert.Null(accessibleObject.Parent); Assert.Equal(AccessibleRole.MenuBar, accessibleObject.Role); Assert.Equal(AccessibleStates.Focusable, accessibleObject.State); } [WinFormsFact] public void ToolStripItemAccessibleObject_Ctor_NullOwnerItem_ThrowsArgumentNullException() { Assert.Throws<ArgumentNullException>("ownerItem", () => new ToolStripItem.ToolStripItemAccessibleObject(null)); } public static IEnumerable<object[]> ToolStripItemAccessibleObject_TestData() { return ReflectionHelper.GetPublicNotAbstractClasses<ToolStripItem>().Select(type => new object[] { type }); } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_TestData))] public void ToolStripItemAccessibleObject_LegacyIAccessible_Custom_Role_ReturnsExpected(Type type) { using (new NoAssertContext()) { using ToolStripItem item = ReflectionHelper.InvokePublicConstructor<ToolStripItem>(type); item.AccessibleRole = AccessibleRole.Link; AccessibleObject toolStripItemAccessibleObject = item.AccessibilityObject; var accessibleObjectRole = toolStripItemAccessibleObject.Role; Assert.Equal(AccessibleRole.Link, accessibleObjectRole); } } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_TestData))] public void ToolStripItemAccessibleObject_IsPatternSupported_LegacyIAccessible_ReturnsTrue(Type type) { using ToolStripItem item = ReflectionHelper.InvokePublicConstructor<ToolStripItem>(type); AccessibleObject toolStripItemAccessibleObject = item.AccessibilityObject; bool supportsLegacyIAccessiblePatternId = toolStripItemAccessibleObject.IsPatternSupported(UIA.LegacyIAccessiblePatternId); Assert.True(supportsLegacyIAccessiblePatternId); } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_TestData))] public void ToolStripItemAccessibleObject_LegacyIAccessible_Custom_Description_ReturnsExpected(Type type) { using ToolStripItem item = ReflectionHelper.InvokePublicConstructor<ToolStripItem>(type); item.AccessibleDescription = "Test Accessible Description"; AccessibleObject toolStripItemAccessibleObject = item.AccessibilityObject; var accessibleObjectDescription = toolStripItemAccessibleObject.Description; Assert.Equal("Test Accessible Description", accessibleObjectDescription); } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_TestData))] public void ToolStripItemAccessibleObject_GetPropertyValue_Custom_Name_ReturnsExpected(Type type) { using ToolStripItem item = ReflectionHelper.InvokePublicConstructor<ToolStripItem>(type); AccessibleObject toolStripItemAccessibleObject = item.AccessibilityObject; // By default Name has string.Empty value, because if AccessibleName is not defined // then control uses the value of "Text" property from owner Item (by default an empty string) Assert.Equal(string.Empty, toolStripItemAccessibleObject.GetPropertyValue(UIA.NamePropertyId)); item.Name = "Name1"; item.AccessibleName = "Test Name"; var accessibleName = toolStripItemAccessibleObject.GetPropertyValue(UIA.NamePropertyId); Assert.Equal("Test Name", accessibleName); } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_TestData))] public void ToolStripHostedControlAccessibleObject_GetPropertyValue_IsOffscreenPropertyId_ReturnExpected(Type type) { using var toolStrip = new ToolStrip(); toolStrip.CreateControl(); using ToolStripItem item = ReflectionHelper.InvokePublicConstructor<ToolStripItem>(type); item.Size = new Size(0, 0); toolStrip.Items.Add(item); AccessibleObject toolStripItemAccessibleObject = item.AccessibilityObject; Assert.True((bool)toolStripItemAccessibleObject.GetPropertyValue(UIA.IsOffscreenPropertyId) || (toolStripItemAccessibleObject.Bounds.Width > 0 && toolStripItemAccessibleObject.Bounds.Height > 0)); } [WinFormsFact] public void ToolStripItemAccessibleObject_ControlType_IsButton_IfAccessibleRoleIsDefault() { // Test the Default role case separately because ToolStripItemAccessibleObject // has default Role property value as "PushButton" using ToolStripItem toolStripItem = new SubToolStripItem(); // AccessibleRole is not set = Default UIA actual = (UIA)toolStripItem.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId); Assert.Equal(UIA.ButtonControlTypeId, actual); } [WinFormsFact] public static IEnumerable<object[]> ToolStripItemAccessibleObject_GetPropertyValue_ControlTypeProperty_ReturnsCorrectValue_TestData() { Array roles = Enum.GetValues(typeof(AccessibleRole)); foreach (AccessibleRole role in roles) { if (role == AccessibleRole.Default) { continue; // The test checks custom roles } yield return new object[] { role }; } } [WinFormsTheory] [MemberData(nameof(ToolStripItemAccessibleObject_GetPropertyValue_ControlTypeProperty_ReturnsCorrectValue_TestData))] public void ToolStripItemAccessibleObject_GetPropertyValue_ControlTypeProperty_ReturnsCorrectValue(AccessibleRole role) { using ToolStripItem toolStripItem = new SubToolStripItem(); toolStripItem.AccessibleRole = role; UIA actual = (UIA)toolStripItem.AccessibilityObject.GetPropertyValue(UIA.ControlTypePropertyId); UIA expected = AccessibleRoleControlTypeMap.GetControlType(role); Assert.Equal(expected, actual); // Check if the method returns an exist UIA_ControlTypeId Assert.True(actual >= UIA.ButtonControlTypeId && actual <= UIA.AppBarControlTypeId); } [WinFormsFact] public void ToolStripItemAccessibleObject_GetPropertyValue_ReturnsExpected() { using ToolStripItem toolStripItem = new SubToolStripItem(); Assert.False((bool)toolStripItem.AccessibilityObject.GetPropertyValue(UIA.IsExpandCollapsePatternAvailablePropertyId)); Assert.Null(toolStripItem.AccessibilityObject.GetPropertyValue(UIA.ValueValuePropertyId)); } private class SubToolStripItem : ToolStripItem { public SubToolStripItem() : base() { } } } }
44.736559
141
0.693186
[ "MIT" ]
AndreRRR/winforms
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ToolStripItemAccessibleObjectTests.cs
8,323
C#
// System.Globalization.Calendar.cs // // (C) Ulrich Kunitz 2002 // // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace System.Globalization { using System; using System.IO; using System.Runtime.InteropServices; /// <remarks> /// The class serves as a base class for calendar classes. /// </remarks> [Serializable] [ComVisible (true)] public abstract class Calendar : ICloneable { /// <value>An protected integer property that gives the number of /// days in a week. It might be overridden.</value> internal virtual int M_DaysInWeek { get { return 7; } } /// <summary> /// The protected method creates the string used in the /// <see cref="T:System.ArgumentOutOfRangeException"/> /// </summary> /// <param name="a">An object that represents the smallest /// allowable value.</param> /// <param name="b">An object that represents the greatest allowable /// value.</param> /// <returns>The string used in the /// <see cref="T:System.ArgumentOutOfRangeException"/> /// </returns> internal string M_ValidValues(object a, object b) { StringWriter sw = new StringWriter(); sw.Write("Valid values are between {0} and {1}, inclusive.", a, b); return sw.ToString(); } /// <summary> /// The protected method checks wether the parameter /// <paramref name="arg"/> is in the allowed range. /// </summary> /// <param name="param">A string that gives the name of the /// parameter to check.</param> /// <param name="arg">An integer that gives the value to check. /// </param> /// <param name="a">An integer that represents the smallest allowed /// value.</param> /// <param name="b">An integer that represents the greatest allowed /// value.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the <paramref name="arg"/> is outside /// the allowed range. /// </exception> internal void M_ArgumentInRange(string param, int arg, int a, int b) { if (a <= arg && arg <= b) return; throw new ArgumentOutOfRangeException(param, M_ValidValues(a, b)); } /// <summary> /// The protected method, that checks whether /// <paramref name="hour"/>, <paramref name="minute"/>, /// <paramref name="second"/>, and <parameref name="millisecond"/> /// are in their valid ranges /// </summary> /// <param name="hour">An integer that represents a hour, /// should be between 0 and 23.</param> /// <param name="minute">An integer that represents a minute, /// should be between 0 and 59.</param> /// <param name="second">An integer that represents a second, /// should be between 0 and 59.</param> /// <param name="milliseconds">An integer that represents a number /// of milliseconds, should be between 0 and 999999.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The Exception is thrown, if one of the parameter is outside the /// allowed the range. /// </exception> internal void M_CheckHMSM(int hour, int minute, int second, int milliseconds) { M_ArgumentInRange("hour", hour, 0, 23); M_ArgumentInRange("minute", minute, 0, 59); M_ArgumentInRange("second", second, 0, 59); M_ArgumentInRange("milliseconds", milliseconds, 0, 999999); } /// <value> /// A represantation of the CurrentEra. /// </value> public const int CurrentEra = 0; /// <value>When overridden gives the eras supported by the /// calendar as an array of integers. /// </value> public abstract int[] Eras { get; } [NonSerialized] bool m_isReadOnly; [System.Runtime.InteropServices.ComVisible(false)] public virtual CalendarAlgorithmType AlgorithmType { get { return CalendarAlgorithmType.Unknown; } } [System.Runtime.InteropServices.ComVisible(false)] public virtual DateTime MaxSupportedDateTime { get { return DateTime.MaxValue; } } [System.Runtime.InteropServices.ComVisible(false)] public virtual DateTime MinSupportedDateTime { get { return DateTime.MinValue; } } // LAMESPEC: huh, why not Calendar but Object? [ComVisible (false)] public virtual object Clone () { Calendar c = (Calendar) MemberwiseClone (); c.m_isReadOnly = false; return c; } [ComVisible (false)] public virtual int GetLeapMonth (int year) { return GetLeapMonth (year, GetEra (ToDateTime (year, 1, 1, 0, 0, 0, 0))); } [ComVisible (false)] public virtual int GetLeapMonth (int year, int era) { int max = GetMonthsInYear (year, era); for (int i = 1; i <= max; i++) if (IsLeapMonth (year, i, era)) return i; return 0; } [ComVisible (false)] public bool IsReadOnly { get { return m_isReadOnly; } } [ComVisible (false)] public static Calendar ReadOnly (Calendar calendar) { if (calendar.m_isReadOnly) return calendar; Calendar c = (Calendar) calendar.Clone (); c.m_isReadOnly = true; return c; } internal void CheckReadOnly () { if (m_isReadOnly) throw new InvalidOperationException ("This Calendar is read-only."); } /// <summary> /// The protected member stores the value for the /// <see cref="P:TwoDigitYearMax"/> /// property. /// </summary> [NonSerialized] internal int twoDigitYearMax; /// <summary> /// Private field containing the maximum year for the calendar. /// </summary> [NonSerialized] private int M_MaxYearValue = 0; /// <value> /// Get-only property returing the maximum allowed year for this /// class. /// </value> internal virtual int M_MaxYear { get { if (M_MaxYearValue == 0) { M_MaxYearValue = GetYear(DateTime.MaxValue); } return M_MaxYearValue; } } /// <summary> /// Checks whether the year is the era is valid, if era = CurrentEra /// the right value is set. /// </summary> /// <param name="year">The year to check.</param> /// <param name="era">The era to check.</Param> /// <exception cref="T:ArgumentOutOfRangeException"> /// The exception will be thrown, if the year is not valid. /// </exception> internal virtual void M_CheckYE(int year, ref int era) { // // By default, we do nothing. // // This used to be an abstract method in Mono's implementation, // but that means that end-user code could not create their // own calendars. // // Binaries would also crash in this condition. } /// <value> /// <para>The property gives the maximum value for years with two /// digits. If the property has the value 2029, than the two-digit /// integer 29 results in the year 2029 and 30 in the /// year 1930.</para> /// <para>It might be overridden.</para> /// </value> public virtual int TwoDigitYearMax { get { return twoDigitYearMax; } set { CheckReadOnly (); M_ArgumentInRange("year", value, 100, M_MaxYear); int era = CurrentEra; M_CheckYE(value, ref era); twoDigitYearMax = value; } } /// <summary> /// The virtual method adds days to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// days. /// </param> /// <param name="days">The number of days to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="days"/> to the specified /// DateTime.</returns> public virtual DateTime AddDays(DateTime time, int days) { return time.Add(TimeSpan.FromDays(days)); } /// <summary> /// The virtual method adds hours to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// hours. /// </param> /// <param name="hours">The number of hours to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="hours"/> to the specified /// DateTime.</returns> public virtual DateTime AddHours(DateTime time, int hours) { return time.Add(TimeSpan.FromHours(hours)); } /// <summary> /// The virtual method adds milliseconds to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// milliseconds. /// </param> /// <param name="milliseconds">The number of milliseconds given as /// double to add. Keep in mind the 100 nanosecond resolution of /// <see cref="T:System.DateTime"/>. /// </param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="milliseconds"/> to the specified /// DateTime.</returns> public virtual DateTime AddMilliseconds(DateTime time, double milliseconds) { return time.Add(TimeSpan.FromMilliseconds(milliseconds)); } /// <summary> /// The virtual method adds minutes to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// minutes. /// </param> /// <param name="minutes">The number of minutes to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="minutes"/> to the specified /// DateTime.</returns> public virtual DateTime AddMinutes(DateTime time, int minutes) { return time.Add(TimeSpan.FromMinutes(minutes)); } /// <summary> /// When overrideden adds months to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// months. /// </param> /// <param name="months">The number of months to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="months"/> to the specified /// DateTime.</returns> public abstract DateTime AddMonths(DateTime time, int months); /// <summary> /// The virtual method adds seconds to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// seconds. /// </param> /// <param name="seconds">The number of seconds to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="seconds"/> to the specified /// DateTime.</returns> public virtual DateTime AddSeconds(DateTime time, int seconds) { return time.Add(TimeSpan.FromSeconds(seconds)); } /// <summary> /// A wirtual method that adds weeks to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// weeks. /// </param> /// <param name="weeks">The number of weeks to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="weeks"/> to the specified /// DateTime.</returns> public virtual DateTime AddWeeks(DateTime time, int weeks) { return time.AddDays(weeks * M_DaysInWeek); } /// <summary> /// When overrideden adds years to a given date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> to which to add /// years. /// </param> /// <param name="years">The number of years to add.</param> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="years"/> to the specified /// DateTime.</returns> public abstract DateTime AddYears(DateTime time, int years); /// <summary> /// When overriden gets the day of the month from /// <paramref name="time"/>. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer giving the day of months, starting with 1. /// </returns> public abstract int GetDayOfMonth(DateTime time); /// <summary> /// When overriden gets the day of the week from the specified date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer giving the day of months, starting with 1. /// </returns> public abstract DayOfWeek GetDayOfWeek(DateTime time); /// <summary> /// When overridden gives the number of the day in the year. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer representing the day of the year, /// starting with 1.</returns> public abstract int GetDayOfYear(DateTime time); /// <summary> /// A virtual method that gives the number of days of the specified /// month of the <paramref name="year"/> and the /// <see cref="P:CurrentEra"/>. /// </summary> /// <param name="year">An integer that gives the year in the current /// era.</param> /// <param name="month">An integer that gives the month, starting /// with 1.</param> /// <returns>An integer that gives the number of days of the /// specified month.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if <paramref name="month"/> or /// <paramref name="year"/> is outside the allowed range. /// </exception> public virtual int GetDaysInMonth(int year, int month) { return GetDaysInMonth(year, month, CurrentEra); } /// <summary> /// When overridden gives the number of days in the specified month /// of the given year and era. /// </summary> /// <param name="year">An integer that gives the year. /// </param> /// <param name="month">An integer that gives the month, starting /// with 1.</param> /// <param name="era">An intger that gives the era of the specified /// year.</param> /// <returns>An integer that gives the number of days of the /// specified month.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if <paramref name="month"/>, /// <paramref name="year"/> ,or <paramref name="era"/> is outside /// the allowed range. /// </exception> public abstract int GetDaysInMonth(int year, int month, int era); /// <summary> /// A virtual method that gives the number of days of the specified /// year of the <see cref="P:CurrentEra"/>. /// </summary> /// <param name="year">An integer that gives the year in the current /// era.</param> /// <returns>An integer that gives the number of days of the /// specified year.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if /// <paramref name="year"/> is outside the allowed range. /// </exception> public virtual int GetDaysInYear(int year) { return GetDaysInYear(year, CurrentEra); } /// <summary> /// When overridden gives the number of days of the specified /// year of the given era.. /// </summary> /// <param name="year">An integer that specifies the year. /// </param> /// <param name="era">An ineger that specifies the era. /// </param> /// <returns>An integer that gives the number of days of the /// specified year.</returns> /// <exception cref="T:System.ArgumentOutOfRangeExceiption"> /// The exception is thrown, if /// <paramref name="year"/> is outside the allowed range. /// </exception> public abstract int GetDaysInYear(int year, int era); /// <summary> /// When overridden gives the era of the specified date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer representing the era of the calendar. /// </returns> public abstract int GetEra(DateTime time); /// <summary> /// Virtual method that gives the hour of the specified time. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies the /// time. /// </param> /// <returns>An integer that gives the hour of the specified time, /// starting with 0.</returns> public virtual int GetHour(DateTime time) { return time.TimeOfDay.Hours; } /// <summary> /// Virtual method that gives the milliseconds in the current second /// of the specified time. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies the /// time. /// </param> /// <returns>An integer that gives the milliseconds in the seconds /// of the specified time, starting with 0.</returns> public virtual double GetMilliseconds(DateTime time) { return time.TimeOfDay.Milliseconds; } /// <summary> /// Virtual method that gives the minute of the specified time. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies the /// time. /// </param> /// <returns>An integer that gives the minute of the specified time, /// starting with 0.</returns> public virtual int GetMinute(DateTime time) { return time.TimeOfDay.Minutes; } /// <summary> /// When overridden gives the number of the month of the specified /// date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer representing the month, /// starting with 1.</returns> public abstract int GetMonth(DateTime time); /// <summary> /// Virtual method that gives the number of months of the specified /// year of the <see cref="M:CurrentEra"/>. /// </summary> /// <param name="year">An integer that specifies the year in the /// current era. /// </param> /// <returns>An integer that gives the number of the months in the /// specified year.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year is not allowed in the /// current era. /// </exception> public virtual int GetMonthsInYear(int year) { return GetMonthsInYear(year, CurrentEra); } /// <summary> /// When overridden gives the number of months in the specified year /// and era. /// </summary> /// <param name="year">An integer that specifies the year. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>An integer that gives the number of the months in the /// specified year.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year or the era are not valid. /// </exception> public abstract int GetMonthsInYear(int year, int era); /// <summary> /// Virtual method that gives the second of the specified time. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies the /// time. /// </param> /// <returns>An integer that gives the second of the specified time, /// starting with 0.</returns> public virtual int GetSecond(DateTime time) { return time.TimeOfDay.Seconds; } /// <summary> /// A protected method to calculate the number of days between two /// dates. /// </summary> /// <param name="timeA">A <see cref="T:System.DateTime"/> /// representing the first date. /// </param> /// <param name="timeB">A <see cref="T:System.DateTime"/> /// representing the second date. /// </param> /// <returns>An integer that represents the difference of days /// between <paramref name="timeA"/> and <paramref name="timeB"/>. /// </returns> internal int M_DiffDays(DateTime timeA, DateTime timeB) { long diff = timeA.Ticks - timeB.Ticks; if (diff >= 0) { return (int)(diff/TimeSpan.TicksPerDay); } diff += 1; return -1 + (int)(diff/TimeSpan.TicksPerDay); } /// <summary> /// A protected method that gives the first day of the second week of /// the year. /// </summary> /// <param name="year">An integer that represents the year.</param> /// <param name="rule">The /// <see cref="T:System.Globalization.CalendarWeekRule"/> /// to be used for the calculation. /// </param> /// <param name="firstDayOfWeek"> /// The <see cref="T:System.Globalization.DayOfWeek"/> /// specifying the first day in a week. /// </param> /// <returns>The <see cref="T:System.DateTime"/> representing /// the first day of the second week of the year. /// </returns> internal DateTime M_GetFirstDayOfSecondWeekOfYear( int year, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { DateTime d1 = ToDateTime(year, 1, 1, 0, 0, 0, 0); int dow1 = (int)GetDayOfWeek(d1); int fdow = (int)firstDayOfWeek; int d = 0; switch (rule) { case CalendarWeekRule.FirstDay: if (fdow > dow1) { d += fdow - dow1; } else { d += fdow + M_DaysInWeek - dow1; } break; case CalendarWeekRule.FirstFullWeek: d = M_DaysInWeek; if (fdow >= dow1) { d += fdow - dow1; } else { d += fdow + M_DaysInWeek - dow1; } break; case CalendarWeekRule.FirstFourDayWeek: int dow4 = (dow1 + 3)%M_DaysInWeek; d = 3; if (fdow > dow4) { d += fdow - dow4; } else { d += fdow + M_DaysInWeek - dow4; } break; } return AddDays(d1, d); } /// <summary> /// A virtual method that gives the number of the week in the year. /// </summary> /// <param name="time">A /// <see cref="T:System.DateTime"/> representing the date. /// </param> /// <param name="rule">The /// <see cref="T:System.Globalization.CalendarWeekRule"/> /// to be used for the calculation. /// </param> /// <param name="firstDayOfWeek"> /// The <see cref="T:System.Globalization.DayOfWeek"/> /// specifying the first day in a week. /// </param> /// <returns>An integer representing the number of the week in the /// year, starting with 1. /// </returns> public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek) { if (firstDayOfWeek < DayOfWeek.Sunday || DayOfWeek.Saturday < firstDayOfWeek) { throw new ArgumentOutOfRangeException("firstDayOfWeek", "Value is not a valid day of week."); } int year = GetYear(time); int days; while (true) { DateTime secondWeek = M_GetFirstDayOfSecondWeekOfYear( year, rule, firstDayOfWeek); days = M_DiffDays(time, secondWeek) + M_DaysInWeek; if (days >= 0) break; year -= 1; } return 1 + days/M_DaysInWeek; } /// <summary> /// When overridden gives the number of the year of the specified /// date. /// </summary> /// <param name="time">The /// <see cref="T:System.DateTime"/> that specifies a /// date. /// </param> /// <returns>An integer representing the year, /// starting with 1.</returns> public abstract int GetYear(DateTime time); /// <summary> /// A virtual method that tells whether the given day in the /// <see cref="M:CurrentEra"/> is a leap day. /// </summary> /// <param name="year">An integer that specifies the year in the /// current era. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <param name="day">An integer that specifies the day. /// </param> /// <returns>A boolean that tells whether the given day is a leap /// day. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year, month or day is not valid /// the current era. /// </exception> public virtual bool IsLeapDay(int year, int month, int day) { return IsLeapDay(year, month, day, CurrentEra); } /// <summary> /// Tells when overridden whether the given day /// is a leap day. /// </summary> /// <param name="year">An integer that specifies the year in the /// given era. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <param name="day">An integer that specifies the day. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>A boolean that tells whether the given day is a leap /// day. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year, month, day, or era is not /// valid. /// </exception> public abstract bool IsLeapDay(int year, int month, int day, int era); /// <summary> /// A virtual method that tells whether the given month of the /// specified year in the /// <see cref="M:CurrentEra"/> is a leap month. /// </summary> /// <param name="year">An integer that specifies the year in the /// current era. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <returns>A boolean that tells whether the given month is a leap /// month. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year or month is not valid /// the current era. /// </exception> public virtual bool IsLeapMonth(int year, int month) { return IsLeapMonth(year, month, CurrentEra); } /// <summary> /// Tells when overridden whether the given month /// is a leap month. /// </summary> /// <param name="year">An integer that specifies the year in the /// given era. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>A boolean that tells whether the given month is a leap /// month. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year, month, or era is not /// valid. /// </exception> public abstract bool IsLeapMonth(int year, int month, int era); /// <summary> /// A virtual method that tells whether the given year /// in the /// <see cref="M:CurrentEra"/> is a leap year. /// </summary> /// <param name="year">An integer that specifies the year in the /// current era. /// </param> /// <returns>A boolean that tells whether the given year is a leap /// year. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year is not valid /// the current era. /// </exception> public virtual bool IsLeapYear(int year) { return IsLeapYear(year, CurrentEra); } /// <summary> /// Tells when overridden whether the given year /// is a leap year. /// </summary> /// <param name="year">An integer that specifies the year in the /// given era. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>A boolean that tells whether the given year is a leap /// year. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year or era is not /// valid. /// </exception> public abstract bool IsLeapYear(int year, int era); /// <summary> /// A virtual method that creates the /// <see cref="T:System.DateTime"/> from the parameters. /// </summary> /// <param name="year">An integer that gives the year in the /// <see cref="M:CurrentEra"/>. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <param name="day">An integer that specifies the day. /// </param> /// <param name="hour">An integer that specifies the hour. /// </param> /// <param name="minute">An integer that specifies the minute. /// </param> /// <param name="second">An integer that gives the second. /// </param> /// <param name="milliseconds">An integer that gives the /// milliseconds. /// </param> /// <returns>A /// <see cref="T:system.DateTime"/> representig the date and time. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if at least one of the parameters /// is out of range. /// </exception> public virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { return ToDateTime (year, month, day, hour, minute, second, millisecond, CurrentEra); } /// <summary> /// When overridden creates the /// <see cref="T:System.DateTime"/> from the parameters. /// </summary> /// <param name="year">An integer that gives the year in the /// <paramref name="era"/>. /// </param> /// <param name="month">An integer that specifies the month. /// </param> /// <param name="day">An integer that specifies the day. /// </param> /// <param name="hour">An integer that specifies the hour. /// </param> /// <param name="minute">An integer that specifies the minute. /// </param> /// <param name="second">An integer that gives the second. /// </param> /// <param name="milliseconds">An integer that gives the /// milliseconds. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>A /// <see cref="T:system.DateTime"/> representig the date and time. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if at least one of the parameters /// is out of range. /// </exception> public abstract DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era); /// <summary> /// A virtual method that converts a two-digit year to a four-digit /// year. It uses the <see cref="M:TwoDigitYearMax"/> property. /// </summary> /// <param name="year">An integer that gives the two-digit year. /// </param> /// <returns>An integer giving the four digit year. /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown if the year is negative or the resulting /// year is invalid. /// </exception> public virtual int ToFourDigitYear(int year) { if (year < 0) throw new ArgumentOutOfRangeException( "year", "Non-negative number required."); /* seems not to be the right thing to do, but .NET is * doing it this way. */ if (year <= 99) { int year2 = TwoDigitYearMax%100; int d = year - year2; year = TwoDigitYearMax + d + (d <= 0 ? 0 : -100); } int era = CurrentEra; M_CheckYE(year, ref era); return year; } // TwoDigitYearMax: Windows reads it from the Registry, we // should have an XML file with the defaults /// <summary> /// The default constructor, is sets the TwoDigitYearMax to 2029. /// </summary> /// <remarks> /// The .NET framework reads the value from the registry. /// We should implement it here. Currently I set the default values /// in the ctors of the derived classes, if it is 99. /// </remarks> protected Calendar() { twoDigitYearMax = 99; } /// <summary>Protected field storing the abbreviated era names. /// </summary> [NonSerialized] internal string[] M_AbbrEraNames; /// <summary>Protected field storing the era names. /// </summary> [NonSerialized] internal string[] M_EraNames; /// <value> /// The property stores the era names. It might be overwritten by /// CultureInfo. /// </value> internal string[] AbbreviatedEraNames { get { if (M_AbbrEraNames == null || M_AbbrEraNames.Length != Eras.Length) throw new Exception( "Internal: M_AbbrEraNames " + "wrong initialized!"); return (string[])M_AbbrEraNames.Clone(); } set { CheckReadOnly (); if (value.Length != Eras.Length) { StringWriter sw = new StringWriter(); sw.Write("Array length must be equal Eras " + "length {0}.", Eras.Length); throw new ArgumentException( sw.ToString()); } M_AbbrEraNames = (string[])value.Clone(); } } /// <value> /// The property stores the era names. It might be overwritten by /// CultureInfo. /// </value> internal string[] EraNames { get { if (M_EraNames == null || M_EraNames.Length != Eras.Length) throw new Exception ("Internal: M_EraNames not initialized!"); return M_EraNames; } set { CheckReadOnly (); if (value.Length != Eras.Length) { StringWriter sw = new StringWriter(); sw.Write("Array length must be equal Eras " + "length {0}.", Eras.Length); throw new ArgumentException( sw.ToString()); } M_EraNames = (string[])value.Clone(); } } #pragma warning disable 649 internal int m_currentEraValue; // Unused, by MS serializes this #pragma warning restore 649 #if NET_4_5 protected virtual int DaysInYearBeforeMinSupportedYear { get{ return 365; } } #endif } }
31.235351
75
0.667241
[ "Apache-2.0" ]
3-1415926/mono
mcs/class/corlib/System.Globalization/Calendar.cs
32,516
C#
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Management.WebSites.Models { /// <summary> /// Defines values for InAvailabilityReasonType. /// </summary> public static class InAvailabilityReasonType { public const string Invalid = "Invalid"; public const string AlreadyExists = "AlreadyExists"; } }
29.217391
74
0.71131
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/InAvailabilityReasonType.cs
672
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("CodeReformat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CodeReformat")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4bdb4d52-1b5a-4bd5-9ad8-90db2acd42a7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.756757
84
0.745168
[ "MIT" ]
KrasimirStoyanov/Telerik-Academy
Homeworks/C# 1/Intro-Programming-Homework/7.CodeReformat/CodeReformat/Properties/AssemblyInfo.cs
1,400
C#
using FluentAssertions; using Xunit; namespace SimpleValidatorBuilder.Tests.Parser; public class ValueIsGreaterThanOrEqualTests { [Fact] public void With_equal_value() { // Arrange const int minValue = 12; const string error = "error"; Validator<int, string> sut = Validate.That<int, string>() .ValueIsGreaterThanOrEqual(minValue, () => error); // Act var result = sut.Validate(minValue); // Assert result.IsSuccess.Should().BeTrue(); result.Value.Should().Be(minValue); } [Fact] public void With_smaller_value() { // Arrange const int minValue = 12; var testValue = minValue - 1; const string error = "error"; Validator<int, string> sut = Validate.That<int, string>() .ValueIsGreaterThanOrEqual(minValue, () => error); // Act var result = sut.Validate(testValue); // Assert result.IsFailure.Should().BeTrue(); result.Error.Should().Be(error); } }
23.688889
65
0.590056
[ "MIT" ]
gagnedavid25/SimpleValidatorBuilder
src/SimpleValidatorBuilder.Tests/Parser/ValueIsGreaterThanOrEqualTests.cs
1,068
C#
using Microsoft.Maui.Graphics; using Microsoft.Maui.Primitives; namespace Microsoft.Maui.UnitTests { class ViewStub : IViewStub { public bool IsEnabled { get; set; } public Visibility Visibility { get; set; } public double Opacity { get; set; } public Rectangle Frame { get; set; } public IViewHandler Handler { get; set; } public IFrameworkElement Parent { get; set; } public Size DesiredSize { get; set; } public bool IsMeasureValid { get; set; } public bool IsArrangeValid { get; set; } public double Width { get; set; } public double Height { get; set; } public Thickness Margin { get; set; } public string AutomationId { get; set; } public FlowDirection FlowDirection { get; set; } public LayoutAlignment HorizontalLayoutAlignment { get; set; } public LayoutAlignment VerticalLayoutAlignment { get; set; } public Semantics Semantics { get; set; } public Paint Background { get; set; } public double TranslationX { get; set; } public double TranslationY { get; set; } public double Scale { get; set; } public double ScaleX { get; set; } public double ScaleY { get; set; } public double Rotation { get; set; } public double RotationX { get; set; } public double RotationY { get; set; } public double AnchorX { get; set; } public double AnchorY { get; set; } public Size Arrange(Rectangle bounds) => Size.Zero; public void InvalidateArrange() { } public void InvalidateMeasure() { } public Size Measure(double widthConstraint, double heightConstraint) => Size.Zero; } }
21.547945
73
0.694215
[ "MIT" ]
IgorPRZ/maui
src/Core/tests/UnitTests/TestClasses/ViewStub.cs
1,573
C#
#region License // Copyright (c) 2018-2021, exomia // All rights reserved. // // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. #endregion #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member // ReSharper disable UnusedMember.Global // ReSharper disable InconsistentNaming // ReSharper disable once CheckNamespace namespace Exomia.Vulkan.Api.Core { public enum VkPipelineCacheHeaderVersion { ONE = 1, MAX_ENUM = 0x7FFFFFFF } }
23.44
89
0.730375
[ "BSD-3-Clause" ]
exomia/vulkan-api
src/Exomia.Vulkan.Api.Core/Enums/VkPipelineCacheHeaderVersion.cs
588
C#
using System.Drawing; namespace DayGame { public class ConsumableItem : Item { public ConsumableItem(int id, string name, string description, Image image, int price) : base(id, name, description, image, price) { } } }
21.333333
138
0.640625
[ "MIT" ]
YorgosBas/DayGame
Source/Item/Consumable/ConsumableItem.cs
258
C#
/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/openiddict/openiddict-core for more information concerning * the license and the contributors participating to this project. */ using System.ComponentModel; using Microsoft.AspNetCore; using Microsoft.Extensions.Options; namespace OpenIddict.Server.AspNetCore; /// <summary> /// Contains a collection of event handler filters commonly used by the ASP.NET Core handlers. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] public static class OpenIddictServerAspNetCoreHandlerFilters { /// <summary> /// Represents a filter that excludes the associated handlers if authorization request caching was not enabled. /// </summary> public class RequireAuthorizationRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireAuthorizationRequestCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableAuthorizationRequestCaching); } /// <summary> /// Represents a filter that excludes the associated handlers if the /// pass-through mode was not enabled for the authorization endpoint. /// </summary> public class RequireAuthorizationEndpointPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireAuthorizationEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableAuthorizationEndpointPassthrough); } /// <summary> /// Represents a filter that excludes the associated handlers if error pass-through was not enabled. /// </summary> public class RequireErrorPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireErrorPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableErrorPassthrough); } /// <summary> /// Represents a filter that excludes the associated handlers if no ASP.NET Core request can be found. /// </summary> public class RequireHttpRequest : IOpenIddictServerHandlerFilter<BaseContext> { public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(context.Transaction.GetHttpRequest() is not null); } /// <summary> /// Represents a filter that excludes the associated handlers if logout request caching was not enabled. /// </summary> public class RequireLogoutRequestCachingEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireLogoutRequestCachingEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableLogoutRequestCaching); } /// <summary> /// Represents a filter that excludes the associated handlers if the /// pass-through mode was not enabled for the logout endpoint. /// </summary> public class RequireLogoutEndpointPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireLogoutEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableLogoutEndpointPassthrough); } /// <summary> /// Represents a filter that excludes the associated handlers if status code pages support was not enabled. /// </summary> public class RequireStatusCodePagesIntegrationEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireStatusCodePagesIntegrationEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableStatusCodePagesIntegration); } /// <summary> /// Represents a filter that excludes the associated handlers if the HTTPS requirement was disabled. /// </summary> public class RequireTransportSecurityRequirementEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireTransportSecurityRequirementEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(!_options.CurrentValue.DisableTransportSecurityRequirement); } /// <summary> /// Represents a filter that excludes the associated handlers if the /// pass-through mode was not enabled for the authorization endpoint. /// </summary> public class RequireTokenEndpointPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireTokenEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableTokenEndpointPassthrough); } /// <summary> /// Represents a filter that excludes the associated handlers if the /// pass-through mode was not enabled for the userinfo endpoint. /// </summary> public class RequireUserinfoEndpointPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireUserinfoEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableUserinfoEndpointPassthrough); } /// <summary> /// Represents a filter that excludes the associated handlers if the /// pass-through mode was not enabled for the verification endpoint. /// </summary> public class RequireVerificationEndpointPassthroughEnabled : IOpenIddictServerHandlerFilter<BaseContext> { private readonly IOptionsMonitor<OpenIddictServerAspNetCoreOptions> _options; public RequireVerificationEndpointPassthroughEnabled(IOptionsMonitor<OpenIddictServerAspNetCoreOptions> options!!) => _options = options; public ValueTask<bool> IsActiveAsync(BaseContext context!!) => new(_options.CurrentValue.EnableVerificationEndpointPassthrough); } }
44.242775
123
0.743402
[ "Apache-2.0" ]
Thodor12/openiddict-core
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandlerFilters.cs
7,656
C#
using System; using System.Globalization; using System.IO; using System.Linq; using System.Text; namespace ScriptPad { public class DelegateTextWriter : TextWriter { private readonly Action<string> appendTextAction; public DelegateTextWriter(Action<string> appendTextAction) : base(CultureInfo.CurrentCulture) { this.appendTextAction = appendTextAction; } public override Encoding Encoding => Encoding.UTF8; public override void Write(char value) { appendTextAction(value.ToString()); } public override void Write(char[] buffer, int index, int count) { if (index != 0 || count != buffer.Length) { buffer = buffer.Skip(index).Take(count).ToArray(); } appendTextAction(new string(buffer)); } public override void Write(string value) { appendTextAction(value); } public override object InitializeLifetimeService() { return null; } } }
24.977273
101
0.591447
[ "MIT" ]
kongdetuo/RevitTools
src/ScriptPad/DelegateTextWriter.cs
1,101
C#
using UnityEngine; // Controls ships, parent class to all ship types public abstract partial class Ship { // GameObjects and Components public GameObject ShipObject { get; protected set; } protected GameObject ShipObjectPrefab; protected Rigidbody ShipRigidbody; // Engine Objects protected GameObject[] ImpulseEngineObjects; protected GameObject[] WarpEngineObjects; protected ParticleSystem[] ImpulseParticleSystems; protected ParticleSystem[] WarpParticleSystems; protected ParticleSystem.MainModule[] ImpulseParticleSystemMains; protected ParticleSystem.MainModule[] WarpParticleSystemMains; protected AudioSource[] ImpulseAudioSources; protected AudioSource[] WarpAudioSources; // Gun Objects protected GameObject[] GunBarrelObjects; protected GameObject[] GunBarrelLightsObjects; protected AudioSource[] GunAudioSources; // Shield Object protected AudioSource ShieldRegenAudio; // Particle Objects protected GameObject ProjectileShieldStrikePrefab; protected GameObject ProjectileHullStrikePrefab; protected GameObject ProjectileShieldStrike; protected GameObject ProjectileHullStrike; protected GameObject ExplosionPrefab; protected GameObject Explosion; protected GameObject ElectricityEffectPrefab; protected GameObject ElectricityEffect; // Inputs protected Float2 MoveInput = new Float2(); protected Float2 AimInput = new Float2(); protected bool WarpEngineInput = false; protected bool MainGunInput = false; protected bool[] AbilityInput = new bool[3]; public bool PauseInput = false; // AI-only Inputs protected bool ImpulseInput = false; protected bool StrafeInput = false; // Rotation fields protected Vector3 StartingPosition = new Vector3(); protected Vector3 CurrentRotationForwardVector = new Vector3(); protected Vector3 NextRotationForwardVector = new Vector3(); protected Quaternion IntendedRotation = new Quaternion(); protected Quaternion CurrentRotation = new Quaternion(); protected Quaternion NextRotation = new Quaternion(); protected Quaternion TiltRotation = new Quaternion(); protected float CurrentRotationAngle = 0f; protected float NextRotationAngle = 0f; protected int RecentRotationsIndex = 0; protected static int RecentRotationsIndexMax = 30; protected float[] RecentRotations = new float[RecentRotationsIndexMax]; protected float RecentRotationsAverage = 0f; protected float TiltAngle = 0f; protected float IntendedAngle = 0f; // Cooldown times protected float LastGunFireTime = 0f; protected float LastDamageTakenTime = 0f; protected float[] LastAbilityActivatedTime = new float[3]; public float[] LastAbilityCooldownStartedTime { get; protected set; } = new float[3]; // On cooldown bools protected bool GunOnCooldown = false; protected bool ShieldOnCooldown = false; public bool[] AbilityOnCooldown { get; protected set; } = new bool[3]; public bool[] AbilityActive { get; protected set; } = new bool[3]; public class ShipStats { // Ship stats // --Health/Armor/Shields public float Health; // Current health value public float MaxHealth; // Maximum health value public float Armor; // Divide by 100 and apply percent as damage reduction modifier to ship to ship impact damage public float Shields; // Current shield value public float MaxShields; // Maximum shield value public float ShieldRegenSpeed; // Amount of shield to regenerate per game tick // --Current/Max energy public float Energy; // Current energy value public float MaxEnergy; // Maximum energy value public float EnergyRegenSpeed; // Amount of energy to regenerate per game tick // --Energy costs public float WarpEnergyCost; // Energy cost per tick applied by using warp engine public float GunEnergyCost; // Energy cost per main gun shot fired (doesn't apply multiple times for multi cannon or multi shot ships) // --Acceleration public uint EngineCount; // Number of engines on ship (used only for visual FX for thruster fire) public float ImpulseAcceleration; // The amount of acceleration to apply per game tick when impulse engine is on public float WarpAccelerationMultiplier; // Impulse acceleration is multiplied by this value while warp engine is on public float StrafeAcceleration; // The amount of acceleration to apply per game tick while strafe is ongoing (strafe is NPC only) // --Max Speed public float MaxImpulseSpeed; // Maximum velocity for impulse engines public float MaxWarpSpeed; // Maximum velocity for warp engines public float MaxStrafeSpeed; // Maximum velocity for strafing (strafe is NPC only) public float MaxRotationSpeed; // Maximum rotation amount per tick for ships // --Weapon stats // ----Main gun public uint GunBarrelCount; // Number of gun barrels from which to spawn projectiles public uint GunShotProjectileType; // Visual FX identifier for projectiles (references projectile prefab numbering system) public float GunCooldownTime; // How long in seconds to wait between each shot fired from main gun public uint GunShotAmount; // Amount of projectiles to spawn from each gun barrel public float GunShotCurvature; // Maximum rotation per game tick that projectiles can turn when homing on target (values of 0 produce no homing effect) public float GunShotSightCone; // Value describing the sight cone within which projectiles can acquire target if they have a curvature above 0 (-1 is full 360°, 0 is 180°, 1 is 0° cone) public float GunShotDamage; // Amount of damage each projectile inflicts on target collided with public float GunShotAccuracy; // Divide by 100 and use value to determine the maximum degree change that can be randomly assigned each fired projectile (5 means projectile can be ±5° from straight forward) public float GunShotSpeed; // Maximum velocity of fired projectile public float GunShotLifetime; // Number of seconds projectile lasts before burning out // --Cooldowns public float ShieldCooldownTime; // How long in seconds the regenerating shield must go without taking damage before it will recharge public float[] AbilityDuration = new float[3]; public float[] AbilityCooldownTime = new float[3]; } public ShipStats Stats { get; protected set; } // Defaults for ability changes protected float DefaultGunCooldownTime = 0f; protected uint DefaultGunShotAmount = 0; protected float DefaultGunShotDamage = 0f; protected float DefaultGunShotAccuracy = 0f; protected float DefaultGunEnergyCost = 0f; protected float DefaultEnergyRegenSpeed = 0f; protected float DefaultShieldRegenSpeed = 0f; protected float DefaultShieldCooldownTime = 0f; protected float DefaultMaxRotationSpeed = 0f; protected float DefaultMaxImpulseSpeed = 0f; protected float DefaultMaxStrafeSpeed = 0f; // Status effects protected bool IsEMPed = false; protected bool IsEMPApplied = false; protected float EMPEffectDuration = 0f; protected float EMPStartedTime = 0f; // --Experience worth public uint XP { get; protected set; } = 0; // AI fields public enum AIType { None, Drone, Standard, Ramming, Broadside, Flanker } public AIType AItype { get; protected set; } public Ship CurrentTarget { get; protected set; } public bool AIAimAssist { get; protected set; } public float MaxTargetAcquisitionRange { get; protected set; } public float MaxOrbitRange { get; protected set; } public float MaxWeaponsRange { get; protected set; } public float MaxAbilityRange { get; protected set; } public bool StrafeRight { get; protected set; } public bool ResetStrafeDirection { get; protected set; } public bool ShouldWander { get; protected set; } public bool IsWaiting { get; protected set; } public float StartedWaitingTime { get; protected set; } public float TimeToWait { get; protected set; } public bool IsWanderMove { get; protected set; } public float StartedWanderMoveTime { get; protected set; } public float TimeToWanderMove { get; protected set; } public Ship Parent { get; protected set; } public float MaxLeashDistance { get; protected set; } public float OrbitParentRange { get; protected set; } public bool CanFollowParent { get; protected set; } public bool CanAcquireTargets { get; protected set; } public bool CanAccelerate { get; protected set; } public bool CanStrafe { get; protected set; } public bool CanFireGuns { get; protected set; } public bool CanUseAbilities { get; protected set; } // Identification fields public uint ID { get; protected set; } public GameController.IFF IFF { get; protected set; } public bool Alive { get; protected set; } public bool IsPlayer { get; protected set; } // Constants public const float ImpulseEngineAudioStep = 0.05f; public const float ImpulseEngineAudioMinVol = 0.25f; public const float ImpulseEngineAudioMaxVol = 1f; public const float WarpEngineAudioStep = 0.05f; public const float WarpEngineAudioMinVol = 0f; public const float WarpEngineAudioMaxVol = 1f; // Shader constants public const float DamageShaderCooldownTime = 0.5f; // Initialize public virtual void Initialize() { // Set up universal ship fields this.ShipObject.name = $@"{this.ID}"; this.ShipRigidbody = this.ShipObject.GetComponent<Rigidbody>(); this.GetEngineObjects(); this.GetGunBarrelObjects(); this.GetParticleFXObjects(); this.SetupShipDefaultValues(); // Player specific values if(this.IsPlayer == true) { this.ShieldRegenAudio = this.ShipObject.transform.Find(GameController.ShieldObjectName).GetComponent<AudioSource>(); } // NPC specific values else { this.SetupAI(); } } // Update is called once per frame public void Update() { // If ship is alive if(this.Alive == true) { // Process inputs this.ProcessInputs(); // Check health status this.CheckHealth(); // Check Buff/Debuff status this.CheckStatusEffects(); } } // Fixed Update is called a fixed number of times per second, Physics updates should be done in FixedUpdate public void FixedUpdate() { // If ship is alive if(this.Alive == true) { // Update ship state this.UpdateShipState(); } } // Processes inputs protected virtual void ProcessInputs() { this.ProcessAI(); } // Check health protected void CheckHealth() { // If damage shader has been playing long enough if(Time.time - this.LastDamageTakenTime >= DamageShaderCooldownTime) { // Turn off damage shader this.ShowDamageShaderEffect(false); } // If health is less than or equal to half if(this.Stats.Health <= this.Stats.MaxHealth * 0.5f) { // Spawn fire fx on ship this.SpawnFireParticleFX(); // If this is player ship if(this.IsPlayer == true) { // Show damage vignette UIController.ShowHealthDamageEffect(); } } // If health has reached 0 if(this.Stats.Health <= 0f) { this.Stats.Shields = 0f; this.Stats.Health = 0f; // Kill ship this.Kill(); } } // Check effect status protected void CheckStatusEffects() { // If ship is hit by EMP and EMP effect has not been applied yet if(this.IsEMPed == true && this.IsEMPApplied == false) { this.EMPStartedTime = Time.time; this.DefaultEnergyRegenSpeed = this.Stats.EnergyRegenSpeed; this.DefaultShieldRegenSpeed = this.Stats.ShieldRegenSpeed; this.DefaultMaxRotationSpeed = this.Stats.MaxRotationSpeed; this.DefaultMaxImpulseSpeed = this.Stats.MaxImpulseSpeed; this.DefaultMaxStrafeSpeed = this.Stats.MaxStrafeSpeed; this.DefaultGunCooldownTime = this.Stats.GunCooldownTime; this.Stats.EnergyRegenSpeed = 0f; this.Stats.ShieldRegenSpeed = 0f; this.Stats.MaxRotationSpeed = 0f; this.Stats.MaxImpulseSpeed = 0f; this.Stats.MaxStrafeSpeed = 0f; this.Stats.GunCooldownTime = 10f; this.Stats.Energy = 0f; this.Stats.Shields = 0f; this.ElectricityEffect = GameObject.Instantiate(this.ElectricityEffectPrefab, this.ShipObject.transform.position, Quaternion.identity, this.ShipObject.transform); GameObject.Destroy(this.ElectricityEffect, this.EMPEffectDuration); this.IsEMPApplied = true; } // If ship is hit by EMP and EMP has already been applied and it has been longer than EMP effect duration since EMP effect was applied else if(this.IsEMPed == true && this.IsEMPApplied == true && Time.time - this.EMPStartedTime >= this.EMPEffectDuration) { this.IsEMPed = false; this.IsEMPApplied = false; this.Stats.EnergyRegenSpeed = this.DefaultEnergyRegenSpeed; this.Stats.ShieldRegenSpeed = this.DefaultShieldRegenSpeed; this.Stats.MaxRotationSpeed = this.DefaultMaxRotationSpeed; this.Stats.MaxImpulseSpeed = this.DefaultMaxImpulseSpeed; this.Stats.MaxStrafeSpeed = this.DefaultMaxStrafeSpeed; this.Stats.GunCooldownTime = this.DefaultGunCooldownTime; } } // Updates the state of the ship, turning, accelerating, using weapons etc. protected void UpdateShipState() { this.EnergyRegen(); this.ShieldRegen(); this.RotateShip(); this.AccelerateShip(); this.StrafeShip(); this.CheckAbilities(); this.Wander(); this.FollowParent(); } // Regenerates energy protected void EnergyRegen() { // Prevent energy from going below 0 if(this.Stats.Energy < 0f) { this.Stats.Energy = 0f; } // If energy is below maximum if(this.Stats.Energy < this.Stats.MaxEnergy) { // Add energy regen this.Stats.Energy += this.Stats.EnergyRegenSpeed; } // Prevent energy from going over maximum if(this.Stats.Energy > this.Stats.MaxEnergy) { this.Stats.Energy = this.Stats.MaxEnergy; } } // Regenerates shield protected void ShieldRegen() { // If time since last taken damage was more than shield cooldown time if(Time.time - this.LastDamageTakenTime >= this.Stats.ShieldCooldownTime) { // Take shield off cooldown this.ShieldOnCooldown = false; } // If shield is not on cooldown and shields are less than maximum if(this.ShieldOnCooldown == false && this.Stats.Shields < this.Stats.MaxShields) { // Remove energy for regenerating shield this.SubtractEnergy(Mathf.Min(this.Stats.MaxShields - this.Stats.Shields, this.Stats.ShieldRegenSpeed)); // Add shield regen speed to shields this.Stats.Shields += this.Stats.ShieldRegenSpeed; // If this is player and shield regen audio is not currently playing if(this.IsPlayer == true && this.ShieldRegenAudio.isPlaying == false) { // Set shield regen audio to max volume this.ShieldRegenAudio.volume = 1f; // Play shield regen audio this.ShieldRegenAudio.Play(); } } // If shields are greater than max if(this.Stats.Shields > this.Stats.MaxShields) { // Set shields to max value this.Stats.Shields = this.Stats.MaxShields; // If this is player and shield regen audio is playing if(this.IsPlayer == true && this.ShieldRegenAudio.isPlaying == true) { // Fade out shield regen audio AudioController.FadeOut(this.ShieldRegenAudio, 0.25f, 0); } } } // Rotates the ship protected void RotateShip() { this.GetIntendedRotation(); this.TurnShip(); this.LeanShip(); } // Gets intended rotation protected virtual void GetIntendedRotation() { this.GetIntendedRotationAI(); } // Turns the ship protected void TurnShip() { // Get current rotation this.CurrentRotation = this.ShipObject.transform.rotation; // Get next rotation by using intended rotation and max rotation speed this.NextRotation = Quaternion.Lerp(this.CurrentRotation, this.IntendedRotation, this.Stats.MaxRotationSpeed); // Rotate to next rotation this.ShipObject.transform.rotation = this.NextRotation; } // Lean the ship during turns protected void LeanShip() { // Get forward vector for each rotation this.CurrentRotationForwardVector = this.CurrentRotation * Vector3.forward; this.NextRotationForwardVector = this.NextRotation * Vector3.forward; // Get a numeric angle for each vector on the X-Z plane this.CurrentRotationAngle = Mathf.Atan2(this.CurrentRotationForwardVector.x, this.CurrentRotationForwardVector.z) * Mathf.Rad2Deg; this.NextRotationAngle = Mathf.Atan2(this.NextRotationForwardVector.x, this.NextRotationForwardVector.z) * Mathf.Rad2Deg; // Store recent rotation amount to be used for leaning ship this.RecentRotations[this.RecentRotationsIndex] = Mathf.DeltaAngle(this.CurrentRotationAngle, this.NextRotationAngle); // Go to next recent rotation index this.RecentRotationsIndex++; // If recent rotation index has hit the end of the array, go back to the start if(this.RecentRotationsIndex == RecentRotationsIndexMax) { this.RecentRotationsIndex = 0; } // Reset recent rotations average this.RecentRotationsAverage = 0; // Loop through recent rotations and add them together for(int i = 0; i < RecentRotationsIndexMax; i++) { this.RecentRotationsAverage += this.RecentRotations[i]; } // Divide recent rotations by max index to get average this.RecentRotationsAverage /= RecentRotationsIndexMax; // Get current rotation this.CurrentRotation = this.ShipObject.transform.rotation; // Amplify tilt angle by average multiplied by some amount this.TiltAngle = -(this.RecentRotationsAverage * 5f); // Get next tilt rotation this.TiltRotation = Quaternion.Euler(0f, this.CurrentRotation.eulerAngles.y, this.TiltAngle); // Rotate ship to new tilt rotation this.ShipObject.transform.rotation = this.TiltRotation; } // Accelerates the ship protected virtual void AccelerateShip() { // If impulse engine is activated by player input or AI and warp engine is not activated if(this.ImpulseInput == true && this.WarpEngineInput == false) { // Accelerate forward this.ShipRigidbody.AddRelativeForce(new Vector3(0f, 0f, this.Stats.ImpulseAcceleration)); // If current magnitude of velocity is beyond speed limit for impulse power if(this.ShipRigidbody.velocity.magnitude > this.Stats.MaxImpulseSpeed) { // Linearly interpolate velocity toward speed limit this.ShipRigidbody.velocity = Vector3.Lerp(this.ShipRigidbody.velocity, Vector3.ClampMagnitude(this.ShipRigidbody.velocity, this.Stats.MaxImpulseSpeed), 0.05f); } // Loop through engines for(int i = 0; i < this.Stats.EngineCount; i++) { // Modify particle fx this.ImpulseParticleSystemMains[i].startSpeed = 2.8f; // Audio fadein AudioController.FadeIn(this.ImpulseAudioSources[i], ImpulseEngineAudioStep, ImpulseEngineAudioMaxVol); // If this is player if(this.IsPlayer == true) { // Modify warp particle fx this.WarpParticleSystemMains[i].startLifetime = 0f; // Warp audio fadeout AudioController.FadeOut(this.WarpAudioSources[i], WarpEngineAudioStep, WarpEngineAudioMinVol); } } } // If warp engine is activated by player input or AI else if(this.WarpEngineInput == true) { // Accelerate forward with warp multiplier to speed this.ShipRigidbody.AddRelativeForce(new Vector3(0f, 0f, this.Stats.ImpulseAcceleration * this.Stats.WarpAccelerationMultiplier)); // Clamp magnitude at maximum warp speed this.ShipRigidbody.velocity = Vector3.ClampMagnitude(this.ShipRigidbody.velocity, this.Stats.MaxWarpSpeed); // Subtract warp energy cost this.SubtractEnergy(this.Stats.WarpEnergyCost); // Loop through engines for(int i = 0; i < this.Stats.EngineCount; i++) { // Modify particle fx this.ImpulseParticleSystemMains[i].startSpeed = 5f; // Audio fadeout AudioController.FadeOut(this.ImpulseAudioSources[i], ImpulseEngineAudioStep, ImpulseEngineAudioMinVol); // If this is player if(this.IsPlayer == true) { // Modify warp particle fx this.WarpParticleSystemMains[i].startSpeed = 20f; this.WarpParticleSystemMains[i].startLifetime = 1f; // Warp audio fadein AudioController.FadeIn(this.WarpAudioSources[i], WarpEngineAudioStep, WarpEngineAudioMaxVol); } } } // If no engines are active else { // Loop through engines for(int i = 0; i < this.Stats.EngineCount; i++) { // Turn particles back to default this.ImpulseParticleSystemMains[i].startSpeed = 1f; // Audio fadeout to default AudioController.FadeOut(this.ImpulseAudioSources[i], ImpulseEngineAudioStep, ImpulseEngineAudioMinVol); // If this is player if(this.IsPlayer == true) { // Warp particle fx to default this.WarpParticleSystemMains[i].startSpeed = 0f; this.WarpParticleSystemMains[i].startLifetime = 0f; // Warp audio fadeout AudioController.FadeOut(this.WarpAudioSources[i], WarpEngineAudioStep, WarpEngineAudioMinVol); } } } } // Strafe ship if within weapons range, note: strafe input is only set by NPCs protected virtual void StrafeShip() { // If strafe direction should be reset if(this.ResetStrafeDirection == true) { // Get random number 0 or 1, if 1 strafe right, if 0 strafe left if(GameController.RandomNumGen.Next(0, 2) == 1) { this.StrafeRight = true; } else { this.StrafeRight = false; } } // If strafe is activated by AI and ship is below max strafing speed if(this.StrafeInput == true && this.ShipRigidbody.velocity.magnitude < this.Stats.MaxStrafeSpeed) { // If strafe right add positive strafe acceleration if(this.StrafeRight == true) { // Strafe this.ShipRigidbody.AddRelativeForce(new Vector3(this.Stats.StrafeAcceleration, 0f, 0f)); } // If strafe left add negative strafe acceleration else { // Strafe this.ShipRigidbody.AddRelativeForce(new Vector3(-this.Stats.StrafeAcceleration, 0f, 0f)); } } } // Uses abilities: fire weapons, use abilities 1, 2, and 3 protected void CheckAbilities() { this.CheckMainGun(); this.CheckAbility1(); this.CheckAbility2(); this.CheckAbility3(); } // Fires main guns protected virtual void CheckMainGun() { // If time since last fired weapon is greater than or equal to cooldown time if(Time.time - this.LastGunFireTime >= this.Stats.GunCooldownTime) { // Take gun off cooldown this.GunOnCooldown = false; } // If weapons fire gun input is activated by player input or AI, the weapon is not on cooldown, and there is more available energy than the cost to fire if(this.MainGunInput == true && this.GunOnCooldown == false && this.Stats.Energy >= this.Stats.GunEnergyCost) { // Loop through gun barrel count for(int c = 0; c < this.Stats.GunBarrelCount; c++) { // Loop through gun shot amount for(int a = 0; a < this.Stats.GunShotAmount; a++) { // If shot accuracy percentage is above 100, set to 100 Mathf.Clamp(this.Stats.GunShotAccuracy, 0f, 100f); // Get accuracy of current projectile as random number from negative shot accuracy to positive shot accuracy float accuracy = GameController.RandomNumGen.Next(-(int)(100f - this.Stats.GunShotAccuracy), (int)(100f - this.Stats.GunShotAccuracy) + 1); Quaternion shotRotation; // If AI aim assist is on if(this.AIAimAssist == true) { // Shot rotation is affected by accuracy and the rotation to its target (instead of rotation of gun barrel, some NPCs need a little aiming boost) shotRotation = Quaternion.Euler(0f, this.IntendedRotation.eulerAngles.y + accuracy, 0f); } // If AI aim assist is off else { // Shot rotation is affected by accuracy and the rotation of the gun barrel shotRotation = Quaternion.Euler(0f, this.GunBarrelObjects[c].transform.rotation.eulerAngles.y + accuracy, 0f); } // Spawn a projectile GameController.SpawnBolt(this.IFF, this.Stats.GunShotProjectileType, this.Stats.GunShotCurvature, this.Stats.GunShotSightCone, this.Stats.GunShotDamage, this.GunBarrelObjects[c].transform.position, shotRotation, this.ShipRigidbody.velocity, this.Stats.GunShotSpeed, this.Stats.GunShotLifetime); // Turn on gun lights this.GunBarrelLightsObjects[c].SetActive(true); // Play gun audio this.GunAudioSources[c].Play(); } } // Set last shot time this.LastGunFireTime = Time.time; // Put weapon on cooldown this.GunOnCooldown = true; // Subtract energy for shot this.SubtractEnergy(this.Stats.GunEnergyCost); } // If weapons fire input is not active, weapon is on cooldown, or not enough energy to fire else { // Loop through gun barrels for(int i = 0; i < this.Stats.GunBarrelCount; i++) { // Turn gun lights off this.GunBarrelLightsObjects[i].SetActive(false); } } } // Check ablity 1 protected virtual void CheckAbility1() { // Each ship has their own special ablities } // Check ability 2 protected virtual void CheckAbility2() { // Each ship has their own special ablities } // Check ability 3 protected virtual void CheckAbility3() { // Each ship has their own special ablities } // Called when receiving collision from projectile public virtual void ReceivedCollisionFromProjectile(float damage, Vector3 projectileStrikeLocation) { // If shields are above 0 or barrier is active if(this.Stats.Shields > 0f) { // Spawn a shield strike particle effect this.ProjectileShieldStrike = GameObject.Instantiate(this.ProjectileShieldStrikePrefab, projectileStrikeLocation, Quaternion.identity); // Set particle effect to self destroy after 1 second GameObject.Destroy(this.ProjectileShieldStrike, 1f); } // If shield is 0 or less else { // Spawn a hull strike particle effect this.ProjectileHullStrike = GameObject.Instantiate(this.ProjectileHullStrikePrefab, projectileStrikeLocation, Quaternion.identity); // Set particle effect to self destroy after 1 second GameObject.Destroy(this.ProjectileHullStrike, 1f); } // Take damage from projectile this.TakeDamage(damage); } // Called when receiving collision from ship public virtual void ReceivedCollisionFromShip(Vector3 collisionVelocity, GameController.IFF iff) { // Apply velocity inverse to the rotation of the colliding ship Quaternion rotationToTarget = Targeting.GetRotationToTarget(this.ShipObject.transform, collisionVelocity); this.ShipRigidbody.AddRelativeForce(rotationToTarget * new Vector3(0, 0, -1000)); // If ship is different faction if(iff != this.IFF) { // If armor percentage is above 100, cap it at 100 Mathf.Clamp(this.Stats.Armor, 0f, 100f); // Take impact damage less armor percentage this.TakeDamage((this.Stats.MaxHealth + this.Stats.MaxShields) * 0.10f * ((100f - this.Stats.Armor) / 100f)); } } // Subtract energy protected void SubtractEnergy(float energyCost) { this.Stats.Energy -= energyCost; if(this.Stats.Energy < 0f) { this.Stats.Energy = 0f; } } // Called when ship receives a damaging attack public virtual void TakeDamage(float damage) { if(this.Stats.Health > 0f) { // Apply damage to shields this.Stats.Shields -= damage; // If shields are knocked below 0 if(this.Stats.Shields < 0f) { // Add negative shield amount to health this.Stats.Health += this.Stats.Shields; // Reset shield to 0 this.Stats.Shields = 0f; // If this is player if(this.IsPlayer == true) { // Show health damage vignette UIController.ShowHealthDamageEffect(); } } // If shields are still above 0 else { // If this is player if(this.IsPlayer == true) { // Show shield damage vignette UIController.ShowShieldDamageEffect(); } } // Set last damage taken time this.LastDamageTakenTime = Time.time; // Put shield on cooldown this.ShieldOnCooldown = true; // If this is player and shield regen audio is currently playing if(this.IsPlayer == true && this.ShieldRegenAudio.isPlaying == true) { // Fade out shield regen audio AudioController.FadeOut(this.ShieldRegenAudio, 0.25f, 0f); } // If ship is currently alive if(this.Alive == true) { // Show damage shader this.ShowDamageShaderEffect(true); } } } // Turns the damage shader effect on or off protected void ShowDamageShaderEffect(bool show) { if(show == true) { // Turn on damage shader this.ShipObject.transform.GetChild(0).GetComponent<MeshRenderer>().material.SetFloat("_ShowingEffect", 1f); } else { // Turn off the damage shader this.ShipObject.transform.GetChild(0).GetComponent<MeshRenderer>().material.SetFloat("_ShowingEffect", 0f); } } // Spawns fire particle FX on damaged ships protected void SpawnFireParticleFX() { // Spawn fire particles on ship this.ProjectileHullStrike = GameObject.Instantiate(this.ProjectileHullStrikePrefab, this.ShipObject.transform.position, Quaternion.identity); // TODO: Modify hull strike projectile to remove sound effect and add explosive sound effect as a component of the Explosion prefab instead // Hull strike starts with an explosive sound, turn it off in this case this.ProjectileHullStrike.GetComponent<AudioSource>().Stop(); // Set fire particles to self destroy after 1 second GameObject.Destroy(this.ProjectileHullStrike, 1f); } // Called when ship is destroyed by damage, grants XP protected virtual void Kill() { // Set to not alive this.Alive = false; // Reset cooldowns for(int i = 0; i < 3; i++) { this.AbilityActive[i] = false; this.AbilityOnCooldown[i] = false; } // Tell UI to remove healthbar for this ship UIController.RemoveHealthbar(this.ID); // If ship is an enemy if(this.IFF == GameController.IFF.Enemy) { // Increment the score by XP amount GameController.AddToScore(this.XP); } // Create an explosion this.Explosion = GameObject.Instantiate(this.ExplosionPrefab, this.ShipObject.transform.position, Quaternion.identity); // Set explosion object to self destroy after 1 second GameObject.Destroy(this.Explosion, 1f); // Destroy ship object GameObject.Destroy(this.ShipObject); // Add ship to removal list GameController.AddShipToRemovalList(this.ID); } // Called when ship is too far away from player, doesn't grant XP public void Despawn() { // Set to not alive this.Alive = false; // Tell UI to remove healthbar for this ship UIController.RemoveHealthbar(this.ID); // Destroy ship object GameObject.Destroy(this.ShipObject); // Add ship to removal list GameController.AddShipToRemovalList(this.ID); } // Get references to engine objects protected void GetEngineObjects() { // Set up array defaults this.ImpulseEngineObjects = new GameObject[this.Stats.EngineCount]; this.WarpEngineObjects = new GameObject[this.Stats.EngineCount]; this.ImpulseParticleSystems = new ParticleSystem[this.Stats.EngineCount]; this.ImpulseParticleSystemMains = new ParticleSystem.MainModule[this.Stats.EngineCount]; this.WarpParticleSystems = new ParticleSystem[this.Stats.EngineCount]; this.WarpParticleSystemMains = new ParticleSystem.MainModule[this.Stats.EngineCount]; this.ImpulseAudioSources = new AudioSource[this.Stats.EngineCount]; this.WarpAudioSources = new AudioSource[this.Stats.EngineCount]; // Loop through engine count for(int i = 0; i < this.Stats.EngineCount; i++) { // Fill arrays with references to gameobjects this.ImpulseEngineObjects[i] = this.ShipObject.transform.Find(GameController.ImpulseEngineObjectName + $@" {i}").gameObject; this.ImpulseParticleSystems[i] = this.ImpulseEngineObjects[i].GetComponent<ParticleSystem>(); this.ImpulseParticleSystemMains[i] = this.ImpulseParticleSystems[i].main; this.ImpulseAudioSources[i] = this.ImpulseEngineObjects[i].GetComponent<AudioSource>(); // If this is player if(this.IsPlayer == true) { // Fill warp arrays also this.WarpEngineObjects[i] = this.ShipObject.transform.Find(GameController.WarpEngineObjectName + $@" {i}").gameObject; this.WarpParticleSystems[i] = this.WarpEngineObjects[i].GetComponent<ParticleSystem>(); this.WarpParticleSystemMains[i] = this.WarpParticleSystems[i].main; this.WarpAudioSources[i] = this.WarpEngineObjects[i].GetComponent<AudioSource>(); } } } // Get references to gun objects protected void GetGunBarrelObjects() { // Set up array defaults this.GunBarrelObjects = new GameObject[this.Stats.GunBarrelCount]; this.GunBarrelLightsObjects = new GameObject[this.Stats.GunBarrelCount]; this.GunAudioSources = new AudioSource[this.Stats.GunBarrelCount]; // Loop through gun barrel count for(int i = 0; i < this.Stats.GunBarrelCount; i++) { // Fill arrays with references to gameobjects this.GunBarrelObjects[i] = this.ShipObject.transform.Find(GameController.GunBarrelObjectName + $@" {i}").gameObject; this.GunBarrelLightsObjects[i] = this.GunBarrelObjects[i].transform.Find(GameController.GunBarrelLightsObjectName + $@" {i}").gameObject; this.GunAudioSources[i] = this.GunBarrelObjects[i].GetComponent<AudioSource>(); } } // Get references to particle fx objects protected void GetParticleFXObjects() { // Load prefabs from resources folder for all particle fx this.ProjectileShieldStrikePrefab = Resources.Load<GameObject>(GameController.ProjectileShieldStrikePrefabName); this.ProjectileHullStrikePrefab = Resources.Load<GameObject>(GameController.ProjectileHullStrikePrefabName); this.ExplosionPrefab = Resources.Load<GameObject>(GameController.ExplosionPrefabName); this.ElectricityEffectPrefab = Resources.Load<GameObject>(GameController.ElectricityEffectPrefabName); } // Set up basic ship default values protected void SetupShipDefaultValues() { this.Alive = true; this.Stats.Health = this.Stats.MaxHealth; this.Stats.Shields = this.Stats.MaxShields; this.Stats.Energy = this.Stats.MaxEnergy; } // Set up AI protected void SetupAI() { // AI type is switch switch(this.AItype) { // Set AI fields based on AI type case AIType.Standard: { this.CanAcquireTargets = true; this.CanAccelerate = true; this.CanStrafe = true; this.CanFireGuns = true; break; } case AIType.Ramming: { this.CanAcquireTargets = true; this.CanAccelerate = true; this.CanStrafe = false; this.CanFireGuns = false; break; } case AIType.Broadside: { this.CanAcquireTargets = true; this.CanAccelerate = true; this.CanStrafe = true; this.CanFireGuns = true; break; } case AIType.Flanker: { this.CanAcquireTargets = true; this.CanAccelerate = true; this.CanStrafe = true; this.CanFireGuns = true; this.CanUseAbilities = true; break; } case AIType.Drone: { this.CanAcquireTargets = true; this.CanAccelerate = true; this.CanStrafe = true; this.CanFireGuns = true; break; } } } }
42.877766
213
0.625667
[ "MIT" ]
AliTsuki/Leviathan
Assets/Scripts/Ships/Ship.cs
40,698
C#
// -------------------------------------------------------------------------------------------------------------------- // <copyright company="Aspose" file="PermissionsFlags.cs"> // Copyright (c) 2021 Aspose.PDF Cloud // </copyright> // <summary> // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // </summary> // -------------------------------------------------------------------------------------------------------------------- using System; using System.Linq; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Net; using System.ComponentModel.DataAnnotations; using SwaggerDateConverter = Aspose.Pdf.Cloud.Sdk.Client.SwaggerDateConverter; namespace Aspose.Pdf.Cloud.Sdk.Model { /// <summary> /// This enum represents user&#39;s permissions for a pdf. /// </summary> /// <value>This enum represents user&#39;s permissions for a pdf.</value> [JsonConverter(typeof(StringEnumConverter))] public enum PermissionsFlags { /// <summary> /// Enum PrintDocument for "PrintDocument" /// </summary> [EnumMember(Value = "PrintDocument")] PrintDocument, /// <summary> /// Enum ModifyContent for "ModifyContent" /// </summary> [EnumMember(Value = "ModifyContent")] ModifyContent, /// <summary> /// Enum ExtractContent for "ExtractContent" /// </summary> [EnumMember(Value = "ExtractContent")] ExtractContent, /// <summary> /// Enum ModifyTextAnnotations for "ModifyTextAnnotations" /// </summary> [EnumMember(Value = "ModifyTextAnnotations")] ModifyTextAnnotations, /// <summary> /// Enum FillForm for "FillForm" /// </summary> [EnumMember(Value = "FillForm")] FillForm, /// <summary> /// Enum ExtractContentWithDisabilities for "ExtractContentWithDisabilities" /// </summary> [EnumMember(Value = "ExtractContentWithDisabilities")] ExtractContentWithDisabilities, /// <summary> /// Enum AssembleDocument for "AssembleDocument" /// </summary> [EnumMember(Value = "AssembleDocument")] AssembleDocument, /// <summary> /// Enum PrintingQuality for "PrintingQuality" /// </summary> [EnumMember(Value = "PrintingQuality")] PrintingQuality } }
36.871287
120
0.619227
[ "MIT" ]
aspose-pdf-cloud/aspose-pdf-cloud-dotnet
src/Aspose.Pdf.Cloud.Sdk/Model/PermissionsFlags.cs
3,726
C#
using System; using System.Collections.Generic; using DataBuddy; namespace Graffiti.Core { public class CategoryPage : TemplatedThemePage { protected override string ViewLookUp(string baseName, string defaultViewName) { Category category = new CategoryController().GetCachedCategory(CategoryID, false); // category-name.view if (category.ParentId <= 0 && ViewExists(CategoryName + baseName)) return CategoryName + baseName; // Subcategories if (category.ParentId > 0) { // parent-name.child-name.view if (ViewExists(category.LinkName.Replace("/", ".") + baseName)) return category.LinkName.Replace("/", ".") + baseName; // childcategory.parent-name.view if (ViewExists("childcategory." + category.Parent.LinkName + baseName)) return "childcategory." + category.Parent.LinkName + baseName; // childcategory.view if (ViewExists("childcategory" + baseName)) return "childcategory" + baseName; // parent-name.view if (ViewExists(category.Parent.LinkName + baseName)) return category.Parent.LinkName + baseName; } // category.view if (ViewExists("category" + baseName)) return "category" + baseName; // index.view return base.ViewLookUp(baseName, defaultViewName); } protected override void LoadContent(GraffitiContext graffitiContext) { IsIndexable = false; graffitiContext["where"] = "category"; Category category = new CategoryController().GetCachedCategory(CategoryID, false); if(CategoryName != null && !Util.AreEqualIgnoreCase(CategoryName,category.LinkName)) { RedirectTo(category.Url); } graffitiContext["title"] = category.Name + " : " + SiteSettings.Get().Title; graffitiContext["category"] = category; graffitiContext.RegisterOnRequestDelegate("posts", GetCategoryPosts); // GetCategoryPosts needs to be called so the pager works GetCategoryPosts("posts", graffitiContext); } protected virtual object GetCategoryPosts(string key, GraffitiContext graffitiContext) { Category category = new CategoryController().GetCachedCategory(CategoryID, false); int pageSize = SiteSettings.Get().PageSize; PostCollection pc = ZCache.Get<PostCollection>(string.Format(CacheKey, PageIndex, CategoryID, category.SortOrder, pageSize)); if (pc == null) { pc = new PostCollection(); Query q = PostCollection.DefaultQuery(PageIndex, pageSize, category.SortOrder); if (Category.IncludeChildPosts) { if (category.ParentId > 0) q.AndWhere(Post.Columns.CategoryId, CategoryID); else { List<int> ids = new List<int>(category.Children.Count + 1); foreach (Category child in category.Children) ids.Add(child.Id); ids.Add(category.Id); q.AndInWhere(Post.Columns.CategoryId, ids.ToArray()); } } else { q.AndWhere(Post.Columns.CategoryId, CategoryID); } pc.LoadAndCloseReader(q.ExecuteReader()); ZCache.InsertCache(string.Format(CacheKey, PageIndex, CategoryID, category.SortOrder, pageSize), pc, 60); } graffitiContext.TotalRecords = category.PostCount; graffitiContext.PageIndex = PageIndex; graffitiContext.PageSize = SiteSettings.Get().PageSize; return pc; } private const string CacheKey = "Posts-Categories-P:{0}-C:{1}-T:{2}-PS:{3}"; } }
37.882883
137
0.557432
[ "MIT" ]
harder/GraffitiCMS
src/Graffiti.Core/UI/Pages/CategoryPage.cs
4,205
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public struct ADSR_WaveStruct { public float intensity; public float delay; } public class ADSR_WaveShape { public ADSR_WaveStruct attack; public ADSR_WaveStruct delay; public ADSR_WaveStruct sustain; public ADSR_WaveStruct release; public float intensity; public float time; public bool isReleasing = false; public ADSR_WaveShape() { } }
18.115385
36
0.732484
[ "MIT" ]
RMSHR/VirtualMotionTools
Assets/Scenes/Proto_ADSR/Scripts/ADSR_Structures.cs
473
C#
// // IconSize.cs // // Author: // Lluis Sanchez <lluis@xamarin.com> // // Copyright (c) 2011 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Xwt { public enum IconSize { Small, Medium, Large } }
33.763158
80
0.740452
[ "MIT" ]
Bert1974/xwt
Xwt/Xwt/IconSize.cs
1,283
C#
//********************************************************* // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 License // // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or // implied. See the License for the specific language governing // permissions and limitations under the License. // //********************************************************* using System; using System.Threading.Tasks; using Newtonsoft.Json; using Orleans; using Orleans.Runtime; using Orleans.Storage; namespace Samples.StorageProviders { /// <summary> /// Base class for JSON-based grain storage providers. /// </summary> public abstract class BaseJSONStorageProvider : IGrainStorage { /// <summary> /// Storage provider name /// </summary> public string Name { get; protected set; } /// <summary> /// Data manager instance /// </summary> /// <remarks>The data manager is responsible for reading and writing JSON strings.</remarks> protected IJSONStateDataManager DataManager { get; set; } /// <summary> /// Constructor /// </summary> protected BaseJSONStorageProvider() { } /// <summary> /// Closes the storage provider during silo shutdown. /// </summary> /// <returns>Completion promise for this operation.</returns> public Task Close() { if (DataManager != null) DataManager.Dispose(); DataManager = null; return Task.CompletedTask; } /// <summary> /// Reads persisted state from the backing store and deserializes it into the target /// grain state object. /// </summary> /// <param name="grainType">A string holding the name of the grain class.</param> /// <param name="grainReference">Represents the long-lived identity of the grain.</param> /// <param name="grainState">A reference to an object to hold the persisted state of the grain.</param> /// <returns>Completion promise for this operation.</returns> public async Task ReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) { if (DataManager == null) throw new ArgumentException("DataManager property not initialized"); var entityData = await DataManager.Read(grainState.GetType().Name, grainReference.ToKeyString()); if (entityData != null) { ConvertFromStorageFormat(grainState, entityData); grainState.RecordExists = true; } } /// <summary> /// Writes the persisted state from a grain state object into its backing store. /// </summary> /// <param name="grainType">A string holding the name of the grain class.</param> /// <param name="grainReference">Represents the long-lived identity of the grain.</param> /// <param name="grainState">A reference to an object holding the persisted state of the grain.</param> /// <returns>Completion promise for this operation.</returns> public Task WriteStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) { if (DataManager == null) throw new ArgumentException("DataManager property not initialized"); var entityData = ConvertToStorageFormat(grainState); grainState.RecordExists = true; return DataManager.Write(grainState.GetType().Name, grainReference.ToKeyString(), entityData); } /// <summary> /// Removes grain state from its backing store, if found. /// </summary> /// <param name="grainType">A string holding the name of the grain class.</param> /// <param name="grainReference">Represents the long-lived identity of the grain.</param> /// <param name="grainState">An object holding the persisted state of the grain.</param> /// <returns></returns> public Task ClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) { if (DataManager == null) throw new ArgumentException("DataManager property not initialized"); DataManager.Delete(grainState.GetType().Name, grainReference.ToKeyString()); grainState.RecordExists = false; return Task.CompletedTask; } /// <summary> /// Serializes from a grain instance to a JSON document. /// </summary> /// <param name="grainState">Grain state to be converted into JSON storage format.</param> /// <remarks> /// See: /// http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx /// for more on the JSON serializer. /// </remarks> protected static string ConvertToStorageFormat(IGrainState grainState) { return JsonConvert.SerializeObject(grainState.State); } /// <summary> /// Constructs a grain state instance by deserializing a JSON document. /// </summary> /// <param name="grainState">Grain state to be populated for storage.</param> /// <param name="entityData">JSON storage format representation of the grain state.</param> protected static void ConvertFromStorageFormat(IGrainState grainState, string entityData) { object data = JsonConvert.DeserializeObject(entityData, grainState.State.GetType()); grainState.State = data; } } }
43.080292
113
0.622331
[ "MIT" ]
Allen-Xiao/orleans
test/TesterInternal/StorageTests/StorageProviders/BaseJSONStorageProvider.cs
5,902
C#
using System.ComponentModel.DataAnnotations; using Abp.Authorization.Roles; using Jiesen.Dispatcher.Authorization.Users; namespace Jiesen.Dispatcher.Authorization.Roles { public class Role : AbpRole<User> { public const int MaxDescriptionLength = 5000; public Role() { } public Role(int? tenantId, string displayName) : base(tenantId, displayName) { } public Role(int? tenantId, string name, string displayName) : base(tenantId, name, displayName) { } [StringLength(MaxDescriptionLength)] public string Description {get; set;} } }
23.068966
67
0.626308
[ "MIT" ]
sachem1/3.6.0
src/Jiesen.Dispatcher.Core/Authorization/Roles/Role.cs
671
C#
namespace ClassLib068 { public class Class095 { public static string Property => "ClassLib068"; } }
15
55
0.633333
[ "MIT" ]
333fred/performance
src/scenarios/weblarge2.0/src/ClassLib068/Class095.cs
120
C#
#pragma checksum "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b6ad618138168a6258c5ca299ad66dd8c86f9849" // <auto-generated/> #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(MyHome.Areas.Identity.Pages.Account.Areas_Identity_Pages_Account_Register), @"mvc.1.0.razor-page", @"/Areas/Identity/Pages/Account/Register.cshtml")] [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/Areas/Identity/Pages/Account/Register.cshtml", typeof(MyHome.Areas.Identity.Pages.Account.Areas_Identity_Pages_Account_Register), null)] namespace MyHome.Areas.Identity.Pages.Account { #line hidden using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; #line 3 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\_ViewImports.cshtml" using Microsoft.AspNetCore.Identity; #line default #line hidden #line 2 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\_ViewImports.cshtml" using MyHome.Areas.Identity; #line default #line hidden #line 1 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\_ViewImports.cshtml" using MyHome.Areas.Identity.Pages.Account; #line default #line hidden [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"b6ad618138168a6258c5ca299ad66dd8c86f9849", @"/Areas/Identity/Pages/Account/Register.cshtml")] [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"c94c768f478adea19c30a9dc98d1886fecb8cc37", @"/Areas/Identity/Pages/_ViewImports.cshtml")] [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"8ec46b6eaaaca79e8d65d38417ec1c0e9ab1cf7b", @"/Areas/Identity/Pages/Account/_ViewImports.cshtml")] public class Areas_Identity_Pages_Account_Register : global::Microsoft.AspNetCore.Mvc.RazorPages.Page { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("form-control"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("method", "post", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("name", "_ValidationScriptsPartial", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0169 private string __tagHelperStringValueBuffer; #pragma warning restore 0169 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager { get { if (__backed__tagHelperScopeManager == null) { __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); } return __backed__tagHelperScopeManager; } } private global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 3 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" ViewData["Title"] = "Register"; #line default #line hidden BeginContext(73, 6, true); WriteLiteral("\r\n<h2>"); EndContext(); BeginContext(80, 17, false); #line 7 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(97, 64, true); WriteLiteral("</h2>\r\n\r\n<div class=\"row\">\r\n <div class=\"col-md-4\">\r\n "); EndContext(); BeginContext(161, 1131, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c5209c15722945f5aad74985753b75d0", async() => { BeginContext(220, 78, true); WriteLiteral("\r\n <h4>Create a new account.</h4>\r\n <hr />\r\n "); EndContext(); BeginContext(298, 60, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "00753ce7179a4d8cb5511286f4f8c0bc", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper); #line 14 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary = global::Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary.All; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-summary", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(358, 56, true); WriteLiteral("\r\n <div class=\"form-group\">\r\n "); EndContext(); BeginContext(414, 37, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a7fe8ac31004cce8fc6c354a5a377e3", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 16 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Email); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(451, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(469, 52, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "84ea53caa46147beb79b7809847da2cc", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); #line 17 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Email); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(521, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(539, 66, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "8be3adcc022c430fa19054bd1242dfbc", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); #line 18 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Email); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(605, 76, true); WriteLiteral("\r\n </div>\r\n <div class=\"form-group\">\r\n "); EndContext(); BeginContext(681, 40, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "2bab2fd48f324996ba23af4d1dfe3d4f", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 21 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Password); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(721, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(739, 55, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "306e298e5f204536ad9322ee2754fd9f", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); #line 22 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Password); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(794, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(812, 69, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "2595798d7a4848c7b34fb982c50eb4e0", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); #line 23 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.Password); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(881, 76, true); WriteLiteral("\r\n </div>\r\n <div class=\"form-group\">\r\n "); EndContext(); BeginContext(957, 47, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "ab93bf8fab4a4267b8283b9bec54ec3e", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper); #line 26 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.ConfirmPassword); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1004, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(1022, 62, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "f52b088157cf4e01850815e12a502169", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper); #line 27 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.ConfirmPassword); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1084, 18, true); WriteLiteral("\r\n "); EndContext(); BeginContext(1102, 76, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "b774a5d1c6a542bc8871ef5636355ae9", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper); #line 28 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Input.ConfirmPassword); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1178, 107, true); WriteLiteral("\r\n </div>\r\n <button type=\"submit\" class=\"btn btn-default\">Register</button>\r\n "); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); if (__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-returnUrl", "Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 11 "E:\USR\Projects\GitHub\MyHome\MyHome\Areas\Identity\Pages\Account\Register.cshtml" WriteLiteral(Model.ReturnUrl); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-returnUrl", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1292, 24, true); WriteLiteral("\r\n </div>\r\n</div>\r\n\r\n"); EndContext(); DefineSection("Scripts", async() => { BeginContext(1334, 6, true); WriteLiteral("\r\n "); EndContext(); BeginContext(1340, 44, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "879f7d0dc293468786c98a6eaccfdfc7", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1384, 2, true); WriteLiteral("\r\n"); EndContext(); } ); } #pragma warning restore 1998 [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<RegisterModel> Html { get; private set; } public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<RegisterModel> ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<RegisterModel>)PageContext?.ViewData; public RegisterModel Model => ViewData.Model; } } #pragma warning restore 1591
71.69727
350
0.714439
[ "MIT" ]
SnailUpUpUp/MyHome
MyHome/obj/Release/netcoreapp2.1/Razor/Areas/Identity/Pages/Account/Register.g.cshtml.cs
28,894
C#
using System; using System.Threading.Tasks; using Windows.Devices.Enumeration; using Windows.Devices.Spi; using Windows.Foundation; using System.Numerics; using System.Threading; namespace TouchPanels { public sealed class Tsc2046 { private const int MAX_PRESSURE = 254; private const int CS_PIN = 1; private const byte CMD_START = 0x80; private const byte CMD_12BIT = 0x00; private const byte CMD_8BIT = 0x08; private const byte CMD_DIFF = 0x00; private const byte CMD_X_POS = 0x10; private const byte CMD_Z1_POS = 0x30; private const byte CMD_Z2_POS = 0x40; private const byte CMD_Y_POS = 0x50; private SpiDevice _touchSPI; private static Tsc2046 _defaultInstance; public static async Task<Tsc2046> GetDefaultAsync() { if (_defaultInstance == null) { _defaultInstance = new Tsc2046(); await _defaultInstance.InitTSC2046SPI().ConfigureAwait(false); } return _defaultInstance; } private async Task InitTSC2046SPI() { var touchSettings = new SpiConnectionSettings(CS_PIN) { ClockFrequency = 125000, Mode = SpiMode.Mode0 //Mode0,1,2,3; MCP23S17 needs mode 0 }; string DispspiAqs = SpiDevice.GetDeviceSelector( "SPI0"); var DispdeviceInfo = await DeviceInformation.FindAllAsync(DispspiAqs); if (DispdeviceInfo.Count == 0) { throw new PlatformNotSupportedException("No SPI device exists for SPI0 on this platform."); } _touchSPI = await SpiDevice.FromIdAsync(DispdeviceInfo[0].Id, touchSettings); } //Default calibration. public Matrix3x2 CalibrationMatrix { get; set; } = new Matrix3x2(-0.0215403477860236f, 0.317089232808541f, 37.3956514238408f, 0.233169889203826f, -0.0124920484301682f, 31.7292597060892f); /// <summary> /// Last known touch position calculated with the calibration matrix /// </summary> public Point TouchPosition => CalibrationMatrix.Transform(RawTouchPosition); /// <summary> /// Raw touch position /// </summary> public Point RawTouchPosition { get; private set; } = new Point(double.NaN, double.NaN); /// <summary> /// Touch pressure between 0 and 1. /// </summary> public double Pressure => (double)RawPressure / MAX_PRESSURE; public int RawPressure { get; private set; } = 0; /// <summary> /// Communicates with the touch processor chip on the LCD device. /// /// <see cref="RawTouchPosition"/> and <see cref="RawPressure"/> will be updated afterwards, together /// with their not raw counterparts. /// </summary> public void ReadTouchData() { //TODO: Maybe we can reuse some buffers in a thread safe manner var writeBuffer = new byte[3]; var readBuffer = new byte[3]; // Do 2 samples to increase the accuracy. var firstSampleX = ReadXPosition(); var firstSampleY = ReadYPosition(); var firstSamplePressure = ReadPressure(); var secondSampleX = ReadXPosition(); var secondSampleY = ReadYPosition(); var secondSamplePressure = ReadPressure(); // Check the distance between the two samples to cancel out the noise and general inaccuracy. // This is necessary on the tested TSC2046. // On the Tsc2007 this is probably not necessary because the chip already samples and averages 7 times on a single request. // The Tsc2007 removes the 2 highest and 2 lowest values and averages the middle 3 values. if (Math.Abs(firstSampleX - secondSampleX) < 40 && Math.Abs(firstSampleY - secondSampleY) < 40 && Math.Abs(firstSamplePressure - secondSamplePressure) < 10) { // The first sample usually has a higher amount of noise, that's why we use the second one. RawTouchPosition = new Point(secondSampleX, secondSampleY); RawPressure = secondSamplePressure; } int ReadPressure() { writeBuffer[0] = CMD_START | CMD_8BIT | CMD_DIFF | CMD_Z1_POS; _touchSPI.TransferFullDuplex(writeBuffer, readBuffer); var a = readBuffer[1] & 0x7F; //TODO: Reading the pressure doesn't work right, I often get the value 127 writeBuffer[0] = CMD_START | CMD_8BIT | CMD_DIFF | CMD_Z2_POS; _touchSPI.TransferFullDuplex(writeBuffer, readBuffer); var original = readBuffer[1]; var b = 255 - readBuffer[1] & 0x7F; return a + b; } int ReadXPosition() { writeBuffer[0] = CMD_START | CMD_12BIT | CMD_DIFF | CMD_X_POS; _touchSPI.TransferFullDuplex(writeBuffer, readBuffer); var a = readBuffer[1]; var b = readBuffer[2]; return ((a << 4) | (b >> 4)); //12bit: ((a<<4)|(b>>4)) //10bit: ((a<<2)|(b>>6)) } int ReadYPosition() { writeBuffer[0] = CMD_START | CMD_12BIT | CMD_DIFF | CMD_Y_POS; _touchSPI.TransferFullDuplex(writeBuffer, readBuffer); var a = readBuffer[1]; var b = readBuffer[2]; return ((a << 4) | (b >> 4)); //12bit: ((a<<4)|(b>>4)) //10bit: ((a<<2)|(b>>6)) } } } }
39.631944
196
0.586648
[ "MIT" ]
korsarNek/WindowsIotTsc2046Uwp
TouchPanels/Tsc2046.cs
5,709
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace Lab_final_Result_system { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public class Student { public string Name, ID, Grade; public int Attendance, Quiz1, Quiz2, Quiz3, Quiz4, MID, Final, Viva; public double Percent, Total; } List<Student> students = new List<Student>(); private void Form1_Load(object sender, EventArgs e) { using (var reader = new StreamReader(@"E:\CLASSWORKS\SWE OOP LAB\Lab final Result system\SWE4201MarkSheet.csv")) { /**/int x = 0; while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(','); Student dummy = new Student(); dummy.ID = values[0]; dummy.Name = values[1]; string s = values[2]; dummy.Attendance = Convert.ToInt32(s); dummy.Quiz1 = Convert.ToInt32(values[3]); dummy.Quiz2 = Convert.ToInt32(values[4]); dummy.Quiz3 = Convert.ToInt32(values[5]); dummy.Quiz4 = Convert.ToInt32(values[6]); dummy.MID = Convert.ToInt32(values[7]); dummy.Final = Convert.ToInt32(values[8]); dummy.Viva = Convert.ToInt32(values[9]); //dummy.DEPARTMENT_ID = values[10]; double total = dummy.Attendance + dummy.MID + dummy.Final + dummy.Viva; int[] quizes = { dummy.Quiz1, dummy.Quiz2, dummy.Quiz3, dummy.Quiz4 }; Array.Sort(quizes); double quiz_total = quizes[3] + quizes[2] + quizes[1]; total = total + quiz_total; dummy.Total = total; double Percentage = total / 3; dummy.Percent = Percentage; PERCENTAGE_BOX.Items.Add(Convert.ToString(Percentage)); string Grade; if(Percentage >= 80) { Grade = "A+"; } else if(Percentage >= 75) { Grade = "A"; } else if (Percentage >= 70) { Grade = "A-"; } else if (Percentage >= 65) { Grade = "B+"; } else if (Percentage >= 60) { Grade = "B"; } else if (Percentage >= 55) { Grade = "B-"; } else if (Percentage >= 50) { Grade = "C+"; } else if (Percentage >= 45) { Grade = "C"; } else if (Percentage >= 4075) { Grade = "D"; } else { Grade = "F"; } dummy.Grade = Grade; students.Add(dummy); } foreach(var ss in students) { ID_BOX.Items.Add(ss.ID); NAME_BOX.Items.Add(ss.Name); double total = ss.Attendance + ss.MID + ss.Final + ss.Viva; int[] quizes = { ss.Quiz1, ss.Quiz2, ss.Quiz3, ss.Quiz4 }; Array.Sort(quizes); double quiz_total = quizes[3] + quizes[2] + quizes[1]; total = total + quiz_total; double Percentage = total / 3; PERCENTAGE_BOX.Items.Add(Convert.ToString(Percentage)); string Grade; if(Percentage >= 80) { Grade = "A+"; } else if(Percentage >= 75) { Grade = "A"; } else if (Percentage >= 70) { Grade = "A-"; } else if (Percentage >= 65) { Grade = "B+"; } else if (Percentage >= 60) { Grade = "B"; } else if (Percentage >= 55) { Grade = "B-"; } else if (Percentage >= 50) { Grade = "C+"; } else if (Percentage >= 45) { Grade = "C"; } else if (Percentage >= 40) { Grade = "D"; } else { Grade = "F"; } GRADE_BOX.Items.Add(Grade); } } } private void Search_Button_Click(object sender, EventArgs e) { string Search_Id = Search_Box.Text; var result = from id in students where id.ID == Search_Id select (id.Name, id.ID, id.Attendance, id.Quiz1, id.Quiz2, id.Quiz3, id.Quiz4, id.MID, id.Final, id.Viva, id.Percent, id.Grade, id.Total); //MessageBox.Show(typeof(result)); //Attendance.Text = Convert.ToString(result[0]); //List <string> final_result = result.ToList(); int x = 0; foreach(var item in result) { //Console.WriteLine(item.namwe); Attendance.Text = Convert.ToString(item.Attendance); Quiz1.Text = Convert.ToString(item.Quiz1); Quiz2.Text = Convert.ToString(item.Quiz2); Quiz3.Text = Convert.ToString(item.Quiz3); Quiz4.Text = Convert.ToString(item.Quiz4); Mid.Text = Convert.ToString(item.MID); Final.Text = Convert.ToString(item.Final); Viva.Text = Convert.ToString(item.Viva); Total.Text = Convert.ToString(item.Total); Percentage.Text = Convert.ToString(item.Percent) + "%"; Grade.Text = Convert.ToString(item.Grade); } } private void label16_Click(object sender, EventArgs e) { } } }
38.758454
164
0.352861
[ "MIT" ]
Ryuzaki-L-07/SWE-4202-Lab
Lab final Result system/Form1.cs
8,025
C#
using System.Linq; using Plainion.Wiki.AST; namespace Plainion.Wiki.UnitTests { internal static class AstExtensions { /// <summary> /// Returns the containing plain text if there is only one child /// which is of type PlainText, otherwise null. /// </summary> public static string Text( this TextBlock self ) { if( self.Children.Count() != 1 ) { return null; } var plainText = self.Children.OfType<PlainText>().SingleOrDefault(); if( plainText == null ) { return null; } return plainText.Text; } } }
25.103448
81
0.498626
[ "BSD-3-Clause" ]
plainionist/Plainion.Notes
src/Plainion.Wiki.Tests/AstExtensions.cs
730
C#
using Shop.Module.Catalog.Abstractions.Models; using System.Collections.Generic; namespace Shop.Module.Catalog.Abstractions.ViewModels { public class ProductGetOptionResult { public int Id { get; set; } public string Name { get; set; } public OptionDisplayType DisplayType { get; set; } public IList<ProductGetOptionValueResult> Values { get; set; } = new List<ProductGetOptionValueResult>(); } }
26.235294
113
0.701794
[ "MIT" ]
cn-cam/module-shop
src/server/src/Modules/Shop.Module.Catalog.Abstractions/ViewModels/ProductGetOptionResult.cs
448
C#
// <copyright file="TransitionExceptionEventArgs.cs" company="Appccelerate"> // Copyright (c) 2008-2016 // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> namespace Appccelerate.StateMachine.Machine.Events { using System; /// <summary> /// Event arguments providing transition exceptions. /// </summary> /// <typeparam name="TState">The type of the state.</typeparam> /// <typeparam name="TEvent">The type of the event.</typeparam> public class TransitionExceptionEventArgs<TState, TEvent> : TransitionEventArgs<TState, TEvent> { /// <summary> /// Initializes a new instance of the <see cref="TransitionExceptionEventArgs&lt;TState, TEvent&gt;"/> class. /// </summary> /// <param name="context">The event context.</param> /// <param name="exception">The exception.</param> public TransitionExceptionEventArgs(ITransitionContext<TState, TEvent> context, Exception exception) : base(context) { this.Exception = exception; } /// <summary> /// Gets the exception. /// </summary> /// <value>The exception.</value> public Exception Exception { get; } } }
38.638298
118
0.639317
[ "Apache-2.0" ]
ursenzler/statemachine
source/Appccelerate.StateMachine/Machine/Events/TransitionExceptionEventArgs.cs
1,816
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlatformDependentButtonRenderer : MonoBehaviour { [SerializeField] List<GameObject> crashButtons; void Start() { var shouldButtonsBeActive = true; #if !UNITY_STANDALONE_WIN shouldButtonsBeActive = false; #endif foreach (var button in crashButtons) { button.SetActive(shouldButtonsBeActive); } } }
19.375
60
0.683871
[ "MIT" ]
BugSplat-Git/my-unity-crasher
Assets/PlatformDependentButtonRenderer.cs
465
C#
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HelloAspNet5.Entities")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HelloAspNet5.Entities")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
35.387097
84
0.746582
[ "MIT" ]
tonysneed/Experimental
vNext/VS2015/AspNet5/HelloAspNet5/src/HelloAspNet5.Client.Entities/Properties/AssemblyInfo.cs
1,100
C#
namespace SoftUniBlog.Migrations { using System.Data.Entity.Migrations; using Models; internal sealed class Configuration : DbMigrationsConfiguration<BlogDbContext> { public Configuration() { AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = true; ContextKey = "SoftUniBlog.Models.BlogDbContext"; } protected override void Seed(BlogDbContext context) { } } }
25.526316
82
0.645361
[ "MIT" ]
jeliozver/SoftUni-Software-Technologies
13-CSharp-Blog-Basic-Functionality/SoftUniBlog/Migrations/Configuration.cs
485
C#
using System; using System.Collections.Generic; using System.Diagnostics; using System.Dynamic; using System.Reflection; using System.Threading; using System.Timers; using Abot.Core; using Abot.Poco; using Abot.Util; using log4net; using Timer = System.Timers.Timer; namespace Abot.Crawler { public interface IWebCrawler : IDisposable { /// <summary> /// Synchronous event that is fired before a page is crawled. /// </summary> event EventHandler<PageCrawlStartingArgs> PageCrawlStarting; /// <summary> /// Synchronous event that is fired when an individual page has been crawled. /// </summary> event EventHandler<PageCrawlCompletedArgs> PageCrawlCompleted; /// <summary> /// Synchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawl impl returned false. This means the page or its links were not crawled. /// </summary> event EventHandler<PageCrawlDisallowedArgs> PageCrawlDisallowed; /// <summary> /// Synchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawlLinks impl returned false. This means the page's links were not crawled. /// </summary> event EventHandler<PageLinksCrawlDisallowedArgs> PageLinksCrawlDisallowed; /// <summary> /// Asynchronous event that is fired before a page is crawled. /// </summary> event EventHandler<PageCrawlStartingArgs> PageCrawlStartingAsync; /// <summary> /// Asynchronous event that is fired when an individual page has been crawled. /// </summary> event EventHandler<PageCrawlCompletedArgs> PageCrawlCompletedAsync; /// <summary> /// Asynchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawl impl returned false. This means the page or its links were not crawled. /// </summary> event EventHandler<PageCrawlDisallowedArgs> PageCrawlDisallowedAsync; /// <summary> /// Asynchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawlLinks impl returned false. This means the page's links were not crawled. /// </summary> event EventHandler<PageLinksCrawlDisallowedArgs> PageLinksCrawlDisallowedAsync; /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page should be crawled or not /// </summary> void ShouldCrawlPage(Func<PageToCrawl, CrawlContext, CrawlDecision> decisionMaker); /// <summary> /// Synchronous method that registers a delegate to be called to determine whether the page's content should be dowloaded /// </summary> /// <param name="shouldDownloadPageContent"></param> void ShouldDownloadPageContent(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker); /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page's links should be crawled or not /// </summary> /// <param name="shouldCrawlPageLinksDelegate"></param> void ShouldCrawlPageLinks(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker); /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a cerain link on a page should be scheduled to be crawled /// </summary> void ShouldScheduleLink(Func<Uri, CrawledPage, CrawlContext, bool> decisionMaker); /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page should be recrawled /// </summary> void ShouldRecrawlPage(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker); /// <summary> /// Synchronous method that registers a delegate to be called to determine whether the 1st uri param is considered an internal uri to the second uri param /// </summary> /// <param name="decisionMaker delegate"></param> void IsInternalUri(Func<Uri, Uri, bool> decisionMaker); /// <summary> /// Begins a crawl using the uri param /// </summary> CrawlResult Crawl(Uri uri); /// <summary> /// Begins a crawl using the uri param, and can be cancelled using the CancellationToken /// </summary> CrawlResult Crawl(Uri uri, CancellationTokenSource tokenSource); /// <summary> /// Dynamic object that can hold any value that needs to be available in the crawl context /// </summary> dynamic CrawlBag { get; set; } } [Serializable] public abstract class WebCrawler : IWebCrawler { static ILog _logger = LogManager.GetLogger("AbotLogger"); protected bool _crawlComplete = false; protected bool _crawlStopReported = false; protected bool _crawlCancellationReported = false; protected bool _maxPagesToCrawlLimitReachedOrScheduled = false; protected Timer _timeoutTimer; protected CrawlResult _crawlResult = null; protected CrawlContext _crawlContext; protected IThreadManager _threadManager; protected IScheduler _scheduler; protected IPageRequester _pageRequester; protected IHyperLinkParser _hyperLinkParser; protected ICrawlDecisionMaker _crawlDecisionMaker; protected IMemoryManager _memoryManager; protected Func<PageToCrawl, CrawlContext, CrawlDecision> _shouldCrawlPageDecisionMaker; protected Func<CrawledPage, CrawlContext, CrawlDecision> _shouldDownloadPageContentDecisionMaker; protected Func<CrawledPage, CrawlContext, CrawlDecision> _shouldCrawlPageLinksDecisionMaker; protected Func<CrawledPage, CrawlContext, CrawlDecision> _shouldRecrawlPageDecisionMaker; protected Func<Uri, CrawledPage, CrawlContext, bool> _shouldScheduleLinkDecisionMaker; protected Func<Uri, Uri, bool> _isInternalDecisionMaker = (uriInQuestion, rootUri) => uriInQuestion.Authority == rootUri.Authority; /// <summary> /// Dynamic object that can hold any value that needs to be available in the crawl context /// </summary> public dynamic CrawlBag { get; set; } #region Constructors static WebCrawler() { //This is a workaround for dealing with periods in urls (http://stackoverflow.com/questions/856885/httpwebrequest-to-url-with-dot-at-the-end) //Will not be needed when this project is upgraded to 4.5 MethodInfo getSyntax = typeof(UriParser).GetMethod("GetSyntax", BindingFlags.Static | BindingFlags.NonPublic); FieldInfo flagsField = typeof(UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic); if (getSyntax != null && flagsField != null) { foreach (string scheme in new[] { "http", "https" }) { UriParser parser = (UriParser)getSyntax.Invoke(null, new object[] { scheme }); if (parser != null) { int flagsValue = (int)flagsField.GetValue(parser); // Clear the CanonicalizeAsFilePath attribute if ((flagsValue & 0x1000000) != 0) flagsField.SetValue(parser, flagsValue & ~0x1000000); } } } } /// <summary> /// Creates a crawler instance with the default settings and implementations. /// </summary> public WebCrawler() : this(null, null, null, null, null, null, null) { } /// <summary> /// Creates a crawler instance with custom settings or implementation. Passing in null for all params is the equivalent of the empty constructor. /// </summary> /// <param name="threadManager">Distributes http requests over multiple threads</param> /// <param name="scheduler">Decides what link should be crawled next</param> /// <param name="pageRequester">Makes the raw http requests</param> /// <param name="hyperLinkParser">Parses a crawled page for it's hyperlinks</param> /// <param name="crawlDecisionMaker">Decides whether or not to crawl a page or that page's links</param> /// <param name="crawlConfiguration">Configurable crawl values</param> /// <param name="memoryManager">Checks the memory usage of the host process</param> public WebCrawler( CrawlConfiguration crawlConfiguration, ICrawlDecisionMaker crawlDecisionMaker, IThreadManager threadManager, IScheduler scheduler, IPageRequester pageRequester, IHyperLinkParser hyperLinkParser, IMemoryManager memoryManager) { _crawlContext = new CrawlContext(); _crawlContext.CrawlConfiguration = crawlConfiguration ?? GetCrawlConfigurationFromConfigFile(); CrawlBag = _crawlContext.CrawlBag; _threadManager = threadManager ?? new TaskThreadManager(_crawlContext.CrawlConfiguration.MaxConcurrentThreads > 0 ? _crawlContext.CrawlConfiguration.MaxConcurrentThreads : Environment.ProcessorCount); _scheduler = scheduler ?? new Scheduler(_crawlContext.CrawlConfiguration.IsUriRecrawlingEnabled, null, null); _pageRequester = pageRequester ?? new PageRequester(_crawlContext.CrawlConfiguration); _crawlDecisionMaker = crawlDecisionMaker ?? new CrawlDecisionMaker(); if (_crawlContext.CrawlConfiguration.MaxMemoryUsageInMb > 0 || _crawlContext.CrawlConfiguration.MinAvailableMemoryRequiredInMb > 0) _memoryManager = memoryManager ?? new MemoryManager(new CachedMemoryMonitor(new GcMemoryMonitor(), _crawlContext.CrawlConfiguration.MaxMemoryUsageCacheTimeInSeconds)); _hyperLinkParser = hyperLinkParser ?? new HapHyperLinkParser(_crawlContext.CrawlConfiguration, null); _crawlContext.Scheduler = _scheduler; } #endregion Constructors /// <summary> /// Begins a synchronous crawl using the uri param, subscribe to events to process data as it becomes available /// </summary> public virtual CrawlResult Crawl(Uri uri) { return Crawl(uri, null); } /// <summary> /// Begins a synchronous crawl using the uri param, subscribe to events to process data as it becomes available /// </summary> public virtual CrawlResult Crawl(Uri uri, CancellationTokenSource cancellationTokenSource) { if (uri == null) throw new ArgumentNullException("uri"); _crawlContext.RootUri = _crawlContext.OriginalRootUri = uri; if (cancellationTokenSource != null) _crawlContext.CancellationTokenSource = cancellationTokenSource; _crawlResult = new CrawlResult(); _crawlResult.RootUri = _crawlContext.RootUri; _crawlResult.CrawlContext = _crawlContext; _crawlComplete = false; _logger.InfoFormat("About to crawl site [{0}]", uri.AbsoluteUri); PrintConfigValues(_crawlContext.CrawlConfiguration); if (_memoryManager != null) { _crawlContext.MemoryUsageBeforeCrawlInMb = _memoryManager.GetCurrentUsageInMb(); _logger.InfoFormat("Starting memory usage for site [{0}] is [{1}mb]", uri.AbsoluteUri, _crawlContext.MemoryUsageBeforeCrawlInMb); } _crawlContext.CrawlStartDate = DateTime.Now; Stopwatch timer = Stopwatch.StartNew(); if (_crawlContext.CrawlConfiguration.CrawlTimeoutSeconds > 0) { _timeoutTimer = new Timer(_crawlContext.CrawlConfiguration.CrawlTimeoutSeconds * 1000); _timeoutTimer.Elapsed += HandleCrawlTimeout; _timeoutTimer.Start(); } try { PageToCrawl rootPage = new PageToCrawl(uri) { ParentUri = uri, IsInternal = true, IsRoot = true }; if (ShouldSchedulePageLink(rootPage)) _scheduler.Add(rootPage); VerifyRequiredAvailableMemory(); CrawlSite(); } catch (Exception e) { _crawlResult.ErrorException = e; _logger.FatalFormat("An error occurred while crawling site [{0}]", uri); _logger.Fatal(e); } finally { if (_threadManager != null) _threadManager.Dispose(); } if (_timeoutTimer != null) _timeoutTimer.Stop(); timer.Stop(); if (_memoryManager != null) { _crawlContext.MemoryUsageAfterCrawlInMb = _memoryManager.GetCurrentUsageInMb(); _logger.InfoFormat("Ending memory usage for site [{0}] is [{1}mb]", uri.AbsoluteUri, _crawlContext.MemoryUsageAfterCrawlInMb); } _crawlResult.Elapsed = timer.Elapsed; _logger.InfoFormat("Crawl complete for site [{0}]: Crawled [{1}] pages in [{2}]", _crawlResult.RootUri.AbsoluteUri, _crawlResult.CrawlContext.CrawledCount, _crawlResult.Elapsed); return _crawlResult; } #region Synchronous Events /// <summary> /// Synchronous event that is fired before a page is crawled. /// </summary> public event EventHandler<PageCrawlStartingArgs> PageCrawlStarting; /// <summary> /// Synchronous event that is fired when an individual page has been crawled. /// </summary> public event EventHandler<PageCrawlCompletedArgs> PageCrawlCompleted; /// <summary> /// Synchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawl impl returned false. This means the page or its links were not crawled. /// </summary> public event EventHandler<PageCrawlDisallowedArgs> PageCrawlDisallowed; /// <summary> /// Synchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawlLinks impl returned false. This means the page's links were not crawled. /// </summary> public event EventHandler<PageLinksCrawlDisallowedArgs> PageLinksCrawlDisallowed; protected virtual void FirePageCrawlStartingEvent(PageToCrawl pageToCrawl) { try { EventHandler<PageCrawlStartingArgs> threadSafeEvent = PageCrawlStarting; if (threadSafeEvent != null) threadSafeEvent(this, new PageCrawlStartingArgs(_crawlContext, pageToCrawl)); } catch (Exception e) { _logger.Error("An unhandled exception was thrown by a subscriber of the PageCrawlStarting event for url:" + pageToCrawl.Uri.AbsoluteUri); _logger.Error(e); } } protected virtual void FirePageCrawlCompletedEvent(CrawledPage crawledPage) { try { EventHandler<PageCrawlCompletedArgs> threadSafeEvent = PageCrawlCompleted; if (threadSafeEvent != null) threadSafeEvent(this, new PageCrawlCompletedArgs(_crawlContext, crawledPage)); } catch (Exception e) { _logger.Error("An unhandled exception was thrown by a subscriber of the PageCrawlCompleted event for url:" + crawledPage.Uri.AbsoluteUri); _logger.Error(e); } } protected virtual void FirePageCrawlDisallowedEvent(PageToCrawl pageToCrawl, string reason) { try { EventHandler<PageCrawlDisallowedArgs> threadSafeEvent = PageCrawlDisallowed; if (threadSafeEvent != null) threadSafeEvent(this, new PageCrawlDisallowedArgs(_crawlContext, pageToCrawl, reason)); } catch (Exception e) { _logger.Error("An unhandled exception was thrown by a subscriber of the PageCrawlDisallowed event for url:" + pageToCrawl.Uri.AbsoluteUri); _logger.Error(e); } } protected virtual void FirePageLinksCrawlDisallowedEvent(CrawledPage crawledPage, string reason) { try { EventHandler<PageLinksCrawlDisallowedArgs> threadSafeEvent = PageLinksCrawlDisallowed; if (threadSafeEvent != null) threadSafeEvent(this, new PageLinksCrawlDisallowedArgs(_crawlContext, crawledPage, reason)); } catch (Exception e) { _logger.Error("An unhandled exception was thrown by a subscriber of the PageLinksCrawlDisallowed event for url:" + crawledPage.Uri.AbsoluteUri); _logger.Error(e); } } #endregion #region Asynchronous Events /// <summary> /// Asynchronous event that is fired before a page is crawled. /// </summary> public event EventHandler<PageCrawlStartingArgs> PageCrawlStartingAsync; /// <summary> /// Asynchronous event that is fired when an individual page has been crawled. /// </summary> public event EventHandler<PageCrawlCompletedArgs> PageCrawlCompletedAsync; /// <summary> /// Asynchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawl impl returned false. This means the page or its links were not crawled. /// </summary> public event EventHandler<PageCrawlDisallowedArgs> PageCrawlDisallowedAsync; /// <summary> /// Asynchronous event that is fired when the ICrawlDecisionMaker.ShouldCrawlLinks impl returned false. This means the page's links were not crawled. /// </summary> public event EventHandler<PageLinksCrawlDisallowedArgs> PageLinksCrawlDisallowedAsync; protected virtual void FirePageCrawlStartingEventAsync(PageToCrawl pageToCrawl) { EventHandler<PageCrawlStartingArgs> threadSafeEvent = PageCrawlStartingAsync; if (threadSafeEvent != null) { //Fire each subscribers delegate async foreach (EventHandler<PageCrawlStartingArgs> del in threadSafeEvent.GetInvocationList()) { del.BeginInvoke(this, new PageCrawlStartingArgs(_crawlContext, pageToCrawl), null, null); } } } protected virtual void FirePageCrawlCompletedEventAsync(CrawledPage crawledPage) { EventHandler<PageCrawlCompletedArgs> threadSafeEvent = PageCrawlCompletedAsync; if (threadSafeEvent == null) return; if (_scheduler.Count == 0) { //Must be fired synchronously to avoid main thread exiting before completion of event handler for first or last page crawled try { threadSafeEvent(this, new PageCrawlCompletedArgs(_crawlContext, crawledPage)); } catch (Exception e) { _logger.Error("An unhandled exception was thrown by a subscriber of the PageCrawlCompleted event for url:" + crawledPage.Uri.AbsoluteUri); _logger.Error(e); } } else { //Fire each subscribers delegate async foreach (EventHandler<PageCrawlCompletedArgs> del in threadSafeEvent.GetInvocationList()) { del.BeginInvoke(this, new PageCrawlCompletedArgs(_crawlContext, crawledPage), null, null); } } } protected virtual void FirePageCrawlDisallowedEventAsync(PageToCrawl pageToCrawl, string reason) { EventHandler<PageCrawlDisallowedArgs> threadSafeEvent = PageCrawlDisallowedAsync; if (threadSafeEvent != null) { //Fire each subscribers delegate async foreach (EventHandler<PageCrawlDisallowedArgs> del in threadSafeEvent.GetInvocationList()) { del.BeginInvoke(this, new PageCrawlDisallowedArgs(_crawlContext, pageToCrawl, reason), null, null); } } } protected virtual void FirePageLinksCrawlDisallowedEventAsync(CrawledPage crawledPage, string reason) { EventHandler<PageLinksCrawlDisallowedArgs> threadSafeEvent = PageLinksCrawlDisallowedAsync; if (threadSafeEvent != null) { //Fire each subscribers delegate async foreach (EventHandler<PageLinksCrawlDisallowedArgs> del in threadSafeEvent.GetInvocationList()) { del.BeginInvoke(this, new PageLinksCrawlDisallowedArgs(_crawlContext, crawledPage, reason), null, null); } } } #endregion /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page should be crawled or not /// </summary> public void ShouldCrawlPage(Func<PageToCrawl, CrawlContext, CrawlDecision> decisionMaker) { _shouldCrawlPageDecisionMaker = decisionMaker; } /// <summary> /// Synchronous method that registers a delegate to be called to determine whether the page's content should be dowloaded /// </summary> /// <param name="shouldDownloadPageContent"></param> public void ShouldDownloadPageContent(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker) { _shouldDownloadPageContentDecisionMaker = decisionMaker; } /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page's links should be crawled or not /// </summary> /// <param name="shouldCrawlPageLinksDelegate"></param> public void ShouldCrawlPageLinks(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker) { _shouldCrawlPageLinksDecisionMaker = decisionMaker; } /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a cerain link on a page should be scheduled to be crawled /// </summary> public void ShouldScheduleLink(Func<Uri, CrawledPage, CrawlContext, bool> decisionMaker) { _shouldScheduleLinkDecisionMaker = decisionMaker; } /// <summary> /// Synchronous method that registers a delegate to be called to determine whether a page should be recrawled or not /// </summary> public void ShouldRecrawlPage(Func<CrawledPage, CrawlContext, CrawlDecision> decisionMaker) { _shouldRecrawlPageDecisionMaker = decisionMaker; } /// <summary> /// Synchronous method that registers a delegate to be called to determine whether the 1st uri param is considered an internal uri to the second uri param /// </summary> /// <param name="decisionMaker delegate"></param> public void IsInternalUri(Func<Uri, Uri, bool> decisionMaker) { _isInternalDecisionMaker = decisionMaker; } private CrawlConfiguration GetCrawlConfigurationFromConfigFile() { AbotConfigurationSectionHandler configFromFile = AbotConfigurationSectionHandler.LoadFromXml(); if (configFromFile == null) throw new InvalidOperationException("abot config section was NOT found"); _logger.DebugFormat("abot config section was found"); return configFromFile.Convert(); } protected virtual void CrawlSite() { while (!_crawlComplete) { RunPreWorkChecks(); if (_scheduler.Count > 0) { _threadManager.DoWork(() => ProcessPage(_scheduler.GetNext())); } else if (!_threadManager.HasRunningThreads()) { _crawlComplete = true; } else { _logger.DebugFormat("Waiting for links to be scheduled..."); Thread.Sleep(2500); } } } protected virtual void VerifyRequiredAvailableMemory() { if (_crawlContext.CrawlConfiguration.MinAvailableMemoryRequiredInMb < 1) return; if (!_memoryManager.IsSpaceAvailable(_crawlContext.CrawlConfiguration.MinAvailableMemoryRequiredInMb)) throw new InsufficientMemoryException(string.Format("Process does not have the configured [{0}mb] of available memory to crawl site [{1}]. This is configurable through the minAvailableMemoryRequiredInMb in app.conf or CrawlConfiguration.MinAvailableMemoryRequiredInMb.", _crawlContext.CrawlConfiguration.MinAvailableMemoryRequiredInMb, _crawlContext.RootUri)); } protected virtual void RunPreWorkChecks() { CheckMemoryUsage(); CheckForCancellationRequest(); CheckForHardStopRequest(); CheckForStopRequest(); } protected virtual void CheckMemoryUsage() { if (_memoryManager == null || _crawlContext.IsCrawlHardStopRequested || _crawlContext.CrawlConfiguration.MaxMemoryUsageInMb < 1) return; int currentMemoryUsage = _memoryManager.GetCurrentUsageInMb(); if (_logger.IsDebugEnabled) _logger.DebugFormat("Current memory usage for site [{0}] is [{1}mb]", _crawlContext.RootUri, currentMemoryUsage); if (currentMemoryUsage > _crawlContext.CrawlConfiguration.MaxMemoryUsageInMb) { _memoryManager.Dispose(); _memoryManager = null; string message = string.Format("Process is using [{0}mb] of memory which is above the max configured of [{1}mb] for site [{2}]. This is configurable through the maxMemoryUsageInMb in app.conf or CrawlConfiguration.MaxMemoryUsageInMb.", currentMemoryUsage, _crawlContext.CrawlConfiguration.MaxMemoryUsageInMb, _crawlContext.RootUri); _crawlResult.ErrorException = new InsufficientMemoryException(message); _logger.Fatal(_crawlResult.ErrorException); _crawlContext.IsCrawlHardStopRequested = true; } } protected virtual void CheckForCancellationRequest() { if (_crawlContext.CancellationTokenSource.IsCancellationRequested) { if (!_crawlCancellationReported) { string message = string.Format("Crawl cancellation requested for site [{0}]!", _crawlContext.RootUri); _logger.Fatal(message); _crawlResult.ErrorException = new OperationCanceledException(message, _crawlContext.CancellationTokenSource.Token); _crawlContext.IsCrawlHardStopRequested = true; _crawlCancellationReported = true; } } } protected virtual void CheckForHardStopRequest() { if (_crawlContext.IsCrawlHardStopRequested) { if (!_crawlStopReported) { _logger.InfoFormat("Hard crawl stop requested for site [{0}]!", _crawlContext.RootUri); _crawlStopReported = true; } _scheduler.Clear(); _threadManager.AbortAll(); _scheduler.Clear();//to be sure nothing was scheduled since first call to clear() //Set all events to null so no more events are fired PageCrawlStarting = null; PageCrawlCompleted = null; PageCrawlDisallowed = null; PageLinksCrawlDisallowed = null; PageCrawlStartingAsync = null; PageCrawlCompletedAsync = null; PageCrawlDisallowedAsync = null; PageLinksCrawlDisallowedAsync = null; } } protected virtual void CheckForStopRequest() { if (_crawlContext.IsCrawlStopRequested) { if (!_crawlStopReported) { _logger.InfoFormat("Crawl stop requested for site [{0}]!", _crawlContext.RootUri); _crawlStopReported = true; } _scheduler.Clear(); } } protected virtual void HandleCrawlTimeout(object sender, ElapsedEventArgs e) { Timer elapsedTimer = sender as Timer; if (elapsedTimer != null) elapsedTimer.Stop(); _logger.InfoFormat("Crawl timeout of [{0}] seconds has been reached for [{1}]", _crawlContext.CrawlConfiguration.CrawlTimeoutSeconds, _crawlContext.RootUri); _crawlContext.IsCrawlHardStopRequested = true; } //protected virtual async Task ProcessPage(PageToCrawl pageToCrawl) protected virtual void ProcessPage(PageToCrawl pageToCrawl) { try { if (pageToCrawl == null) return; ThrowIfCancellationRequested(); AddPageToContext(pageToCrawl); //CrawledPage crawledPage = await CrawlThePage(pageToCrawl); CrawledPage crawledPage = CrawlThePage(pageToCrawl); // Validate the root uri in case of a redirection. if (crawledPage.IsRoot) ValidateRootUriForRedirection(crawledPage); if (IsRedirect(crawledPage) && !_crawlContext.CrawlConfiguration.IsHttpRequestAutoRedirectsEnabled) ProcessRedirect(crawledPage); if (PageSizeIsAboveMax(crawledPage)) return; ThrowIfCancellationRequested(); bool shouldCrawlPageLinks = ShouldCrawlPageLinks(crawledPage); if (shouldCrawlPageLinks || _crawlContext.CrawlConfiguration.IsForcedLinkParsingEnabled) ParsePageLinks(crawledPage); ThrowIfCancellationRequested(); if (shouldCrawlPageLinks) SchedulePageLinks(crawledPage); ThrowIfCancellationRequested(); FirePageCrawlCompletedEventAsync(crawledPage); FirePageCrawlCompletedEvent(crawledPage); if (ShouldRecrawlPage(crawledPage)) { crawledPage.IsRetry = true; _scheduler.Add(crawledPage); } } catch (OperationCanceledException oce) { _logger.DebugFormat("Thread cancelled while crawling/processing page [{0}]", pageToCrawl.Uri); throw; } catch (Exception e) { _crawlResult.ErrorException = e; _logger.FatalFormat("Error occurred during processing of page [{0}]", pageToCrawl.Uri); _logger.Fatal(e); _crawlContext.IsCrawlHardStopRequested = true; } } protected virtual void ProcessRedirect(CrawledPage crawledPage) { if (crawledPage.RedirectPosition >= 20) _logger.WarnFormat("Page [{0}] is part of a chain of 20 or more consecutive redirects, redirects for this chain will now be aborted.", crawledPage.Uri); try { var uri = ExtractRedirectUri(crawledPage); PageToCrawl page = new PageToCrawl(uri); page.ParentUri = crawledPage.ParentUri; page.CrawlDepth = crawledPage.CrawlDepth; page.IsInternal = IsInternalUri(uri); page.IsRoot = false; page.RedirectedFrom = crawledPage; page.RedirectPosition = crawledPage.RedirectPosition + 1; crawledPage.RedirectedTo = page; _logger.DebugFormat("Page [{0}] is requesting that it be redirect to [{1}]", crawledPage.Uri, crawledPage.RedirectedTo.Uri); if (ShouldSchedulePageLink(page)) { _logger.InfoFormat("Page [{0}] will be redirect to [{1}]", crawledPage.Uri, crawledPage.RedirectedTo.Uri); _scheduler.Add(page); } } catch {} } protected virtual bool IsInternalUri(Uri uri) { return _isInternalDecisionMaker(uri, _crawlContext.RootUri) || _isInternalDecisionMaker(uri, _crawlContext.OriginalRootUri); } protected virtual bool IsRedirect(CrawledPage crawledPage) { bool isRedirect = false; if (crawledPage.HttpWebResponse != null) { isRedirect = (_crawlContext.CrawlConfiguration.IsHttpRequestAutoRedirectsEnabled && crawledPage.HttpWebResponse.ResponseUri != null && crawledPage.HttpWebResponse.ResponseUri.AbsoluteUri != crawledPage.Uri.AbsoluteUri) || (!_crawlContext.CrawlConfiguration.IsHttpRequestAutoRedirectsEnabled && (int) crawledPage.HttpWebResponse.StatusCode >= 300 && (int) crawledPage.HttpWebResponse.StatusCode <= 399); } return isRedirect; } protected virtual void ThrowIfCancellationRequested() { if (_crawlContext.CancellationTokenSource != null && _crawlContext.CancellationTokenSource.IsCancellationRequested) _crawlContext.CancellationTokenSource.Token.ThrowIfCancellationRequested(); } protected virtual bool PageSizeIsAboveMax(CrawledPage crawledPage) { bool isAboveMax = false; if (_crawlContext.CrawlConfiguration.MaxPageSizeInBytes > 0 && crawledPage.Content.Bytes != null && crawledPage.Content.Bytes.Length > _crawlContext.CrawlConfiguration.MaxPageSizeInBytes) { isAboveMax = true; _logger.InfoFormat("Page [{0}] has a page size of [{1}] bytes which is above the [{2}] byte max, no further processing will occur for this page", crawledPage.Uri, crawledPage.Content.Bytes.Length, _crawlContext.CrawlConfiguration.MaxPageSizeInBytes); } return isAboveMax; } protected virtual bool ShouldCrawlPageLinks(CrawledPage crawledPage) { CrawlDecision shouldCrawlPageLinksDecision = _crawlDecisionMaker.ShouldCrawlPageLinks(crawledPage, _crawlContext); if (shouldCrawlPageLinksDecision.Allow) shouldCrawlPageLinksDecision = (_shouldCrawlPageLinksDecisionMaker != null) ? _shouldCrawlPageLinksDecisionMaker.Invoke(crawledPage, _crawlContext) : new CrawlDecision { Allow = true }; if (!shouldCrawlPageLinksDecision.Allow) { _logger.DebugFormat("Links on page [{0}] not crawled, [{1}]", crawledPage.Uri.AbsoluteUri, shouldCrawlPageLinksDecision.Reason); FirePageLinksCrawlDisallowedEventAsync(crawledPage, shouldCrawlPageLinksDecision.Reason); FirePageLinksCrawlDisallowedEvent(crawledPage, shouldCrawlPageLinksDecision.Reason); } SignalCrawlStopIfNeeded(shouldCrawlPageLinksDecision); return shouldCrawlPageLinksDecision.Allow; } protected virtual bool ShouldCrawlPage(PageToCrawl pageToCrawl) { if (_maxPagesToCrawlLimitReachedOrScheduled) return false; CrawlDecision shouldCrawlPageDecision = _crawlDecisionMaker.ShouldCrawlPage(pageToCrawl, _crawlContext); if (!shouldCrawlPageDecision.Allow && shouldCrawlPageDecision.Reason.Contains("MaxPagesToCrawl limit of")) { _maxPagesToCrawlLimitReachedOrScheduled = true; _logger.Info("MaxPagesToCrawlLimit has been reached or scheduled. No more pages will be scheduled."); return false; } if (shouldCrawlPageDecision.Allow) shouldCrawlPageDecision = (_shouldCrawlPageDecisionMaker != null) ? _shouldCrawlPageDecisionMaker.Invoke(pageToCrawl, _crawlContext) : new CrawlDecision { Allow = true }; if (!shouldCrawlPageDecision.Allow) { _logger.DebugFormat("Page [{0}] not crawled, [{1}]", pageToCrawl.Uri.AbsoluteUri, shouldCrawlPageDecision.Reason); FirePageCrawlDisallowedEventAsync(pageToCrawl, shouldCrawlPageDecision.Reason); FirePageCrawlDisallowedEvent(pageToCrawl, shouldCrawlPageDecision.Reason); } SignalCrawlStopIfNeeded(shouldCrawlPageDecision); return shouldCrawlPageDecision.Allow; } protected virtual bool ShouldRecrawlPage(CrawledPage crawledPage) { //TODO No unit tests cover these lines CrawlDecision shouldRecrawlPageDecision = _crawlDecisionMaker.ShouldRecrawlPage(crawledPage, _crawlContext); if (shouldRecrawlPageDecision.Allow) shouldRecrawlPageDecision = (_shouldRecrawlPageDecisionMaker != null) ? _shouldRecrawlPageDecisionMaker.Invoke(crawledPage, _crawlContext) : new CrawlDecision { Allow = true }; if (!shouldRecrawlPageDecision.Allow) { _logger.DebugFormat("Page [{0}] not recrawled, [{1}]", crawledPage.Uri.AbsoluteUri, shouldRecrawlPageDecision.Reason); } else { // Look for the Retry-After header in the response. crawledPage.RetryAfter = null; if (crawledPage.HttpWebResponse != null && crawledPage.HttpWebResponse.Headers != null) { string value = crawledPage.HttpWebResponse.GetResponseHeader("Retry-After"); if (!String.IsNullOrEmpty(value)) { // Try to convert to DateTime first, then in double. DateTime date; double seconds; if (crawledPage.LastRequest.HasValue && DateTime.TryParse(value, out date)) { crawledPage.RetryAfter = (date - crawledPage.LastRequest.Value).TotalSeconds; } else if (double.TryParse(value, out seconds)) { crawledPage.RetryAfter = seconds; } } } } SignalCrawlStopIfNeeded(shouldRecrawlPageDecision); return shouldRecrawlPageDecision.Allow; } //protected virtual async Task<CrawledPage> CrawlThePage(PageToCrawl pageToCrawl) protected virtual CrawledPage CrawlThePage(PageToCrawl pageToCrawl) { _logger.DebugFormat("About to crawl page [{0}]", pageToCrawl.Uri.AbsoluteUri); FirePageCrawlStartingEventAsync(pageToCrawl); FirePageCrawlStartingEvent(pageToCrawl); if (pageToCrawl.IsRetry){ WaitMinimumRetryDelay(pageToCrawl); } pageToCrawl.LastRequest = DateTime.Now; CrawledPage crawledPage = _pageRequester.MakeRequest(pageToCrawl.Uri, ShouldDownloadPageContent); //CrawledPage crawledPage = await _pageRequester.MakeRequestAsync(pageToCrawl.Uri, ShouldDownloadPageContent); Map(pageToCrawl, crawledPage); if (crawledPage.HttpWebResponse == null) _logger.InfoFormat("Page crawl complete, Status:[NA] Url:[{0}] Elapsed:[{1}] Parent:[{2}] Retry:[{3}]", crawledPage.Uri.AbsoluteUri, crawledPage.Elapsed, crawledPage.ParentUri, crawledPage.RetryCount); else _logger.InfoFormat("Page crawl complete, Status:[{0}] Url:[{1}] Elapsed:[{2}] Parent:[{3}] Retry:[{4}]", Convert.ToInt32(crawledPage.HttpWebResponse.StatusCode), crawledPage.Uri.AbsoluteUri, crawledPage.Elapsed, crawledPage.ParentUri, crawledPage.RetryCount); return crawledPage; } protected void Map(PageToCrawl src, CrawledPage dest) { dest.Uri = src.Uri; dest.ParentUri = src.Uri; dest.IsRetry = src.IsRetry; dest.RetryAfter = src.RetryAfter; dest.RetryCount = src.RetryCount; dest.LastRequest = src.LastRequest; dest.IsRoot = src.IsRoot; dest.IsInternal = src.IsInternal; dest.PageBag = CombinePageBags(src.PageBag, dest.PageBag); dest.CrawlDepth = src.CrawlDepth; dest.RedirectedFrom = src.RedirectedFrom; dest.RedirectPosition = src.RedirectPosition; } protected virtual dynamic CombinePageBags(dynamic pageToCrawlBag, dynamic crawledPageBag) { IDictionary<string, object> combinedBag = new ExpandoObject(); var pageToCrawlBagDict = pageToCrawlBag as IDictionary<string, object>; var crawledPageBagDict = crawledPageBag as IDictionary<string, object>; foreach (KeyValuePair<string, object> entry in pageToCrawlBagDict) combinedBag[entry.Key] = entry.Value; foreach (KeyValuePair<string, object> entry in crawledPageBagDict) combinedBag[entry.Key] = entry.Value; return combinedBag; } protected virtual void AddPageToContext(PageToCrawl pageToCrawl) { if (pageToCrawl.IsRetry) { pageToCrawl.RetryCount++; return; } int domainCount = 0; Interlocked.Increment(ref _crawlContext.CrawledCount); _crawlContext.CrawlCountByDomain.AddOrUpdate(pageToCrawl.Uri.Authority, 1, (key, oldValue) => oldValue + 1); } protected virtual void ParsePageLinks(CrawledPage crawledPage) { crawledPage.ParsedLinks = _hyperLinkParser.GetLinks(crawledPage); } protected virtual void SchedulePageLinks(CrawledPage crawledPage) { int linksToCrawl = 0; foreach (Uri uri in crawledPage.ParsedLinks) { // First validate that the link was not already visited or added to the list of pages to visit, so we don't // make the same validation and fire the same events twice. if (!_scheduler.IsUriKnown(uri) && (_shouldScheduleLinkDecisionMaker == null || _shouldScheduleLinkDecisionMaker.Invoke(uri, crawledPage, _crawlContext))) { try //Added due to a bug in the Uri class related to this (http://stackoverflow.com/questions/2814951/system-uriformatexception-invalid-uri-the-hostname-could-not-be-parsed) { PageToCrawl page = new PageToCrawl(uri); page.ParentUri = crawledPage.Uri; page.CrawlDepth = crawledPage.CrawlDepth + 1; page.IsInternal = IsInternalUri(uri); page.IsRoot = false; if (ShouldSchedulePageLink(page)) { _scheduler.Add(page); linksToCrawl++; } if (!ShouldScheduleMorePageLink(linksToCrawl)) { _logger.InfoFormat("MaxLinksPerPage has been reached. No more links will be scheduled for current page [{0}].", crawledPage.Uri); break; } } catch { } } // Add this link to the list of known Urls so validations are not duplicated in the future. _scheduler.AddKnownUri(uri); } } protected virtual bool ShouldSchedulePageLink(PageToCrawl page) { if ((page.IsInternal || _crawlContext.CrawlConfiguration.IsExternalPageCrawlingEnabled) && (ShouldCrawlPage(page))) return true; return false; } protected virtual bool ShouldScheduleMorePageLink(int linksAdded) { return _crawlContext.CrawlConfiguration.MaxLinksPerPage == 0 || _crawlContext.CrawlConfiguration.MaxLinksPerPage > linksAdded; } protected virtual CrawlDecision ShouldDownloadPageContent(CrawledPage crawledPage) { CrawlDecision decision = _crawlDecisionMaker.ShouldDownloadPageContent(crawledPage, _crawlContext); if (decision.Allow) decision = (_shouldDownloadPageContentDecisionMaker != null) ? _shouldDownloadPageContentDecisionMaker.Invoke(crawledPage, _crawlContext) : new CrawlDecision { Allow = true }; SignalCrawlStopIfNeeded(decision); return decision; } protected virtual void PrintConfigValues(CrawlConfiguration config) { _logger.Info("Configuration Values:"); string indentString = new string(' ', 2); string abotVersion = Assembly.GetAssembly(this.GetType()).GetName().Version.ToString(); _logger.InfoFormat("{0}Abot Version: {1}", indentString, abotVersion); foreach (PropertyInfo property in config.GetType().GetProperties()) { if (property.Name != "ConfigurationExtensions") _logger.InfoFormat("{0}{1}: {2}", indentString, property.Name, property.GetValue(config, null)); } foreach (string key in config.ConfigurationExtensions.Keys) { _logger.InfoFormat("{0}{1}: {2}", indentString, key, config.ConfigurationExtensions[key]); } } protected virtual void SignalCrawlStopIfNeeded(CrawlDecision decision) { if (decision.ShouldHardStopCrawl) { _logger.InfoFormat("Decision marked crawl [Hard Stop] for site [{0}], [{1}]", _crawlContext.RootUri, decision.Reason); _crawlContext.IsCrawlHardStopRequested = decision.ShouldHardStopCrawl; } else if (decision.ShouldStopCrawl) { _logger.InfoFormat("Decision marked crawl [Stop] for site [{0}], [{1}]", _crawlContext.RootUri, decision.Reason); _crawlContext.IsCrawlStopRequested = decision.ShouldStopCrawl; } } protected virtual void WaitMinimumRetryDelay(PageToCrawl pageToCrawl) { //TODO No unit tests cover these lines if (pageToCrawl.LastRequest == null) { _logger.WarnFormat("pageToCrawl.LastRequest value is null for Url:{0}. Cannot retry without this value.", pageToCrawl.Uri.AbsoluteUri); return; } double milliSinceLastRequest = (DateTime.Now - pageToCrawl.LastRequest.Value).TotalMilliseconds; double milliToWait; if (pageToCrawl.RetryAfter.HasValue) { // Use the time to wait provided by the server instead of the config, if any. milliToWait = pageToCrawl.RetryAfter.Value*1000 - milliSinceLastRequest; } else { if (!(milliSinceLastRequest < _crawlContext.CrawlConfiguration.MinRetryDelayInMilliseconds)) return; milliToWait = _crawlContext.CrawlConfiguration.MinRetryDelayInMilliseconds - milliSinceLastRequest; } _logger.InfoFormat("Waiting [{0}] milliseconds before retrying Url:[{1}] LastRequest:[{2}] SoonestNextRequest:[{3}]", milliToWait, pageToCrawl.Uri.AbsoluteUri, pageToCrawl.LastRequest, pageToCrawl.LastRequest.Value.AddMilliseconds(_crawlContext.CrawlConfiguration.MinRetryDelayInMilliseconds)); //TODO Cannot use RateLimiter since it currently cannot handle dynamic sleep times so using Thread.Sleep in the meantime if (milliToWait > 0) Thread.Sleep(TimeSpan.FromMilliseconds(milliToWait)); } /// <summary> /// Validate that the Root page was not redirected. If the root page is redirected, we assume that the root uri /// should be changed to the uri where it was redirected. /// </summary> protected virtual void ValidateRootUriForRedirection(CrawledPage crawledRootPage) { if (!crawledRootPage.IsRoot) { throw new ArgumentException("The crawled page must be the root page to be validated for redirection."); } if (IsRedirect(crawledRootPage)) { _crawlContext.RootUri = ExtractRedirectUri(crawledRootPage); _logger.InfoFormat("The root URI [{0}] was redirected to [{1}]. [{1}] is the new root.", _crawlContext.OriginalRootUri, _crawlContext.RootUri); } } /// <summary> /// Retrieve the URI where the specified crawled page was redirected. /// </summary> /// <remarks> /// If HTTP auto redirections is disabled, this value is stored in the 'Location' header of the response. /// If auto redirections is enabled, this value is stored in the response's ResponseUri property. /// </remarks> protected virtual Uri ExtractRedirectUri(CrawledPage crawledPage) { Uri locationUri; if (_crawlContext.CrawlConfiguration.IsHttpRequestAutoRedirectsEnabled) { // For auto redirects, look for the response uri. locationUri = crawledPage.HttpWebResponse.ResponseUri; } else { // For manual redirects, we need to look for the location header. var location = crawledPage.HttpWebResponse.Headers["Location"]; // Check if the location is absolute. If not, create an absolute uri. if (!Uri.TryCreate(location, UriKind.Absolute, out locationUri)) { Uri baseUri = new Uri(crawledPage.Uri.GetLeftPart(UriPartial.Authority)); locationUri = new Uri(baseUri, location); } } return locationUri; } public virtual void Dispose() { if (_threadManager != null) { _threadManager.Dispose(); } if (_scheduler != null) { _scheduler.Dispose(); } if (_pageRequester != null) { _pageRequester.Dispose(); } if (_memoryManager != null) { _memoryManager.Dispose(); } } } }
45.46696
376
0.617072
[ "Apache-2.0" ]
CerebralMischief/abot
Abot/Crawler/WebCrawler.cs
51,607
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using HoloToolkit.Unity.Receivers; using HoloToolkit.Unity.InputModule; using UnityEngine.UI; public class ImplicitBtnReceiver : InteractionReceiver { private InputField inputField; private GameObject implicitMenu; private Manager manager; private GameObject inputPanel; public CalculatorWrapper cw; // Use this for initialization void Start () { inputField = GameObject.Find("InputField").GetComponent<HoloToolkit.UI.Keyboard.KeyboardInputField>(); implicitMenu = GameObject.Find("ImplicitButtons"); manager = GameObject.Find("manager").GetComponent<Manager>(); inputPanel = GameObject.Find("KeyboardCanvas"); cw = GameObject.Find("manager").GetComponent<CalculatorWrapper>(); } // Update is called once per frame void Update () { } protected override void InputClicked(GameObject obj, InputClickedEventData eventData) { switch(obj.name) { case "HolographicButton(3D)": { Debug.Log("start draw 3d implicit function"); implicitMenu.SetActive(false); inputPanel.SetActive(false); cw.calculate(inputField.text); break; } case "HolographicButton(2D)": { Debug.Log("start draw 2d implicit function"); implicitMenu.SetActive(false); inputPanel.SetActive(false); cw.calculatevec(inputField.text); break; } } } }
31.788462
110
0.620085
[ "MIT" ]
rebas777/3D-Function-Visualization
Assets/Scripts/ImplicitButtons/ImplicitBtnReceiver.cs
1,655
C#
using System; using ClientBuilder.Common; using ClientBuilder.Core.Modules; using ClientBuilder.Core.Scanning; using ClientBuilder.Options; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace ClientBuilder.Extensions; /// <summary> /// Extensions for <see cref="WebApplicationBuilder"/>. /// </summary> public static class WebApplicationBuilderExtensions { /// <summary> /// Registers all Client Builder modules and related services. /// </summary> /// <param name="builder"></param> /// <param name="optionsAction"></param> /// <returns></returns> public static WebApplicationBuilder AddClientBuilder(this WebApplicationBuilder builder, Action<ClientBuilderOptions> optionsAction) { if (!builder.Environment.IsDevelopment()) { return builder; } var options = new ClientBuilderOptions(); optionsAction?.Invoke(options); builder.Services.AddOptions<ClientBuilderOptions>(); builder.Services.PostConfigure(optionsAction); builder.Services.AddSingleton<IScaffoldModuleFactory, ScaffoldModuleFactory>(); builder.Services.AddSingleton<IFileSystemManager, FileSystemManager>(); builder.Services.AddSingleton<IScaffoldModuleRepository, ScaffoldModuleRepository>(); builder.Services.AddScoped<IScaffoldModuleGenerator, ScaffoldModuleGenerator>(); builder.Services.AddScoped<IAssemblyScanner, AssemblyScanner>(); builder.Services.AddScoped<IDescriptionExtractor, DescriptionExtractor>(); builder.Services.AddScoped<ISourceRepository, SourceRepository>(); foreach (var modulesType in options.ModulesTypes) { builder.Services.AddScoped(modulesType); } builder.Services.AddCors(options => { options.AddPolicy(Constants.ClientBuilderCorsPolicy, builder => { builder .WithOrigins( "https://clientbuilder.dev", "https://localhost:7069", "http://localhost:5069") .AllowAnyHeader() .AllowAnyMethod(); }); }); return builder; } }
35.538462
136
0.661472
[ "MIT" ]
clientbuilder/clientbuilder
src/ClientBuilder/Extensions/WebApplicationBuilderExtensions.cs
2,312
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace TriggleTextBox { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } }
21.37931
44
0.71129
[ "MIT" ]
LinZong/WPF-SeletableTextBox
TriggleTextBox/MainWindow.xaml.cs
632
C#