Example #1
0
        /// <summary>
        /// Initializes a new instance of the LoginCommandMessage class based on greeting with specified client identifier, password and client transaction identifier
        /// </summary>
        /// <param name="greeting">Greeting message</param>
        /// <param name="clientId">Сlient identifier</param>
        /// <param name="password">Password for login</param>
        /// <param name="clientTranId">Client transaction identifier</param>
        public LoginCommandMessage(GreetingMessage greeting, string clientId, string password, string clientTranId)
            : base(CommandType.Login, false, clientTranId)
        {
            var clientIDElement = new XElement(EppNs.GetName("clID"), clientId);
            var passwordElement = new XElement(EppNs.GetName("pw"), password);

            var versionElement = new XElement(EppNs.GetName("version"), greeting.Versions.First());
            var langElement    = new XElement(EppNs.GetName("lang"), greeting.Languages.First());

            var optionsElement = new XElement(EppNs.GetName("options"), versionElement, langElement);

            var objURIElements = greeting.ObjectURIs.Select(objUri => new XElement(EppNs.GetName("objURI"), objUri));
            var svcsElement    = new XElement(EppNs.GetName("svcs"), objURIElements);

            if (greeting.ExtensionURIs.Any())
            {
                var extURIElements      = greeting.ExtensionURIs.Select(extUri => new XElement(EppNs.GetName("extURI"), extUri));
                var svcExtensionElement = new XElement(EppNs.GetName("svcExtension"), extURIElements);
                svcsElement.Add(svcExtensionElement);
            }

            var loginElement = new XElement(EppNs.GetName("login"), clientIDElement, passwordElement, optionsElement, svcsElement);

            this.CommandElement.AddFirst(loginElement);
        }
Example #2
0
 private void GreetingMessageHandler(GreetingMessage greeting)
 {
     Console.WriteLine($"Typed Actor named: {Self.Path.Name}");
     Console.WriteLine($"Received a greeting: {greeting.Greeting}");
     Console.WriteLine($"Actor's path: {Self.Path}");
     Console.WriteLine($"Actor is part of the ActorSystem: {Context.System.Name}");
 }
Example #3
0
        static void Main()
        {
            using (var adapter = new BuiltinContainerAdapter())
            {
                adapter.Handle <string>(reply => Console.WriteLine("Got reply: {0}" + Environment.NewLine, reply));

                Configure.With(adapter)
                .Logging(l => l.ColoredConsole(minLevel: LogLevel.Warn))
                .Transport(t => t.UseMsmqAndGetInputQueueNameFromAppConfig())
                .MessageOwnership(o => o.FromRebusConfigurationSection())
                .CreateBus()
                .Start();

                var bus = adapter.Bus;

                Console.WriteLine("Type a greeting + ENTER to send to server" + Environment.NewLine);
                while (true)
                {
                    var text = Console.ReadLine();

                    if (string.IsNullOrWhiteSpace(text))
                    {
                        break;
                    }

                    var greeting = new GreetingMessage(text);

                    bus.Send(greeting);
                }
            }
        }
Example #4
0
        static async Task Main()
        {
            var registars = new IRegistar[]
            {
                new ServiceCollectionRegistar(),
                new AutofacRegistar()
            };

            var greetingMessage = new GreetingMessage {
                Name = "World", User = "******"
            };

            foreach (var registar in registars)
            {
                Console.WriteLine($"Running {registar.GetType().Name}");
                Console.WriteLine();

                var broker = registar.Register();

                await broker.SendAsync(greetingMessage);

                await broker.PublishAsync(greetingMessage);

                await broker.SendAsync <IAudit>(greetingMessage);

                var result = await broker.SendAsync <GreetingMessage, string>(greetingMessage);

                Console.WriteLine(result);

                Console.WriteLine();
                Console.WriteLine();
            }

            Console.ReadKey();
        }
Example #5
0
        public string Talk()
        {
            if (string.IsNullOrWhiteSpace(OwnerName))
            {
                return("Hello, I am Alexa.");
            }

            return(GreetingMessage.Replace("{OwnerName}", OwnerName));
        }
Example #6
0
        //public void Configure(Alexa alexa)
        //{

        //}

        public string Talk()
        {
            if (OwnerName == null)
            {
                return(GreetingMessage);
            }

            return(GreetingMessage.Replace("{OwnerName}", OwnerName));
        }
Example #7
0
 internal string Talk()
 {
     if (!string.IsNullOrEmpty(GreetingMessage))
     {
         return(GreetingMessage.Replace("{OwnerName}", OwnerName));
     }
     else
     {
         return("print hello, i am Alexa");
     }
 }
Example #8
0
 public static void Prefix(ref ZNet __instance)
 {
     // Reset the server greeting variables when the client disconnects.
     // These will be set once the client connects to a server.
     if (!ZNet.m_isServer)
     {
         VChatPlugin.Log("Resetting variables for local player");
         PlayerPatchOnSpawned.HasSentServerPluginStatusMessage = false;
         GreetingMessage.ResetClientVariables();
     }
 }
Example #9
0
 public string Talk()
 {
     if (!string.IsNullOrWhiteSpace(GreetingMessage) && !string.IsNullOrWhiteSpace(OwnerName))
     {
         return(GreetingMessage.Replace("{OwnerName}", OwnerName));
     }
     else
     {
         return("hello, i am Alexa");
     }
 }
Example #10
0
 public static void Postfix(ref ZRoutedRpc __instance, ref ZNetPeer peer)
 {
     // Send a greeting message to the server or client.
     if (ZNet.m_isServer)
     {
         GreetingMessage.SendToClient(peer.m_uid);
     }
     else
     {
         GreetingMessage.SendToServer();
     }
 }
Example #11
0
        public void SendMessage(GreetingMessage greetingMessage)
        {
            var message = new MimeMessage();

            message.From.Add(new MailboxAddress(_sender));
            message.To.Add(new MailboxAddress(greetingMessage.Recipient));
            message.Subject = greetingMessage.Subject;
            message.Body    = new TextPart("plain")
            {
                Text = greetingMessage.Body
            };
            // Send the message
            SendMessage(smtpHost, smtpPort, message);
        }
Example #12
0
 public string GetGreeting()
 {
     return(GreetingMessage.Replace($"{{{nameof(OwnerName)}}}", OwnerName));
 }
Example #13
0
 private static void Postfix(ref ZNet __instance)
 {
     // Register our custom defined messages.
     GlobalMessages.Register();
     GreetingMessage.Register();
 }
Example #14
0
 private void GreetingMessageHandler3(GreetingMessage greeting)
 {
     Console.WriteLine($" GreetingMessageHandler3 Received a greeting: {greeting.Greeting}");
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the LoginCommandMessage class based on greeting with specified client identifier and password
 /// </summary>
 /// <param name="greeting">Greeting message</param>
 /// <param name="clientId">Сlient identifier</param>
 /// <param name="password">Password for login</param>
 public LoginCommandMessage(GreetingMessage greeting, string clientId, string password)
     : this(greeting, clientId, password, null)
 {
 }
Example #16
0
 public override Task HandleAsync(GreetingMessage message)
 {
     Console.WriteLine("Derived");
     return(Task.CompletedTask);
 }
 public void InitGreeting(Person active, Person passive)
 {
     this.greeting  += active.Greeting;
     passive.OnCame += this.greeting;
 }