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

            return
                ((
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                     ) &&
                 (
                     Memo == other.Memo ||
                     Memo != null &&
                     Memo.Equals(other.Memo)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     WalletType == other.WalletType ||
                     WalletType != null &&
                     WalletType.Equals(other.WalletType)
                 ));
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Customer other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((Cards == null && other.Cards == null) || (Cards?.Equals(other.Cards) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Preferences == null && other.Preferences == null) || (Preferences?.Equals(other.Preferences) == true)) &&
                   ((Groups == null && other.Groups == null) || (Groups?.Equals(other.Groups) == true)) &&
                   ((CreationSource == null && other.CreationSource == null) || (CreationSource?.Equals(other.CreationSource) == true)) &&
                   ((GroupIds == null && other.GroupIds == null) || (GroupIds?.Equals(other.GroupIds) == true)) &&
                   ((SegmentIds == null && other.SegmentIds == null) || (SegmentIds?.Equals(other.SegmentIds) == true)));
        }
예제 #3
0
        /// <summary>
        /// Returns true if OutputAddressesModel1 instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputAddressesModel1 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputAddressesModel1 other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;

            return 
                (
                    Address == other.Address ||
                    Address != null &&
                    Address.Equals(other.Address)
                ) && 
                (
                    Memo == other.Memo ||
                    Memo != null &&
                    Memo.Equals(other.Memo)
                ) && 
                (
                    Nickname == other.Nickname ||
                    Nickname != null &&
                    Nickname.Equals(other.Nickname)
                ) && 
                (
                    WalletType == other.WalletType ||
                    WalletType != null &&
                    WalletType.Equals(other.WalletType)
                ) && 
                (
                    SessionToken == other.SessionToken ||
                    SessionToken != null &&
                    SessionToken.Equals(other.SessionToken)
                );
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateCustomerRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) &&
                   ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) &&
                   ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) &&
                   ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) &&
                   ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) &&
                   ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) &&
                   ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)));
        }
예제 #5
0
        // override object.Equals
        public override bool Equals(object obj)
        {
            //
            // See the full list of guidelines at
            //   http://go.microsoft.com/fwlink/?LinkID=85237
            // and also the guidance for operator== at
            //   http://go.microsoft.com/fwlink/?LinkId=85238
            //

            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var other = obj as Player;

            // Note: when nickname == "" -> shallow compare.
            if (Nickname.Equals("") && other.Nickname.Equals(""))
            {
                return(this == other);
            }

            return
                (other != null &&
                 CurrentState == other.CurrentState &&
                 Nickname.Equals(other.Nickname)
                 //&& this.PrivateCards.Equals(other.PrivateCards) //TODO override card.equals
                 && _wallet.AmountOfMoney.Equals(other._wallet.AmountOfMoney)
                );
        }
예제 #6
0
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return(false);
     }
     else
     {
         if (Nickname != null)
         {
             User f = obj as User;
             if (Nickname.Equals(f.Nickname))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
예제 #7
0
        /// <summary>
        /// Returns true if BankingAccount instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingAccount to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingAccount other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     MaskedNumber == other.MaskedNumber ||
                     MaskedNumber != null &&
                     MaskedNumber.Equals(other.MaskedNumber)
                 ) &&
                 (
                     OpenStatus == other.OpenStatus ||
                     OpenStatus != null &&
                     OpenStatus.Equals(other.OpenStatus)
                 ) &&
                 (
                     IsOwned == other.IsOwned ||
                     IsOwned != null &&
                     IsOwned.Equals(other.IsOwned)
                 ) &&
                 (
                     ProductCategory == other.ProductCategory ||
                     ProductCategory != null &&
                     ProductCategory.Equals(other.ProductCategory)
                 ) &&
                 (
                     ProductName == other.ProductName ||
                     ProductName != null &&
                     ProductName.Equals(other.ProductName)
                 ));
        }
