Exemple #1
0
        private static async void Emit(OutboundMessage message)
        {
            if (message.Event != CoreEvents.LogMirror)
            {
                Logger.Trace(message.Payloads.Count > 0
                                ? $"Emit: \"{message.Event}\" with {message.Payloads.Count} payload{(message.Payloads.Count > 1 ? "s" : string.Empty)}:{Environment.NewLine}\t{string.Join($"{Environment.NewLine}\t", message.Payloads)}"
                                : $"Emit: \"{message.Event}\" with no payloads");
            }

            // Marshall back to the main thread in order to use a native call.
            await BaseScript.Delay(0);

            BaseScript.TriggerServerEvent(message.Event, message.Pack());
        }
Exemple #2
0
        public void Fire(OutboundMessage message)
        {
            if (!message.Event.StartsWith("nfive:log:"))
            {
                if (message.Payloads.Count > 0)
                {
                    this.logger.Trace($"Fire: \"{message.Event}\" with {message.Payloads.Count} payload{(message.Payloads.Count > 1 ? "s" : string.Empty)}:{Environment.NewLine}\t{string.Join($"{Environment.NewLine}\t", message.Payloads)}");
                }
                else
                {
                    this.logger.Trace($"Fire: \"{message.Event}\" with no payloads");
                }
            }

            BaseScript.TriggerServerEvent(message.Event, message.Pack());
        }