Esempio n. 1
0
        /// <summary>
        /// Sets up the default values for a server
        /// </summary>
        /// <param name="server"></param>
        public static void SetupDefaultServerConfig(Server server)
        {
            var existingEntries = Globals.BotFramework !.ConfigStore.GetAllConfigValues(server);

            foreach (var defaultConfigValue in DefaultServerConfig)
            {
                if (existingEntries.Any(x => string.Equals(x.Key, defaultConfigValue.Key, System.StringComparison.Ordinal)))
                {
                    continue;
                }

                Globals.BotFramework.ConfigStore.SetConfigValue(defaultConfigValue.Key, defaultConfigValue.Value, server);
            }

            // Delete existing entries that are not listed in "DefaultServerConfig"
            var entriesToDelete = existingEntries.Where(x => !DefaultServerConfig.Any(y => string.Equals(x.Key, y.Key, System.StringComparison.Ordinal))).ToList();

            foreach (var entryToDelete in entriesToDelete)
            {
                Globals.BotFramework.ConfigStore.DeleteConfigEntry(entryToDelete.Key, server);
            }
        }