Пример #1
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));
            output.Write(RandomId.ToBytes());
            output.Write(TTL.ToBytes());
            //output.Write(RandomBytes.ToBytes());
            output.Write(Message.ToBytes());
            Media.ToStream(output);

            ChatId.NullableToStream(output);
            InputFile.NullableToStream(output);
            FromId.NullableToStream(output);
            Out.NullableToStream(output);
            Unread.NullableToStream(output);
            Date.NullableToStream(output);
            DeleteDate.NullableToStream(output);
            Qts.NullableToStream(output);

            var status = new TLInt((int)Status);

            output.Write(status.ToBytes());

            InSeqNo.NullableToStream(output);
            OutSeqNo.NullableToStream(output);
            CustomFlags.NullableToStream(output);
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Code != 0)
            {
                hash ^= Code.GetHashCode();
            }
            if (Time != 0L)
            {
                hash ^= Time.GetHashCode();
            }
            if (ToId.Length != 0)
            {
                hash ^= ToId.GetHashCode();
            }
            if (FromId.Length != 0)
            {
                hash ^= FromId.GetHashCode();
            }
            if (ReqId.Length != 0)
            {
                hash ^= ReqId.GetHashCode();
            }
            if (Data.Length != 0)
            {
                hash ^= Data.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));
            output.Write(Flags.ToBytes());
            output.Write(RandomId.ToBytes());
            output.Write(TTL.ToBytes());
            output.Write(Message.ToBytes());
            ToStream(output, Media, Flags, (int)MessageFlags.Media);
            ToStream(output, Entities, Flags, (int)MessageFlags.Entities);
            ToStream(output, ViaBotName, Flags, (int)MessageFlags.ViaBotId);
            ToStream(output, ReplyToRandomMsgId, Flags, (int)MessageFlags.ReplyToMsgId);

            ChatId.NullableToStream(output);
            InputFile.NullableToStream(output);
            FromId.NullableToStream(output);
            Out.NullableToStream(output);
            Unread.NullableToStream(output);
            Date.NullableToStream(output);
            DeleteDate.NullableToStream(output);
            Qts.NullableToStream(output);

            var status = new TLInt((int)Status);

            output.Write(status.ToBytes());

            InSeqNo.NullableToStream(output);
            OutSeqNo.NullableToStream(output);
            CustomFlags.NullableToStream(output);

            if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult))
            {
                _inlineBotResult.ToStream(output);
            }
        }
Пример #4
0
 public bool Remove(KeyValuePair <object, Artefact> item)
 {
     if (FromRef.ContainsKey(item.Key))
     {
         Artefact artefact = FromRef[item.Key];
         FromRef.Remove(item.Key);
         FromId.Remove(artefact.Id);
         return(true);
     }
     return(false);
 }
Пример #5
0
 public bool Remove(object key)
 {
     if (FromRef.ContainsKey(key))
     {
         Artefact artefact = FromRef[key];
         FromRef.Remove(key);
         FromId.Remove(artefact.Id);
         return(true);
     }
     return(false);
 }
Пример #6
0
            public int CompareTo(object o)
            {
                if (null == o)
                {
                    return(1);
                }
                var that   = (AlignmentKey)o;
                int result = FromId.CompareTo(that.FromId);

                if (result == 0)
                {
                    result = ToId.CompareTo(that.ToId);
                }
                return(result);
            }
Пример #7
0
        public Artefact GetOrCreate <T>(object instance)
        {
            Artefact artefact;

            if (ContainsKey(instance))
            {
                artefact = FromRef[instance];
            }
            else
            {
                artefact = new Artefact(instance);
                FromRef.Add(instance, artefact);
                FromId.Add(artefact.Id, artefact);
            }
            artefact.StoreInstance(instance, typeof(T));
            return(artefact);
        }
Пример #8
0
        public override void ToStream(Stream output)
        {
            output.Write(TLUtils.SignatureToBytes(Signature));
            output.Write(RandomId.ToBytes());
            output.Write(RandomBytes.ToBytes());
            output.Write(Action.ToBytes());

            ChatId.NullableToStream(output);
            FromId.NullableToStream(output);
            Out.NullableToStream(output);
            Unread.NullableToStream(output);
            Date.NullableToStream(output);
            DeleteDate.NullableToStream(output);
            Qts.NullableToStream(output);

            var status = new TLInt((int)Status);

            output.Write(status.ToBytes());
        }
Пример #9
0
        /// <summary>
        ///     Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///     A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        public override int GetHashCode( )
        {
            unchecked
            {
                int hash = 17;

                hash = hash * 92821 + TypeId.GetHashCode( );

                hash = hash * 92821 + FromId.GetHashCode( );

                hash = hash * 92821 + ToId.GetHashCode( );

                if (Cardinality != null)
                {
                    hash = hash * 92821 + Cardinality.GetHashCode( );
                }

                return(hash);
            }
        }
Пример #10
0
 public void Clear()
 {
     FromRef.Clear();
     FromId.Clear();
 }
Пример #11
0
 public void Add(KeyValuePair <object, Artefact> item)
 {
     FromRef.Add(item.Key, item.Value);
     FromId.Add(item.Value.Id, item.Value);
 }
Пример #12
0
 public void Add(object key, Artefact value)
 {
     FromRef.Add(key, value);
     FromId.Add(value.Id, value);
 }
Пример #13
0
 /// <summary>
 ///     Navigates the click.
 /// </summary>
 private void NavigateFromClick( )
 {
     EntityNotificationService.NavigateTo(FromId.ToString(CultureInfo.InvariantCulture), TenantId);
 }