System.Enum.Equals(object)

Here are the examples of the csharp api System.Enum.Equals(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

520 Examples 7

19 Source : Exploit.cs
with GNU General Public License v3.0
from 0x00-0x00

private static Boolean HasFullControl(string path, string username)
        {

            bool fc = false;
            FileInfo file = new FileInfo($@"{path}");
            FileSecurity acl = file.GetAccessControl();

            foreach (FileSystemAccessRule rule in acl.GetAccessRules(true, true, typeof(NTAccount)))
            {
                if (rule.IdenreplacedyReference.Value.Equals(username) & rule.FileSystemRights.Equals(FileSystemRights.FullControl))
                    fc = true;
            }

            return fc;

        }

19 Source : BuildUtils.cs
with MIT License
from 1ZouLTReX1

public static void KillAllProcesses()
    {
        foreach (GameLoopMode loopMode in Enum.GetValues(typeof(GameLoopMode)))
        {
            if (loopMode.Equals(GameLoopMode.Undefined))
                continue;

            var buildExe = GetBuildExe(loopMode);

            var processName = Path.GetFileNameWithoutExtension(buildExe);
            var processes = System.Diagnostics.Process.GetProcesses();

            foreach (var process in processes)
            {
                if (process.HasExited)
                    continue;

                try
                {
                    if (process.ProcessName != null && process.ProcessName == processName)
                    {
                        process.Kill();
                    }
                }
                catch (InvalidOperationException)
                {

                }
            }
        }
    }

19 Source : BuildWindow.cs
with MIT License
from 1ZouLTReX1

static void KillAllProcesses()
    {
        foreach (GameLoopMode loopMode in Enum.GetValues(typeof(GameLoopMode)))
        {
            if (loopMode.Equals(GameLoopMode.Undefined))
                continue;

            var buildExe = GetBuildExe(loopMode);

            var processName = Path.GetFileNameWithoutExtension(buildExe);
            var processes = System.Diagnostics.Process.GetProcesses();
            foreach (var process in processes)
            {
                if (process.HasExited)
                    continue;

                try
                {
                    if (process.ProcessName != null && process.ProcessName == processName)
                    {
                        process.Kill();
                    }
                }
                catch (InvalidOperationException)
                {

                }
            }
        }
    }

19 Source : Name.cs
with MIT License
from Adyen

public bool Equals(Name input)
        {
            if (input == null)
                return false;

            return
                (
                    this.FirstName == input.FirstName ||
                    this.FirstName != null &&
                    this.FirstName.Equals(input.FirstName)
                ) &&
                (
                    this.Gender == input.Gender ||
                    this.Gender != null &&
                    this.Gender.Equals(input.Gender)
                ) &&
                (
                    this.Infix == input.Infix ||
                    this.Infix != null &&
                    this.Infix.Equals(input.Infix)
                ) &&
                (
                    this.LastName == input.LastName ||
                    this.LastName != null &&
                    this.LastName.Equals(input.LastName)
                );
        }

19 Source : PaymentLinkResource.cs
with MIT License
from Adyen

public bool Equals(PaymentLinkResource input)
        {
            if (input == null)
                return false;

            return
                (
                    this.AllowedPaymentMethods == input.AllowedPaymentMethods ||
                    this.AllowedPaymentMethods != null &&
                    input.AllowedPaymentMethods != null &&
                    this.AllowedPaymentMethods.SequenceEqual(input.AllowedPaymentMethods)
                ) &&
                (
                    this.Amount == input.Amount ||
                    this.Amount != null &&
                    this.Amount.Equals(input.Amount)
                ) &&
                (
                    this.ApplicationInfo == input.ApplicationInfo ||
                    this.ApplicationInfo != null &&
                    this.ApplicationInfo.Equals(input.ApplicationInfo)
                ) &&
                (
                    this.BillingAddress == input.BillingAddress ||
                    this.BillingAddress != null &&
                    this.BillingAddress.Equals(input.BillingAddress)
                ) &&
                (
                    this.BlockedPaymentMethods == input.BlockedPaymentMethods ||
                    this.BlockedPaymentMethods != null &&
                    input.BlockedPaymentMethods != null &&
                    this.BlockedPaymentMethods.SequenceEqual(input.BlockedPaymentMethods)
                ) &&
                (
                    this.CountryCode == input.CountryCode ||
                    this.CountryCode != null &&
                    this.CountryCode.Equals(input.CountryCode)
                ) &&
                (
                    this.DeliverAt == input.DeliverAt ||
                    this.DeliverAt != null &&
                    this.DeliverAt.Equals(input.DeliverAt)
                ) &&
                (
                    this.DeliveryAddress == input.DeliveryAddress ||
                    this.DeliveryAddress != null &&
                    this.DeliveryAddress.Equals(input.DeliveryAddress)
                ) &&
                (
                    this.Description == input.Description ||
                    this.Description != null &&
                    this.Description.Equals(input.Description)
                ) &&
                (
                    this.ExpiresAt == input.ExpiresAt ||
                    this.ExpiresAt != null &&
                    this.ExpiresAt.Equals(input.ExpiresAt)
                ) &&
                (
                    this.Id == input.Id ||
                    this.Id != null &&
                    this.Id.Equals(input.Id)
                ) &&
                (
                    this.LineItems == input.LineItems ||
                    this.LineItems != null &&
                    input.LineItems != null &&
                    this.LineItems.SequenceEqual(input.LineItems)
                ) &&
                (
                    this.MerchantAccount == input.MerchantAccount ||
                    this.MerchantAccount != null &&
                    this.MerchantAccount.Equals(input.MerchantAccount)
                ) &&
                (
                    this.MerchantOrderReference == input.MerchantOrderReference ||
                    this.MerchantOrderReference != null &&
                    this.MerchantOrderReference.Equals(input.MerchantOrderReference)
                ) &&
                (
                    this.RecurringProcessingModel == input.RecurringProcessingModel ||
                    this.RecurringProcessingModel != null &&
                    this.RecurringProcessingModel.Equals(input.RecurringProcessingModel)
                ) &&
                (
                    this.Reference == input.Reference ||
                    this.Reference != null &&
                    this.Reference.Equals(input.Reference)
                ) &&
                (
                    this.ReturnUrl == input.ReturnUrl ||
                    this.ReturnUrl != null &&
                    this.ReturnUrl.Equals(input.ReturnUrl)
                ) &&
                (
                    this.Reusable == input.Reusable ||
                    this.Reusable != null &&
                    this.Reusable.Equals(input.Reusable)
                ) &&
                (
                    this.RiskData == input.RiskData ||
                    this.RiskData != null &&
                    this.RiskData.Equals(input.RiskData)
                ) &&
                (
                    this.ShopperEmail == input.ShopperEmail ||
                    this.ShopperEmail != null &&
                    this.ShopperEmail.Equals(input.ShopperEmail)
                ) &&
                (
                    this.ShopperLocale == input.ShopperLocale ||
                    this.ShopperLocale != null &&
                    this.ShopperLocale.Equals(input.ShopperLocale)
                ) &&
                (
                    this.ShopperName == input.ShopperName ||
                    this.ShopperName != null &&
                    this.ShopperName.Equals(input.ShopperName)
                ) &&
                (
                    this.ShopperReference == input.ShopperReference ||
                    this.ShopperReference != null &&
                    this.ShopperReference.Equals(input.ShopperReference)
                ) &&
                (
                    this.Splits == input.Splits ||
                    this.Splits != null &&
                    input.Splits != null &&
                    this.Splits.SequenceEqual(input.Splits)
                ) &&
                (
                    this.Status == input.Status ||
                    this.Status != null &&
                    this.Status.Equals(input.Status)
                ) &&
                (
                    this.Store == input.Store ||
                    this.Store != null &&
                    this.Store.Equals(input.Store)
                ) &&
                (
                    this.StorePaymentMethod == input.StorePaymentMethod ||
                    this.StorePaymentMethod != null &&
                    this.StorePaymentMethod.Equals(input.StorePaymentMethod)
                ) &&
                (
                    this.Url == input.Url ||
                    this.Url != null &&
                    this.Url.Equals(input.Url)
                );
        }

19 Source : Split.cs
with MIT License
from Adyen

public bool Equals(Split input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Account == input.Account ||
                    this.Account != null &&
                    this.Account.Equals(input.Account)
                ) &&
                (
                    this.Amount == input.Amount ||
                    this.Amount != null &&
                    this.Amount.Equals(input.Amount)
                ) &&
                (
                    this.Description == input.Description ||
                    this.Description != null &&
                    this.Description.Equals(input.Description)
                ) &&
                (
                    this.Reference == input.Reference ||
                    this.Reference != null &&
                    this.Reference.Equals(input.Reference)
                ) &&
                (
                    this.Type == input.Type ||
                    this.Type != null &&
                    this.Type.Equals(input.Type)
                );
        }

19 Source : CloseAccountResponse.cs
with MIT License
from Adyen