예제 #8
0
        /// <summary>
        /// Returns true if InlineResponseDefault5Value instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefault5Value to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefault5Value other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     OdataEtag == other.OdataEtag ||
                     OdataEtag != null &&
                     OdataEtag.Equals(other.OdataEtag)
                     ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     Fullname == other.Fullname ||
                     Fullname != null &&
                     Fullname.Equals(other.Fullname)
                 ) &&
                 (
                     Firstname == other.Firstname ||
                     Firstname != null &&
                     Firstname.Equals(other.Firstname)
                 ) &&
                 (
                     Lastname == other.Lastname ||
                     Lastname != null &&
                     Lastname.Equals(other.Lastname)
                 ) &&
                 (
                     Azureactivedirectoryobjectid == other.Azureactivedirectoryobjectid ||
                     Azureactivedirectoryobjectid != null &&
                     Azureactivedirectoryobjectid.Equals(other.Azureactivedirectoryobjectid)
                 ) &&
                 (
                     Systemuserid == other.Systemuserid ||
                     Systemuserid != null &&
                     Systemuserid.Equals(other.Systemuserid)
                 ) &&
                 (
                     Ownerid == other.Ownerid ||
                     Ownerid != null &&
                     Ownerid.Equals(other.Ownerid)
                 ));
        }
예제 #9
0
        /// <summary>sets the nickname for this client</summary>
        public void SetNickname(string nickname)
        {
            if (!string.IsNullOrEmpty(Nickname) && Nickname.Equals(nickname))
            {
                return;
            }

            Nickname = nickname;

            if (IsLocal)
            {
                //update photon local player aswell if this is our local client
                PhotonNetwork.LocalPlayer.NickName = nickname;
            }
        }
예제 #10
0
        public override bool Equals(object obj)
        {
            bool equals;

            if (obj == null || !obj.GetType().Equals(GetType()))
            {
                equals = false;
            }
            else
            {
                User known = (User)obj;
                equals = Nickname.Equals(known.Nickname);
            }
            return(equals);
        }
        /// <summary>
        /// Returns true if InlineResponseDefaultCreatedby instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefaultCreatedby to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefaultCreatedby other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Fullname == other.Fullname ||
                     Fullname != null &&
                     Fullname.Equals(other.Fullname)
                     ) &&
                 (
                     Firstname == other.Firstname ||
                     Firstname != null &&
                     Firstname.Equals(other.Firstname)
                 ) &&
                 (
                     Lastname == other.Lastname ||
                     Lastname != null &&
                     Lastname.Equals(other.Lastname)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     Systemuserid == other.Systemuserid ||
                     Systemuserid != null &&
                     Systemuserid.Equals(other.Systemuserid)
                 ) &&
                 (
                     Ownerid == other.Ownerid ||
                     Ownerid != null &&
                     Ownerid.Equals(other.Ownerid)
                 ));
        }
예제 #12
0
        /// <summary>
        /// Returns true if BankingPayee instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingPayee to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingPayee other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PayeeId == other.PayeeId ||
                     PayeeId != null &&
                     PayeeId.Equals(other.PayeeId)
                     ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     CreationDate == other.CreationDate ||
                     CreationDate != null &&
                     CreationDate.Equals(other.CreationDate)
                 ));
        }
