コード例 #1
0
 public DeleteFriendCommand(IFriendService friendService, IHubManager hubManager,
                            IHttpContextReader httpContextReader)
 {
     this.friendService     = friendService;
     this.hubManager        = hubManager;
     this.httpContextReader = httpContextReader;
 }
コード例 #2
0
        private static void GenerateType(IHubManager hubManager, StringBuilder sb, HubDescriptor descriptor, bool includeDocComments)
        {
            // Get only actions with minimum number of parameters.
            var methods = GetMethods(hubManager, descriptor);
            var hubName = GetDescriptorName(descriptor);

            sb.AppendFormat("    proxies.{0} = this.createHubProxy('{1}'); ", hubName, hubName).AppendLine();
            sb.AppendFormat("        proxies.{0}.client = {{ ", hubName);
            GenerateClientRxStuff(sb, descriptor);
            sb.AppendLine();
            sb.Append("        };");
            sb.AppendLine();
            sb.AppendFormat("        proxies.{0}.server = {{", hubName);

            bool first = true;

            foreach (var method in methods)
            {
                if (!first)
                {
                    sb.Append(",").AppendLine();
                }
                GenerateMethod(sb, method, includeDocComments, hubName);
                first = false;
            }
            GenerateServerRxSubject(sb, descriptor);


            sb.AppendLine();
            sb.Append("        }");
        }
コード例 #3
0
 public override void Init(IDependencyResolver resolver)
 {
     _manager         = resolver.GetService <IHubManager>();
     _activator       = resolver.GetService <IHubActivator>();
     _pipelineInvoker = resolver.GetService <IHubPipelineInvoker>();
     base.Init(resolver);
 }
コード例 #4
0
ファイル: AddOfferCommand.cs プロジェクト: TomeQ2k/_MyVinted
 public AddOfferCommand(IOfferService offerService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.offerService = offerService;
     this.mapper       = mapper;
     this.notifier     = notifier;
     this.hubManager   = hubManager;
 }
コード例 #5
0
ファイル: LikeOfferCommand.cs プロジェクト: TomeQ2k/_MyVinted
 public LikeOfferCommand(IFavoritesService favoritesService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.favoritesService = favoritesService;
     this.mapper           = mapper;
     this.notifier         = notifier;
     this.hubManager       = hubManager;
 }
コード例 #6
0
 public CreateOfferAuctionCommand(IOfferAuctionManager auctionManager, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.auctionManager = auctionManager;
     this.mapper         = mapper;
     this.notifier       = notifier;
     this.hubManager     = hubManager;
 }
コード例 #7
0
        private static string GenerateProxy(IHubManager hubManager, IJavaScriptMinifier javaScriptMinifier, bool includeDocComments)
        {
            string script = _templateFromResource.Value;

            var hubs  = new StringBuilder();
            var first = true;

            foreach (var descriptor in hubManager.GetHubs().OrderBy(h => h.Name))
            {
                if (!first)
                {
                    hubs.AppendLine(";");
                    hubs.AppendLine();
                    hubs.Append("    ");
                }
                GenerateType(hubManager, hubs, descriptor, includeDocComments);
                first = false;
            }

            if (hubs.Length > 0)
            {
                hubs.Append(";");
            }

            script = script.Replace("/*hubs*/", hubs.ToString());

            return(javaScriptMinifier.Minify(script));
        }
コード例 #8
0
 /// <summary>
 /// QueueItemsController constructor
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="manager"></param>
 /// <param name="membershipManager"></param>
 /// <param name="userManager"></param>
 /// <param name="hub"></param>
 /// <param name="httpContextAccessor"></param>
 /// <param name="binaryObjectRepository"></param>
 /// <param name="configuration"></param>
 /// <param name="hubManager"></param>
 /// <param name="queueItemAttachmentRepository"></param>
 /// <param name="queueRepository"></param>
 /// <param name="scheduleRepository"></param>
 /// <param name="webhookPublisher"></param>
 public QueueItemsController(
     IQueueItemRepository repository,
     IQueueRepository queueRepository,
     IQueueItemManager manager,
     IMembershipManager membershipManager,
     ApplicationIdentityUserManager userManager,
     IHubContext <NotificationHub> hub,
     IHttpContextAccessor httpContextAccessor,
     IHubManager hubManager,
     IScheduleRepository scheduleRepository,
     IConfiguration configuration,
     IBinaryObjectRepository binaryObjectRepository,
     IQueueItemAttachmentRepository queueItemAttachmentRepository,
     IWebhookPublisher webhookPublisher,
     IOrganizationSettingManager organizationSettingManager) : base(repository, userManager, httpContextAccessor, membershipManager, configuration)
 {
     this.manager                       = manager;
     _hub                               = hub;
     this.queueRepository               = queueRepository;
     this.hubManager                    = hubManager;
     scheduleRepo                       = scheduleRepository;
     Configuration                      = configuration;
     this.binaryObjectRepository        = binaryObjectRepository;
     this.queueItemAttachmentRepository = queueItemAttachmentRepository;
     this.webhookPublisher              = webhookPublisher;
     this.organizationSettingManager    = organizationSettingManager;
 }