public bool Equals(CloseAccountResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.InvalidFields == input.InvalidFields ||
                    this.InvalidFields != null &&
                    input.InvalidFields != null &&
                    this.InvalidFields.SequenceEqual(input.InvalidFields)
                ) && 
                (
                    this.PspReference == input.PspReference ||
                    (this.PspReference != null &&
                    this.PspReference.Equals(input.PspReference))
                ) && 
                (
                    this.ResultCode == input.ResultCode ||
                    (this.ResultCode != null &&
                    this.ResultCode.Equals(input.ResultCode))
                ) && 
                (
                    this.Status == input.Status ||
                    this.Status.Equals(input.Status)
                );
        }

19 Source : CreateAccountHolderRequest.cs
with MIT License
from Adyen

public bool Equals(CreateAccountHolderRequest input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.AccountHolderDetails == input.AccountHolderDetails ||
                    (this.AccountHolderDetails != null &&
                    this.AccountHolderDetails.Equals(input.AccountHolderDetails))
                ) && 
                (
                    this.CreateDefaultAccount == input.CreateDefaultAccount ||
                    (this.CreateDefaultAccount != null &&
                    this.CreateDefaultAccount.Equals(input.CreateDefaultAccount))
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.LegalEnreplacedy == input.LegalEnreplacedy ||
                    this.LegalEnreplacedy.Equals(input.LegalEnreplacedy)
                ) && 
                (
                    this.PrimaryCurrency == input.PrimaryCurrency ||
                    (this.PrimaryCurrency != null &&
                    this.PrimaryCurrency.Equals(input.PrimaryCurrency))
                ) && 
                (
                    this.ProcessingTier == input.ProcessingTier ||
                    (this.ProcessingTier != null &&
                    this.ProcessingTier.Equals(input.ProcessingTier))
                );
        }

19 Source : CreateAccountHolderResponse.cs
with MIT License
from Adyen

public bool Equals(CreateAccountHolderResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountCode == input.AccountCode ||
                    (this.AccountCode != null &&
                    this.AccountCode.Equals(input.AccountCode))
                ) && 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.AccountHolderDetails == input.AccountHolderDetails ||
                    (this.AccountHolderDetails != null &&
                    this.AccountHolderDetails.Equals(input.AccountHolderDetails))
                ) && 
                (
                    this.AccountHolderStatus == input.AccountHolderStatus ||
                    (this.AccountHolderStatus != null &&
                    this.AccountHolderStatus.Equals(input.AccountHolderStatus))
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.InvalidFields == input.InvalidFields ||
                    this.InvalidFields != null &&
                    input.InvalidFields != null &&
                    this.InvalidFields.SequenceEqual(input.InvalidFields)
                ) && 
                (
                    this.LegalEnreplacedy == input.LegalEnreplacedy ||
                    this.LegalEnreplacedy.Equals(input.LegalEnreplacedy)
                ) && 
                (
                    this.PrimaryCurrency == input.PrimaryCurrency ||
                    (this.PrimaryCurrency != null &&
                    this.PrimaryCurrency.Equals(input.PrimaryCurrency))
                ) && 
                (
                    this.PspReference == input.PspReference ||
                    (this.PspReference != null &&
                    this.PspReference.Equals(input.PspReference))
                ) && 
                (
                    this.ResultCode == input.ResultCode ||
                    (this.ResultCode != null &&
                    this.ResultCode.Equals(input.ResultCode))
                ) && 
                (
                    this.Verification == input.Verification ||
                    (this.Verification != null &&
                    this.Verification.Equals(input.Verification))
                );
        }

19 Source : DocumentDetail.cs
with MIT License
from Adyen

public bool Equals(DoreplacedentDetail input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.BankAccountUUID == input.BankAccountUUID ||
                    (this.BankAccountUUID != null &&
                    this.BankAccountUUID.Equals(input.BankAccountUUID))
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.DoreplacedentType == input.DoreplacedentType ||
                    this.DoreplacedentType.Equals(input.DoreplacedentType)
                ) && 
                (
                    this.Filename == input.Filename ||
                    (this.Filename != null &&
                    this.Filename.Equals(input.Filename))
                ) && 
                (
                    this.ShareholderCode == input.ShareholderCode ||
                    (this.ShareholderCode != null &&
                    this.ShareholderCode.Equals(input.ShareholderCode))
                );
        }

19 Source : GetAccountHolderResponse.cs
with MIT License
from Adyen

public bool Equals(GetAccountHolderResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.AccountHolderDetails == input.AccountHolderDetails ||
                    (this.AccountHolderDetails != null &&
                    this.AccountHolderDetails.Equals(input.AccountHolderDetails))
                ) && 
                (
                    this.AccountHolderStatus == input.AccountHolderStatus ||
                    (this.AccountHolderStatus != null &&
                    this.AccountHolderStatus.Equals(input.AccountHolderStatus))
                ) && 
                (
                    this.Accounts == input.Accounts ||
                    this.Accounts != null &&
                    input.Accounts != null &&
                    this.Accounts.SequenceEqual(input.Accounts)
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.InvalidFields == input.InvalidFields ||
                    this.InvalidFields != null &&
                    input.InvalidFields != null &&
                    this.InvalidFields.SequenceEqual(input.InvalidFields)
                ) && 
                (
                    this.LegalEnreplacedy == input.LegalEnreplacedy ||
                    this.LegalEnreplacedy.Equals(input.LegalEnreplacedy)
                ) && 
                (
                    this.PrimaryCurrency == input.PrimaryCurrency ||
                    (this.PrimaryCurrency != null &&
                    this.PrimaryCurrency.Equals(input.PrimaryCurrency))
                ) && 
                (
                    this.PspReference == input.PspReference ||
                    (this.PspReference != null &&
                    this.PspReference.Equals(input.PspReference))
                ) && 
                (
                    this.ResultCode == input.ResultCode ||
                    (this.ResultCode != null &&
                    this.ResultCode.Equals(input.ResultCode))
                ) && 
                (
                    this.SystemUpToDateTime == input.SystemUpToDateTime ||
                    (this.SystemUpToDateTime != null &&
                    this.SystemUpToDateTime.Equals(input.SystemUpToDateTime))
                ) && 
                (
                    this.Verification == input.Verification ||
                    (this.Verification != null &&
                    this.Verification.Equals(input.Verification))
                );
        }

19 Source : UpdateAccountHolderStateRequest.cs
with MIT License
from Adyen

public bool Equals(UpdateAccountHolderStateRequest input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.Disable == input.Disable ||
                    (this.Disable != null &&
                    this.Disable.Equals(input.Disable))
                ) && 
                (
                    this.Reason == input.Reason ||
                    (this.Reason != null &&
                    this.Reason.Equals(input.Reason))
                ) && 
                (
                    this.StateType == input.StateType ||
                    this.StateType.Equals(input.StateType)
                );
        }

19 Source : ViasName.cs
with MIT License
from Adyen

public bool Equals(ViasName input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.FirstName == input.FirstName ||
                    (this.FirstName != null &&
                    this.FirstName.Equals(input.FirstName))
                ) && 
                (
                    this.Gender == input.Gender ||
                    this.Gender.Equals(input.Gender)
                ) && 
                (
                    this.Infix == input.Infix ||
                    (this.Infix != null &&
                    this.Infix.Equals(input.Infix))
                ) && 
                (
                    this.LastName == input.LastName ||
                    (this.LastName != null &&
                    this.LastName.Equals(input.LastName))
                );
        }

19 Source : UpdatePaymentLinkRequest.cs
with MIT License
from Adyen

public bool Equals(UpdatePaymentLinkRequest input)
        {
            if (input == null)
                return false;

            return
                this.Status == input.Status ||
                this.Status != null &&
                this.Status.Equals(input.Status);
        }

19 Source : SubscriptionDetails.cs
with MIT License
from Adyen

public bool Equals(SubscriptionDetails input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Amount == input.Amount ||
                    this.Amount != null &&
                    this.Amount.Equals(input.Amount)
                ) &&
                (
                    this.AmountRule == input.AmountRule ||
                    this.AmountRule != null &&
                    this.AmountRule.Equals(input.AmountRule)
                ) &&
                (
                    this.BillingAttemptsRule == input.BillingAttemptsRule ||
                    this.BillingAttemptsRule != null &&
                    this.BillingAttemptsRule.Equals(input.BillingAttemptsRule)
                ) &&
                (
                    this.BillingDay == input.BillingDay ||
                    this.BillingDay != null &&
                    this.BillingDay.Equals(input.BillingDay)
                ) &&
                (
                    this.EndAt == input.EndAt ||
                    this.EndAt != null &&
                    this.EndAt.Equals(input.EndAt)
                ) &&
                (
                    this.Frequency == input.Frequency ||
                    this.Frequency != null &&
                    this.Frequency.Equals(input.Frequency)
                ) &&
                (
                    this.Remarks == input.Remarks ||
                    this.Remarks != null &&
                    this.Remarks.Equals(input.Remarks)
                ) &&
                (
                    this.StartAt == input.StartAt ||
                    this.StartAt != null &&
                    this.StartAt.Equals(input.StartAt)
                );
        }

19 Source : AccountEvent.cs
with MIT License
from Adyen

public bool Equals(AccountEvent input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.Event == input.Event ||
                    this.Event.Equals(input.Event)
                ) && 
                (
                    this.ExecutionDate == input.ExecutionDate ||
                    (this.ExecutionDate != null &&
                    this.ExecutionDate.Equals(input.ExecutionDate))
                ) && 
                (
                    this.Reason == input.Reason ||
                    (this.Reason != null &&
                    this.Reason.Equals(input.Reason))
                );
        }