예제 #13
0
        private int count_nb_bytes()
        {
            /* All the ASCII strings in the VCard must be separated by 0x0D0A, which represent 2 characters */
            int NbBytes = 0;

            NbBytes  = "BEGIN:VCARD".Length + 2 + "VERSION:3.0".Length + 2;
            NbBytes += "FN:".Length + First_name.Length + 1 + Family_name.Length + 2;                           /* 1 is for "space"	*/

            if (!Nickname.Equals(""))
            {
                NbBytes += "NICKNAME:".Length + Nickname.Length + 2;
            }

            /* Birthday with 8 characters: yyyymmdd	*/
            DateTime dateBirthday;

            if ((!Birthday.Equals("")) && (DateTime.TryParse(Birthday, out dateBirthday)))
            {
                NbBytes += "BDAY:".Length + 8 + 2;
            }

            /* Home address in 6 fields, separated by a ';'						*/
            /* The PO Box is discarded, which explains the first ';'	*/
            if (!(Address1.Equals("")) ||
                !(Address2.Equals("")) ||
                !(Town.Equals("")) ||
                !(Region_State.Equals("")) ||
                !(Post_Code.Equals("")) ||
                !(Country.Equals(""))
                )
            {
                NbBytes += "ADR:;".Length
                           + Address1.Length + 1
                           + Address2.Length + 1
                           + Town.Length + 1
                           + Region_State.Length + 1
                           + Post_Code.Length + 1
                           + Country.Length + 2;
            }

            /* Work address in 6 fields, separated by a ';'						*/
            /* The PO Box is discarded, which explains the first ';'	*/
            if (!(Pro_Address1.Equals("")) ||
                !(Pro_Address2.Equals("")) ||
                !(Pro_Town.Equals("")) ||
                !(Pro_Region_State.Equals("")) ||
                !(Pro_Post_Code.Equals("")) ||
                !(Pro_Country.Equals(""))
                )
            {
                NbBytes += "ADR;TYPE=work:;".Length
                           + Pro_Address1.Length + 1
                           + Pro_Address2.Length + 1
                           + Pro_Town.Length + 1
                           + Pro_Region_State.Length + 1
                           + Pro_Post_Code.Length + 1
                           + Pro_Country.Length + 2;
            }

            if (!Home_phone.Equals(""))
            {
                NbBytes += "TEL;TYPE=home:".Length + Home_phone.Length + 2;
            }

            if (!Business_phone.Equals(""))
            {
                NbBytes += "TEL;TYPE=work:".Length + Business_phone.Length + 2;
            }

            if (!Cell_phone.Equals(""))
            {
                NbBytes += "TEL;TYPE=cell:".Length + Cell_phone.Length + 2;
            }

            if (!Fax.Equals(""))
            {
                NbBytes += "TEL;TYPE=fax:".Length + Fax.Length + 2;
            }

            if (!Pager.Equals(""))
            {
                NbBytes += "TEL;TYPE=pager:".Length + Pager.Length + 2;
            }

            if (!Email.Equals(""))
            {
                if (Email_alternative.Equals(""))
                {
                    NbBytes += "EMAIL:".Length + Email.Length + 2;
                }
                else
                {
                    /* TWO EMAILS : PREF=1 and PREF=2	*/
                    NbBytes += "EMAIL;PREF=1:".Length + Email.Length + 2 + "EMAIL;PREF=2:".Length + Email_alternative.Length + 2;
                }
            }

            if (!Title.Equals(""))
            {
                NbBytes += "TITLE:".Length + Title.Length + 2;
            }

            if (!Role.Equals(""))
            {
                NbBytes += "ROLE:".Length + Role.Length + 2;
            }

            if (!Company.Equals(""))
            {
                NbBytes += "ORG:".Length + Company.Length + 2;
            }

            if (!_photo.Equals(""))
            {
                NbBytes += "PHOTO;ENCODING=BASE64;TYPE=JPEG:".Length + _photo.Length + 2;
            }

            NbBytes += "END:VCARD".Length + 2;

            return(NbBytes);
        }
        public virtual global::System.Boolean Equals(FindPlayers_Players_AccountsSearchResponseItem?other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

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

            if (other.GetType() != GetType())
            {
                return(false);
            }

            return((AccountId == other.AccountId) && ((Nickname is null && other.Nickname is null) || Nickname != null && Nickname.Equals(other.Nickname)) && ((ClanTag is null && other.ClanTag is null) || ClanTag != null && ClanTag.Equals(other.ClanTag)) && LastBattle.Equals(other.LastBattle) && BattlesCount == other.BattlesCount && WinRate == other.WinRate);
        }
예제 #15
0
        /// <summary>
        /// Returns true if BankInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of BankInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                     ) &&
                 (
                     CurrencyId == other.CurrencyId ||
                     CurrencyId != null &&
                     CurrencyId.Equals(other.CurrencyId)
                 ) &&
                 (
                     AccountHolder == other.AccountHolder ||
                     AccountHolder != null &&
                     AccountHolder.Equals(other.AccountHolder)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     Iban == other.Iban ||
                     Iban != null &&
                     Iban.Equals(other.Iban)
                 ) &&
                 (
                     BankName == other.BankName ||
                     BankName != null &&
                     BankName.Equals(other.BankName)
                 ) &&
                 (
                     SortCode == other.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(other.SortCode)
                 ) &&
                 (
                     RoutingNumber == other.RoutingNumber ||
                     RoutingNumber != null &&
                     RoutingNumber.Equals(other.RoutingNumber)
                 ) &&
                 (
                     SwiftBic == other.SwiftBic ||
                     SwiftBic != null &&
                     SwiftBic.Equals(other.SwiftBic)
                 ) &&
                 (
                     IfscCode == other.IfscCode ||
                     IfscCode != null &&
                     IfscCode.Equals(other.IfscCode)
                 ) &&
                 (
                     RoutingCode == other.RoutingCode ||
                     RoutingCode != null &&
                     RoutingCode.Equals(other.RoutingCode)
                 ) &&
                 (
                     UserAddressId == other.UserAddressId ||
                     UserAddressId != null &&
                     UserAddressId.Equals(other.UserAddressId)
                 ) &&
                 (
                     BankAddress == other.BankAddress ||
                     BankAddress != null &&
                     BankAddress.Equals(other.BankAddress)
                 ));
        }