コード例 #9
0
 public FollowUserCommand(IUserService userService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.userService = userService;
     this.mapper      = mapper;
     this.notifier    = notifier;
     this.hubManager  = hubManager;
 }
コード例 #10
0
        public static HubDescriptor EnsureHub(this IHubManager hubManager, string hubName, params IPerformanceCounter[] counters)
        {
            if (hubManager == null)
            {
                throw new ArgumentNullException("hubManager");
            }

            if (String.IsNullOrEmpty(hubName))
            {
                throw new ArgumentNullException("hubName");
            }

            if (counters == null)
            {
                throw new ArgumentNullException("counters");
            }

            var descriptor = hubManager.GetHub(hubName);

            if (descriptor == null)
            {
                for (var i = 0; i < counters.Length; i++)
                {
                    counters[i].Increment();
                }
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Resources.Error_HubCouldNotBeResolved, hubName));
            }

            return(descriptor);
        }
コード例 #11
0
 public AddOpinionCommand(IOpinionService opinionService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.opinionService = opinionService;
     this.mapper         = mapper;
     this.notifier       = notifier;
     this.hubManager     = hubManager;
 }
コード例 #12
0
ファイル: Notifier.cs プロジェクト: TomeQ2k/_Smile
 public Notifier(IDatabase database, IHttpContextReader httpContextReader, IHubManager hubManager,
                 IMapper mapper)
 {
     this.database          = database;
     this.httpContextReader = httpContextReader;
     this.hubManager        = hubManager;
     this.mapper            = mapper;
 }
コード例 #13
0
 public ReviewRPTestCommand(IRPTestManager rpTestManager, IHttpContextReader httpContextReader,
                            INotifier notifier, IHubManager <NotifierHub> hubManager, IMapper mapper)
 {
     this.rpTestManager     = rpTestManager;
     this.httpContextReader = httpContextReader;
     this.notifier          = notifier;
     this.hubManager        = hubManager;
     this.mapper            = mapper;
 }
コード例 #14
0
 public DenyOfferAuctionCommand(IOfferAuctionManager auctionManager, IReadOnlyOfferService offerService, IMapper mapper, INotifier notifier,
                                IHubManager <NotifierHub> hubManager)
 {
     this.auctionManager = auctionManager;
     this.offerService   = offerService;
     this.mapper         = mapper;
     this.notifier       = notifier;
     this.hubManager     = hubManager;
 }
コード例 #15
0
 public SetOrderApprovalStateCommand(IOrderService orderService, IHttpContextReader httpContextReader,
                                     INotifier notifier, IHubManager <NotifierHub> hubManager, IMapper mapper)
 {
     this.orderService      = orderService;
     this.httpContextReader = httpContextReader;
     this.notifier          = notifier;
     this.hubManager        = hubManager;
     this.mapper            = mapper;
 }
コード例 #16
0
        public static IEnumerable <MethodDescriptor> GetHubMethods(this IHubManager hubManager, string hubName)
        {
            if (hubManager == null)
            {
                throw new ArgumentNullException("hubManager");
            }

            return(hubManager.GetHubMethods(hubName, m => true));
        }
コード例 #17
0
 public ToggleBlockCharacterCommand(ICharacterManager characterManager, IHttpContextReader httpContextReader,
                                    INotifier notifier, IHubManager <NotifierHub> hubManager, IMapper mapper)
 {
     this.characterManager  = characterManager;
     this.httpContextReader = httpContextReader;
     this.notifier          = notifier;
     this.hubManager        = hubManager;
     this.mapper            = mapper;
 }
