Ejemplo n.º 1
0
        protected BaseClient([NotNull] ICommsNetworkState network)
        {
            if (network == null)
            {
                throw new ArgumentNullException("network");
            }

            Log = Logs.Create(LogCategory.Network, GetType().Name);

            const int poolSize        = 32;
            const int byteBufferSize  = 1024;
            const int channelListSize = 8;
            var       byteArrayPool   = new ReadonlyLockedValue <Pool <byte[]> >(new Pool <byte[]>(poolSize, () => new byte[byteBufferSize]));
            var       channelListPool = new ConcurrentPool <List <RemoteChannel> >(poolSize, () => new List <RemoteChannel>(channelListSize));

            _sendQueue        = new SendQueue <TPeer>(this, byteArrayPool);
            _serverNegotiator = new ConnectionNegotiator <TPeer>(_sendQueue, network.PlayerName, network.CodecSettings);
            _lossSimulator    = new PacketDelaySimulator();

            _events = new EventQueue(byteArrayPool, channelListPool);
            _peers  = new SlaveClientCollection <TPeer>(_sendQueue, _serverNegotiator, _events, network.Rooms, network.PlayerName, network.CodecSettings);
            _peers.OnClientJoined        += OnAddedClient;
            _peers.OnClientIntroducedP2P += OnMetClient;

            _voiceReceiver = new VoiceReceiver <TPeer>(_serverNegotiator, _peers, _events, network.Rooms, channelListPool);
            _voiceSender   = new VoiceSender <TPeer>(_sendQueue, _serverNegotiator, _peers, _events, network.PlayerChannels, network.RoomChannels);

            _textReceiver = new TextReceiver <TPeer>(_events, network.Rooms, _peers);
            _textSender   = new TextSender <TPeer>(_sendQueue, _serverNegotiator, _peers);
        }
Ejemplo n.º 2
0
        private void Start()
        {
            Loom.Initialize();

            WebCamera.Initialize();

            VoiceReceiver.Initialize();

            GenerateModules();

            AppEntry();
        }
        ///GENMHASH:28EA8740CFC6755BFA8A1D7E7EC01656:E04F70E660B16F519FBABB6207B6EA67
        public ActionGroupImpl WithVoice(string countryCode, string phoneNumber)
        {
            this.WithoutVoice();

            var compositeKey = this.actionReceiverPrefix + voiceSuffix;
            var vr           = new VoiceReceiver
            {
                Name        = compositeKey,
                CountryCode = countryCode,
                PhoneNumber = phoneNumber
            };

            this.voiceReceivers[compositeKey] = vr;
            return(this);
        }
Ejemplo n.º 4
0
        protected override void OnCreateCompleted()
        {
            _viewModel.OnStartRecordEvent += ViewModel_OnStartRecordEvent;

            _viewModel.OnEndRecordEvent += ViewModel_OnEndRecordEvent;

            _viewModel.OnDeleteItemEvent += ViewModel_OnDeleteItemEvent;

            _viewModel.OnAddItemEvent += ViewModel_OnAddItemEvent;

            _dataPath = Path.Combine(Application.persistentDataPath, "MingMemo.mdat");

            _voiceReceiver = VoiceReceiver.Default;

            MEventHub.Instance.AddListener(SpeechRecEventId.SpeechRecResult, this);
        }
