Example #1
0
 public OptionsContainer(IOptionsBase options, Action <object, IOptionsBase> onOptionsUpdate)
 {
     this.options = options;
     if (onOptionsUpdate != null)
     {
         optionsUpdate += onOptionsUpdate;
     }
 }
Example #2
0
        protected override bool ExecuteCommandInner(IOptionsBase optionsBase)
        {
            var sendMessage = base.ExecuteCommandInner(optionsBase);

            if (sendMessage)
            {
                SendMessage((TOption)optionsBase);
            }

            return(sendMessage);
        }
Example #3
0
        public override bool Equals(Object obj)
        {
            bool result = false;

            if (obj != null && obj is IOptionsContainer)
            {
                IOptionsBase objOptions = (obj as IOptionsContainer).Options;
                result = this.options.Equals(objOptions);
            }

            return(result);
        }
Example #4
0
        public override bool Equals(Object obj)
        {
            bool result = false;

            if (obj != null && obj is IOptionsBase)
            {
                IOptionsBase options = obj as IOptionsBase;
                if (GetHashCode() == options.GetHashCode())
                {
                    result = true;
                }
            }

            return(result);
        }
        internal void OnPortOptionsUpdate(object sender, IOptionsBase options)
        {
            try
            {
                bool openAfterUpdate = false;
                if (IsOpen)
                {
                    openAfterUpdate = true;
                    Close();
                }

                PortOptionsUpdate(this.options as MKOPortOptions);

                if (openAfterUpdate)
                {
                    Open();
                }
            }
            catch (Exception exception)
            {
                throw CreateThrowUpException(exception);
            }
        }
Example #6
0
 internal void OnPortOptionsUpdate(object sender, IOptionsBase options)
 {
 }
Example #7
0
        protected virtual Task <bool> ExecuteCommandInner(IDiscordBot bot, SocketMessage message, IOptionsBase optionsBase)
        {
            var options = optionsBase;

            return(ExecuteCommand(bot, message, (TOption)options));
        }
        private static string WithPrePostWrap(string innerCypher, IOptionsBase options)
        {
            var output = string.Format("{0}({1}){2}", options.PreCql, innerCypher, options.PostCql);

            return(output);
        }
Example #9
0
 protected virtual bool ExecuteCommandInner(IOptionsBase optionsBase)
 {
     Options = optionsBase;
     return(ExecuteCommand((TOption)Options));
 }
Example #10
0
 public OptionsContainer(IOptionsBase options)
     : this(options, null)
 {
 }