예제 #1
0
파일: CMD.cs 프로젝트: fourmatrix/Wox
 private void ExecuteCmd(string cmd)
 {
     if (context.ShellRun(cmd))
     {
         CMDStorage.Instance.AddCmdHistory(cmd);
     }
 }
예제 #2
0
파일: Programs.cs 프로젝트: fourmatrix/Wox
        protected override List <Result> QueryInternal(Query query)
        {
            if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1)
            {
                return(new List <Result>());
            }

            var            fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
            List <Program> returnList  = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();

            returnList.ForEach(ScoreFilter);
            //return ordered list instead of return the score, because programs scores will affect other
            //plugins, the weight of program should be less than the plugins when they showed at the same time.
            returnList = returnList.OrderByDescending(o => o.Score).ToList();

            return(returnList.Select(c => new Result()
            {
                Title = c.Title,
                SubTitle = c.ExecutePath,
                IcoPath = c.IcoPath,
                Score = 0,
                Action = (e) =>
                {
                    context.HideApp();
                    context.ShellRun(c.ExecutePath);
                    return true;
                }
            }).ToList());
        }
예제 #3
0
        protected override List <Result> QueryInternal(Query query)
        {
            if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1)
            {
                return(new List <Result>());
            }

            var             fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
            List <Bookmark> returnList  = bookmarks.Where(o => MatchProgram(o, fuzzyMather)).ToList();

            returnList = returnList.OrderByDescending(o => o.Score).ToList();
            return(returnList.Select(c => new Result()
            {
                Title = c.Name,
                SubTitle = "Bookmark: " + c.Url,
                IcoPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\bookmark.png",
                Score = 5,
                Action = (e) =>
                {
                    context.HideApp();
                    context.ShellRun(c.Url);
                    return true;
                }
            }).ToList());
        }