예제 #16
0
        /// <summary>
        /// Returns true if JWToken instances are equal
        /// </summary>
        /// <param name="other">Instance of JWToken to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(JWToken other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Iss == other.Iss ||
                     Iss != null &&
                     Iss.Equals(other.Iss)
                     ) &&
                 (
                     Sub == other.Sub ||
                     Sub != null &&
                     Sub.Equals(other.Sub)
                 ) &&
                 (
                     Aud == other.Aud ||
                     Aud != null &&
                     Aud.Equals(other.Aud)
                 ) &&
                 (
                     Exp == other.Exp ||
                     Exp != null &&
                     Exp.Equals(other.Exp)
                 ) &&
                 (
                     Nbf == other.Nbf ||
                     Nbf != null &&
                     Nbf.Equals(other.Nbf)
                 ) &&
                 (
                     Iat == other.Iat ||
                     Iat != null &&
                     Iat.Equals(other.Iat)
                 ) &&
                 (
                     Jti == other.Jti ||
                     Jti != null &&
                     Jti.Equals(other.Jti)
                 ) &&
                 (
                     Uuid == other.Uuid ||
                     Uuid != null &&
                     Uuid.Equals(other.Uuid)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     EmailVerified == other.EmailVerified ||
                     EmailVerified != null &&
                     EmailVerified.Equals(other.EmailVerified)
                 ) &&
                 (
                     Zoneinfo == other.Zoneinfo ||
                     Zoneinfo != null &&
                     Zoneinfo.Equals(other.Zoneinfo)
                 ) &&
                 (
                     Locale == other.Locale ||
                     Locale != null &&
                     Locale.Equals(other.Locale)
                 ) &&
                 (
                     Cnf == other.Cnf ||
                     Cnf != null &&
                     Cnf.Equals(other.Cnf)
                 ) &&
                 (
                     Orig == other.Orig ||
                     Orig != null &&
                     Orig.Equals(other.Orig)
                 ) &&
                 (
                     Dest == other.Dest ||
                     Dest != null &&
                     Dest.Equals(other.Dest)
                 ) &&
                 (
                     Mky == other.Mky ||
                     Mky != null &&
                     Mky.Equals(other.Mky)
                 ));
        }
예제 #17
0
        /// <summary>
        /// Erstellt ein neues ircMessage Objekt um eine IRC Nachricht dazustellen
        /// </summary>
        /// <param name="data">Die Ausgangsdaten</param>
        /// <param name="serverConnetion">Die ServerConnetion von dem die Nachricht kommt</param>
        public IrcMessage(IrcMessageData data, ServerConnection serverConnetion)
        {
            Contract.Requires(data != null && serverConnetion != null);

            Data             = data;
            ServerConnetion  = serverConnetion;
            Nickname         = Data.Nick;
            Source           = Data.Channel ?? Data.Nick;
            Answered         = false;
            UnloggedMessages = new Queue <LogEvent>(3);
            List <string> MessageTmp = Data.MessageArray.Where(x => !String.IsNullOrEmpty(x)).ToList();

            Message = MessageTmp.Join(" ");
            if (Nickname.Contains("#") || Nickname.Contains(".") || ServerConnetion.IrcClient.IsMe(Nickname) || Nickname.Equals("freenode-connect", StringComparison.OrdinalIgnoreCase) || Nickname.Equals("nickserv", StringComparison.OrdinalIgnoreCase) || Nickname.Equals("chanserv", StringComparison.OrdinalIgnoreCase) || Data.Message.Contains("[Global Notice]"))
            {
                IsIgnored = true;
            }
            else
            {
                IsIgnored = false;
            }
            IsPrivate = data.Type.In(ReceiveType.QueryAction, ReceiveType.QueryMessage, ReceiveType.QueryNotice);
            if (Message.Length > 0)
            {
                IsCommand = Message[0] == '!';
            }
            else
            {
                IsCommand = false;
            }
            if (IsCommand)
            {
                CommandArgs = MessageTmp.Skip(1).ToList();
                CommandLine = CommandArgs.Join(" ");
                CommandName = MessageTmp[0].TrimStart('!');
            }
            else
            {
                CommandArgs = MessageTmp;
                CommandLine = Message;
                CommandName = "";
            }
            HasArgs = CommandArgs.Count > 0;
        }
