Exemplo n.º 1
0
        // Helper method for detecting if a variable is a variable.
        // uses isValid in determining if a string could be a variable
        private bool couldBeAVariable(string s)
        {
            int n;

            if (!char.IsLetter(s[0])) //if the first letter is not a letter
            {
                return(false);
            }
            bool intSwitch = false; //used to test if a letter comes after a number

            for (int i = 1; i < s.Count(); i++)
            {
                if (Int32.TryParse(s[i].ToString(), out n))
                {
                    intSwitch = true;
                }
                else if (intSwitch)
                {
                    return(false);
                }
            }
            return(IsValid.Invoke(s)); //passed my tests now check isValid
        }
Exemplo n.º 2
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var resources = repository.GetXmlFile(FileName);

            resourceList.Clear();

            foreach (var item in resources)
            {
                resourceList.Add(new Resource
                {
                    Name         = item.Name,
                    Language     = item.Language,
                    DateChange   = item.DateChange,
                    GenericKey   = item.GenericKey,
                    ResourceData = item.ResourceData,
                    Tenant       = item.Tenant
                });
            }
            IsValid isValid = new IsValid();

            isValid.ValidList(resourceList);
            xmlTableDataGrid.ItemsSource = resourceList;
        }
Exemplo n.º 3
0
        public override void Process(UponorResponseContainer values)
        {
            foreach ((int controller, int thermostat) in _systemDetails.GetAvailableThermostats())
            {
                string deviceId = HassUniqueIdBuilder.GetThermostatDeviceId(controller, thermostat);

                // Temperature
                ISensorContainer    sensor = HassMqttManager.GetSensor(deviceId, "temperature");
                MqttStateValueTopic sender = sensor.GetValueSender(HassTopicKind.State);

                if (values.TryGetValue(UponorObjects.Thermostat(UponorThermostats.RoomTemperature, controller, thermostat),
                                       UponorProperties.Value, out float floatVal))
                {
                    if (IsValid.Temperature(floatVal))
                    {
                        sender.Value = floatVal;
                    }
                    else
                    {
                        _logger.LogWarning("Received an invalid temperature of {Value} for {Device}", floatVal, deviceId);
                    }
                }
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // The delegate is a refrence to a method, it describe what kind of method can hold
            // 1. Declare a delegate
            // 2. Create a method to use the delegate
            // 3. Create one or more methods that matches the delegate's return value and parameters
            // so I create playAudio, and playVideo
            // 4. Instantiate the delegate
            // 5. Invoke the method through the delegate

            // step 4
            IsValid testMedia = PlayAudio;

            Console.WriteLine(TestResults(testMedia));

            testMedia = PlayVideo;
            Console.WriteLine(TestResults(testMedia));

            IsValid2 test = TestVoid;

            TestCallTheVoidDelegate(test);

            Console.Read();
        }
Exemplo n.º 5
0
 private bool AreVisitFieldsValid()
 {
     return(IsValid.Valid(Diagnose, RegexPatterns.descriptionPattern) &&
            IsValid.Valid(Indications, RegexPatterns.descriptionPattern) &&
            IsValid.Valid(Price.ToString(), RegexPatterns.pricePattern));
 }
Exemplo n.º 6
0
        public override void Process(UponorResponseContainer values)
        {
            foreach ((int controller, int thermostat) in _systemDetails.GetAvailableThermostats())
            {
                string deviceId = HassUniqueIdBuilder.GetThermostatDeviceId(controller, thermostat);

                // Temperature
                ISensorContainer sensor = HassMqttManager.GetSensor(deviceId, "temp");

                if (values.TryGetValue(
                        UponorObjects.Thermostat(UponorThermostats.RoomTemperature, controller, thermostat),
                        UponorProperties.Value, out float floatVal))
                {
                    if (IsValid.Temperature(floatVal))
                    {
                        sensor.SetValue(HassTopicKind.CurrentTemperature, floatVal);
                    }
                    else
                    {
                        _logger.LogWarning("Received an invalid temperature of {Value} for {Device}", floatVal, deviceId);
                    }
                }

                // Setpoint
                if (values.TryGetValue(
                        UponorObjects.Thermostat(UponorThermostats.RoomSetpoint, controller, thermostat),
                        UponorProperties.Value, out floatVal))
                {
                    sensor.SetValue(HassTopicKind.TemperatureState, floatVal);
                }

                // Action & Mode
                if (values.TryGetValue(
                        UponorObjects.Thermostat(UponorThermostats.RoomInDemand, controller, thermostat),
                        UponorProperties.Value, out int intVal))
                {
                    // If this value is >0, the room is heating/cooling (see H/C mode)
                    string action, mode;

                    // Valid values: off, heating, cooling, drying, idle, fan.
                    if (intVal <= 0)
                    {
                        action = "idle";
                        mode   = "off";
                    }
                    else if (_systemDetails.HcMode == HcMode.Heating)
                    {
                        action = "heating";
                        mode   = "heat";
                    }
                    else
                    {
                        action = "cooling";
                        mode   = "cool";
                    }

                    // Override Mode as auto
                    if (_operationConfig.OperationMode == OperationMode.Normal)
                    {
                        mode = "auto";
                    }

                    sensor.SetValue(HassTopicKind.Action, action);
                    sensor.SetValue(HassTopicKind.ModeState, mode);
                }

                // Home/away
                if (values.TryGetValue(
                        UponorObjects.Thermostat(UponorThermostats.HomeAwayModeStatus, controller, thermostat),
                        UponorProperties.Value, out intVal))
                {
                    if (intVal > 0)
                    {
                        // Away
                        sensor.SetValue(HassTopicKind.AwayModeState, "on");
                    }
                    else
                    {
                        // Home
                        sensor.SetValue(HassTopicKind.AwayModeState, "off");
                    }
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Type">Validation type enum</param>
 /// <param name="ErrorMessage">Error message</param>
 public IsAttribute(IsValid Type, string ErrorMessage = "")
     : base(ErrorMessage.IsNullOrEmpty() ? "{0} is not {1}" : ErrorMessage)
 {
     this.Type = Type;
 }
Exemplo n.º 8
0
        /// <summary>
        /// If content is null, throws an ArgumentNullException.
        ///
        /// Otherwise, if name is null or invalid, throws an InvalidNameException.
        ///
        /// Otherwise, if content parses as a double, the contents of the named
        /// cell becomes that double.
        ///
        /// Otherwise, if content begins with the character '=', an attempt is made
        /// to parse the remainder of content into a Formula f using the Formula
        /// constructor with s => s.ToUpper() as the normalizer and a validator that
        /// checks that s is a valid cell name as defined in the AbstractSpreadsheet
        /// class comment.  There are then three possibilities:
        ///
        ///   (1) If the remainder of content cannot be parsed into a Formula, a
        ///       Formulas.FormulaFormatException is thrown.
        ///
        ///   (2) Otherwise, if changing the contents of the named cell to be f
        ///       would cause a circular dependency, a CircularException is thrown.
        ///
        ///   (3) Otherwise, the contents of the named cell becomes f.
        ///
        /// Otherwise, the contents of the named cell becomes content.
        ///
        /// If an exception is not thrown, the method returns a set consisting of
        /// name plus the names of all other cells whose value depends, directly
        /// or indirectly, on the named cell.
        ///
        /// For example, if name is A1, B1 contains A1*2, and C1 contains B1+A1, the
        /// set {A1, B1, C1} is returned.
        /// </summary>

        public override ISet <string> SetContentsOfCell(string name, string content)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            if (ReferenceEquals(name, null) || !Regex.IsMatch(name, @"^[a-zA-Z_](?: [a-zA-Z_]|\d)*$") || !Regex.IsMatch(name, IsValid.ToString()))
            {
                throw new InvalidNameException();
            }

            name = name.ToUpper();

            if (Regex.IsMatch(content, @"^(?:\d+\.\d*|\d*\.\d+|\d+)(?:e[\+-]?\d+)?$"))
            {
                Changed = true;
                return(SetCellContents(name, Double.Parse(content)));
            }
            else if (content.Length > 0 && content[0] == '=')
            {
                Formula f = new Formula(content.Substring(1, content.Length - 1), s => s.ToUpper(), s => Regex.IsMatch(s, IsValid.ToString()));


                Changed = true;
                return(SetCellContents(name, f));
            }
            else
            {
                Changed = true;
                return(SetCellContents(name, content));
            }
        }
 public override int GetHashCode()
 {
     return(IsValid.GetHashCode() ^ ErrorCode.GetHashCode());
 }
Exemplo n.º 10
0
 public void Setup()
 {
     username = new IsNullOrEmpty("Ricardo");
     cedula   = new IsValid(5280242);
 }
Exemplo n.º 11
0
 void SetValues(NativeActivityContext context, bool whereErrors)
 {
     Result.Set(context, whereErrors);
     HasError.Set(context, whereErrors);
     IsValid.Set(context, whereErrors);
 }
Exemplo n.º 12
0
 public ClaimDetails(int claimid, ClaimType claimType, string description, double amount, DateTime dateOfAccident, DateTime dateOfClaim, IsValid isValid)
 {
     ClaimID        = claimid;
     ClaimType      = claimType;
     Description    = description;
     Amount         = amount;
     DateOfAccident = dateOfAccident;
     DateOfClaim    = dateOfClaim;
     IsValid        = isValid;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Type">Validation type enum</param>
 /// <param name="ErrorMessage">Error message</param>
 public IsAttribute(IsValid Type, string ErrorMessage = "")
     : base(string.IsNullOrEmpty(ErrorMessage) ? "{0} is not {1}" : ErrorMessage)
 {
     this.Type = Type;
 }
Exemplo n.º 14
0
        public bool Equals(FireteamSummary input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     FireteamId == input.FireteamId ||
                     (FireteamId.Equals(input.FireteamId))
                     ) &&
                 (
                     GroupId == input.GroupId ||
                     (GroupId.Equals(input.GroupId))
                 ) &&
                 (
                     Platform == input.Platform ||
                     (Platform != null && Platform.Equals(input.Platform))
                 ) &&
                 (
                     ActivityType == input.ActivityType ||
                     (ActivityType.Equals(input.ActivityType))
                 ) &&
                 (
                     IsImmediate == input.IsImmediate ||
                     (IsImmediate != null && IsImmediate.Equals(input.IsImmediate))
                 ) &&
                 (
                     ScheduledTime == input.ScheduledTime ||
                     (ScheduledTime != null && ScheduledTime.Equals(input.ScheduledTime))
                 ) &&
                 (
                     OwnerMembershipId == input.OwnerMembershipId ||
                     (OwnerMembershipId.Equals(input.OwnerMembershipId))
                 ) &&
                 (
                     PlayerSlotCount == input.PlayerSlotCount ||
                     (PlayerSlotCount.Equals(input.PlayerSlotCount))
                 ) &&
                 (
                     AlternateSlotCount == input.AlternateSlotCount ||
                     (AlternateSlotCount.Equals(input.AlternateSlotCount))
                 ) &&
                 (
                     AvailablePlayerSlotCount == input.AvailablePlayerSlotCount ||
                     (AvailablePlayerSlotCount.Equals(input.AvailablePlayerSlotCount))
                 ) &&
                 (
                     AvailableAlternateSlotCount == input.AvailableAlternateSlotCount ||
                     (AvailableAlternateSlotCount.Equals(input.AvailableAlternateSlotCount))
                 ) &&
                 (
                     Title == input.Title ||
                     (Title != null && Title.Equals(input.Title))
                 ) &&
                 (
                     DateCreated == input.DateCreated ||
                     (DateCreated != null && DateCreated.Equals(input.DateCreated))
                 ) &&
                 (
                     DateModified == input.DateModified ||
                     (DateModified != null && DateModified.Equals(input.DateModified))
                 ) &&
                 (
                     IsPublic == input.IsPublic ||
                     (IsPublic != null && IsPublic.Equals(input.IsPublic))
                 ) &&
                 (
                     Locale == input.Locale ||
                     (Locale != null && Locale.Equals(input.Locale))
                 ) &&
                 (
                     IsValid == input.IsValid ||
                     (IsValid != null && IsValid.Equals(input.IsValid))
                 ) &&
                 (
                     DatePlayerModified == input.DatePlayerModified ||
                     (DatePlayerModified != null && DatePlayerModified.Equals(input.DatePlayerModified))
                 ) &&
                 (
                     TitleBeforeModeration == input.TitleBeforeModeration ||
                     (TitleBeforeModeration != null && TitleBeforeModeration.Equals(input.TitleBeforeModeration))
                 ));
        }
Exemplo n.º 15
0
 /// <summary>
 /// Returns a value that represents the hash code of this structure.
 /// </summary>
 /// <returns>
 /// Hash code of this structure.
 /// </returns>
 public override int GetHashCode() => DeviceId.GetHashCode() ^ IsValid.GetHashCode() ^ RawEdid.GetHashCode();
Exemplo n.º 16
0
 public BookService(IBookRepository bookRepo, ApplicationContext context, IsValid valid)
 {
     this.context = context;
     this.valid   = valid;
     repo         = bookRepo;
 }
Exemplo n.º 17
0
 public override int GetHashCode()
 {
     return(IsValid.GetHashCode() ^ Coords.GetHashCode() ^ PhotoID);
 }
Exemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="class"></param>
 /// <returns></returns>
 public static bool IsValid(this IsValid @class) => @class.IsValid();
Exemplo n.º 19
0
        /// <summary>
        /// If name is null, throws an ArgumentNullException.
        ///
        /// Otherwise, if name isn't a valid cell name, throws an InvalidNameException.
        ///
        /// Otherwise, returns an enumeration, without duplicates, of the names of all cells whose
        /// values depend directly on the value of the named cell.  In other words, returns
        /// an enumeration, without duplicates, of the names of all cells that contain
        /// formulas containing name.
        ///
        /// For example, suppose that
        /// A1 contains 3
        /// B1 contains the formula A1 * A1
        /// C1 contains the formula B1 + A1
        /// D1 contains the formula B1 - C1
        /// The direct dependents of A1 are B1 and C1
        /// </summary>
        protected override IEnumerable <string> GetDirectDependents(string name)
        {
            // If name is null, throws an ArgumentNullException.
            if (name == null)
            {
                throw new ArgumentNullException();
            }
            // Otherwise, if name isn't a valid cell name, throws an InvalidNameException.
            if (!Regex.IsMatch(name, @"^[a-zA-Z_](?: [a-zA-Z_]|\d)*$") || !Regex.IsMatch(name, IsValid.ToString()))
            {
                throw new InvalidNameException();
            }


            return(dg.GetDependents(name.ToUpper()));
        }
Exemplo n.º 20
0
 /// <summary>Constructor</summary>
 /// <param name="capacity">the normal item limit for cache (Count may exeed capacity due to minAge)</param>
 /// <param name="minAge">the minimium time after an access before an item becomes eligible for removal, during this time
 /// the item is protected and will not be removed from cache even if over capacity</param>
 /// <param name="maxAge">the max time that an object will sit in the cache without being accessed, before being removed</param>
 /// <param name="isValid">delegate used to determine if cache is out of date.  Called before index access not more than once per 10 seconds</param>
 public LruCache(int capacity, TimeSpan minAge, TimeSpan maxAge, IsValid isValid)
 {
     _capacity = capacity;
     _isValid  = isValid;
     _lifeSpan = new LifespanMgr(this, minAge, maxAge);
 }
Exemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string userid = Convert.ToString(Session["UserID"]);

            if (Session["RoleID"] == null || Session["UserID"] == null)
            {
                Util.ShowMessage("用户登录超时,请重新登录!", "Login.aspx");
            }
            else
            {
                string username = Convert.ToString(Session["UserName"]);
                int    roleID   = Util.UpdateAvatar(username);
                AvatarImage.ImageUrl  = Session["Avatar"].ToString();
                AvatarImage1.ImageUrl = Session["Avatar"].ToString();
                if (roleID == 1)
                {
                    AdminUser.Visible     = true;
                    EditorArctile.Visible = true;
                    FilePanel.Visible     = true;
                    ClassPanel.Visible    = true;
                    FocusPanel.Visible    = true;
                    MenuPanel.Visible     = true;
                    UserTagPanel.Visible  = true;
                }
                else if (roleID == 2)
                {
                    AdminUser.Visible     = false;
                    EditorArctile.Visible = true;
                    FilePanel.Visible     = false;
                    ClassPanel.Visible    = true;
                    FocusPanel.Visible    = false;
                    MenuPanel.Visible     = true;
                    UserTagPanel.Visible  = false;
                }
                else if (roleID == 3)
                {
                    AdminUser.Visible     = false;
                    EditorArctile.Visible = false;
                    FilePanel.Visible     = false;
                    ClassPanel.Visible    = false;
                    FocusPanel.Visible    = false;
                    MenuPanel.Visible     = false;
                    UserTagPanel.Visible  = false;
                }
                else if (roleID == 4)
                {
                    AdminUser.Visible     = false;
                    EditorArctile.Visible = false;
                    FilePanel.Visible     = false;
                    ClassPanel.Visible    = false;
                    FocusPanel.Visible    = false;
                    MenuPanel.Visible     = false;
                    UserTagPanel.Visible  = false;
                }
                else
                {
                    AdminUser.Visible     = false;
                    EditorArctile.Visible = false;
                    FilePanel.Visible     = false;
                    ClassPanel.Visible    = false;
                    FocusPanel.Visible    = false;
                    MenuPanel.Visible     = false;
                    UserTagPanel.Visible  = false;
                }

                using (SqlConnection conn = new DB().GetConnection())
                {
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "select distinct RoleName as RoleName from Roles";
                    conn.Open();
                    SqlDataReader rd = cmd.ExecuteReader();
                    RoleTypeDDL.DataSource     = rd;
                    RoleTypeDDL.DataValueField = "RoleName";
                    RoleTypeDDL.DataTextField  = "RoleName";
                    RoleTypeDDL.DataBind();
                    rd.Close();
                    RoleTypeDDL.Items.Insert(0, new ListItem("角色类型", ""));


                    cmd.CommandText = "select distinct Valid as Valid from Users";
                    rd = cmd.ExecuteReader();
                    IsValid.DataSource     = rd;
                    IsValid.DataValueField = "Valid";
                    IsValid.DataTextField  = "Valid";
                    IsValid.DataBind();
                    rd.Close();
                    IsValid.Items.Insert(0, new ListItem("状态", ""));

                    cmd.CommandText = "select * from UserTags where UserID = @UserID and Users <> 0 order by ID desc";
                    cmd.Parameters.AddWithValue("@UserID", userid);
                    rd = cmd.ExecuteReader();
                    CheckBoxList1.DataSource     = rd;
                    CheckBoxList1.DataTextField  = "TagName";
                    CheckBoxList1.DataValueField = "ID";
                    CheckBoxList1.DataBind();
                    rd.Close();
                }
            }
            //  MyDataBind();
            MyDataBind2();
        }
    }