19 Source : AccountHolderStatus.cs
with MIT License
from Adyen

public bool Equals(AccountHolderStatus input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Events == input.Events ||
                    this.Events != null &&
                    input.Events != null &&
                    this.Events.SequenceEqual(input.Events)
                ) &&
                (
                    this.PayoutState == input.PayoutState ||
                    (this.PayoutState != null &&
                    this.PayoutState.Equals(input.PayoutState))
                ) &&
                (
                    this.ProcessingState == input.ProcessingState ||
                    (this.ProcessingState != null &&
                    this.ProcessingState.Equals(input.ProcessingState))
                ) &&
                (
                    this.Status == input.Status ||
                    this.Status.Equals(input.Status)
                ) &&
                (
                    this.StatusReason == input.StatusReason ||
                    (this.StatusReason != null &&
                    this.StatusReason.Equals(input.StatusReason))
                );
        }

19 Source : PerformVerificationRequest.cs
with MIT License
from Adyen

public bool Equals(PerformVerificationRequest input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.AccountStateType == input.AccountStateType ||
                    this.AccountStateType.Equals(input.AccountStateType)
                ) && 
                (
                    this.Tier == input.Tier ||
                    (this.Tier != null &&
                    this.Tier.Equals(input.Tier))
                );
        }

19 Source : CreateAccountResponse.cs
with MIT License
from Adyen

public bool Equals(CreateAccountResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountCode == input.AccountCode ||
                    (this.AccountCode != null &&
                    this.AccountCode.Equals(input.AccountCode))
                ) && 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.InvalidFields == input.InvalidFields ||
                    this.InvalidFields != null &&
                    input.InvalidFields != null &&
                    this.InvalidFields.SequenceEqual(input.InvalidFields)
                ) && 
                (
                    this.Metadata == input.Metadata ||
                    this.Metadata != null &&
                    input.Metadata != null &&
                    this.Metadata.SequenceEqual(input.Metadata)
                ) && 
                (
                    this.PayoutSchedule == input.PayoutSchedule ||
                    (this.PayoutSchedule != null &&
                    this.PayoutSchedule.Equals(input.PayoutSchedule))
                ) && 
                (
                    this.PspReference == input.PspReference ||
                    (this.PspReference != null &&
                    this.PspReference.Equals(input.PspReference))
                ) && 
                (
                    this.ResultCode == input.ResultCode ||
                    (this.ResultCode != null &&
                    this.ResultCode.Equals(input.ResultCode))
                ) && 
                (
                    this.Status == input.Status ||
                    this.Status.Equals(input.Status)
                );
        }

19 Source : UpdateAccountHolderResponse.cs
with MIT License
from Adyen

public bool Equals(UpdateAccountHolderResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.AccountHolderCode == input.AccountHolderCode ||
                    (this.AccountHolderCode != null &&
                    this.AccountHolderCode.Equals(input.AccountHolderCode))
                ) && 
                (
                    this.AccountHolderDetails == input.AccountHolderDetails ||
                    (this.AccountHolderDetails != null &&
                    this.AccountHolderDetails.Equals(input.AccountHolderDetails))
                ) && 
                (
                    this.AccountHolderStatus == input.AccountHolderStatus ||
                    (this.AccountHolderStatus != null &&
                    this.AccountHolderStatus.Equals(input.AccountHolderStatus))
                ) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && 
                (
                    this.InvalidFields == input.InvalidFields ||
                    this.InvalidFields != null &&
                    input.InvalidFields != null &&
                    this.InvalidFields.SequenceEqual(input.InvalidFields)
                ) && 
                (
                    this.LegalEnreplacedy == input.LegalEnreplacedy ||
                    this.LegalEnreplacedy.Equals(input.LegalEnreplacedy)
                ) && 
                (
                    this.PrimaryCurrency == input.PrimaryCurrency ||
                    (this.PrimaryCurrency != null &&
                    this.PrimaryCurrency.Equals(input.PrimaryCurrency))
                ) && 
                (
                    this.PspReference == input.PspReference ||
                    (this.PspReference != null &&
                    this.PspReference.Equals(input.PspReference))
                ) && 
                (
                    this.ResultCode == input.ResultCode ||
                    (this.ResultCode != null &&
                    this.ResultCode.Equals(input.ResultCode))
                ) && 
                (
                    this.Verification == input.Verification ||
                    (this.Verification != null &&
                    this.Verification.Equals(input.Verification))
                );
        }

19 Source : KYCCheckStatusData.cs
with MIT License
from Adyen

public bool Equals(KYCCheckStatusData input)
        {
            if (input == null)
                return false;

            return
                (
                    this.RequiredFields == input.RequiredFields ||
                    this.RequiredFields != null &&
                    input.RequiredFields != null &&
                    this.RequiredFields.SequenceEqual(input.RequiredFields)
                ) &&
                (
                    this.Status == input.Status ||
                    this.Status.Equals(input.Status)
                ) &&
                (
                    this.Summary == input.Summary ||
                    (this.Summary != null &&
                    this.Summary.Equals(input.Summary))
                ) &&
                (
                    this.Type == input.Type ||
                    this.Type.Equals(input.Type)
                );
        }

19 Source : PayoutScheduleResponse.cs
with MIT License
from Adyen

public bool Equals(PayoutScheduleResponse input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.NextScheduledPayout == input.NextScheduledPayout ||
                    (this.NextScheduledPayout != null &&
                    this.NextScheduledPayout.Equals(input.NextScheduledPayout))
                ) && 
                (
                    this.Schedule == input.Schedule ||
                    this.Schedule.Equals(input.Schedule)
                );
        }

19 Source : PersonalDocumentData.cs
with MIT License
from Adyen

public bool Equals(PersonalDoreplacedentData input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.ExpirationDate == input.ExpirationDate ||
                    (this.ExpirationDate != null &&
                    this.ExpirationDate.Equals(input.ExpirationDate))
                ) && 
                (
                    this.IssuerCountry == input.IssuerCountry ||
                    (this.IssuerCountry != null &&
                    this.IssuerCountry.Equals(input.IssuerCountry))
                ) && 
                (
                    this.IssuerState == input.IssuerState ||
                    (this.IssuerState != null &&
                    this.IssuerState.Equals(input.IssuerState))
                ) && 
                (
                    this.Number == input.Number ||
                    (this.Number != null &&
                    this.Number.Equals(input.Number))
                ) && 
                (
                    this.Type == input.Type ||
                    this.Type.Equals(input.Type)
                );
        }

19 Source : UpdatePayoutScheduleRequest.cs
with MIT License
from Adyen

public bool Equals(UpdatePayoutScheduleRequest input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.Action == input.Action ||
                    (this.Action != null &&
                    this.Action.Equals(input.Action))
                ) && 
                (
                    this.Reason == input.Reason ||
                    (this.Reason != null &&
                    this.Reason.Equals(input.Reason))
                ) && 
                (
                    this.Schedule == input.Schedule ||
                    this.Schedule.Equals(input.Schedule)
                );
        }

19 Source : Split.cs
with MIT License
from Adyen

public bool Equals(Split input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Account == input.Account ||
                    (this.Account != null &&
                     this.Account.Equals(input.Account))
                ) &&
                (
                    this.Amount == input.Amount ||
                    (this.Amount != null &&
                     this.Amount.Equals(input.Amount))
                ) &&
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                     this.Description.Equals(input.Description))
                ) &&
                (
                    this.Reference == input.Reference ||
                    (this.Reference != null &&
                     this.Reference.Equals(input.Reference))
                ) &&
                (
                    this.Type == input.Type ||
                    (this.Type.Equals(input.Type))
                );
        }

19 Source : StringFormatter.cs
with MIT License
from alexis-

public override bool Equals(object obj)
      {
        if (!(obj is ColumnInfo))
          return false;

        ColumnInfo ci = (ColumnInfo)obj;

        return Width.Equals(ci.Width) && Content.Equals(ci.Content) && Alignment.Equals(ci.Alignment) && WordWrappingMethod.Equals(ci.WordWrappingMethod);
      }

19 Source : TemplateAdditionalDirectivesHelper.cs
with MIT License
from alexismorin

public void AddNativeContainer()
		{
			if( m_nativeDirectives.Count > 0 )
			{
				if( m_additionalDirectives.FindIndex( x => x.Origin.Equals( AdditionalContainerOrigin.Native ) ) == -1 )
				{
					AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>();
					newItem.Origin = AdditionalContainerOrigin.Native;
					newItem.hideFlags = HideFlags.HideAndDontSave;
					m_additionalDirectives.Add( newItem );
				}
			}
		}

19 Source : JwtTokenUtil.cs
with MIT License
from AlphaYu

