Exemple #1
0
        public override bool Equals(object o)
        {
            if (!(o is HttpAccount))
            {
                return(false);
            }
            HttpAccount v = o as HttpAccount;

            if (!AccountId.Equals(v.AccountId))
            {
                return(false);
            }
            if (!IsBasicAuthentication.Equals(v.IsBasicAuthentication))
            {
                return(false);
            }
            if (!Password.Equals(v.Password))
            {
                return(false);
            }
            if (!Timeout.Equals(v.Timeout))
            {
                return(false);
            }
            if (!Url.Equals(v.Url))
            {
                return(false);
            }
            if (!UserName.Equals(v.UserName))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Returns true if OrgApacheFelixSystemreadyImplFrameworkStartCheckProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheFelixSystemreadyImplFrameworkStartCheckProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheFelixSystemreadyImplFrameworkStartCheckProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Timeout == other.Timeout ||
                     Timeout != null &&
                     Timeout.Equals(other.Timeout)
                     ) &&
                 (
                     TargetStartLevel == other.TargetStartLevel ||
                     TargetStartLevel != null &&
                     TargetStartLevel.Equals(other.TargetStartLevel)
                 ) &&
                 (
                     TargetStartLevelPropName == other.TargetStartLevelPropName ||
                     TargetStartLevelPropName != null &&
                     TargetStartLevelPropName.Equals(other.TargetStartLevelPropName)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ));
        }
        /// <inheritdocs />
        public bool Equals(DnsQuerySettings other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(EnableAuditTrail == other.EnableAuditTrail &&
                   UseCache == other.UseCache &&
                   Recursion == other.Recursion &&
                   Retries == other.Retries &&
                   ThrowDnsErrors == other.ThrowDnsErrors &&
                   UseRandomNameServer == other.UseRandomNameServer &&
                   ContinueOnDnsError == other.ContinueOnDnsError &&
                   ContinueOnEmptyResponse == other.ContinueOnEmptyResponse &&
                   Timeout.Equals(other.Timeout) &&
                   UseTcpFallback == other.UseTcpFallback &&
                   UseTcpOnly == other.UseTcpOnly &&
                   ExtendedDnsBufferSize == other.ExtendedDnsBufferSize &&
                   RequestDnsSecRecords == other.RequestDnsSecRecords);
        }
 /// <inheritdoc/>
 public bool Equals(ReadMajority other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Timeout.Equals(other.Timeout) && MinCapacity == other.MinCapacity);
 }
Exemple #5
0
 public bool Equals(StreamSubscriptionTimeout other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Timeout.Equals(other.Timeout) && Mode.Equals(other.Mode));
 }
Exemple #6
0
 public bool Equals(WriteMajorityPlus other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Timeout.Equals(other.Timeout) && Additional == other.Additional && MinCapacity == other.MinCapacity);
 }
Exemple #7
0
 public bool Equals(State <TS, TD> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(EqualityComparer <TS> .Default.Equals(StateName, other.StateName) &&
            EqualityComparer <TD> .Default.Equals(StateData, other.StateData) &&
            Timeout.Equals(other.Timeout) && Equals(StopReason, other.StopReason));
 }
Exemple #8
0
 /// <inheritdoc />
 public bool Equals(ProduceRequest other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Timeout.Equals(other.Timeout) &&
            Acks == other.Acks &&
            Payloads.HasEqualElementsInOrder(other.Payloads));
 }
        /// <summary>
        /// Returns true if PageDTO instances are equal
        /// </summary>
        /// <param name="input">Instance of PageDTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PageDTO input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Id == input.Id ||
                     (Id != null &&
                      Id.Equals(input.Id))
                     ) &&
                 (
                     Title == input.Title ||
                     (Title != null &&
                      Title.Equals(input.Title))
                 ) &&
                 (
                     Icon == input.Icon ||
                     (Icon != null &&
                      Icon.Equals(input.Icon))
                 ) &&
                 (
                     Link == input.Link ||
                     (Link != null &&
                      Link.Equals(input.Link))
                 ) &&
                 (
                     Parent == input.Parent ||
                     (Parent != null &&
                      Parent.Equals(input.Parent))
                 ) &&
                 (
                     Leaf == input.Leaf ||
                     (Leaf != null &&
                      Leaf.Equals(input.Leaf))
                 ) &&
                 (
                     Timeout == input.Timeout ||
                     (Timeout != null &&
                      Timeout.Equals(input.Timeout))
                 ) &&
                 (
                     Widgets == input.Widgets ||
                     Widgets != null &&
                     Widgets.SequenceEqual(input.Widgets)
                 ));
        }
