Esempio n. 1
0
        /// <summary>
        /// Processes the message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="client">The client.</param>
        private static void ProcessMessage(string message, Socket client)
        {
            Console.WriteLine($"Message Received: {message}");

            if (message == "GET")
            {
                client.Send(Encoding.ASCII.GetBytes(_service.GetLatestVersionedSetting()));
            }
            else if (message.StartsWith("GET_VER"))
            {
                var tokens = message.Split("::");
                client.Send(Encoding.ASCII.GetBytes(_service.GetVersionedSetting(int.Parse(tokens[1]))));
            }
            else if (message.StartsWith("ADD"))
            {
                var tokens = message.Split("::");
                _service.AddVersionedSetting(tokens[1]);
            }
            else if (message.StartsWith("DEL"))
            {
                var tokens = message.Split("::");
                client.Send(Encoding.ASCII.GetBytes(_service.RemoveVersionedSetting(int.Parse(tokens[1])).ToString()));
            }
            else if (message.StartsWith("UPD"))
            {
                var tokens = message.Split("::");
                _service.UpdateVersionedSetting(int.Parse(tokens[1]), tokens[2]);
            }
        }
 public void Put([FromBody] VersionedSetting updatedSetting)
 {
     _demonstrationServiceImplementation.UpdateVersionedSetting(updatedSetting.Version, updatedSetting.Setting);
 }
 /// <summary>
 /// Updates the versioned setting.
 /// </summary>
 /// <param name="version">The version.</param>
 /// <param name="setting">The setting.</param>
 public void UpdateVersionedWcfSetting(int version, string setting)
 {
     _demonstrationServiceImplementation.UpdateVersionedSetting(version, setting);
 }