/// <summary>
        /// 创建WCF服务代理
        /// </summary>
        /// <returns></returns>
        private IUpdateFileService CreateUpdateFileProxy()
        {
            if (_mUpdateConfig == null)
            {
                return(null);
            }

            try
            {
                string address    = _mUpdateConfig.IntranetUrl.ToLower().Replace("net.tcp://", "");
                string relatePath = address.Substring(address.IndexOf('/') + 1);
                address = "net.tcp://" + _Address + "/" + relatePath;

                IUpdateFileService proxy   = null;
                NetTcpBinding      binding = new NetTcpBinding(SecurityMode.None, true);
                //BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
                binding.ReaderQuotas.MaxArrayLength = 2147483647;
                binding.MaxBufferSize          = 2147483647;
                binding.MaxReceivedMessageSize = 2147483647;
                ChannelFactory <IUpdateFileService> channel =
                    new ChannelFactory <IUpdateFileService>(
                        binding,
                        new EndpointAddress(address));
                proxy = channel.CreateChannel();

                return(proxy);
            }
            catch (Exception)
            {
                return(null);
            }
        }
 public GeneratedPackagesService(IModeDeploimentService modeDeploimentService,
                                 IBackupFile backupFile,
                                 IConsoleService consoleService,
                                 IUpdateFileService updateFileService,
                                 ICmdCordovaService cmdCordovaService,
                                 IConfigurationService configurationService,
                                 ISelectPathDirectoryService selectPathDirectoryService,
                                 IEventAggregator eventAggregator,
                                 ILoggerService loggerService)
 {
     _modeDeploimentService      = modeDeploimentService;
     _backupFile                 = backupFile;
     _consoleService             = consoleService;
     _updateFileService          = updateFileService;
     _cmdCordovaService          = cmdCordovaService;
     _configurationService       = configurationService;
     _selectPathDirectoryService = selectPathDirectoryService;
     _eventAggregator            = eventAggregator;
     _loggerService              = loggerService;
     _config = _configurationService.GetConfig();
     if (!_eventAggregator.GetEvent <CmdIsFinishEvent>().Contains(OnFinishRecevied))
     {
         _eventAggregator.GetEvent <CmdIsFinishEvent>().Subscribe(OnFinishRecevied, false);
     }
 }
 public GithubReleaseSource(IUpdateService updateService,
                            IUpdateFileService updateFileService,
                            IOptions <Config> config)
 {
     _updateService     = updateService;
     _updateFileService = updateFileService;
     _config            = config.Value;
     _gitHubClient      = new GitHubClient(new ProductHeaderValue("ServarrAPI"));
     _httpClient        = new HttpClient();
 }
        public AzureReleaseSource(IUpdateService updateService,
                                  IUpdateFileService updateFileService,
                                  IOptions <Config> config,
                                  ILogger <AzureReleaseSource> logger)
        {
            _updateService     = updateService;
            _updateFileService = updateFileService;
            _config            = config.Value;

            _connection   = new VssConnection(new Uri($"https://dev.azure.com/{_config.Project}"), new VssBasicCredential());
            _githubClient = new GitHubClient(new ProductHeaderValue("ServarrAPI"));
            _httpClient   = new HttpClient();

            _logger = logger;
        }
Esempio n. 5
0
 public GetClaimDocumentService(
     IPdfMerge pdfMerge,
     IGetHtmlTemplatesService getHtmlTemplatesService,
     IHtmlToPdfHelperService htmlToPdfHelperService,
     IGetClaimService getClaimService,
     IGetFileService getFileService,
     IUpdateFileService updateFileService,
     IUpdateClaimService updateClaimService,
     IChangeClaimStateService changeClaimStateService)
 {
     this.pdfMerge = pdfMerge;
     this.getHtmlTemplatesService = getHtmlTemplatesService;
     this.htmlToPdfHelperService  = htmlToPdfHelperService;
     this.getClaimService         = getClaimService;
     this.getFileService          = getFileService;
     this.updateFileService       = updateFileService;
     this.updateClaimService      = updateClaimService;
     this.changeClaimStateService = changeClaimStateService;
 }
        /// <summary>
        /// 检查内部网络是否正确
        /// </summary>
        /// <returns></returns>
        private bool CheckIntranetCorrect()
        {
            if (_mUpdateConfig == null)
            {
                return(false);
            }

            _proxy = CreateUpdateFileProxy(); //创建内部网络服务代理
            if (_proxy == null)               //内部网络不通
            {
                return(false);
            }
            try
            {
                //是否能连通服务器,并判断文件是否存在
                bool result = _proxy.IsExistUpdateFileXml(_UpdateServiceConfigName);
                return(result);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public UpdateController(IUpdateFileService updateFileService, IOptions <Config> config)
 {
     _updateFileService = updateFileService;
     _project           = config.Value.Project;
 }