Ejemplo n.º 5
0
        internal static ActionGroupData DeserializeActionGroupData(JsonElement element)
        {
            Optional <string>            kind     = default;
            Optional <string>            identity = default;
            IDictionary <string, string> tags     = default;
            AzureLocation      location           = default;
            ResourceIdentifier id             = default;
            string             name           = default;
            ResourceType       type           = default;
            SystemData         systemData     = default;
            Optional <string>  groupShortName = default;
            Optional <bool>    enabled        = default;
            Optional <IList <EmailReceiver> >             emailReceivers             = default;
            Optional <IList <SmsReceiver> >               smsReceivers               = default;
            Optional <IList <WebhookReceiver> >           webhookReceivers           = default;
            Optional <IList <ItsmReceiver> >              itsmReceivers              = default;
            Optional <IList <AzureAppPushReceiver> >      azureAppPushReceivers      = default;
            Optional <IList <AutomationRunbookReceiver> > automationRunbookReceivers = default;
            Optional <IList <VoiceReceiver> >             voiceReceivers             = default;
            Optional <IList <LogicAppReceiver> >          logicAppReceivers          = default;
            Optional <IList <AzureFunctionReceiver> >     azureFunctionReceivers     = default;
            Optional <IList <ArmRoleReceiver> >           armRoleReceivers           = default;
            Optional <IList <EventHubReceiver> >          eventHubReceivers          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    identity = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("groupShortName"))
                        {
                            groupShortName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("emailReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EmailReceiver> array = new List <EmailReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EmailReceiver.DeserializeEmailReceiver(item));
                            }
                            emailReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("smsReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SmsReceiver> array = new List <SmsReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SmsReceiver.DeserializeSmsReceiver(item));
                            }
                            smsReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("webhookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WebhookReceiver> array = new List <WebhookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(WebhookReceiver.DeserializeWebhookReceiver(item));
                            }
                            webhookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("itsmReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ItsmReceiver> array = new List <ItsmReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ItsmReceiver.DeserializeItsmReceiver(item));
                            }
                            itsmReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureAppPushReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureAppPushReceiver> array = new List <AzureAppPushReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureAppPushReceiver.DeserializeAzureAppPushReceiver(item));
                            }
                            azureAppPushReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("automationRunbookReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AutomationRunbookReceiver> array = new List <AutomationRunbookReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AutomationRunbookReceiver.DeserializeAutomationRunbookReceiver(item));
                            }
                            automationRunbookReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("voiceReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VoiceReceiver> array = new List <VoiceReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VoiceReceiver.DeserializeVoiceReceiver(item));
                            }
                            voiceReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("logicAppReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <LogicAppReceiver> array = new List <LogicAppReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(LogicAppReceiver.DeserializeLogicAppReceiver(item));
                            }
                            logicAppReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("azureFunctionReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AzureFunctionReceiver> array = new List <AzureFunctionReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFunctionReceiver.DeserializeAzureFunctionReceiver(item));
                            }
                            azureFunctionReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("armRoleReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ArmRoleReceiver> array = new List <ArmRoleReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ArmRoleReceiver.DeserializeArmRoleReceiver(item));
                            }
                            armRoleReceivers = array;
                            continue;
                        }
                        if (property0.NameEquals("eventHubReceivers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <EventHubReceiver> array = new List <EventHubReceiver>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(EventHubReceiver.DeserializeEventHubReceiver(item));
                            }
                            eventHubReceivers = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ActionGroupData(id, name, type, systemData, tags, location, kind.Value, identity.Value, groupShortName.Value, Optional.ToNullable(enabled), Optional.ToList(emailReceivers), Optional.ToList(smsReceivers), Optional.ToList(webhookReceivers), Optional.ToList(itsmReceivers), Optional.ToList(azureAppPushReceivers), Optional.ToList(automationRunbookReceivers), Optional.ToList(voiceReceivers), Optional.ToList(logicAppReceivers), Optional.ToList(azureFunctionReceivers), Optional.ToList(armRoleReceivers), Optional.ToList(eventHubReceivers)));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the PSVoiceReceiver class.
 /// </summary>
 /// <param name="receiver">The receiver to wrap.</param>
 public PSVoiceReceiver(VoiceReceiver receiver)
 {
     this.Name        = receiver.Name;
     this.CountryCode = receiver.CountryCode;
     this.PhoneNumber = receiver.PhoneNumber;
 }
Ejemplo n.º 7
0
    private void Start()
    {
        _receiver = VoiceReceiver.Default;

        _audioSource = this.GetComponent <AudioSource>();
    }