public static string CreateToken(JWTConfig jwtConfig, Claim[] claims, TokenType tokenType)
        {
            var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtConfig.SymmetricSecurityKey));

            string issuer = jwtConfig.Issuer;
            string audience = tokenType.Equals(TokenType.AccessToken) ? jwtConfig.Audience : jwtConfig.RefreshTokenAudience;
            int expires = tokenType.Equals(TokenType.AccessToken) ? jwtConfig.Expire : jwtConfig.RefreshTokenExpire;

            var token = new JwtSecurityToken(
                issuer: issuer,
                audience: audience,
                claims: claims,
                notBefore: DateTime.Now,
                expires: DateTime.Now.AddMinutes(expires),
                signingCredentials: new SigningCredentials(key, SecurityAlgorithms.HmacSha256)
            );

            var jwtAccessTokenToken = new JwtSecurityTokenHandler().WriteToken(token);
            return jwtAccessTokenToken;
        }

19 Source : JwtTokenHelper.cs
with MIT License
from AlphaYu

public static string CreateToken(JwtConfig jwtConfig, Claim[] claims, TokenType tokenType)
        {
            var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtConfig.SymmetricSecurityKey));

            string issuer = jwtConfig.Issuer;
            string audience = tokenType.Equals(TokenType.AccessToken) ? jwtConfig.Audience : jwtConfig.RefreshTokenAudience;
            int expires = tokenType.Equals(TokenType.AccessToken) ? jwtConfig.Expire : jwtConfig.RefreshTokenExpire;

            var token = new JwtSecurityToken(
                issuer: issuer,
                audience: audience,
                claims: claims,
                notBefore: DateTime.Now,
                expires: DateTime.Now.AddMinutes(expires),
                signingCredentials: new SigningCredentials(key, SecurityAlgorithms.HmacSha256)
            );

            var jwtAccessTokenToken = new JwtSecurityTokenHandler().WriteToken(token);
            return jwtAccessTokenToken;
        }

19 Source : Browser.cs
with Apache License 2.0
from aquality-automation

public void SetPageLoadTimeout(TimeSpan timeout)
        {
            pageLoadTimeout = timeout;
            if (!BrowserName.Equals(BrowserName.Safari))
            {
                Driver.Manage().Timeouts().PageLoad = timeout;
            }
        }

19 Source : Browser.cs
with Apache License 2.0
from aquality-automation

public void HandleAlert(AlertAction alertAction, string text = null)
        {
            Logger.Info($"loc.browser.alert.{alertAction.ToString().ToLower()}");
            try
            {
                var alert = Driver.SwitchTo().Alert();
                if (!string.IsNullOrEmpty(text))
                {
                    Logger.Info("loc.send.text", text);
                    alert.SendKeys(text);
                }
                if (alertAction.Equals(AlertAction.Accept))
                {
                    alert.Accept();
                }
                else
                {
                    alert.Dismiss();
                }
            }
            catch (NoAlertPresentException ex)
            {
                Logger.Fatal("loc.browser.alert.fail", ex);
                throw;
            }
        }

19 Source : Form.cs
with Apache License 2.0
from ArkaneDev

