Read .exe file description for program name
This commit is contained in:
parent
aab0bf369d
commit
baa50069cf
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Wox.Plugin.System
|
namespace Wox.Plugin.System
|
||||||
{
|
{
|
||||||
|
@ -29,6 +30,18 @@ namespace Wox.Plugin.System
|
||||||
ExecutePath = file
|
ExecutePath = file
|
||||||
};
|
};
|
||||||
|
|
||||||
|
switch (global::System.IO.Path.GetExtension(file).ToLower())
|
||||||
|
{
|
||||||
|
case ".exe":
|
||||||
|
p.ExecuteName = global::System.IO.Path.GetFileNameWithoutExtension(file);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(file);
|
||||||
|
if (versionInfo.FileDescription != null && versionInfo.FileDescription != string.Empty) p.Title = versionInfo.FileDescription;
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
break;
|
||||||
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace Wox.Plugin.System
|
||||||
public string AbbrTitle { get; private set; }
|
public string AbbrTitle { get; private set; }
|
||||||
public string IcoPath { get; set; }
|
public string IcoPath { get; set; }
|
||||||
public string ExecutePath { get; set; }
|
public string ExecutePath { get; set; }
|
||||||
|
public string ExecuteName { get; set; }
|
||||||
public int Score { get; set; }
|
public int Score { get; set; }
|
||||||
public IProgramSource Source { get; set; }
|
public IProgramSource Source { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -98,6 +99,7 @@ namespace Wox.Plugin.System
|
||||||
if (program.AbbrTitle != null && (program.Score = matcher.Score(program.AbbrTitle)) > 0) return true;
|
if (program.AbbrTitle != null && (program.Score = matcher.Score(program.AbbrTitle)) > 0) return true;
|
||||||
if ((program.Score = matcher.Score(program.Title)) > 0) return true;
|
if ((program.Score = matcher.Score(program.Title)) > 0) return true;
|
||||||
if ((program.Score = matcher.Score(program.PinyinTitle)) > 0) return true;
|
if ((program.Score = matcher.Score(program.PinyinTitle)) > 0) return true;
|
||||||
|
if (program.ExecuteName != null && (program.Score = matcher.Score(program.ExecuteName)) > 0) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue