mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Rename Wox.Plugin.System to Wox.Plugin.SystemPlugins
Finish moving ProgramSetting into featureBox
This commit is contained in:
48
Wox.Plugin.SystemPlugins/IProgramSource.cs
Normal file
48
Wox.Plugin.SystemPlugins/IProgramSource.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Wox.Plugin.SystemPlugins
|
||||
{
|
||||
public interface IProgramSource
|
||||
{
|
||||
List<Program> LoadPrograms();
|
||||
int BonusPoints { get; set; }
|
||||
}
|
||||
|
||||
public abstract class AbstractProgramSource : IProgramSource
|
||||
{
|
||||
public abstract List<Program> LoadPrograms();
|
||||
|
||||
public int BonusPoints
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected Program CreateEntry(string file)
|
||||
{
|
||||
Program p = new Program()
|
||||
{
|
||||
Title = global::System.IO.Path.GetFileNameWithoutExtension(file),
|
||||
IcoPath = file,
|
||||
ExecutePath = file
|
||||
};
|
||||
|
||||
switch (global::System.IO.Path.GetExtension(file).ToLower())
|
||||
{
|
||||
case ".exe":
|
||||
p.ExecuteName = global::System.IO.Path.GetFileName(file);
|
||||
try
|
||||
{
|
||||
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(file);
|
||||
if (versionInfo.FileDescription != null && versionInfo.FileDescription != string.Empty) p.Title = versionInfo.FileDescription;
|
||||
}
|
||||
catch (Exception) { }
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user