Exemplo n.º 22
0
 private bool AreOpinionFieldsValid()
 {
     return(IsValid.Valid(Rate, RegexPatterns.descriptionPattern) &&
            IsValid.Valid(Description, RegexPatterns.descriptionPattern) &&
            IsValid.Valid(Price.ToString(), RegexPatterns.pricePattern));
 }
        /// <devdoc>
        /// <para>Evaluates validity and updates the <see cref='System.Web.UI.WebControls.BaseValidator.IsValid'/> property.</para>
        /// </devdoc>
        public void Validate()
        {
            IsValid = true;
            if (!Visible || !Enabled)
            {
                return;
            }
            propertiesChecked = false;
            if (!PropertiesValid)
            {
                return;
            }
            IsValid = EvaluateIsValid();
            Debug.Trace("BaseValidator.Validate", "id:" + ID + ", evaluateIsValid = " + IsValid.ToString());
            if (!IsValid)
            {
                Page page = Page;
                if (page != null && SetFocusOnError)
                {
                    // Dev10 584609 Need to render ClientID not control id for auto focus to work
                    string  validateId = ControlToValidate;
                    Control c          = NamingContainer.FindControl(validateId);
                    if (c != null)
                    {
                        validateId = c.ClientID;
                    }

                    Page.SetValidatorInvalidControlFocus(validateId);
                }
            }
        }