コード例 #18
0
ファイル: HubDispatcher.cs プロジェクト: contextworks/SignalR
        public override void Initialize(IDependencyResolver resolver)
        {
            _proxyGenerator = resolver.Resolve <IJavaScriptProxyGenerator>();
            _manager        = resolver.Resolve <IHubManager>();
            _binder         = resolver.Resolve <IParameterResolver>();
            _requestParser  = resolver.Resolve <IHubRequestParser>();

            base.Initialize(resolver);
        }
コード例 #19
0
        public static IEnumerable <HubDescriptor> GetHubs(this IHubManager hubManager)
        {
            if (hubManager == null)
            {
                throw new ArgumentNullException("hubManager");
            }

            return(hubManager.GetHubs(d => true));
        }
コード例 #20
0
 public ReceiveFriendCommand(IFriendService friendService, IMapper mapper, IHubManager hubManager,
                             INotifier notifier, IHttpContextReader httpContextReader)
 {
     this.friendService     = friendService;
     this.mapper            = mapper;
     this.hubManager        = hubManager;
     this.notifier          = notifier;
     this.httpContextReader = httpContextReader;
 }
コード例 #21
0
 public AddCreditsCommand(IUserManager userManager, INotifier notifier, IHubManager <NotifierHub> hubManager,
                          IHttpContextReader httpContextReader, IMapper mapper)
 {
     this.userManager       = userManager;
     this.notifier          = notifier;
     this.hubManager        = hubManager;
     this.httpContextReader = httpContextReader;
     this.mapper            = mapper;
 }
コード例 #22
0
 private static IEnumerable <MethodDescriptor> GetMethods(IHubManager manager, HubDescriptor descriptor)
 {
     return(from method in manager.GetHubMethods(descriptor.Name)
            group method by method.Name into overloads
            let oload = (from overload in overloads
                         orderby overload.Parameters.Count
                         select overload).FirstOrDefault()
                        orderby oload.Name
                        select oload);
 }
コード例 #23
0
 public DonateServerCommand(IDonationManager donationManager, IHttpContextReader httpContextReader,
                            INotifier notifier, IHubManager <NotifierHub> hubManager, IRewardReferrerSystem rewardReferrerSystem,
                            IMapper mapper)
 {
     this.donationManager      = donationManager;
     this.httpContextReader    = httpContextReader;
     this.notifier             = notifier;
     this.hubManager           = hubManager;
     this.rewardReferrerSystem = rewardReferrerSystem;
     this.mapper = mapper;
 }
コード例 #24
0
 public AddReportCommentCommand(IReportCommentService reportCommentService,
                                IReportValidationHub reportValidationHub, IReportManager reportManager, INotifier notifier,
                                IHubManager <NotifierHub> hubManager, IMapper mapper)
 {
     this.reportCommentService = reportCommentService;
     this.reportValidationHub  = reportValidationHub;
     this.reportManager        = reportManager;
     this.notifier             = notifier;
     this.hubManager           = hubManager;
     this.mapper = mapper;
 }
コード例 #25
0
 public ArchiveReportCommand(IReportManager reportManager, IReportValidationHub reportValidationHub,
                             IHttpContextReader httpContextReader, INotifier notifier, IHubManager <NotifierHub> hubManager,
                             IMapper mapper)
 {
     this.reportManager       = reportManager;
     this.reportValidationHub = reportValidationHub;
     this.httpContextReader   = httpContextReader;
     this.notifier            = notifier;
     this.hubManager          = hubManager;
     this.mapper = mapper;
 }
コード例 #26
0
 public RemoveReportSubscriberCommand(IReportSubscriberService reportSubscriberService,
                                      IReportValidationHub reportValidationHub, IHttpContextReader httpContextReader, INotifier notifier,
                                      IHubManager <NotifierHub> hubManager, IMapper mapper)
 {
     this.reportSubscriberService = reportSubscriberService;
     this.reportValidationHub     = reportValidationHub;
     this.httpContextReader       = httpContextReader;
     this.notifier   = notifier;
     this.hubManager = hubManager;
     this.mapper     = mapper;
 }
