public void FixChannelNameForSlack_Numbers_ReturnsValidSlackChannelName()
        {
            // Arrange
            var channelName = "123";

            // Act
            var fixedChannelName = ChannelName.Create(channelName);

            // Assert
            AssertValidSlackChannelName(fixedChannelName);
        }
        public void FixChannelNameForSlack_LowerCaseAndNumbersDashSeparated_ReturnsValidSlackChannelName()
        {
            // Arrange
            var channelName = "numbers123-moreNumbers456";

            // Act
            var fixedChannelName = ChannelName.Create(channelName);

            // Assert
            AssertValidSlackChannelName(fixedChannelName);
        }
Esempio n. 3
0
        public void ChannelNamesDoMatch_WithAliasWithCountry(
            string definedName,
            string definedCountry,
            string alias,
            string providerName,
            string providerCountry)
        {
            ChannelName channelName = GetChannelName(definedName, definedCountry, alias);

            Assert.IsTrue(channelMatcher.DoesMatch(channelName, providerName, providerCountry));
        }
Esempio n. 4
0
        public override void Write()
        {
            _worldPacket.WritePackedGuid(UpdatedUserGUID);
            _worldPacket.WriteUInt8((byte)UserFlags);
            _worldPacket.WriteUInt32((uint)ChannelFlags);
            _worldPacket.WriteUInt32(ChannelID);

            _worldPacket.WriteBits(ChannelName.GetByteCount(), 7);
            _worldPacket.FlushBits();
            _worldPacket.WriteString(ChannelName);
        }
        public void FixChannelNameForSlack_PascalCasing_ReturnsValidSlackChannelName()
        {
            // Arrange
            var channelName = "PascalCasing";

            // Act
            var fixedChannelName = ChannelName.Create(channelName);

            // Assert
            AssertValidSlackChannelName(fixedChannelName);
        }
Esempio n. 6
0
        public async Task HandleAsync(RenameChannelCommand command)
        {
            var group = await _groupRepository.GetAsync(GroupId.From(command.GroupId)) ??
                        throw new GroupNotFoundException(GroupId.From(command.GroupId));

            var channel = await _channelRepository.GetAsync(group.Id, ChannelId.From(command.ChannelId)) ??
                          throw new ChannelNotFoundException(ChannelId.From(command.ChannelId));

            var name = ChannelName.Create(command.Name);

            group.RenameChannel(UserId.From(command.UserId), channel, name);
        }
Esempio n. 7
0
 /// <summary>
 /// Do the channel name's match?
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool Equals(ChannelName other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(_name, other._name));
 }
        public void FixChannelNameForSlack_NumbersAndLowerCaseDashSeparated_ReturnsValidSlackChannelName()
        {
            // Arrange
            var channelName = "123numbers-456moreNumbers";


            // Act
            var fixedChannelName = ChannelName.Create(channelName);

            // Assert
            AssertValidSlackChannelName(fixedChannelName);
        }
