示例#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 Delete(int version)
 {
     _demonstrationServiceImplementation.RemoveVersionedSetting(version);
 }
 /// <summary>
 /// Removes the versioned setting.
 /// </summary>
 /// <param name="version">The version.</param>
 /// <returns><c>true</c> if the setting is removed, <c>false</c> otherwise.</returns>
 public bool RemoveVersionedWcfSetting(int version)
 {
     return(_demonstrationServiceImplementation.RemoveVersionedSetting(version));
 }