Example #1
0
        public override IEnumerator <string> Complete(CommandDispatcher dispatcher, string partialCommand, string lastWord)
        {
            string[] sp = partialCommand.Trim().Split(' ');

            IEnumerator <string> complete = null;

            if (sp.Length >= 1)
            {
                List <string> list = new List <string>();

                string s = sp[sp.Length - 1].ToLower();
                if (s == "connect")
                {
                    list.Add("to");
                }
                else if (s == "identified")
                {
                    list.Add("by");
                }
                else if (s == "to")
                {
                    //TODO: load the saved addresses ...
                }
                else if (s == "on")
                {
                    list.Add("http");
                    list.Add("tcp");
                }
                else if (s == "with")
                {
                    list.Add("xml");
                    list.Add("json");
                    list.Add("binary");
                }
                else if (sp.Length == 3 && sp[1] == "to")
                {
                    list.Add("with");
                    list.Add("on");
                }
                else if (s == "http" || s == "tcp")
                {
                    list.Add("with");
                    list.Add("identified");
                }
                else if (s == "xml" || s == "json" || s == "binary")
                {
                    list.Add("on");
                    list.Add("identified");
                }

                complete = new Collections.SortedMatchEnumerator(lastWord, list, StringComparer.InvariantCultureIgnoreCase);
            }

            return(complete);
        }
Example #2
0
        public override IEnumerator<string> Complete(CommandDispatcher dispatcher, string partialCommand, string lastWord)
        {
            string[] sp = partialCommand.Trim().Split(' ');

            IEnumerator<string> complete = null;

            if (sp.Length >= 1) {
                List<string> list = new List<string>();

                string s = sp[sp.Length - 1].ToLower();
                if (s == "connect") {
                    list.Add("to");
                } else if (s == "identified") {
                    list.Add("by");
                } else if (s == "to") {
                    //TODO: load the saved addresses ...
                } else if (s == "on") {
                    list.Add("http");
                    list.Add("tcp");
                } else if (s == "with") {
                    list.Add("xml");
                    list.Add("json");
                    list.Add("binary");
                } else if (sp.Length == 3 && sp[1] == "to") {
                    list.Add("with");
                    list.Add("on");
                } else if (s == "http" || s == "tcp") {
                    list.Add("with");
                    list.Add("identified");
                } else if (s == "xml" || s == "json" || s == "binary") {
                    list.Add("on");
                    list.Add("identified");
                }

                complete = new Collections.SortedMatchEnumerator(lastWord, list, StringComparer.InvariantCultureIgnoreCase);
            }

            return complete;
        }