Exemple #1
0
        /// <summary>
        /// Directly removes the target relay from a given channel's respective database.
        /// </summary>
        /// <param name="Parameters">
        /// A string-string dictionary containing a defition for "ChannelID".
        /// This value should be parsable to a <c>ulong</c> (Channel ID).
        /// </param>

        public void RemoveRelayCallback(Dictionary <string, string> Parameters)
        {
            ulong ChannelID = ulong.Parse(Parameters["ChannelID"]);

            Relay RelayToRemove = RelayDB.Relays.Find(ChannelID);

            RelayDB.Relays.Remove(RelayToRemove);

            RelayDB.SaveChanges();
        }
Exemple #2
0
        /// <summary>
        /// Directly adds a new relay to the corresponding database.
        /// </summary>
        /// <param name="Parameters">
        /// A string-string dictionary containing definitions for "MessageInterval", "ChannelID", and "Message".
        /// Each of these values should be parsable to an <c>int</c>, <c>ulong</c> (Channel ID), and <c>string</c> respectively.
        /// </param>

        public void AddRelayCallback(Dictionary <string, string> Parameters)
        {
            int    MessageInterval = int.Parse(Parameters["MessageInterval"]);
            ulong  ChannelID       = ulong.Parse(Parameters["ChannelID"]);
            string Message         = Parameters["Message"];

            RelayDB.Add(new Relay {
                ChannelID           = ChannelID,
                CurrentMessageCount = MessageInterval,
                MessageInterval     = MessageInterval,
                Message             = Message
            });

            RelayDB.SaveChanges();
        }