예제 #18
0
 public bool IsFromUser(string user)
 {
     return(Nickname.Equals(user, StringComparison.CurrentCultureIgnoreCase));
 }
예제 #19
0
        public override bool Encode(ref byte[] buffer)
        {
            /* First : determine the total number of characters	*/
            int NbBytes = count_nb_bytes();

            /* Second : create the whole byte array                         */
            int index = 0;
            int new_index;

            byte[] pl = new byte[NbBytes];

            new_index = AddLine(pl, pl.Length, index, "BEGIN:VCARD", "");
            if (new_index < 0)
            {
                Trace.WriteLine("Error generating 'VCard' object: after 'BEGIN'");
                return(false);
            }
            index = new_index;

            new_index = AddLine(pl, pl.Length, index, "VERSION:3.0", "");
            if (new_index < 0)
            {
                Trace.WriteLine("Error generating 'VCard' object: after 'VERSION'");
                return(false);
            }
            index = new_index;

            string name = _first_name + " " + _family_name;

            new_index = AddLine(pl, pl.Length, index, "FN:", name);
            if (new_index < 0)
            {
                Trace.WriteLine("Error generating 'VCard' object: after 'FN'");
                return(false);
            }
            index = new_index;


            if (!Nickname.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "NICKNAME:", Nickname);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'Nickname'");
                    return(false);
                }
                index = new_index;
            }

            DateTime dateBirthday;

            if ((!Birthday.Equals("")) && (DateTime.TryParse(Birthday, out dateBirthday)))
            {
                string Bday = convert_into_vcard_date(Birthday);
                new_index = AddLine(pl, pl.Length, index, "BDAY:", Bday);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'Birthday'");
                    return(false);
                }
                index = new_index;
            }

            if (!(Address1.Equals("")) ||
                !(Address2.Equals("")) ||
                !(Town.Equals("")) ||
                !(Region_State.Equals("")) ||
                !(Post_Code.Equals("")) ||
                !(Country.Equals(""))
                )
            {
                string addr_line = Address1 + ";" + Address2 + ";" + Town + ";"
                                   + Region_State + ";" + Post_Code + ";" + Country;
                new_index = AddLine(pl, pl.Length, index, "ADR:;", addr_line);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'Address'");
                    return(false);
                }
                index = new_index;
            }

            if (!(Pro_Address1.Equals("")) ||
                !(Pro_Address2.Equals("")) ||
                !(Pro_Town.Equals("")) ||
                !(Pro_Region_State.Equals("")) ||
                !(Pro_Post_Code.Equals("")) ||
                !(Pro_Country.Equals(""))
                )
            {
                string pro_addr_line = Pro_Address1 + ";" + Pro_Address2 + ";" + Pro_Town + ";"
                                       + Pro_Region_State + ";" + Pro_Post_Code + ";" + Pro_Country;
                new_index = AddLine(pl, pl.Length, index, "ADR;TYPE=work:;", pro_addr_line);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'Professional Address'");
                    return(false);
                }
                index = new_index;
            }

            if (!Home_phone.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TEL;TYPE=home:", Home_phone);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TEL;TYPE=home'");
                    return(false);
                }
                index = new_index;
            }


            if (!Business_phone.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TEL;TYPE=work:", Business_phone);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TEL;TYPE=work'");
                    return(false);
                }
                index = new_index;
            }

            if (!Cell_phone.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TEL;TYPE=cell:", Cell_phone);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TEL;TYPE=cell'");
                    return(false);
                }
                index = new_index;
            }

            if (!Pager.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TEL;TYPE=pager:", Pager);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TEL;TYPE=pager'");
                    return(false);
                }
                index = new_index;
            }

            if (!Fax.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TEL;TYPE=fax:", Fax);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TEL;TYPE=fax'");
                    return(false);
                }
                index = new_index;
            }

            if (!Email.Equals(""))
            {
                if (Email_alternative.Equals(""))
                {
                    new_index = AddLine(pl, pl.Length, index, "EMAIL:", Email);
                    if (new_index < 0)
                    {
                        Trace.WriteLine("Error generating 'VCard' object: after 'EMAIL'");
                        return(false);
                    }
                    index = new_index;
                }
                else
                {
                    /*	Two E-mails to add */
                    new_index = AddLine(pl, pl.Length, index, "EMAIL;PREF=1:", Email);
                    if (new_index < 0)
                    {
                        Trace.WriteLine("Error generating 'VCard' object: after 'EMAIL;PREF=1'");
                        return(false);
                    }
                    index = new_index;

                    new_index = AddLine(pl, pl.Length, index, "EMAIL;PREF=2:", Email_alternative);
                    if (new_index < 0)
                    {
                        Trace.WriteLine("Error generating 'VCard' object: after 'EMAIL;PREF=2'");
                        return(false);
                    }
                    index = new_index;
                }
            }

            if (!Title.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "TITLE:", Title);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'TITLE'");
                    return(false);
                }
                index = new_index;
            }

            if (!Role.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "ROLE:", Role);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'ROLE'");
                    return(false);
                }
                index = new_index;
            }

            if (!Company.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "ORG:", Company);
                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'ORG'");
                    return(false);
                }
                index = new_index;
            }

            if (!_photo.Equals(""))
            {
                new_index = AddLine(pl, pl.Length, index, "PHOTO;ENCODING=BASE64;TYPE=JPEG:", _photo);

                if (new_index < 0)
                {
                    Trace.WriteLine("Error generating 'VCard' object: after 'PHOTO'");
                    return(false);
                }

                index = new_index;
            }

            new_index = AddLine(pl, pl.Length, index, "END:VCARD", "");
            _payload  = pl;

            return(base.Encode(ref buffer));
        }
