diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index 7a5e458..10b4b85 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -49,6 +49,7 @@ + @@ -119,6 +120,7 @@ + diff --git a/B3ClientService/Rpcs/VersionRpc.cs b/B3ClientService/Rpcs/VersionRpc.cs new file mode 100644 index 0000000..1013618 --- /dev/null +++ b/B3ClientService/Rpcs/VersionRpc.cs @@ -0,0 +1,38 @@ +using Forks.EnterpriseServices.JsonRpc; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; + +namespace BWP.B3ClientService.Rpcs +{ + [Rpc] + public static class VersionRpc + { + [Rpc(RpcFlags.SkipAuth)] + public static string CheckVersion(string version) + { + var folder = Path.Combine(HttpRuntime.AppDomainAppPath, "ClientVersion"); + var versionPath = Path.Combine(folder, "Version.txt"); + if (File.Exists(versionPath)) + { + if (File.ReadAllText(versionPath) == version) + return null; + else + return GetAllFiles(folder); + } + return null; + } + + static string GetAllFiles(string path) + { + var list = new List(); + var folder = new DirectoryInfo(path); + foreach (var file in folder.GetFiles()) + list.Add(file.Name); + return string.Join(",", list); + } + } +}