Esempio n. 9
0
        public void ChannelNamesDoNotMatch_WithoutAliasWithoutCountry(
            string definedName,
            string providerName)
        {
            // Arrange
            ChannelName channelName = GetChannelName(definedName, alias: null);

            // Act
            bool isMatch = channelMatcher.DoesMatch(channelName, providerName, country2: null);

            // Assert
            Assert.That(isMatch, Is.False);
        }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="routingKey">The routing key</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel</param>
 /// <param name="channelName">The channel name</param>
 /// <param name="isDurable">The durability of the queue</param>
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, string routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false)
 {
     RequeueCount               = requeueCount;
     Name                       = name;
     ChannelFactory             = channelFactory;
     DataType                   = dataType;
     NoOfPeformers              = noOfPerformers;
     TimeoutInMiliseconds       = timeoutInMilliseconds;
     UnacceptableMessageLimit   = unacceptableMessageLimit;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     ChannelName                = channelName;
     RoutingKey                 = routingKey;
     IsDurable                  = isDurable;
 }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogViewModel"/> class.
        /// </summary>
        public ChannelsViewModel()
        {
            ChannelsCollection     = new ObservableCollection <AblyChannel>();
            UnSubscribeFromChannel = new Command <string>(async channelName =>
            {
                await Ably.Channels.Get(channelName).Push.UnsubscribeDevice();
                await ExecuteLoadItemsCommand(); // Make sure we reload the channels list

                Message          = $"Unsubscribed from channel {channelName}";
                MessageIsVisible = true;

                DelayAction(() =>
                {
                    Message          = string.Empty;
                    MessageIsVisible = false;
                    return(Task.CompletedTask);
                });
            });
            LoadChannelsCommand = new Command(async() => await ExecuteLoadItemsCommand());
            SubscribeToChannel  = new Command(async() =>
            {
                MessageIsVisible = false;

                if (string.IsNullOrEmpty(ChannelName))
                {
                    Message = "Please enter a channel name";
                    return;
                }

                if (ChannelName.StartsWith("push:") == false)
                {
                    Message = "Make sure the 'push:' channel namespace is set.";
                    return;
                }

                try
                {
                    await Ably.Channels.Get(ChannelName).Push.SubscribeDevice();
                    await ExecuteLoadItemsCommand(); // Make sure we reload the channels list
                }
                catch (AblyException e)
                {
                    Message = $"Error subscribing device to channel. Messages: {e.Message}. Code: {e.ErrorInfo.Code}";
                }

                ChannelName = string.Empty;
            });
        }
Esempio n. 12
0
 public Connection(
     ClientType clientType,
     ClientName clientName,
     ClientId clientId,
     ChannelType channelType,
     ChannelName channelName,
     ChannelId channelId
     )
 {
     ClientType  = clientType;
     ClientId    = clientId;
     ClientName  = clientName;
     ChannelType = channelType;
     ChannelName = channelName;
     ChannelId   = channelId;
 }
Esempio n. 13
0
        public void FixChannelNameForSlack_NameWithLength100_ReturnsValidSlackChannelName()
        {
            // Arrange
            var channelNameOfLength100 = string.Join("", Enumerable
                                                     .Repeat(0, 100)
                                                     .Select(n =>
                                                             (char)new Random().Next(97, 123)
                                                             )
                                                     );

            // Act
            var fixedChannelName = ChannelName.Create(channelNameOfLength100);

            // Assert
            AssertValidSlackChannelName(fixedChannelName);
        }
Esempio n. 14
0
        public override void Parse()
        {
            base.Parse();

            if (ChannelName.Contains("#"))
            {
                Type = MessageType.ChannelMessage;
            }
            else
            {
                // todo check if there need user message
                Type        = MessageType.UserMessage;
                ChannelName = null;
                NickName    = _cmdParams[0];
            }
            Message = _longParam;
        }
Esempio n. 15
0
        public async Task CreateChannel_Given_valid_input_Should_create_channel()
        {
            // Arrange
            var sut         = new SlackFacade(_httpClient, _slackOptions, null);
            var channelName = ChannelName.Create(Guid.NewGuid().ToString());

            // Act
            var createChannelResponse = await sut.CreateChannel(channelName.ToString());

            // Assert
            Assert.True(createChannelResponse.Ok);
            Assert.Equal(channelName, createChannelResponse.Channel.Name);
            Assert.NotEmpty(createChannelResponse.Channel.Id.ToString());

            //Clean up integration test resources.
            await sut.ArchiveChannel(createChannelResponse.Channel.Id);
        }