예제 #20
0
        /// <summary>
        /// Returns true if AddressInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of AddressInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AddressInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AddressId == other.AddressId ||
                     AddressId != null &&
                     AddressId.Equals(other.AddressId)
                     ) &&
                 (
                     Nickname == other.Nickname ||
                     Nickname != null &&
                     Nickname.Equals(other.Nickname)
                 ) &&
                 (
                     IsPrimary == other.IsPrimary ||
                     IsPrimary != null &&
                     IsPrimary.Equals(other.IsPrimary)
                 ) &&
                 (
                     CountryName == other.CountryName ||
                     CountryName != null &&
                     CountryName.Equals(other.CountryName)
                 ) &&
                 (
                     CountryId == other.CountryId ||
                     CountryId != null &&
                     CountryId.Equals(other.CountryId)
                 ) &&
                 (
                     Zip == other.Zip ||
                     Zip != null &&
                     Zip.Equals(other.Zip)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     AdministrativeArea == other.AdministrativeArea ||
                     AdministrativeArea != null &&
                     AdministrativeArea.Equals(other.AdministrativeArea)
                 ) &&
                 (
                     DependentLocality == other.DependentLocality ||
                     DependentLocality != null &&
                     DependentLocality.Equals(other.DependentLocality)
                 ) &&
                 (
                     SortingCode == other.SortingCode ||
                     SortingCode != null &&
                     SortingCode.Equals(other.SortingCode)
                 ) &&
                 (
                     Organization == other.Organization ||
                     Organization != null &&
                     Organization.Equals(other.Organization)
                 ) &&
                 (
                     AddressLine1 == other.AddressLine1 ||
                     AddressLine1 != null &&
                     AddressLine1.Equals(other.AddressLine1)
                 ) &&
                 (
                     AddressLine2 == other.AddressLine2 ||
                     AddressLine2 != null &&
                     AddressLine2.Equals(other.AddressLine2)
                 ));
        }