private void AddQEModule_Click(object sender, EventArgs e) { QEDriveTier1 drive = new QEDriveTier1(); AddModuleRequest req = new AddModuleRequest(drive, currUser); req.seshID = currUser.seshID; currUser = client.SendRequest <User>(req, currUser); currUser.equippedShip.UpdateShipStats(); }
public AddModuleResponse Execute(AddModuleRequest request) { var existingModule = _moduleManager.GetModule(new ModuleName(request.ModuleName)); if (existingModule != null) { throw new Exception(string.Format("The module '{0}' already exist on client.", request.ModuleName)); } var filePath = Path.Combine(ModuleDirectoryPath, request.ModuleName + ".dll"); _moduleManager.AddModule(filePath); return(new AddModuleResponse()); }
public override Task <AddModuleResponse> AddModule(AddModuleRequest request, ServerCallContext context) { RemoteTarget target = GrpcLookupUtils.GetTarget(request.Target, _targetStore); var response = new AddModuleResponse(); SbModule module = target.AddModule(request.Path, request.Triple, request.Uuid); if (module != null) { response.Module = new GrpcSbModule { Id = _moduleStore.AddObject(module) }; } return(Task.FromResult(response)); }
public IHttpActionResult AddModule(AddModuleRequest request) { request.ValidateNotNull(); ModuleDomain moduleDomain = new ModuleDomain() { Name = request.Name, Code = request.Code, IsActive = request.IsActive, }; return(Ok(new AddModuleResponse() { Data = _moduleManipulation.AddModule(moduleDomain), Success = Common.Enumerations.ResponseStatus.Succeeded })); }
/// <summary> /// 添加模块 /// </summary> /// <param name="request"></param> /// <param name="userId"></param> /// <returns></returns> public async Task <ApiResult> AddModuleAsync(AddModuleRequest request, long userId) { var response = new ApiResult(); try { var isExist = await _moduleRepository.TableNotTracking .AnyAsync(item => item.Status == 1 && item.ModuleName == request.ModuleName); if (isExist) { response.Code = Code.Error; response.Message = "模块已存在"; return(response); } var module = new Module(true) { ModuleName = request.ModuleName, ModuleSecret = request.ModuleSecret, Status = 1, CreateTime = DateTime.Now }; await _moduleRepository.InsertAsync(module); await _work.SaveChangesAsync(); response.Code = Code.Ok; response.Message = "添加成功"; return(response); } catch (Exception ex) { _logger.LogError($"添加模块异常;method={nameof(AddModuleAsync)};param={request.ToJson()};exception messges={ex.Message}"); response.Code = Code.Error; response.Message = $"添加模块异常:{ex.Message}"; return(response); } }
public void AddModule(string moduleName) { var request = new AddModuleRequest(moduleName); _remoteClient.Send <AddModuleRequest, AddModuleResponse>(request); }
public async Task <ApiResult> AddModuleAsync([FromBody] AddModuleRequest request) { return(await _moduleService.AddModuleAsync(request, 0)); }
public static Response AddModuleRequestHandler(AddModuleRequest arg) { arg.owningUser.equippedShip.equippedModules.Add(arg.modToAdd); return(Response.From <User>(arg.owningUser)); }
/// <summary> Setter constructor. </summary> public AddModule(AddModuleRequest request) { Request = request; Response = new AddModuleResponse(); }
/// <summary> Empty constructor. </summary> public AddModule() { Request = new AddModuleRequest(); Response = new AddModuleResponse(); }