Exemplo n.º 24
0
        // this function forwards the inputs for validations check and then forwards to User class
        public static InfoObject addTask(string email, string title, string description, string dueDate)
        {
            Log.Info("Add new task request by: " + email + ". Task: " + title);
            User CurrUser = (User)currUsers[email];

            if (CurrUser != null && (IsValid.IsValidTaskTitle(title) & IsValid.IsValidTaskDescreption(description) & IsValid.IsValidTaskDueDate(dueDate)))
            {
                return(CurrUser.addTask(title, description, dueDate));
            }
            else
            {
                Log.Error("Adding task failed.");
                InfoObject info = new InfoObject(false, "Adding task failed.");
                return(info);
            }
        }
Exemplo n.º 25
0
 public Dialog_Name(string text, OnAcceptName onAcceptName, IsValid isValid)
 {
     base.curName      = text;
     this.onAcceptName = onAcceptName;
     this.isValid      = isValid;
 }
Exemplo n.º 26
0
 public override int GetHashCode()
 {
     unchecked {
         return((IsValid.GetHashCode() * 397) ^ (Errors != null ? Errors.GetHashCode() : 0));
     }
 }
Exemplo n.º 27
0
 /// <summary>
 ///     Hash function for ValidationResult
 /// </summary>
 /// <returns>hash code for the current ValidationResult</returns>
 public override int GetHashCode()
 {
     return(IsValid.GetHashCode() ^ ((ErrorContent == null) ? int.MinValue : ErrorContent).GetHashCode());
 }