private void InstallButtonClick(object sender, EventArgs e)
        {
            string regTweaksDownloadPath = $@"{mTempWorkingDir}\regtweaks.reg";

            try
            {
                Utils.DownloadFile(Constants.Url.RegTweaks, regTweaksDownloadPath);
                Utils.ShowMessageBox(string.Format(Strings.Body.DownloadSuccess, "registry tweaks"), MessageBoxType.Information);
            }
            // Create an error box if download fails
            catch
            {
                Utils.ShowMessageBox(string.Format(Strings.Body.DownloadFailed, "registry tweaks"), MessageBoxType.Error);
            }

            if (selectionBox.Text == "Dev")
            {
                DialogResult result = MessageBox.Show(Strings.Body.InstallButtonDialog, "WinPreplaced11 Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result.Equals(DialogResult.Yes))
                {
                    if (File.Exists(regTweaksDownloadPath))
                    {
                        try
                        {
                            string text = File.ReadAllText(regTweaksDownloadPath);
                            text = text.Replace("Beta", "Dev");
                            File.WriteAllText(regTweaksDownloadPath, text);
                        }
                        catch
                        {
                            Utils.ShowMessageBox($"{Strings.Body.RegApplyFailed}\nStage 1 Failed", MessageBoxType.Error);
                        }

                        try
                        {
                            int ret = Utils.StartProcess("regedit.exe", $"/s {regTweaksDownloadPath}", true);
                            Console.WriteLine("regedit exited with exit code of {0}", ret);
                            Utils.ShowMessageBox(Strings.Body.RegApplySuccess, MessageBoxType.Information);
                        }
                        // Create an error box if registry applicaation fails
                        catch
                        {
                            Utils.ShowMessageBox($"{Strings.Body.RegApplyFailed}\nStage 2 Failed", MessageBoxType.Error);
                        }
                    }
                    else
                    {
                        Utils.ShowMessageBox(Strings.Body.RegFileNotDownloaded, MessageBoxType.Error);
                    }
                    string usoClient = "UsoClient";
                    int ust = Utils.StartProcess(usoClient, "StartInteractiveScan", true);
                    Console.WriteLine($"{usoClient} exited with exit code of {0}", ust);

                    // debug: MessageBox.Show("Invoked System Update");
                    Handlers.AppraiserRes obj = new Handlers.AppraiserRes();

                    // Creating thread
                    // Using thread clreplaced
                    Thread thread = new Thread(new ThreadStart(obj.checkForExist));
                    thread.Start();
                }
                else
                {
                    Utils.ShowMessageBox(Strings.Body.InstallationCanceled, MessageBoxType.Information);
                }
            }
            else if (selectionBox.Text == "Beta") // For future releases
            {
                DialogResult result = MessageBox.Show(Strings.Body.InstallButtonDialog, "WinPreplaced11 Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result.Equals(DialogResult.Yes))
                {
                    if (File.Exists(regTweaksDownloadPath))
                    {
                        try
                        {
                            string text = File.ReadAllText(regTweaksDownloadPath);
                            text = text.Replace("Dev", "Beta");
                            File.WriteAllText(regTweaksDownloadPath, text);
                        }
                        catch
                        {
                            Utils.ShowMessageBox($"{Strings.Body.RegApplyFailed}\nStage 1 Failed", MessageBoxType.Error);
                        }

                        try
                        {
                            int ret = Utils.StartProcess("regedit.exe", $"/s {regTweaksDownloadPath}", true);
                            Console.WriteLine("regedit exited with exit code of {0}", ret);
                            Utils.ShowMessageBox(Strings.Body.RegApplySuccess, MessageBoxType.Information);
                        }
                        // Create an error box if registry applicaation fails
                        catch
                        {
                            Utils.ShowMessageBox($"{Strings.Body.RegApplyFailed}\nStage 2 Failed", MessageBoxType.Error);
                        }
                    }
                    else
                    {
                        Utils.ShowMessageBox(Strings.Body.RegFileNotDownloaded, MessageBoxType.Error);
                    }
                    string usoClient = "UsoClient";
                    int ust = Utils.StartProcess(usoClient, "StartInteractiveScan", true);
                    Console.WriteLine($"{usoClient} exited with exit code of {0}", ust);

                    // debug: MessageBox.Show("Invoked System Update");
                    Handlers.AppraiserRes obj = new Handlers.AppraiserRes();

                    // Creating thread
                    // Using thread clreplaced
                    Thread thread = new Thread(new ThreadStart(obj.checkForExist));
                    thread.Start();
                }
                else
                {
                    Utils.ShowMessageBox(Strings.Body.InstallationCanceled, MessageBoxType.Information);
                }
            }
            else
            {
                Utils.ShowMessageBox(Strings.Body.InvalidChannel, MessageBoxType.Error);
            }
        }

19 Source : ListViewColumnSorter.cs
with GNU General Public License v3.0
from audiamus

public int Compare (object x, object y) {
      int compareResult = 0;
      ListViewItem listviewX, listviewY;

      // Cast the objects to be compared to ListViewItem objects
      listviewX = (ListViewItem)x;
      listviewY = (ListViewItem)y;

      ListView listViewMain = listviewX.ListView;

      // Calculate correct return value based on object comparison
      if (listViewMain.Sorting != SortOrder.Ascending &&
          listViewMain.Sorting != SortOrder.Descending) {
        // Return '0' to indicate they are equal
        return compareResult;
      }

      if (_sortModifier.Equals (ESortModifiers.SortByText) || 
          _sortModifier.Equals (ESortModifiers.SortByTagOrText) || _columnToSort > 0) {
        // Compare the two items

        if (listviewX.SubItems.Count <= _columnToSort &&
            listviewY.SubItems.Count <= _columnToSort) {
          compareResult = _objectCompare.Compare (null, null);
        } else if (listviewX.SubItems.Count <= _columnToSort &&
                   listviewY.SubItems.Count > _columnToSort) {
          compareResult = _objectCompare.Compare (null, listviewY.SubItems[_columnToSort].Text.Trim ());
        } else if (listviewX.SubItems.Count > _columnToSort && listviewY.SubItems.Count <= _columnToSort) {
          compareResult = _objectCompare.Compare (listviewX.SubItems[_columnToSort].Text.Trim (), null);
        } else {
          if (listviewX.SubItems[_columnToSort].Tag != null && listviewX.SubItems[_columnToSort].Tag is IComparable &&
              listviewY.SubItems[_columnToSort].Tag != null && listviewY.SubItems[_columnToSort].Tag is IComparable)
            compareResult = _objectCompare.Compare (
              listviewX.SubItems[_columnToSort].Tag, 
              listviewY.SubItems[_columnToSort].Tag); 
          else
           compareResult = _objectCompare.Compare (
             listviewX.SubItems[_columnToSort].Text.Trim (), 
             listviewY.SubItems[_columnToSort].Text.Trim ());
        }
      } else {
        switch (_sortModifier) {
          case ESortModifiers.SortByCheckbox:
            compareResult = _firstObjectCompare2.Compare (x, y);
            break;
          case ESortModifiers.SortByImage:
            compareResult = _firstObjectCompare.Compare (x, y);
            break;
          default:
            //if (mySortModifier.Equals (ESortModifiers.SortByTagOrText))
            compareResult = _firstObjectCompare.Compare (x, y);
            break;
        }
      }

      // Calculate correct return value based on object comparison
      if (_orderOfSort == SortOrder.Ascending) {
        // Ascending sort is selected, return normal result of compare operation
        return compareResult;
      } else if (_orderOfSort == SortOrder.Descending) {
        // Descending sort is selected, return negative result of compare operation
        return (-compareResult);
      } else {
        // Return '0' to indicate they are equal
        return 0;
      }
    }

19 Source : ServiceDependency.cs
with Apache License 2.0
from awslabs

public override bool IsDependencyAvailable()
        {
            try
            {
                _controller.Refresh();
                _controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMilliseconds(200));
                return _controller.Status.Equals(ServiceControllerStatus.Running);
            }
            catch (InvalidOperationException)
            {
                return false;
            }
        }

19 Source : ObjectPool.cs
with MIT License
from Bian-Sh

public void Release(T target) //释放
    {
        //池爆炸了再多都不再要了,当然,如果不是 InUse 的就更别想挤进来~
        if (target.AllocateState.Equals(AllocateState.InUse) && items.Count < Capacity) 
        {
            items.Push(target);
        }
    }

19 Source : System_EnumWrap.cs
with MIT License
from bjfumac

[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Equals(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			System.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);
			object arg0 = ToLua.ToVarObject(L, 2);
			bool o = obj != null ? obj.Equals(arg0) : arg0 == null;
			LuaDLL.lua_pushboolean(L, o);
			return 1;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

19 Source : DateTimeExtensions.cs
with MIT License
from CacoCode

[Description("获取当前日期在一个月的第几个星期")]
        public static int WeekDayInstanceOfMonth(this DateTime dateTime)
        {
            var y = 0;
            return DaysOfMonth(dateTime.Year, dateTime.Month)
                .Where(date => dateTime.DayOfWeek.Equals(date.DayOfWeek))
                .Select(x => new { n = ++y, date = x })
                .Where(x => x.date.Equals(new DateTime(dateTime.Year, dateTime.Month, dateTime.Day)))
                .Select(x => x.n).FirstOrDefault();
        }

19 Source : CustomExtensions.cs
with MIT License
from CandyCoded

public static void RotateWithInputDelta(this Transform transform, Vector3 delta, float speed,
            Transform cameraTransform, RotationAxis axis)
        {

            if (axis.Equals(RotationAxis.All) || axis.Equals(RotationAxis.Horizontal))
            {

                var transformUp = transform.InverseTransformDirection(cameraTransform.TransformDirection(Vector3.up));

                var horizontalRotate = Quaternion.AngleAxis(-delta.x * speed * Time.deltaTime, transformUp);

                transform.rotation *= horizontalRotate;

            }

            if (!axis.Equals(RotationAxis.All) && !axis.Equals(RotationAxis.Vertical))
            {
                return;
            }

            var transformRight =
                transform.InverseTransformDirection(cameraTransform.TransformDirection(Vector3.right));

            var verticalRotate = Quaternion.AngleAxis(delta.y * speed * Time.deltaTime, transformRight);

            transform.rotation *= verticalRotate;

        }

19 Source : TraceExporterHandler.cs
with Apache License 2.0
from census-instrumentation

private string ResolveHostAddress(string hostName, AddressFamily family)
        {
            string result = null;

            try
            {
                var results = Dns.GetHostAddresses(hostName);

                if (results != null && results.Length > 0)
                {
                    foreach (var addr in results)
                    {
                        if (addr.AddressFamily.Equals(family))
                        {
                            var sanitizedAddress = new IPAddress(addr.GetAddressBytes()); // Construct address sans ScopeID
                            result = sanitizedAddress.ToString();

                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
                // Ignore
            }

            return result;
        }

19 Source : SystemHelper.cs
with Apache License 2.0
from Chem4Word

private string GetData(string url)
        {
            string result = "0.0.0.0";

            var securityProtocol = ServicePointManager.SecurityProtocol;

            try
            {
                if (url.StartsWith("https"))
                {
                    ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                }

                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                if (request != null)
                {
                    request.UserAgent = "Chem4Word Add-In";
                    request.Timeout = url.Contains("chem4word") ? 5000 : 2500;

                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    try
                    {
                        // Get Server Date header i.e. "Tue, 01 Jan 2019 19:52:46 GMT"
                        ServerDateHeader = response.Headers["date"];
                        SystemUtcDateTime = DateTime.UtcNow;
                        ServerUtcDateTime = DateTime.Parse(ServerDateHeader).ToUniversalTime();
                        UtcOffset = SystemUtcDateTime.Ticks - ServerUtcDateTime.Ticks;
                    }
                    catch
                    {
                        // Indicate failure
                        ServerDateHeader = null;
                        SystemUtcDateTime = DateTime.MinValue;
                    }

                    if (HttpStatusCode.OK.Equals(response.StatusCode))
                    {
                        var stream = response.GetResponseStream();
                        if (stream != null)
                        {
                            using (var reader = new StreamReader(stream))
                            {
                                result = reader.ReadToEnd();
                            }
                        }
                    }
                }
            }
            catch (WebException webException)
            {
                StartUpTimings.Add(webException.Status == WebExceptionStatus.Timeout
                                       ? $"Timeout: '{url}'"
                                       : webException.Message);
            }
            catch (Exception exception)
            {
                StartUpTimings.Add(exception.Message);
            }
            finally
            {
                ServicePointManager.SecurityProtocol = securityProtocol;
            }

            return result;
        }

19 Source : SearchOpsin.cs
with Apache License 2.0
from Chem4Word

private void SearchButton_Click(object sender, EventArgs e)
        {
            string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";

            if (!string.IsNullOrEmpty(SearchFor.Text))
            {
                Telemetry.Write(module, "Information", $"User searched for '{SearchFor.Text}'");
                Cursor = Cursors.WaitCursor;

                var securityProtocol = ServicePointManager.SecurityProtocol;
                ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                UriBuilder builder = new UriBuilder(UserOptions.OpsinWebServiceUri + SearchFor.Text);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(builder.Uri);
                request.Timeout = 30000;
                request.Accept = "chemical/x-cml";
                request.UserAgent = "Chem4Word";

                HttpWebResponse response;
                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                    if (response.StatusCode.Equals(HttpStatusCode.OK))
                    {
                        ProcessResponse(response);
                    }
                    else
                    {
                        Telemetry.Write(module, "Warning", $"Status code {response.StatusCode} was returned by the server");
                        ShowFailureMessage($"An unexpected status code {response.StatusCode} was returned by the server");
                    }
                }
                catch (WebException ex)
                {
                    HttpWebResponse webResponse = (HttpWebResponse)ex.Response;
                    switch (webResponse.StatusCode)
                    {
                        case HttpStatusCode.NotFound:
                            ShowFailureMessage($"No valid representation of the name '{SearchFor.Text}' has been found");
                            break;

                        case HttpStatusCode.RequestTimeout:
                            ShowFailureMessage("Please try again later - the service has timed out");
                            break;

                        default:
                            Telemetry.Write(module, "Warning", $"Status code: {webResponse.StatusCode}  was returned by the server");
                            break;
                    }
                }
                catch (Exception ex)
                {
                    Telemetry.Write(module, "Exception", ex.Message);
                    Telemetry.Write(module, "Exception", ex.StackTrace);
                    ShowFailureMessage($"An unexpected error has occurred: {ex.Message}");
                }
                finally
                {
                    ServicePointManager.SecurityProtocol = securityProtocol;
                    Cursor = Cursors.Default;
                }
            }
        }

19 Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word

private void GetData(string idlist)
        {
            string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";

            var request = (HttpWebRequest)
                WebRequest.Create(
                    string.Format(CultureInfo.InvariantCulture,
                        "{0}entrez/eutils/esummary.fcgi?db=pccompound&id={1}&retmode=xml",
                        UserOptions.PubChemWebServiceUri, idlist));

            request.Timeout = 30000;
            request.UserAgent = "Chem4Word";

            var securityProtocol = ServicePointManager.SecurityProtocol;
            ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            HttpWebResponse response;
            try
            {
                response = (HttpWebResponse)request.GetResponse();
                if (HttpStatusCode.OK.Equals(response.StatusCode))
                {
                    Results.Enabled = true;

                    // we will read data via the response stream
                    using (var resStream = response.GetResponseStream())
                    {
                        var resultDoreplacedent = XDoreplacedent.Load(new StreamReader(resStream));
                        var compounds = resultDoreplacedent.XPathSelectElements("//DocSum");
                        if (compounds.Any())
                        {
                            foreach (var compound in compounds)
                            {
                                var id = compound.XPathSelectElement("./Id");
                                var name = compound.XPathSelectElement("./Item[@Name='IUPACName']");
                                //var smiles = compound.XPathSelectElement("./Item[@Name='CanonicalSmile']")
                                var formula = compound.XPathSelectElement("./Item[@Name='MolecularFormula']");
                                ListViewItem lvi = new ListViewItem(id.Value);

                                lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, name.Value));
                                //lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, smiles.ToString()))
                                lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, formula.Value));

                                Results.Items.Add(lvi);
                                // Add to a list view ...
                            }
                        }
                        else
                        {
                            Debug.WriteLine("Something went wrong");
                        }
                    }
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine($"Bad request. Status code: {response.StatusCode}");
                    UserInteractions.AlertUser(sb.ToString());
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Equals("The operation has timed out"))
                {
                    ErrorsAndWarnings.Text = "Please try again later - the service has timed out";
                }
                else
                {
                    ErrorsAndWarnings.Text = ex.Message;
                    Telemetry.Write(module, "Exception", ex.Message);
                    Telemetry.Write(module, "Exception", ex.StackTrace);
                }
            }
            finally
            {
                ServicePointManager.SecurityProtocol = securityProtocol;
            }
        }

