예제 #1
0
        private void btn_Parser_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txt_url.Text))
            {
                MessageBox.Show("Pleasr input the url to parser.");
                return;
            }

            listPagePatterns = new List <ListPagePattern>();
            selectedPattern  = null;
            lastTitleXPath   = null;

            channelUrl = txt_url.Text;

            if (checkUseBrowser.IsChecked ?? false)
            {
                httpResult = SeleniumHelper.HttpRequest(channelUrl);
            }
            else
            {
                httpResult = HttpHelper.HttpRequest(channelUrl);
            }

            if (httpResult != null && httpResult.HttpCode == 200)
            {
                listPagePatterns = SmartParser.Extract_Patterns(channelUrl, httpResult.Content, MediaType.WebNews, Enums.Language.CHINESE);
                RefreshUI();
            }
        }
        public string[] GetSuggestions(string text, int index)
        {
            //Base command hints
            if (string.IsNullOrWhiteSpace(text))
            {
                return(Program.CommandTable.Keys.ToArray());
            }

            string[] arguments   = SmartParser.ParseAsArguments(text).ToArray();
            string   lastArg     = arguments.Last();
            bool     newArgument = text.Last() == ' ';

            if (arguments.Count() == 1 && !newArgument && CommandKeys.Any(x => x.StartsWith(lastArg)))
            {
                return(QueryCommands(lastArg));
            }

            //Profile hints
            if (arguments[0] == "profiles" || arguments[0] == "delete")
            {
                if (newArgument)
                {
                    return(QueryProfiles());
                }

                string query = arguments[1];
                return(QueryProfiles(query));
            }

            return(null);
        }
예제 #3
0
 static void Profiles(string[] args = null)
 {
     if (args.Length < 1)
     {
         PrettyPrinter.PrintGameProfiles(ProfileManager.GetAllProfiles());
     }
     else
     {
         SmartParser.PrintProfile(args);
     }
 }
예제 #4
0
 static void Options(string[] args)
 {
     SmartParser.Configuration(args);
 }
예제 #5
0
 static void Launch(string[] args)
 {
     SmartParser.LaunchGame(args);
 }
예제 #6
0
 static void Delete(string[] args)
 {
     SmartParser.DeleteGameProfile(args);
 }
예제 #7
0
 //Create game profile
 static void Create(string[] args)
 {
     SmartParser.CreateGameProfile(args);
 }