Created
May 13, 2013 21:01
-
-
Save DevJohnC/5571498 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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