Exemple #10
0
 /// <inheritdocs />
 public bool Equals(DnsQuerySettings other)
 {
     return(other != null &&
            NameServers.SequenceEqual(other.NameServers) &&
            EnableAuditTrail == other.EnableAuditTrail &&
            UseCache == other.UseCache &&
            Recursion == other.Recursion &&
            Retries == other.Retries &&
            ThrowDnsErrors == other.ThrowDnsErrors &&
            UseRandomNameServer == other.UseRandomNameServer &&
            ContinueOnDnsError == other.ContinueOnDnsError &&
            Timeout.Equals(other.Timeout) &&
            UseTcpFallback == other.UseTcpFallback &&
            UseTcpOnly == other.UseTcpOnly &&
            AutoResolvedNameServers == other.AutoResolvedNameServers);
 }
Exemple #11
0
        /// <summary>
        /// Compares two KeepAliveType for equality.
        /// </summary>
        /// <param name="KeepAliveType">An KeepAliveType to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(KeepAliveType KeepAliveType)
        {
            if ((Object)KeepAliveType == null)
            {
                return(false);
            }

            if (!Timeout.Equals(KeepAliveType.Timeout))
            {
                return(false);
            }

            if (!MaxNumberOfRequests.Equals(KeepAliveType.MaxNumberOfRequests))
            {
                return(false);
            }

            return(true);
        }
Exemple #12
0
 public bool Equals(HttpClientCacheKey other)
 => Timeout.Equals(other.Timeout) &&
 EqualityComparer <IWebProxy> .Default.Equals(Proxy, other.Proxy);
Exemple #13
0
 private bool Equals(Phase other)
 {
     return(DependsOn.SetEquals(other.DependsOn) &&
            Timeout.Equals(other.Timeout) &&
            Recover == other.Recover);
 }
Exemple #14
0
            /// <summary>
            /// Used by the worker thread to start the request
            /// </summary>
            public void Start()
            {
                try
                {
                    // Create the request
                    request             = (HttpWebRequest)System.Net.WebRequest.Create(Url);
                    request.Method      = Method;
                    request.Credentials = CredentialCache.DefaultCredentials;
                    request.Proxy       = null;
                    request.KeepAlive   = false;
                    request.Timeout     = (int)Math.Round((Timeout.Equals(0f) ? WebRequests.Timeout : Timeout) * 1000f);
                    request.ServicePoint.MaxIdleTime       = request.Timeout;
                    request.ServicePoint.Expect100Continue = ServicePointManager.Expect100Continue;
                    request.ServicePoint.ConnectionLimit   = ServicePointManager.DefaultConnectionLimit;

                    // Optional request body for POST requests
                    var data = new byte[0];
                    if (Body != null)
                    {
                        data = Encoding.UTF8.GetBytes(Body);
                        request.ContentLength = data.Length;
                        request.ContentType   = "application/x-www-form-urlencoded";
                    }

                    if (RequestHeaders != null)
                    {
                        request.SetRawHeaders(RequestHeaders);
                    }

                    // Perform DNS lookup and connect (blocking)
                    if (data.Length > 0)
                    {
                        request.BeginGetRequestStream(result =>
                        {
                            if (request == null)
                            {
                                return;
                            }
                            try
                            {
                                // Write request body
                                using (var stream = request.EndGetRequestStream(result)) stream.Write(data, 0, data.Length);
                            }
                            catch (Exception ex)
                            {
                                ResponseText = ex.Message.Trim('\r', '\n', ' ');
                                request?.Abort();
                                OnComplete();
                                return;
                            }
                            WaitForResponse();
                        }, null);
                    }
                    else
                    {
                        WaitForResponse();
                    }
                }
                catch (Exception ex)
                {
                    ResponseText = ex.Message.Trim('\r', '\n', ' ');
                    var message = $"Web request produced exception (Url: {Url})";
                    if (Owner)
                    {
                        message += $" in '{Owner.Name} v{Owner.Version}' plugin";
                    }
                    Interface.Oxide.LogException(message, ex);
                    request?.Abort();
                    OnComplete();
                }
            }
Exemple #15
0
 private bool Equals(HttpClientCacheKey other)
 {
     return(string.Equals(ApiKey, other.ApiKey) && Equals(Credentials, other.Credentials) && Timeout.Equals(other.Timeout) && AuthenticationDisabled.Equals(other.AuthenticationDisabled));
 }
