示例#1
0
 public override TLauncherEntry ReadLinkFile(string file)
 {
     var ini = new INIFile(file);
     var entry = new TLauncherEntry();
     entry.Name = ini.GetValue("Desktop Entry", "Name", "");
     var cmd = ini.GetValue("Desktop Entry", "Exec", "");
     entry.CommandPath = Path.GetDirectoryName(cmd);
     entry.CommandFile = Path.GetFileName(cmd);
     entry.CommandArgs = ""; //TODO
     entry.Categories = ini.GetValue("Desktop Entry", "Categories", "");
     entry.IconName = ini.GetValue("Desktop Entry", "Icon", "");
     entry.Description = ini.GetValue("Desktop Entry", "Comment", "");
     entry.UpdateMainCategory();
     return entry;
 }
示例#2
0
        public static void SetCategory(TLauncherEntry entry)
        {
            if (xdoc == null)
                xdoc = XDocument.Load("../res/categories/default.xml");

            foreach (var itm in  xdoc.Root.Elements("Item")) {
                var filter = itm.Attribute("Filter").Value;
                var cat = itm.Attribute("Category").Value;
                if (entry.Command.ToLower().Contains(filter)) {
                    entry.Categories = cat;
                    entry.UpdateMainCategory();
                    return;
                }
                entry.Categories = "None";
                entry.MainCategory = "None";
            }
        }