19 Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word

private void ExecuteSearch(int direction)
        {
            string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";

            if (!string.IsNullOrEmpty(SearchFor.Text))
            {
                Cursor = Cursors.WaitCursor;

                string webCall;
                if (direction == 0)
                {
                    webCall = string.Format(CultureInfo.InvariantCulture,
                            "{0}entrez/eutils/esearch.fcgi?db=pccompound&term={1}&retmode=xml&relevanceorder=on&usehistory=y&retmax={2}",
                            UserOptions.PubChemWebServiceUri, SearchFor.Text, UserOptions.ResultsPerCall);
                }
                else
                {
                    if (direction == 1)
                    {
                        int startFrom = firstResult + numResults;
                        webCall = string.Format(CultureInfo.InvariantCulture,
                                "{0}entrez/eutils/esearch.fcgi?db=pccompound&term={1}&retmode=xml&relevanceorder=on&usehistory=y&retmax={2}&WebEnv={3}&RetStart={4}",
                                UserOptions.PubChemWebServiceUri, SearchFor.Text, UserOptions.ResultsPerCall, webEnv, startFrom);
                    }
                    else
                    {
                        int startFrom = firstResult - numResults;
                        webCall = string.Format(CultureInfo.InvariantCulture,
                                "{0}entrez/eutils/esearch.fcgi?db=pccompound&term={1}&retmode=xml&relevanceorder=on&usehistory=y&retmax={2}&WebEnv={3}&RetStart={4}",
                                UserOptions.PubChemWebServiceUri, SearchFor.Text, UserOptions.ResultsPerCall, webEnv, startFrom);
                    }
                }

                var securityProtocol = ServicePointManager.SecurityProtocol;
                ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                var request = (HttpWebRequest)WebRequest.Create(webCall);

                request.Timeout = 30000;
                request.UserAgent = "Chem4Word";

                HttpWebResponse response;
                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                    if (HttpStatusCode.OK.Equals(response.StatusCode))
                    {
                        using (var resStream = response.GetResponseStream())
                        {
                            var resultDoreplacedent = XDoreplacedent.Load(new StreamReader(resStream));
                            // Get the count of results
                            resultsCount = int.Parse(resultDoreplacedent.XPathSelectElement("//Count").Value);
                            // Current position
                            firstResult = int.Parse(resultDoreplacedent.XPathSelectElement("//RetStart").Value);
                            int fetched = int.Parse(resultDoreplacedent.XPathSelectElement("//RetMax").Value);
                            lastResult = firstResult + fetched;
                            // WebEnv for history
                            webEnv = resultDoreplacedent.XPathSelectElement("//WebEnv").Value;

                            // Set flags for More/Prev buttons

                            if (lastResult > numResults)
                            {
                                PreviousButton.Enabled = true;
                            }
                            else
                            {
                                PreviousButton.Enabled = false;
                            }

                            if (lastResult < resultsCount)
                            {
                                NextButton.Enabled = true;
                            }
                            else
                            {
                                NextButton.Enabled = false;
                            }

                            var ids = resultDoreplacedent.XPathSelectElements("//Id");
                            var count = ids.Count();
                            Results.Items.Clear();

                            if (count > 0)
                            {
                                // Set form replacedle
                                Text = $"Search PubChem - Showing {firstResult + 1} to {lastResult} [of {resultsCount}]";
                                Refresh();

                                var sb = new StringBuilder();
                                for (var i = 0; i < count; i++)
                                {
                                    var id = ids.ElementAt(i);
                                    if (i > 0)
                                    {
                                        sb.Append(",");
                                    }
                                    sb.Append(id.Value);
                                }
                                GetData(sb.ToString());
                            }
                            else
                            {
                                // Set error box
                                ErrorsAndWarnings.Text = "Sorry, no results were found.";
                            }
                        }
                    }
                    else
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.AppendLine($"Status code {response.StatusCode} was returned by the server");
                        Telemetry.Write(module, "Warning", sb.ToString());
                        UserInteractions.AlertUser(sb.ToString());
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message.Equals("The operation has timed out"))
                    {
                        ErrorsAndWarnings.Text = "Please try again later - the service has timed out";
                    }
                    else
                    {
                        ErrorsAndWarnings.Text = ex.Message;
                        Telemetry.Write(module, "Exception", ex.Message);
                        Telemetry.Write(module, "Exception", ex.StackTrace);
                    }
                }
                finally
                {
                    ServicePointManager.SecurityProtocol = securityProtocol;
                    Cursor = Cursors.Default;
                }
            }
        }

19 Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word

private string FetchStructure()
        {
            string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";

            string result = lastSelected;
            ImportButton.Enabled = false;

            ListView.SelectedListViewItemCollection selected = Results.SelectedItems;
            if (selected.Count > 0)
            {
                ListViewItem item = selected[0];
                string pubchemId = item.Text;
                PubChemId = pubchemId;

                if (!pubchemId.Equals(lastSelected))
                {
                    Cursor = Cursors.WaitCursor;

                    // https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/241/record/SDF

                    var securityProtocol = ServicePointManager.SecurityProtocol;
                    ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                    try
                    {
                        var request = (HttpWebRequest)WebRequest.Create(
                            string.Format(CultureInfo.InvariantCulture, "{0}rest/pug/compound/cid/{1}/record/SDF",
                                UserOptions.PubChemRestApiUri, pubchemId));

                        request.Timeout = 30000;
                        request.UserAgent = "Chem4Word";

                        HttpWebResponse response;

                        response = (HttpWebResponse)request.GetResponse();
                        if (HttpStatusCode.OK.Equals(response.StatusCode))
                        {
                            // we will read data via the response stream
                            using (var resStream = response.GetResponseStream())
                            {
                                lastMolfile = new StreamReader(resStream).ReadToEnd();
                                SdFileConverter sdFileConverter = new SdFileConverter();
                                Model.Model model = sdFileConverter.Import(lastMolfile);
                                if (model.MeanBondLength < Core.Helpers.Constants.MinimumBondLength - Core.Helpers.Constants.BondLengthTolerance
                                    || model.MeanBondLength > Core.Helpers.Constants.MaximumBondLength + Core.Helpers.Constants.BondLengthTolerance)
                                {
                                    model.ScaleToAverageBondLength(Core.Helpers.Constants.StandardBondLength);
                                }
                                this.display1.Chemistry = model;
                                if (model.AllWarnings.Count > 0 || model.AllErrors.Count > 0)
                                {
                                    Telemetry.Write(module, "Exception(Data)", lastMolfile);
                                    List<string> lines = new List<string>();
                                    if (model.AllErrors.Count > 0)
                                    {
                                        Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllErrors));
                                        lines.Add("Errors(s)");
                                        lines.AddRange(model.AllErrors);
                                    }
                                    if (model.AllWarnings.Count > 0)
                                    {
                                        Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllWarnings));
                                        lines.Add("Warnings(s)");
                                        lines.AddRange(model.AllWarnings);
                                    }
                                    ErrorsAndWarnings.Text = string.Join(Environment.NewLine, lines);
                                }
                                else
                                {
                                    CMLConverter cmlConverter = new CMLConverter();
                                    Cml = cmlConverter.Export(model);
                                    ImportButton.Enabled = true;
                                }
                            }
                            result = pubchemId;
                        }
                        else
                        {
                            result = string.Empty;
                            lastMolfile = string.Empty;

                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine($"Bad request. Status code: {response.StatusCode}");
                            UserInteractions.AlertUser(sb.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Equals("The operation has timed out"))
                        {
                            ErrorsAndWarnings.Text = "Please try again later - the service has timed out";
                        }
                        else
                        {
                            ErrorsAndWarnings.Text = ex.Message;
                            Telemetry.Write(module, "Exception", ex.Message);
                            Telemetry.Write(module, "Exception", ex.StackTrace);
                        }
                    }
                    finally
                    {
                        ServicePointManager.SecurityProtocol = securityProtocol;
                        Cursor = Cursors.Default;
                    }
                }
            }

            return result;
        }

