diff --git a/TGServerService/Config.cs b/TGServerService/Config.cs index 11d0f5c2ce..52553c70e2 100644 --- a/TGServerService/Config.cs +++ b/TGServerService/Config.cs @@ -119,5 +119,26 @@ namespace TGServerService return e.ToString(); } } + + [OperationBehavior(Impersonation = ImpersonationOption.Required)] + public IList ListStaticDirectory(string subDir, out string error) + { + try + { + DirectoryInfo dirToEnum = new DirectoryInfo(Path.Combine(StaticDirs, subDir ?? "")); + var result = new List(); + foreach (var I in dirToEnum.GetFiles()) + result.Add(I.Name); + foreach (var I in dirToEnum.GetDirectories()) + result.Add("@" + I.Name); + error = null; + return result; + } + catch (Exception e) + { + error = e.ToString(); + return null; + } + } } } diff --git a/TGServiceInterface/Config.cs b/TGServiceInterface/Config.cs index a06dcdaec3..c0a58ecde3 100644 --- a/TGServiceInterface/Config.cs +++ b/TGServiceInterface/Config.cs @@ -18,6 +18,16 @@ namespace TGServiceInterface [OperationContract] string ServerDirectory(); + /// + /// Returns the file contents of the specified server directory + /// Subdirectories will be prefixed with '@' + /// + /// Subdirectory to enumerate, enumerates the root directory if null + /// null on success, error message on failure + /// A list of files in the enumerated static directory on success, null on failure + [OperationContract] + IList ListStaticDirectory(string subpath, out string error); + /// /// For when you really just need to see the raw data of the config ///