Exemple #16
0
            /// <summary>
            /// Used by the worker thread to start the request
            /// </summary>
            public void Start()
            {
                try
                {
                    // Create the request
                    request                                = (HttpWebRequest)System.Net.WebRequest.Create(Url);
                    request.Method                         = Method;
                    request.Credentials                    = CredentialCache.DefaultCredentials;
                    request.Proxy                          = null; // Make sure no proxy is set
                    request.KeepAlive                      = false;
                    request.Timeout                        = (int)Math.Round((Timeout.Equals(0f) ? WebRequests.Timeout : Timeout) * 1000f);
                    request.AutomaticDecompression         = AllowDecompression ? DecompressionMethods.GZip | DecompressionMethods.Deflate : DecompressionMethods.None;
                    request.ServicePoint.MaxIdleTime       = request.Timeout;
                    request.ServicePoint.Expect100Continue = ServicePointManager.Expect100Continue;
                    request.ServicePoint.ConnectionLimit   = ServicePointManager.DefaultConnectionLimit;
                    request.UserAgent                      = $"Oxide Mod (v{OxideMod.Version}; https://umod.org)";

                    // Set webrequest to use assigned IP address
                    if (!request.RequestUri.IsLoopback && IPAddress.TryParse(Interface.Oxide.Config.Options.WebRequestIP, out IPAddress address))
                    {
                        request.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEndPoint, retryCount) =>
                        {
                            return(new IPEndPoint(address, 0));
                        };
                    }

                    // Optional request body for POST requests
                    byte[] data = new byte[0];
                    if (Body != null)
                    {
                        data = Encoding.UTF8.GetBytes(Body);
                        request.ContentLength = data.Length;
                        request.ContentType   = "application/x-www-form-urlencoded";
                    }

                    if (RequestHeaders != null)
                    {
                        request.SetRawHeaders(RequestHeaders);
                    }

                    // Perform DNS lookup and connect (blocking)
                    if (data.Length > 0)
                    {
                        request.BeginGetRequestStream(result =>
                        {
                            if (request == null)
                            {
                                return;
                            }

                            try
                            {
                                // Write request body
                                using (Stream stream = request.EndGetRequestStream(result))
                                {
                                    stream.Write(data, 0, data.Length);
                                }
                            }
                            catch (Exception ex)
                            {
                                ResponseText = FormatWebException(ex, ResponseText ?? string.Empty);
                                request?.Abort();
                                OnComplete();
                                return;
                            }
                            WaitForResponse();
                        }, null);
                    }
                    else
                    {
                        WaitForResponse();
                    }
                }
                catch (Exception ex)
                {
                    ResponseText = FormatWebException(ex, ResponseText ?? string.Empty);
                    string message = $"Web request produced exception (Url: {Url})";
                    if (Owner)
                    {
                        message += $" in '{Owner.Name} v{Owner.Version}' plugin";
                    }

                    Interface.Oxide.LogException(message, ex);
                    request?.Abort();
                    OnComplete();
                }
            }
Exemple #17
0
            /// <summary>
            /// Used by the worker thread to start the request
            /// </summary>
            public void Start()
            {
                try
                {
                    // Create the request
                    request                                = (HttpWebRequest)System.Net.WebRequest.Create(Url);
                    request.Method                         = Method;
                    request.Credentials                    = CredentialCache.DefaultCredentials;
                    request.Proxy                          = null; // Make sure no proxy is set
                    request.KeepAlive                      = false;
                    request.Timeout                        = (int)Math.Round((Timeout.Equals(0f) ? WebRequests.Timeout : Timeout) * 1000f);
                    request.AutomaticDecompression         = AllowDecompression ? DecompressionMethods.GZip | DecompressionMethods.Deflate : DecompressionMethods.None;
                    request.ServicePoint.MaxIdleTime       = request.Timeout;
                    request.ServicePoint.Expect100Continue = ServicePointManager.Expect100Continue;
                    request.ServicePoint.ConnectionLimit   = ServicePointManager.DefaultConnectionLimit;

                    // Exclude loopback requests and Linux from IP binding for now
                    if (!request.RequestUri.IsLoopback && Environment.OSVersion.Platform != PlatformID.Unix)
                    {
                        request.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEndPoint, retryCount) =>
                        {
                            // Try to assign server's assigned IP address, not primary network adapter address
                            return(new IPEndPoint(covalence.Server.LocalAddress ?? covalence.Server.Address, 0)); // TODO: Figure out why this doesn't work on Linux
                        };
                    }

                    // Optional request body for POST requests
                    byte[] data = new byte[0];
                    if (Body != null)
                    {
                        data = Encoding.UTF8.GetBytes(Body);
                        request.ContentLength = data.Length;
                        request.ContentType   = "application/x-www-form-urlencoded";
                    }

                    if (RequestHeaders != null)
                    {
                        request.SetRawHeaders(RequestHeaders);
                    }

                    // Perform DNS lookup and connect (blocking)
                    if (data.Length > 0)
                    {
                        request.BeginGetRequestStream(result =>
                        {
                            if (request == null)
                            {
                                return;
                            }

                            try
                            {
                                // Write request body
                                using (Stream stream = request.EndGetRequestStream(result))
                                {
                                    stream.Write(data, 0, data.Length);
                                }
                            }
                            catch (Exception ex)
                            {
                                ResponseText = FormatWebException(ex, ResponseText ?? string.Empty);
                                request?.Abort();
                                OnComplete();
                                return;
                            }
                            WaitForResponse();
                        }, null);
                    }
                    else
                    {
                        WaitForResponse();
                    }
                }
                catch (Exception ex)
                {
                    ResponseText = FormatWebException(ex, ResponseText ?? string.Empty);
                    string message = $"Web request produced exception (Url: {Url})";
                    if (Owner)
                    {
                        message += $" in '{Owner.Name} v{Owner.Version}' plugin";
                    }

                    Interface.Oxide.LogException(message, ex);
                    request?.Abort();
                    OnComplete();
                }
            }