19 Source : SystemHelper.cs
with Apache License 2.0
from Chem4Word

private string GetData(string url)
        {
            string result = "0.0.0.0";

            var securityProtocol = ServicePointManager.SecurityProtocol;

            try
            {
                if (url.StartsWith("https"))
                {
                    ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                }

                if (WebRequest.Create(url) is HttpWebRequest request)
                {
                    request.UserAgent = "Chem4Word Add-In";
                    request.Timeout = url.Contains("chem4word") ? 5000 : 2500;

                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    try
                    {
                        // Get Server Date header i.e. "Tue, 01 Jan 2019 19:52:46 GMT"
                        ServerDateHeader = response.Headers["date"];
                        SystemUtcDateTime = DateTime.UtcNow;
                        ServerUtcDateTime = DateTime.Parse(ServerDateHeader).ToUniversalTime();
                        UtcOffset = SystemUtcDateTime.Ticks - ServerUtcDateTime.Ticks;
                    }
                    catch
                    {
                        // Indicate failure
                        ServerDateHeader = null;
                        SystemUtcDateTime = DateTime.MinValue;
                    }

                    if (HttpStatusCode.OK.Equals(response.StatusCode))
                    {
                        var stream = response.GetResponseStream();
                        if (stream != null)
                        {
                            using (var reader = new StreamReader(stream))
                            {
                                result = reader.ReadToEnd();
                            }
                        }
                    }
                }
            }
            catch (WebException webException)
            {
                StartUpTimings.Add(webException.Status == WebExceptionStatus.Timeout
                                       ? $"Timeout: '{url}'"
                                       : webException.Message);
            }
            catch (Exception exception)
            {
                StartUpTimings.Add(exception.Message);
            }
            finally
            {
                ServicePointManager.SecurityProtocol = securityProtocol;
            }

            return result;
        }

19 Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word

private string FetchStructure()
        {
            string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";

            string result = lastSelected;
            ImportButton.Enabled = false;

            ListView.SelectedListViewItemCollection selected = Results.SelectedItems;
            if (selected.Count > 0)
            {
                ListViewItem item = selected[0];
                string pubchemId = item.Text;
                PubChemId = pubchemId;

                if (!pubchemId.Equals(lastSelected))
                {
                    Cursor = Cursors.WaitCursor;

                    // https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/241/record/SDF

                    var securityProtocol = ServicePointManager.SecurityProtocol;
                    ServicePointManager.SecurityProtocol = securityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

                    try
                    {
                        var request = (HttpWebRequest)WebRequest.Create(
                            string.Format(CultureInfo.InvariantCulture, "{0}rest/pug/compound/cid/{1}/record/SDF",
                                UserOptions.PubChemRestApiUri, pubchemId));

                        request.Timeout = 30000;
                        request.UserAgent = "Chem4Word";

                        HttpWebResponse response;

                        response = (HttpWebResponse)request.GetResponse();
                        if (HttpStatusCode.OK.Equals(response.StatusCode))
                        {
                            // we will read data via the response stream
                            using (var resStream = response.GetResponseStream())
                            {
                                lastMolfile = new StreamReader(resStream).ReadToEnd();
                                SdFileConverter sdFileConverter = new SdFileConverter();
                                Model model = sdFileConverter.Import(lastMolfile);
                                CMLConverter cmlConverter = new CMLConverter();
                                Cml = cmlConverter.Export(model);

                                model.ScaleToAverageBondLength(Core.Helpers.Constants.StandardBondLength);
                                this.display1.Chemistry = model;

                                if (model.AllWarnings.Count > 0 || model.AllErrors.Count > 0)
                                {
                                    Telemetry.Write(module, "Exception(Data)", lastMolfile);
                                    List<string> lines = new List<string>();
                                    if (model.AllErrors.Count > 0)
                                    {
                                        Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllErrors));
                                        lines.Add("Errors(s)");
                                        lines.AddRange(model.AllErrors);
                                    }
                                    if (model.AllWarnings.Count > 0)
                                    {
                                        Telemetry.Write(module, "Exception(Data)", string.Join(Environment.NewLine, model.AllWarnings));
                                        lines.Add("Warnings(s)");
                                        lines.AddRange(model.AllWarnings);
                                    }
                                    ErrorsAndWarnings.Text = string.Join(Environment.NewLine, lines);
                                }
                                else
                                {
                                    ImportButton.Enabled = true;
                                }
                            }
                            result = pubchemId;
                        }
                        else
                        {
                            result = string.Empty;
                            lastMolfile = string.Empty;

                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine($"Bad request. Status code: {response.StatusCode}");
                            UserInteractions.AlertUser(sb.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Equals("The operation has timed out"))
                        {
                            ErrorsAndWarnings.Text = "Please try again later - the service has timed out";
                        }
                        else
                        {
                            ErrorsAndWarnings.Text = ex.Message;
                            Telemetry.Write(module, "Exception", ex.Message);
                            Telemetry.Write(module, "Exception", ex.StackTrace);
                        }
                    }
                    finally
                    {
                        ServicePointManager.SecurityProtocol = securityProtocol;
                        Cursor = Cursors.Default;
                    }
                }
            }

            return result;
        }

19 Source : Program.cs
with GNU General Public License v2.0
from CHKZL

static void Main(string[] args)
        {
            Auxiliary.VTBS.API.VTBS服务器CDN.根据CDN更新VTBS_Url();       
            new Task(() =>
            {
                //启动DDTV.CORE核心
                MMPU.配置文件初始化(1);
            }).Start();
           

            new Task(() =>
            {
                //启动WEB服务
                DDTVLiveRecWebServer.Program.Main(new string[] { });
            }).Start();

            bool 是否已检查更新 = false;
            bool 是否已发送过webhook = false;
            #region 检查更新
            new Task(() =>
            {
                while (true)
                {
                    try
                    {
                        update.检查升级程序是否需要升级("rec");
                        string 服务器版本号 = MMPU.TcpSend(Server.RequestCode.GET_GET_DDTVLiveRec_LATEST_VERSION_NUMBER, "{}", true, 50);
                        if (!string.IsNullOrEmpty(服务器版本号))
                        {
                            bool 检测状态 = true;
                            foreach (var item in MMPU.不检测的版本号)
                            {
                                if (服务器版本号 == item)
                                {
                                    检测状态 = false;
                                }
                            }
                            if (MMPU.DDTVLiveRec版本号 != 服务器版本号 && 检测状态)
                            {
                                MMPU.检测到的新版本号 = 服务器版本号;
                                MMPU.更新公告 = MMPU.TcpSend(Server.RequestCode.GET_DDTVLiveRec_UPDATE_ANNOUNCEMENT, "{}", true, 100);
                                MMPU.是否有新版本 = true;
                                InfoLog.InfoPrintf("检测到版本更新,更新内容:\n" + MMPU.更新公告 + "\n\n", InfoLog.InfoClreplaced.下载系统信息);
                                if (!是否已发送过webhook)
                                {
                                    Auxiliary.Webhook.更新推送.更新提示(new Auxiliary.Webhook.更新推送.更新Info()
                                    {
                                        Ver = 服务器版本号,
                                        UpdateMsg = MMPU.更新公告
                                    });
                                    是否已发送过webhook = true;
                                }
                            }
                        }
                        是否已检查更新 = true;
                    }
                    catch (Exception) { }
                    Thread.Sleep(3600 * 1000);
                }
            }).Start();
            #endregion
            int i = 0;
            #region 提示更新
            new Task(() =>
            {
                while (true)
                {                   
                    try
                    {                  
                        if(MMPU.是否有新版本)
                        {
                            if(i<1)
                            {
                                i++;
                            }
                            else
                            {
                                InfoLog.InfoPrintf("检测到版本更新,请运行DDTVLiveRec的update子目录中的update程序进行升级,更新内容:\n" + MMPU.更新公告 + "\n\n", InfoLog.InfoClreplaced.系统强制信息);
                            }
                        }
                    }
                    catch (Exception)
                    {
                     
                    }
                    if(是否已检查更新)
                    {
                        Thread.Sleep(300 * 1000);
                    }
                    else
                    {
                        Thread.Sleep(10 * 1000);
                    }
                    
                }
            }).Start();
            #endregion

            InfoLog.InfoPrintf(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": " + "DDTVLiveRec启动完成", InfoLog.InfoClreplaced.下载系统信息);
            while (true)
            {
                if(Console.ReadKey().Key.Equals(ConsoleKey.I))
                {
                    Console.WriteLine($"请按对应的按键查看或修改配置:\n" +
                        $"a:修改调试模式(控制台会输出API接口调用日志)\n" +
                        $"b:查看WebUserName和WebPreplacedword\n" +
                        $"c:查看WebToken\n" +
                        $"d:查看ApiToken\n" +
                        $"");
                    switch (Console.ReadKey().Key)
                    {
                        case ConsoleKey.A:
                            MMPU.调试模式 = !MMPU.调试模式;
                            Console.WriteLine($"修改调试模式\n修改调试模式为:{ MMPU.调试模式}");
                            break;
                        case ConsoleKey.B:
                            Console.WriteLine($"查看WebUserName和WebPreplacedword\nWebUserName:{ MMPU.WebUserName}\nWebPreplacedword:{MMPU.WebPreplacedword}");
                            break;
                        case ConsoleKey.C:
                            Console.WriteLine($"查看WebToken\nWebToken:{MMPU.WebToken}");
                            break;
                        case ConsoleKey.D:
                            Console.WriteLine($"查看ApiToken\nApiToken:{MMPU.ApiToken}");
                            break;
                        default:
                            Console.WriteLine("没有该操作命令!");
                            break;
                    }  
                }
            }
           
        }