Esempio n. 16
0
 public override int GetHashCode() {
   int hash = 1;
   if (HostName.Length != 0) hash ^= HostName.GetHashCode();
   if (HostIp.Length != 0) hash ^= HostIp.GetHashCode();
   if (ProcessId != 0) hash ^= ProcessId.GetHashCode();
   if (NodeName.Length != 0) hash ^= NodeName.GetHashCode();
   if (NodeId != 0UL) hash ^= NodeId.GetHashCode();
   if (ChannelName.Length != 0) hash ^= ChannelName.GetHashCode();
   if (ChannelId != 0UL) hash ^= ChannelId.GetHashCode();
   if (MessageType.Length != 0) hash ^= MessageType.GetHashCode();
   if (ProtoDesc.Length != 0) hash ^= ProtoDesc.GetHashCode();
   if (Id != 0UL) hash ^= Id.GetHashCode();
   if (qosProfile_ != null) hash ^= QosProfile.GetHashCode();
   if (socketAddr_ != null) hash ^= SocketAddr.GetHashCode();
   if (ServiceName.Length != 0) hash ^= ServiceName.GetHashCode();
   if (ServiceId != 0UL) hash ^= ServiceId.GetHashCode();
   return hash;
 }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 public MsSqlSubscription(
     Type dataType,
     SubscriptionName name          = null,
     ChannelName channelName        = null,
     RoutingKey routingKey          = null,
     int bufferSize                 = 1,
     int noOfPerformers             = 1,
     int timeoutInMilliseconds      = 300,
     int requeueCount               = -1,
     int requeueDelayInMilliseconds = 0,
     int unacceptableMessageLimit   = 0,
     bool runAsync = false,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
            requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
 {
 }
Esempio n. 18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (ChannelName.Length != 0)
            {
                hash ^= ChannelName.GetHashCode();
            }
            if (message_ != null)
            {
                hash ^= Message.GetHashCode();
            }
            return(hash);
        }
Esempio n. 19
0
        public async Task InviteToChannel_Given_valid_input_Should_invite_to_channel()
        {
            // Arrange
            var sut         = new SlackFacade(_httpClient, _slackOptions, null, new MemoryCache(new MemoryCacheOptions()));
            var channelName = ChannelName.Create(Guid.NewGuid().ToString());
            var userEmail   = _configuration.SLACK_TESTING_USER_EMAIL;

            // Act
            var createChannelResponse = await sut.CreateChannel(channelName.ToString());

            await sut.InviteToChannel(userEmail, createChannelResponse.Channel.Id.ToString());

            // Assert
            Assert.True(createChannelResponse.Ok);

            //Clean up integration test resources.
            await sut.ArchiveChannel(createChannelResponse.Channel.Id);
        }
Esempio n. 20
0
        public static ChannelName ToValidSQSQueueName(this ChannelName channelName, bool isFifo = false)
        {
            //SQS only allows 80 characters alphanumeric, hyphens, and underscores, but we might use a period in a
            //default typename strategy
            var name = channelName.Value;

            name = name.Replace(".", "_");
            if (name.Length > 80)
            {
                name = name.Substring(0, 80);
            }

            if (isFifo)
            {
                name = name + ".fifo";
            }

            return(new ChannelName(name));
        }
