/// <summary> /// 解压文件 /// </summary> /// <param name="rarFilePath"></param> /// <returns></returns> private void UnRarFile(string rarFilePath) { string directoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UploadFiles", "Temp", Guid.NewGuid().ToString()); if (Directory.Exists(directoryPath)) { throw new DeployException("解压失败,请重新上传"); } DirectoryInfo directoryInfo = Directory.CreateDirectory(directoryPath); ProcessStartInfo processStartInfo = ProcessManager.GetProcessStartInfo("UnRAR.exe", $"x -o+ -y {rarFilePath} {directoryPath}"); var process = new Process { StartInfo = processStartInfo }; void DataHandler(object sender, DataReceivedEventArgs e) { DeployConsoleHelper.WriteLine(e.Data); } process.OutputDataReceived += DataHandler; process.ErrorDataReceived += DataHandler; if (process.Start()) { process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); process.Dispose(); } foreach (DirectoryInfo item in directoryInfo.GetDirectories()) { CopyApplication(item); } directoryInfo.Delete(true); }
/// <summary> /// 入口 /// </summary> /// <param name="args"></param> /// <returns></returns> public static async Task Main(string[] args) { Console.Title = $"{DeployConfig.ServerInfo.Name} 版本:[{ApplicationConfig.GetProgramVersion()}]"; string[] inputArgs = MateralAPPHelper.HandlerArgs(args, DeployConfig.ServerInfo); DeployConsoleHelper.WriteLine($"本服务地址:{ApplicationConfig.Url}"); DeployConsoleHelper.WriteLine($"本服务公开地址:{ApplicationConfig.PublicUrl}"); await CreateHostBuilder(inputArgs).Build().RunAsync(); }
public Task RegisterResult(bool isSuccess, string message) { if (isSuccess) { DeployConsoleHelper.WriteLine("注册成功"); } else { DeployConsoleHelper.WriteLine(message, "注册失败", ConsoleColor.Red); } return(Task.CompletedTask); }
public async Task <(List <DefaultDataListDTO> defaultDataList, PageModel pageModel)> GetListAsync(QueryDefaultDataFilterModel model) { List <DefaultData> allDefaultData = await _defaultDataRepository.GetAllInfoFromCacheAsync(); DeployConsoleHelper.WriteDebug(allDefaultData == null ? "以从环境获取数据,但为空" : $"以从环境获取数据,数量:{allDefaultData.Count}"); if (allDefaultData == null) { return(null, new PageModel(model, 0)); } Func <DefaultData, bool> searchDelegate = model.GetSearchDelegate <DefaultData>(); List <DefaultData> defaultDataList = allDefaultData.Where(searchDelegate).ToList(); var pageModel = new PageModel(model, defaultDataList.Count); defaultDataList = defaultDataList.Skip(model.Skip).Take(model.Take).ToList(); DeployConsoleHelper.WriteDebug($"已通过条件筛选完毕,数量:{defaultDataList.Count}"); var result = _mapper.Map <List <DefaultDataListDTO> >(defaultDataList); return(result, pageModel); }