Exemplo n.º 28
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if (LiteralPath.Expression != null)
            {
                targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context));
            }

            if (Filter.Expression != null)
            {
                targetCommand.AddParameter("Filter", Filter.Get(context));
            }

            if (Include.Expression != null)
            {
                targetCommand.AddParameter("Include", Include.Get(context));
            }

            if (Exclude.Expression != null)
            {
                targetCommand.AddParameter("Exclude", Exclude.Get(context));
            }

            if (PathType.Expression != null)
            {
                targetCommand.AddParameter("PathType", PathType.Get(context));
            }

            if (IsValid.Expression != null)
            {
                targetCommand.AddParameter("IsValid", IsValid.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (OlderThan.Expression != null)
            {
                targetCommand.AddParameter("OlderThan", OlderThan.Get(context));
            }

            if (NewerThan.Expression != null)
            {
                targetCommand.AddParameter("NewerThan", NewerThan.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Exemplo n.º 29
0
        /// <summary>
        /// Returns true if OutputAddressValidationInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputAddressValidationInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputAddressValidationInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     IsValid == other.IsValid ||
                     IsValid != null &&
                     IsValid.Equals(other.IsValid)
                     ) &&
                 (
                     IsAccount == other.IsAccount ||
                     IsAccount != null &&
                     IsAccount.Equals(other.IsAccount)
                 ) &&
                 (
                     IsBlacklisted == other.IsBlacklisted ||
                     IsBlacklisted != null &&
                     IsBlacklisted.Equals(other.IsBlacklisted)
                 ) &&
                 (
                     Avatar == other.Avatar ||
                     Avatar != null &&
                     Avatar.Equals(other.Avatar)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     CorrectAddress == other.CorrectAddress ||
                     CorrectAddress != null &&
                     CorrectAddress.Equals(other.CorrectAddress)
                 ) &&
                 (
                     MemoExpected == other.MemoExpected ||
                     MemoExpected != null &&
                     MemoExpected.Equals(other.MemoExpected)
                 ) &&
                 (
                     MemoPlaceholderText == other.MemoPlaceholderText ||
                     MemoPlaceholderText != null &&
                     MemoPlaceholderText.Equals(other.MemoPlaceholderText)
                 ) &&
                 (
                     SimilarToExistingService == other.SimilarToExistingService ||
                     SimilarToExistingService != null &&
                     SimilarToExistingService.Equals(other.SimilarToExistingService)
                 ) &&
                 (
                     Balances == other.Balances ||
                     Balances != null &&
                     Balances.Equals(other.Balances)
                 ));
        }
Exemplo n.º 30
0
 /// <summary>Constructor</summary>
 /// <param name="capacity">the normal item limit for cache (Count may exeed capacity due to minAge)</param>
 /// <param name="minAge">the minimium time after an access before an item becomes eligible for removal, during this time
 /// the item is protected and will not be removed from cache even if over capacity</param>
 /// <param name="maxAge">the max time that an object will sit in the cache without being accessed, before being removed</param>
 /// <param name="getNow">A delegate to get the current time.</param>
 /// <param name="validateCache">
 /// An optional delegate used to determine if cache is out of date. Is called before index access not more than once per 10 seconds
 /// </param>
 public FluidCache(int capacity, TimeSpan minAge, TimeSpan maxAge, GetNow getNow, IsValid validateCache = null)
 {
     lifeSpan = new LifespanManager <T>(this, capacity, minAge, maxAge, getNow)
     {
         ValidateCache = validateCache
     };
 }
Exemplo n.º 31
0
 public override int GetHashCode() => IsValid.GetHashCode() ^ ErrorMessages.GetHashCode();