1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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<GetAppUpdateRequest>
- {
- VersionService _service = new VersionService();
- protected override IActionResult ExcuteInternal(GetAppUpdateRequest request, object state)
- {
- HttpRequest httpRequest = state as HttpRequest;
- Regex regx = new Regex(@"GetAppUpdate/(?<apkName>.*?\.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();
- }
- }
- }
- }
|