| | |
| | | public class UploadController : ApiController |
| | | { |
| | | [HttpPost] |
| | | public Task<IEnumerable<FileDesc>> Post([FromUri]string path) |
| | | public Task<IEnumerable<FileDesc>> Post([FromUri] string path, [FromUri] string token) |
| | | { |
| | | if (string.IsNullOrEmpty(token) || !ExportUtil.VerifyToken(token)) |
| | | { |
| | | throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.Unauthorized, "令牌为空或无效!")); |
| | | } |
| | | |
| | | //string root = HttpContext.Current.Server.MapPath("~/uploads"); |
| | | if (string.IsNullOrEmpty(path)) return null; |
| | | string root = Path.Combine(Tools.GetSetting("tempFolder"), path); |
| | |
| | | |
| | | string layerJson = Path.Combine(dirPath, "layer.json"); |
| | | string[] lines = File.ReadAllLines(layerJson, Encoding.UTF8); |
| | | lines[12] = " [ {\"endX\":1,\"endY\":0,\"startX\":0,\"startY\":0} ]"; |
| | | //lines[12] = " [ { \"startX\": 0, \"startY\": 0, \"endX\": 1, \"endY\": 0 } ]"; |
| | | for (int i = 0, c = lines.Length; i < c; i++) |
| | | { |
| | | if (lines[i].IndexOf("startX") > -1) |
| | | { |
| | | lines[i] = " [ { \"startX\": 0, \"startY\": 0, \"endX\": 1, \"endY\": 0 } ]"; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | File.WriteAllLines(layerJson, lines, Encoding.UTF8); |
| | | } |