Ejemplo n.º 1
0
        public IEnumerable <TLauncherEntry> BySearchExpression(string exp)
        {
            if (string.IsNullOrEmpty(exp))
            {
                yield break;
            }

            TopDocs hits = null;

            try {
                var parser = new MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_CURRENT, new string[] {
                    "label",
                    "description",
                    "category"
                }, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_CURRENT));
                parser.AllowLeadingWildcard = true;
                hits = reader.Search(parser.Parse(exp), 1000);
            } catch (Exception ex) {
                CoreLib.Log(ex.ToString());
            }
            if (hits != null)
            {
                for (var i = 0; i < hits.TotalHits; i++)
                {
                    yield return(new TLauncherEntry(reader.Doc(hits.ScoreDocs[i].Doc)));
                }
            }
        }
Ejemplo n.º 2
0
 public Pixbuf GetIconPixBuf()
 {
     if (Environment.OSVersion.Platform == PlatformID.Unix)
     {
         var file = "/usr/share/icons/gnome/32x32/apps/" + IconName + ".png";
         if (File.Exists(file))
         {
             return(new Pixbuf(file));
         }
         else
         {
             return(null);
         }
     }
     else
     {
         try {
             var data = IconStored;
             if (data == null || data.Length == 0)
             {
                 return(null);
             }
             else
             {
                 return(new Pixbuf(data));
             }
         } catch (Exception ex) {
             CoreLib.Log(ex.ToString());
         }
         return(null);
     }
 }
Ejemplo n.º 3
0
 public void AddLink(string file)
 {
     try {
         var entry = TLauncherEntry.CreateFromFile(file);
         writer.AddDocument(entry.doc);
     } catch (Exception ex) {
         CoreLib.Log(ex.ToString());
     }
 }
Ejemplo n.º 4
0
 public static TLauncherEntry CreateFromFile(string path)
 {
     CoreLib.Log("ADD LINK: " + path);
     return(Factory.Current.ReadLinkFile(path));
 }