Skip to content

Instantly share code, notes, and snippets.

@DevJohnC
Created May 13, 2013 21:01
Show Gist options
  • Select an option

  • Save DevJohnC/5571498 to your computer and use it in GitHub Desktop.

Select an option

Save DevJohnC/5571498 to your computer and use it in GitHub Desktop.
using FragLabs.Adjutant.API.Services;
using FragLabs.Adjutant.Modules.Video.Dtos;
namespace FragLabs.Adjutant.Modules.Video.Services
{
public class BrowseService : Service<Browse>
{
public override object Execute(Browse request)
{
var app = (VideoApp)Context.App;
var ret = new BrowseResponse();
if (request.MountPoint == null)
{
ret.MountPoints = new string[app.Settings.MountPoints.Count];
for (var i = 0; i < ret.MountPoints.Length; i++)
{
ret.MountPoints[i] = app.Settings.MountPoints[i].Name;
}
}
else
{
MountPoint mountPoint = null;
foreach (var mount in app.Settings.MountPoints)
{
if (mount.Name == request.MountPoint)
{
mountPoint = mount;
break;
}
}
if (mountPoint != null)
{
var browser = new DirBrowser(mountPoint.Directory, request.Directory);
browser.Run();
ret.Directories = browser.Directories;
ret.Files = browser.Files;
}
}
return ret;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment