Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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));
        }
Esempio n. 4
0
        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
            }));
        }
Esempio n. 5
0
        /// <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);
            }
        }
Esempio n. 6
0
        public void AddModule(string moduleName)
        {
            var request = new AddModuleRequest(moduleName);

            _remoteClient.Send <AddModuleRequest, AddModuleResponse>(request);
        }
Esempio n. 7
0
 public async Task <ApiResult> AddModuleAsync([FromBody] AddModuleRequest request)
 {
     return(await _moduleService.AddModuleAsync(request, 0));
 }
Esempio n. 8
0
 public static Response AddModuleRequestHandler(AddModuleRequest arg)
 {
     arg.owningUser.equippedShip.equippedModules.Add(arg.modToAdd);
     return(Response.From <User>(arg.owningUser));
 }
Esempio n. 9
0
 /// <summary> Setter constructor. </summary>
 public AddModule(AddModuleRequest request)
 {
     Request  = request;
     Response = new AddModuleResponse();
 }
Esempio n. 10
0
 /// <summary> Empty constructor. </summary>
 public AddModule()
 {
     Request  = new AddModuleRequest();
     Response = new AddModuleResponse();
 }