19 Source : OrclPower.cs
with GNU General Public License v3.0
from ClayLipscomb

public static string GetreplacedocArrayAsCommaDelimited(OracleParameter param) {
            if (param.CollectionType != OracleCollectionType.PLSQLreplacedociativeArray) return null;

            string commaDelimitedVals = "";

            List<string> vals = new List<string>();
            switch (param.OracleDbType) {
                case OracleDbType.Varchar2:
                    for (int i = 0; i < (param.Value as Array).Length; i++) {
                        if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
                            //a = GetStructArray<OracleString>(param.Value);
                            vals.Add((param.Value as OracleString[])[i].IsNull
                                ? "NULL"
                                : "'" + (param.Value as OracleString[])[i].Value + "'"); // use single quotes to designate string
                        } else {
                            vals.Add((param.Value as String[])[i] == null
                                ? "NULL"
                                : "'" + (param.Value as String[])[i] + "'"); // use single quotes to designate string
                        }
                    }
                    commaDelimitedVals += String.Join(",", vals.ToArray());
                    break;

                case OracleDbType.Decimal:
                case OracleDbType.Int16:
                case OracleDbType.Int32:
                case OracleDbType.Int64:
                    for (int i = 0; i < (param.Value as Array).Length; i++) {
                        if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
                            vals.Add((param.Value as OracleDecimal[])[i].IsNull
                                ? "NULL"
                                : (param.Value as OracleDecimal[])[i].Value.ToString());
                        } else {
                            //Type arrayType = param.Value.GetType().GetElementType();
                            //decimal?[] a = GetStructArray<decimal?>(param.Value);
                            //Nullable.GetUnderlyingType(field.FieldType) ?? field.FieldType
                            if (param.OracleDbType.Equals(OracleDbType.Int64)) {
                                vals.Add(!(param.Value as Int64?[])[i].HasValue
                                    ? "NULL"
                                    : Convert.ToString((param.Value as Int64?[])[i].Value));
                            } else if (param.OracleDbType.Equals(OracleDbType.Int32)) {
                                vals.Add(!(param.Value as Int32?[])[i].HasValue
                                    ? "NULL"
                                    : Convert.ToString((param.Value as Int32?[])[i].Value));
                            } else if (param.OracleDbType.Equals(OracleDbType.Int16)) {
                                vals.Add(!(param.Value as Int16?[])[i].HasValue
                                    ? "NULL"
                                    : Convert.ToString((param.Value as Int16?[])[i].Value));
                            } else if (param.OracleDbType.Equals(OracleDbType.Decimal)) {
                                vals.Add(!(param.Value as Decimal?[])[i].HasValue
                                    ? "NULL"
                                    : Convert.ToString((param.Value as Decimal?[])[i].Value));
                            } else {
                                commaDelimitedVals = NOT_AVAILABLE;
                                break;
                            }
                        }
                    }
                    commaDelimitedVals += String.Join(",", vals.ToArray());
                    break;

                case OracleDbType.Date:
                    for (int i = 0; i < (param.Value as Array).Length; i++) {
                        if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
                            vals.Add((param.Value as OracleDate[])[i].IsNull
                                ? "NULL"
                                : (param.Value as OracleDate[])[i].Value.ToString());
                        } else {
                            vals.Add((param.Value as DateTime[])[i] == null
                                ? "NULL"
                                : (param.Value as DateTime[])[i].ToString());
                        }
                    }
                    commaDelimitedVals += String.Join(",", vals.ToArray());
                    break;
            }

            return commaDelimitedVals;
        }

19 Source : VRTK_MoveInPlace.cs
with GNU General Public License v3.0
from cloudhu

public void SetControlOptions(ControlOptions givenControlOptions)
        {
            controlOptions = givenControlOptions;
            trackedObjects.Clear();

            if (controllerLeftHand && controllerRightHand && (controlOptions.Equals(ControlOptions.HeadsetAndControllers) || controlOptions.Equals(ControlOptions.ControllersOnly)))
            {
                trackedObjects.Add(VRTK_DeviceFinder.GetActualController(controllerLeftHand).transform);
                trackedObjects.Add(VRTK_DeviceFinder.GetActualController(controllerRightHand).transform);
            }

            if (headset && (controlOptions.Equals(ControlOptions.HeadsetAndControllers) || controlOptions.Equals(ControlOptions.HeadsetOnly)))
            {
                trackedObjects.Add(headset.transform);
            }
        }

19 Source : VRTK_MoveInPlace.cs
with GNU General Public License v3.0
from cloudhu

protected virtual void FixedUpdate()
        {
            HandleFalling();
            // If Move In Place is currently engaged.
            if (active && !currentlyFalling)
            {
                // Initialize the list average.
                float listAverage = 0;

                foreach (Transform trackedObj in trackedObjects)
                {
                    // Get the amount of Y movement that's occured since the last update.
                    float deltaYPostion = Mathf.Abs(previousYPositions[trackedObj] - trackedObj.transform.localPosition.y);

                    // Convenience code.
                    List<float> trackedObjList = movementList[trackedObj];

                    // Cap off the speed.
                    if (deltaYPostion > sensitivity)
                    {
                        trackedObjList.Add(sensitivity);
                    }
                    else
                    {
                        trackedObjList.Add(deltaYPostion);
                    }

                    // Keep our tracking list at m_averagePeriod number of elements.
                    if (trackedObjList.Count > averagePeriod)
                    {
                        trackedObjList.RemoveAt(0);
                    }

                    // Average out the current tracker's list.
                    float sum = 0;
                    foreach (float diffrences in trackedObjList)
                    {
                        sum += diffrences;
                    }
                    float avg = sum / averagePeriod;

                    // Add the average to the the list average.
                    listAverage += avg;
                }

                float speed = ((speedScale * 350) * (listAverage / trackedObjects.Count));

                if (speed > maxSpeed && maxSpeed >= 0)
                {
                    speed = maxSpeed;
                }

                direction = Vector3.zero;

                // If we're doing a decoupling method...
                if (directionMethod == DirectionalMethod.SmartDecoupling || directionMethod == DirectionalMethod.DumbDecoupling)
                {
                    // If we haven't set an inital gaze yet, set it now.
                    // If we're doing dumb decoupling, this is what we'll be sticking with.
                    if (initalGaze.Equals(Vector3.zero))
                    {
                        initalGaze = new Vector3(headset.forward.x, 0, headset.forward.z);
                    }

                    // If we're doing smart decoupling, check to see if we want to reset our distance.
                    if (directionMethod == DirectionalMethod.SmartDecoupling)
                    {
                        bool closeEnough = true;
                        float curXDir = headset.rotation.eulerAngles.y;
                        if (curXDir <= smartDecoupleThreshold)
                        {
                            curXDir += 360;
                        }

                        closeEnough = closeEnough && (Mathf.Abs(curXDir - controllerLeftHand.transform.rotation.eulerAngles.y) <= smartDecoupleThreshold);
                        closeEnough = closeEnough && (Mathf.Abs(curXDir - controllerRightHand.transform.rotation.eulerAngles.y) <= smartDecoupleThreshold);

                        // If the controllers and the headset are pointing the same direction (within the threshold) reset the direction the player's moving.
                        if (closeEnough)
                        {
                            initalGaze = new Vector3(headset.forward.x, 0, headset.forward.z);
                        }
                    }
                    direction = initalGaze;
                }
                // if we're doing controller rotation movement
                else if (directionMethod.Equals(DirectionalMethod.ControllerRotation))
                {
                    direction = DetermineAverageControllerRotation() * Vector3.forward;
                }
                // Otherwise if we're just doing Gaze movement, always set the direction to where we're looking.
                else if (directionMethod.Equals(DirectionalMethod.Gaze))
                {
                    direction = (new Vector3(headset.forward.x, 0, headset.forward.z));
                }

                // Update our current speed.
                currentSpeed = speed;
            }
            else if (currentSpeed > 0f)
            {
                currentSpeed -= (currentlyFalling ? fallingDeceleration : deceleration);
            }
            else
            {
                currentSpeed = 0f;
                direction = Vector3.zero;
            }

            foreach (Transform trackedObj in trackedObjects)
            {
                // Get delta postions and rotations
                previousYPositions[trackedObj] = trackedObj.transform.localPosition.y;
            }

            Vector3 movement = (direction * currentSpeed) * Time.fixedDeltaTime;
            if (playArea)
            {
                playArea.position = new Vector3(movement.x + playArea.position.x, playArea.position.y, movement.z + playArea.position.z);
            }
        }

See More Examples