Beispiel #1
0
 public void Deserialize(string value, XNameValueCollection parameters)
 {
     Email  = value.Substring(value.IndexOf(':') + 1);
     Name   = parameters["CN"];
     SentBy = parameters["SENT-BY"];
     if (!string.IsNullOrEmpty(SentBy))
     {
         SentBy = SentBy.Substring(SentBy.IndexOf(':') + 1);
     }
     Directory = parameters["DIR"];
 }
Beispiel #2
0
        public void Deserialize(string value, System.Collections.Specialized.NameValueCollection parameters)
        {
            if (value == null)
            {
                return;
            }

            Email  = value.Substring(value.IndexOf(':') + 1);
            Name   = parameters["CN"];
            SentBy = parameters["SENT-BY"];
            if (!string.IsNullOrEmpty(SentBy))
            {
                SentBy = SentBy.Substring(SentBy.IndexOf(':') + 1);
            }
            Directory = parameters["DIR"];
        }
Beispiel #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = SentBy?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (CommonName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (DirectoryEntry?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Type?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Members);
         hashCode = (hashCode * 397) ^ (Role?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ParticipationStatus?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Rsvp.GetHashCode();
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(DelegatedTo);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(DelegatedFrom);
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Beispiel #4
0
    public override IEnumerator Process()
    {
        if (SentBy.Equals(NetworkInstanceId.Invalid))
        {
            //Failfast
            Logger.LogWarning($"Shoot request invalid, processing stopped: {ToString()}", Category.Firearms);
            yield break;
        }


        yield return(WaitFor(SentBy));

        //get the currently equipped weapon in the player's active hand
        PlayerNetworkActions pna = NetworkObject.GetComponent <PlayerNetworkActions>();
        Weapon wep = pna.GetActiveHandItem().GetComponent <Weapon>();

        wep.ServerShoot(NetworkObject, Target, DamageZone, IsSuicideShot);
    }
        /// <summary>
        /// Converts this to valid "via-parm" value.
        /// </summary>
        /// <returns>Returns "via-parm" value.</returns>
        public override string ToStringValue()
        {
            /*
             *  Via               =  ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
             *  via-parm          =  sent-protocol LWS sent-by *( SEMI via-params )
             *  via-params        =  via-ttl / via-maddr / via-received / via-branch / via-extension
             *  via-ttl           =  "ttl" EQUAL ttl
             *  via-maddr         =  "maddr" EQUAL host
             *  via-received      =  "received" EQUAL (IPv4address / IPv6address)
             *  via-branch        =  "branch" EQUAL token
             *  via-extension     =  generic-param
             *  sent-protocol     =  protocol-name SLASH protocol-version
             *                       SLASH transport
             *  protocol-name     =  "SIP" / token
             *  protocol-version  =  token
             *  transport         =  "UDP" / "TCP" / "TLS" / "SCTP" / other-transport
             *  sent-by           =  host [ COLON port ]
             *  ttl               =  1*3DIGIT ; 0 to 255
             *
             *  Via extentions:
             *  // RFC 3486
             *  via-compression  =  "comp" EQUAL ("sigcomp" / other-compression)
             *  // RFC 3581
             *  response-port  =  "rport" [EQUAL 1*DIGIT]
             *
             *  Examples:
             *  Via: SIP/2.0/UDP 127.0.0.1:58716;branch=z9hG4bK-d87543-4d7e71216b27df6e-1--d87543-
             *  // Specifically, LWS on either side of the ":" or "/" is allowed.
             *  Via: SIP / 2.0 / UDP 127.0.0.1:58716;branch=z9hG4bK-d87543-4d7e71216b27df6e-1--d87543-
             */

            StringBuilder retVal = new StringBuilder();

            retVal.Append(ProtocolName + "/" + ProtocolVersion + "/" + ProtocolTransport + " ");
            retVal.Append(SentBy.ToString());
            retVal.Append(ParametersToString());

            return(retVal.ToString());
        }
Beispiel #6
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append($"Via: {SIPVersion}");
            sb.Append($"/{Protocol} ");
            sb.Append($"{SentBy.ToString()};");

            if (!string.IsNullOrWhiteSpace(Branch))
            {
                sb.Append($"branch={Branch};");
            }

            if (!string.IsNullOrWhiteSpace(RPort))
            {
                sb.Append($"{RPort}");
            }

            sb.AppendLine();

            return(sb.ToString());
        }
Beispiel #7
0
        public override string FormatBodyToString()
        {
            var b = new StringBuilder();

            b.AppendFormat("{0}/{1} {2};{3}", SipConstants.SipTwoZeroString, Transport, SentBy.ToString(), Parameters.FormatToString());
            return(b.ToString());
        }