2014-08-14 22:21:07 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2014-03-19 02:06:51 +08:00
|
|
|
|
using System.IO;
|
2014-03-30 11:16:44 +08:00
|
|
|
|
using System.Linq;
|
2015-11-09 01:32:33 +00:00
|
|
|
|
using Wox.Infrastructure.Exception;
|
2015-10-30 23:17:34 +00:00
|
|
|
|
using Wox.Infrastructure.Logger;
|
2014-03-19 02:06:51 +08:00
|
|
|
|
|
2015-01-03 15:20:34 +08:00
|
|
|
|
namespace Wox.Plugin.Program.ProgramSources
|
2014-03-19 02:06:51 +08:00
|
|
|
|
{
|
2014-12-15 22:58:49 +08:00
|
|
|
|
[Serializable]
|
2016-08-19 23:05:59 +01:00
|
|
|
|
public class FileSystemProgramSource : Win32
|
2014-03-19 02:06:51 +08:00
|
|
|
|
{
|
2016-07-21 19:51:47 +01:00
|
|
|
|
public string Location { get; set; } = "";
|
2014-03-19 04:05:27 +08:00
|
|
|
|
|
2014-03-19 02:06:51 +08:00
|
|
|
|
public override List<Program> LoadPrograms()
|
|
|
|
|
|
{
|
2016-08-19 20:34:20 +01:00
|
|
|
|
if (Directory.Exists(Location) && MaxDepth >= -1)
|
2014-08-12 12:21:04 +08:00
|
|
|
|
{
|
2016-08-19 20:34:20 +01:00
|
|
|
|
var apps = new List<Program>();
|
2016-08-19 23:05:59 +01:00
|
|
|
|
GetAppFromDirectory(apps, Location, MaxDepth);
|
2016-08-19 20:34:20 +01:00
|
|
|
|
return apps;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return new List<Program>();
|
2014-08-12 12:21:04 +08:00
|
|
|
|
}
|
2015-04-20 20:32:10 -04:00
|
|
|
|
}
|
2014-03-19 02:06:51 +08:00
|
|
|
|
}
|
2016-07-21 19:51:47 +01:00
|
|
|
|
}
|