using LJProxy.LJLib.Net.SPI.Server; using LJProxy.Models; using LJProxy.Services; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace LJProxy.Excutor { public class GetAppUpdateExcutor : ExcutorBase { VersionService _service = new VersionService(); protected override IActionResult ExcuteInternal(GetAppUpdateRequest request, object state) { HttpRequest httpRequest = state as HttpRequest; Regex regx = new Regex(@"GetAppUpdate/(?.*?\.apk)", RegexOptions.IgnoreCase); var matchResult=regx.Match(httpRequest.Path.ToString()); if (matchResult.Success) { var apkName = matchResult.Groups["apkName"]?.Value; var fs = _service.GetAPK(apkName); if (fs==null) { return new NotFoundResult(); } else { return new FileContentResult(fs, "application/vnd.android.package-archive"); } } else { return new NotFoundResult(); } } } }