コード例 #27
0
        public static HubDescriptor EnsureHub(this IHubManager hubManager, string hubName)
        {
            var descriptor = hubManager.GetHub(hubName);

            if (descriptor == null)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "'{0}' hub could not be resolved.", hubName));
            }

            return(descriptor);
        }
コード例 #28
0
 public PurchaseOrderCommand(IOrderService orderService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager,
                             IBalanceService balanceService, IRolesManager rolesManager, IJwtAuthorizationTokenGenerator jwtAuthorizationTokenGenerator, IBalanceValidationService balanceValidationService,
                             IHttpContextReader httpContextReader)
 {
     this.orderService   = orderService;
     this.mapper         = mapper;
     this.notifier       = notifier;
     this.hubManager     = hubManager;
     this.balanceService = balanceService;
     this.rolesManager   = rolesManager;
     this.jwtAuthorizationTokenGenerator = jwtAuthorizationTokenGenerator;
     this.balanceValidationService       = balanceValidationService;
     this.httpContextReader = httpContextReader;
 }
コード例 #29
0
        public override void Initialize(IDependencyResolver resolver, HostContext context)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException("resolver");
            }

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _proxyGenerator  = resolver.Resolve <IJavaScriptProxyGenerator>();
            _manager         = resolver.Resolve <IHubManager>();
            _binder          = resolver.Resolve <IParameterResolver>();
            _requestParser   = resolver.Resolve <IHubRequestParser>();
            _pipelineInvoker = resolver.Resolve <IHubPipelineInvoker>();

            _counters = resolver.Resolve <IPerformanceCounterManager>();

            // Call base initializer before populating _hubs so the _jsonSerializer is initialized
            base.Initialize(resolver, context);

            // Populate _hubs
            string data = context.Request.QueryStringOrForm("connectionData");

            if (!String.IsNullOrEmpty(data))
            {
                var clientHubInfo = JsonSerializer.Parse <IEnumerable <ClientHubInfo> >(data);
                if (clientHubInfo != null)
                {
                    foreach (var hubInfo in clientHubInfo)
                    {
                        // Try to find the associated hub type
                        HubDescriptor hubDescriptor = _manager.EnsureHub(hubInfo.Name,
                                                                         _counters.ErrorsHubResolutionTotal,
                                                                         _counters.ErrorsHubResolutionPerSec,
                                                                         _counters.ErrorsAllTotal,
                                                                         _counters.ErrorsAllPerSec);

                        if (_pipelineInvoker.AuthorizeConnect(hubDescriptor, context.Request))
                        {
                            // Add this to the list of hub descriptors this connection is interested in
                            _hubs.Add(hubDescriptor);
                        }
                    }
                }
            }
        }
コード例 #30
0
        public static HubDescriptor EnsureHub(this IHubManager hubManager, string hubName, params PerformanceCounter[] counters)
        {
            var descriptor = hubManager.GetHub(hubName);

            if (descriptor == null)
            {
                for (var i = 0; i < counters.Length; i++)
                {
                    counters[i].SafeIncrement();
                }
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "'{0}' hub could not be resolved.", hubName));
            }

            return(descriptor);
        }
コード例 #31
0
        private static IEnumerable<HubModel> GetHubs(IHubManager hubManager)
        {
            var hubDescriptors = hubManager.GetHubs(hd => true).ToList();
            if (!hubDescriptors.Any())
                return null;

            var hubData = hubDescriptors
                .Select(hubDescriptor => new HubModel
                {
                    Name = hubDescriptor.Name,
                    HubType = hubDescriptor.HubType,
                    Methods = GetHubMethodInfo(hubManager, hubDescriptor)
                })
                .ToList();

            return hubData;
        }
コード例 #32
0
        private static IEnumerable<HubMethodModel> GetHubMethodInfo(IHubManager hubManager, HubDescriptor hubDescriptor)
        {
            var hubMethodDescriptors = hubManager.GetHubMethods(hubDescriptor.Name, md => true).ToList();
            if (!hubMethodDescriptors.Any())
                return null;

            var hubMethodData = hubMethodDescriptors
                .Select(hubMethodDescriptor => new HubMethodModel
                {
                    Name = hubMethodDescriptor.Name,
                    ReturnType = hubMethodDescriptor.ReturnType,
                    Parameters = GetHubMethodParametersInfo(hubMethodDescriptor)
                })
                .ToList();

            return hubMethodData;
        }