Esempio n. 21
0
        public async Task SendNotificationToChannel_Given_valid_input_Should_send_notfication_to_channel()
        {
            // Arrange
            var          sut         = new SlackFacade(_httpClient, _slackOptions, null, new MemoryCache(new MemoryCacheOptions()));
            var          channelName = ChannelName.Create(Guid.NewGuid().ToString());
            const string message     = "Integration test message.";

            // Act
            var createChannelResponse = await sut.CreateChannel(channelName.ToString());

            var sendNotificationToChannelResponse = await sut.SendNotificationToChannel(createChannelResponse.Channel.Id, message : message);

            // Assert
            Assert.True(sendNotificationToChannelResponse.Ok);
            Assert.NotEmpty(sendNotificationToChannelResponse.TimeStamp);

            //Clean up integration test resources.
            await sut.ArchiveChannel(createChannelResponse.Channel.Id);
        }
 /// <summary>
 /// Initializes an Instance of <see cref="AzureServiceBusSubscription"/>
 /// </summary>
 /// <param name="dataType">The type for this Subscription.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer on the channel</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMs">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="isAsync"></param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 /// <param name="subscriptionConfiguration">The configuration options for the subscriptions.</param>
 /// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
 /// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
 public AzureServiceBusSubscription(
     Type dataType,
     SubscriptionName name        = null,
     ChannelName channelName      = null,
     RoutingKey routingKey        = null,
     int bufferSize               = 1,
     int noOfPerformers           = 1,
     int timeoutInMilliseconds    = 400,
     int requeueCount             = -1,
     int requeueDelayInMs         = 0,
     int unacceptableMessageLimit = 0,
     bool isAsync = false,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create,
     AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null,
     int emptyChannelDelay   = 500,
     int channelFailureDelay = 1000)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMs, unacceptableMessageLimit, isAsync, channelFactory,
            makeChannels, emptyChannelDelay, channelFailureDelay)
 {
     Configuration = subscriptionConfiguration ?? new AzureServiceBusSubscriptionConfiguration();
 }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="timeoutInMs">The timeout in milliseconds.</param>
 /// <param name="pollDelayInMs">Interval between polling attempts</param>
 /// <param name="noWorkPauseInMs">When a queue is empty, delay this long before re-reading from the queue</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMs">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="lockTimeout">What is the visibility timeout for the queue</param>
 /// <param name="delaySeconds">The length of time, in seconds, for which the delivery of all messages in the queue is delayed.</param>
 /// <param name="messageRetentionPeriod">The length of time, in seconds, for which Amazon SQS retains a message</param>
 /// <param name="findTopicBy">Is the Topic an Arn, should be treated as an Arn by convention, or a name</param>
 /// <param name="iAmPolicy">The queue's policy. A valid AWS policy.</param>
 /// <param name="redrivePolicy">The policy that controls when and where requeued messages are sent to the DLQ</param>
 /// <param name="snsAttributes">The attributes of the Topic, either ARN if created, or attributes for creation</param>
 /// <param name="tags">Resource tags to be added to the queue</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 /// <param name="rawMessageDelivery">The indication of Raw Message Delivery setting is enabled or disabled</param>
 /// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
 /// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
 public SqsSubscription(Type dataType,
                        SubscriptionName name        = null,
                        ChannelName channelName      = null,
                        RoutingKey routingKey        = null,
                        int bufferSize               = 1,
                        int noOfPerformers           = 1,
                        int timeoutInMs              = 300,
                        int pollDelayInMs            = -1,
                        int noWorkPauseInMs          = 500,
                        int requeueCount             = -1,
                        int requeueDelayInMs         = 0,
                        int unacceptableMessageLimit = 0,
                        bool runAsync = false,
                        IAmAChannelFactory channelFactory = null,
                        int lockTimeout                  = 10,
                        int delaySeconds                 = 0,
                        int messageRetentionPeriod       = 345600,
                        TopicFindBy findTopicBy          = TopicFindBy.Name,
                        string iAmPolicy                 = null,
                        RedrivePolicy redrivePolicy      = null,
                        SnsAttributes snsAttributes      = null,
                        Dictionary <string, string> tags = null,
                        OnMissingChannel makeChannels    = OnMissingChannel.Create,
                        bool rawMessageDelivery          = true,
                        int emptyChannelDelay            = 500,
                        int channelFailureDelay          = 1000
                        )
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMs, requeueCount, requeueDelayInMs, unacceptableMessageLimit, runAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
 {
     LockTimeout            = lockTimeout;
     DelaySeconds           = delaySeconds;
     MessageRetentionPeriod = messageRetentionPeriod;
     FindTopicBy            = findTopicBy;
     IAMPolicy          = iAmPolicy;
     RawMessageDelivery = rawMessageDelivery;
     RedrivePolicy      = redrivePolicy;
     SnsAttributes      = snsAttributes;
     Tags = tags;
 }
