| | |
| | | using LFServer.Models; |
| | | using ExportMap.cs; |
| | | using LFServer.Models; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | try |
| | | { |
| | | string cmdText = string.Format("python {0} -qgz {1} -qpt {2}", py, qgz, qpt); |
| | | LogOut.Info(cmdText); |
| | | |
| | | Process p = new Process(); |
| | | p.StartInfo.FileName = "cmd.exe"; |
| | |
| | | |
| | | string info = so.ReadToEnd(); |
| | | str = se.ReadToEnd(); |
| | | if (p.HasExited == false) |
| | | { |
| | | p.Kill(); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(str)) LogOut.Error(str); |
| | | if (p.HasExited == false) p.Kill(); |
| | | |
| | | si.Close(); |
| | | so.Close(); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | str = ex.Message; |
| | | } |
| | | |
| | |
| | | /// 生成 |
| | | /// </summary> |
| | | /// <param name="args">出图参数</param> |
| | | /// <param name="err">错误信息</param> |
| | | /// <returns>图片路径</returns> |
| | | public static string Generate(ExportArgs args) |
| | | public static string Generate(ExportArgs args, ref string err) |
| | | { |
| | | string date = DateStr; |
| | | string sub = GetExportSubFolder(); |
| | |
| | | |
| | | args.SetDefault(); |
| | | CreateTemplate(args); |
| | | string info = ExecPython(PyFile, qgz, args.qpt); |
| | | err = ExecPython(PyFile, qgz, args.qpt); |
| | | |
| | | string qptFile = Path.Combine(SourcesPath, args.qpt); |
| | | if (File.Exists(qptFile)) |
| | |
| | | |
| | | return rm != null && rm.code == 200 && rm.result; |
| | | } |
| | | catch (Exception ex) |
| | | catch |
| | | { |
| | | return false; |
| | | } |