Exemple #1
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.PutParam(this.Method);
            serializer.PutParam(this.Capability);
        }
Exemple #2
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Method     = serializer.GetParam();
            this.Capability = serializer.GetParam();
        }
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Operator = serializer.GetParam();
            this.User     = serializer.GetParam();
        }
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.PutParam(this.Operator);
            serializer.PutParam(this.User);
        }
Exemple #5
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.PutParam(this.User);
            serializer.PutParam(this.Command);
            serializer.PutParam(this.Message.AddPrefix(IRCParams.TrailingPrefix));
        }
Exemple #6
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.User    = serializer.GetParam();
            this.Command = serializer.GetParam();
            this.Message = serializer.GetParam(true).RemovePrefix(IRCParams.TrailingPrefix);
        }
Exemple #7
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.WriteTags(this.Tags);

            serializer.Command = this.Name;
            serializer.PutParams(this.Values);
        }
Exemple #8
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Tags = serializer.ReadTags(() => new TagsClearChat());

            var user = serializer.GetParam(true);

            this.User = user.RemovePrefix(IRCParams.TrailingPrefix);
        }
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            var toString      = serializer.GetParam().RemovePrefix(IRCParams.TrailingPrefix);
            var splited       = toString.Split(ViewersSeparator);
            var targetChannel = splited[0];

            this.TargetChannel = targetChannel.Equals(HostStop) ? null : targetChannel;
            this.Viewers       = splited.Length >= 2 ? NumberUtils.ToIntNullable(splited[1]) : null;
        }
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            var message = this.Message;

            if (message != null)
            {
                var value = this.Message.AddPrefix(IRCParams.TrailingPrefix);
                serializer.PutParam(value);
            }
        }
Exemple #11
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.PutParam(this.User);
            serializer.PutParam(ChannelSeparator);
            serializer.PutParam(this.Channel);

            var users = this.Users;

            serializer.PutParam(string.Join(UsersDelimiter, users).AddPrefix(IRCParams.TrailingPrefix));
        }
Exemple #12
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Tags = serializer.ReadTags(() => new TagsRaw());

            this.Name = serializer.Command;

            var values = this.Values;

            values.Clear();
            values.AddRange(serializer.GetParams());
        }
Exemple #13
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.User = serializer.GetParam();
            serializer.GetParam(); // ChannelSeparator
            this.Channel = serializer.GetParam();

            var users = this.Users;

            users.Clear();
            users.AddRange(serializer.GetParam().RemovePrefix(IRCParams.TrailingPrefix).Split(UsersDelimiter));
        }
Exemple #14
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.WriteTags(this.Tags);

            var user = this.User;

            if (user != null)
            {
                serializer.PutParam(user.AddPrefix(IRCParams.TrailingPrefix));
            }
        }
        public static Command FromMessage(IRCMessage message)
        {
            try
            {
                var serializer = new CommandSerializer();
                serializer.FromMessage(message);

                var command = CreateCommand(serializer.Command, true);
                command.Read(serializer);

                return(command);
            }
            catch (Exception e)
            {
                throw new CommandException($"message:'{message}'", e);
            }
        }
        public static IRCMessage ToMessage(Command command)
        {
            try
            {
                var message = new IRCMessage();
                message.Params = new IRCParams();

                var serializer = new CommandSerializer();
                serializer.Command = FromType(command.GetType())?.Name;
                command.Write(serializer);
                serializer.ToMessage(message);

                return(message);
            }
            catch (Exception e)
            {
                throw new CommandException($"command:'{command.GetType().FullName}'", e);
            }
        }
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            var targetChannel = this.TargetChannel;
            var viewers       = this.Viewers;

            var toString = new StringBuilder();

            toString.Append(IRCParams.TrailingPrefix);
            toString.Append(targetChannel ?? HostStop);

            if (viewers.HasValue == true)
            {
                toString.Append(ViewersSeparator);
                toString.Append(viewers.Value);
            }

            serializer.PutParam(toString.ToString());
        }
 public override void Write(CommandSerializer serializer)
 {
     base.Write(serializer);
 }
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Tags = serializer.ReadTags(() => new TagsUserNotice());
        }
Exemple #20
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Tags = serializer.ReadTags(() => new TagsClearMessage());
        }
 public virtual void Read(CommandSerializer serializer)
 {
     this.Sender = serializer.Sender;
 }
 public virtual void Write(CommandSerializer serializer)
 {
     serializer.Sender = this.Sender;
 }
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Channel = serializer.GetParam();
        }
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.PutParam(this.Channel);
        }
Exemple #25
0
        public override void Write(CommandSerializer serializer)
        {
            base.Write(serializer);

            serializer.WriteTags(this.Tags);
        }
Exemple #26
0
        public override void Read(CommandSerializer serializer)
        {
            base.Read(serializer);

            this.Tags = serializer.ReadTags(() => new TagsGlobalUserState());
        }