Esempio n. 24
0
        public override void SetupStatsWatcher()
        {
            if (ChannelName.Equals("#" + (Chat as ChatBase).AnonymousNickName, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            statsPoller = new WebPoller()
            {
                Id  = ChannelName,
                Uri = new Uri(String.Format(@"http://api.gaminglive.tv/channels/{0}", ChannelName.Replace("#", ""))),
            };

            statsPoller.ReadStream = (stream) =>
            {
                if (stream == null)
                {
                    return;
                }

                lock (pollerLock)
                {
                    using ( stream )
                    {
                        var channelInfo = JsonUtil.DeserializeStream <GamingLiveChannelStats>(stream);
                        statsPoller.LastValue = channelInfo;
                        int viewers = 0;
                        if (channelInfo != null && channelInfo.state != null)
                        {
                            viewers = channelInfo.state.viewers;
                        }

                        ChannelStats.ViewersCount = viewers;
                        Chat.UpdateStats();
                    }
                }
            };
            statsPoller.Start();
        }
Esempio n. 25
0
        /// <summary>
        /// creates a new read channel suckaz
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="isCounter"></param>
        public void CreateReadTask()
        {
            DestroyReaderTask();

            ReaderWaitHandle = new System.Threading.ManualResetEvent(true);
            ReaderTask       = new Task("IntensityReader");
            ReaderTask.SynchronizeCallbacks = SynchronizeCallbacks;
            ReaderTask.Stream.Timeout       = Timeout;


            // Creates Input Channel task after checking channel type
            string cname = new String(ChannelName.Where(Char.IsLetter).ToArray());

            if (!IsCounter)
            {
                this.ReaderTask.AIChannels.CreateVoltageChannel(ChannelName, "IntensityReader " + cname,
                                                                AITerminalConfiguration.Differential, -10, 10, AIVoltageUnits.Volts);

                AnalogReader = new AnalogMultiChannelReader(ReaderTask.Stream);
                AnalogReader.SynchronizeCallbacks = SynchronizeCallbacks;
            }
            else
            {
                this.ReaderTask.CIChannels.CreateCountEdgesChannel(ChannelName, "CounterReader " + cname,
                                                                   CICountEdgesActiveEdge.Rising, 10, CICountEdgesCountDirection.Up);

                this.ReaderTask.CIChannels.All.CountEdgesTerminal           = InputTerminal;
                this.ReaderTask.CIChannels.All.CountEdgesCountResetTerminal = "/CARD/PFI0";

                CounterReader = new CounterMultiChannelReader(ReaderTask.Stream);
                CounterReader.SynchronizeCallbacks = SynchronizeCallbacks;
            }

            LastReadDataChunk = null;
            // configureing the clock.
            ReaderTask.Timing.ConfigureSampleClock(TimeBaseTerminal,
                                                   SamplingFrequency, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples);
            ReaderTask.Control(TaskAction.Verify);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ChannelName.Length != 0)
            {
                hash ^= ChannelName.GetHashCode();
            }
            if (Sdk.Length != 0)
            {
                hash ^= Sdk.GetHashCode();
            }
            if (Platform.Length != 0)
            {
                hash ^= Platform.GetHashCode();
            }
            if (Source.Length != 0)
            {
                hash ^= Source.GetHashCode();
            }
            if (BundleID.Length != 0)
            {
                hash ^= BundleID.GetHashCode();
            }
            if (DownloadName.Length != 0)
            {
                hash ^= DownloadName.GetHashCode();
            }
            if (UpdateInGame != false)
            {
                hash ^= UpdateInGame.GetHashCode();
            }
            if (ProductName.Length != 0)
            {
                hash ^= ProductName.GetHashCode();
            }
            return(hash);
        }
Esempio n. 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="groupId">What is the id of the consumer group that this consumer belongs to; will not process the same partition as others in group</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="offsetDefault">Where should we begin processing if we cannot find a stored offset</param>
 /// <param name="commitBatchSize">How often should we commit offsets?</param>
 /// <param name="sessionTimeoutMs">What is the heartbeat interval for this consumer, after which Kafka will assume dead and rebalance the consumer group</param>
 /// <param name="maxPollIntervalMs">How often does the consumer poll for a message to be considered alive, after which Kafka will assume dead and rebalance</param>
 /// <param name="sweepUncommittedOffsetsIntervalMs">How often do we commit offsets that have yet to be saved</param>
 /// <param name="isolationLevel">Should we read messages that are not on all replicas? May cause duplicates.</param>
 /// <param name="isAsync">Is this channel read asynchronously</param>
 /// <param name="numOfPartitions">How many partitions should this topic have - used if we create the topic</param>
 /// <param name="replicationFactor">How many copies of each partition should we have across our broker's nodes - used if we create the topic</param>       /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 /// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
 /// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
 public KafkaSubscription(
     Type dataType,
     SubscriptionName name                 = null,
     ChannelName channelName               = null,
     RoutingKey routingKey                 = null,
     string groupId                        = null,
     int bufferSize                        = 1,
     int noOfPerformers                    = 1,
     int timeoutInMilliseconds             = 300,
     int requeueCount                      = -1,
     int requeueDelayInMilliseconds        = 0,
     int unacceptableMessageLimit          = 0,
     AutoOffsetReset offsetDefault         = AutoOffsetReset.Earliest,
     long commitBatchSize                  = 10,
     int sessionTimeoutMs                  = 10000,
     int maxPollIntervalMs                 = 300000,
     int sweepUncommittedOffsetsIntervalMs = 30000,
     IsolationLevel isolationLevel         = IsolationLevel.ReadCommitted,
     bool isAsync                      = false,
     int numOfPartitions               = 1,
     short replicationFactor           = 1,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create,
     int emptyChannelDelay             = 500,
     int channelFailureDelay           = 1000)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
            requeueDelayInMilliseconds, unacceptableMessageLimit, isAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
 {
     CommitBatchSize   = commitBatchSize;
     GroupId           = groupId;
     IsolationLevel    = isolationLevel;
     MaxPollIntervalMs = maxPollIntervalMs;
     SweepUncommittedOffsetsIntervalMs = sweepUncommittedOffsetsIntervalMs;
     OffsetDefault     = offsetDefault;
     SessionTimeoutMs  = sessionTimeoutMs;
     NumPartitions     = numOfPartitions;
     ReplicationFactor = replicationFactor;
 }
Esempio n. 28
0
        public override void SendMessage(ChatMessage message)
        {
            if (Chat.IsAnonymous || String.IsNullOrWhiteSpace(message.Channel) ||
                String.IsNullOrWhiteSpace(message.FromUserName) ||
                String.IsNullOrWhiteSpace(message.Text))
            {
                return;
            }

            if (webSocket == null)
            {
                return;
            }

            webSocket.Send(String.Format(
                               @"42[""send"",{{""room"":""{0}"",""msg"":""{1}"",""token"":""{2}""}}]",
                               ChannelName.Replace("#", ""),
                               message.Text,
                               channelToken
                               ));

            //Send message
        }
Esempio n. 29
0
        internal static string ToSerializedValue(this ChannelName value)
        {
            switch (value)
            {
            case ChannelName.FacebookChannel:
                return("FacebookChannel");

            case ChannelName.EmailChannel:
                return("EmailChannel");

            case ChannelName.KikChannel:
                return("KikChannel");

            case ChannelName.TelegramChannel:
                return("TelegramChannel");

            case ChannelName.SlackChannel:
                return("SlackChannel");

            case ChannelName.MsTeamsChannel:
                return("MsTeamsChannel");

            case ChannelName.SkypeChannel:
                return("SkypeChannel");

            case ChannelName.WebChatChannel:
                return("WebChatChannel");

            case ChannelName.DirectLineChannel:
                return("DirectLineChannel");

            case ChannelName.SmsChannel:
                return("SmsChannel");
            }
            return(null);
        }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="ChannelName" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ChannelName.CreateFrom(sourceValue);
Esempio n. 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="routingKey">The routing key</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel</param>
 /// <param name="channelName">The channel name</param>
 /// <param name="isDurable">The durability of the queue</param>
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, string routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false)
 {
     RequeueCount = requeueCount;
     Name = name;
     ChannelFactory = channelFactory;
     DataType = dataType;
     NoOfPeformers = noOfPerformers;
     TimeoutInMiliseconds = timeoutInMilliseconds;
     UnacceptableMessageLimit = unacceptableMessageLimit;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     ChannelName = channelName;
     RoutingKey = routingKey;
     IsDurable = isDurable;
 }
Esempio n. 32
0
 /// <summary>
 /// Do the channel name's match?
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public bool Equals(ChannelName other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return string.Equals(_name, other._name);
 }