当前位置: 首页>>代码示例>>C#>>正文


C# ExceptionlessConfiguration.GetQueueName方法代码示例

本文整理汇总了C#中ExceptionlessConfiguration.GetQueueName方法的典型用法代码示例。如果您正苦于以下问题:C# ExceptionlessConfiguration.GetQueueName方法的具体用法?C# ExceptionlessConfiguration.GetQueueName怎么用?C# ExceptionlessConfiguration.GetQueueName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExceptionlessConfiguration的用法示例。


在下文中一共展示了ExceptionlessConfiguration.GetQueueName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckVersion

        public static void CheckVersion(int version, ExceptionlessConfiguration config) {
            var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
            if (version <= persistedClientData.GetInt32(String.Concat(config.GetQueueName(), "-ServerConfigVersion"), -1))
                return;

            UpdateSettings(config);
        }
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:7,代码来源:SettingsManager.cs

示例2: CanUpdateSettingsFromServer

        public void CanUpdateSettingsFromServer() {
            var config = new ExceptionlessConfiguration(DependencyResolver.Default);
            config.ApiKey = "e3d51ea621464280bbcb79c11fd6483e";
            config.Settings["LocalSetting"] = "1";
            config.Settings["LocalSettingToOverride"] = "1";

            var submissionClient = new Mock<ISubmissionClient>();
            submissionClient.Setup(m => m.Submit(It.IsAny<IEnumerable<Event>>(), config, It.IsAny<IJsonSerializer>()))
                .Callback(() => SettingsManager.CheckVersion(1, config))
                .Returns(() => new SubmissionResponse(202, "Accepted"));
            submissionClient.Setup(m => m.GetSettings(config, It.IsAny<IJsonSerializer>()))
                .Returns(() => new SettingsResponse(true, new SettingsDictionary { { "Test", "Test" }, { "LocalSettingToOverride", "2" } }, 1));

            config.Resolver.Register<ISubmissionClient>(submissionClient.Object);
            var client = new ExceptionlessClient(config);

            Assert.Equal(2, client.Configuration.Settings.Count);
            Assert.False(client.Configuration.Settings.ContainsKey("Test"));
            Assert.Equal("1", client.Configuration.Settings["LocalSettingToOverride"]);
            client.SubmitEvent(new Event { Type = "Log", Message = "Test" });
            client.ProcessQueue();
            Assert.True(client.Configuration.Settings.ContainsKey("Test"));
            Assert.Equal("2", client.Configuration.Settings["LocalSettingToOverride"]);
            Assert.Equal(3, client.Configuration.Settings.Count);

            var storage = config.Resolver.GetFileStorage() as InMemoryFileStorage;
            Assert.True(storage.Exists(config.GetQueueName() + "\\server-settings.json"));

            config.Settings.Clear();
            config.ApplySavedServerSettings();
            Assert.True(client.Configuration.Settings.ContainsKey("Test"));
            Assert.Equal("2", client.Configuration.Settings["LocalSettingToOverride"]);
            Assert.Equal(2, client.Configuration.Settings.Count);
        }
开发者ID:jrheault,项目名称:Exceptionless,代码行数:34,代码来源:ConfigurationTests.cs

示例3: UpdateSettings

        public static void UpdateSettings(ExceptionlessConfiguration config) {
            if (String.IsNullOrEmpty(config.ApiKey) || String.Equals(config.ApiKey, "API_KEY_HERE", StringComparison.OrdinalIgnoreCase)) {
                config.Resolver.GetLog().Error(typeof(SettingsManager), "Unable to update settings: ApiKey is not set.");
                return;
            }

            var serializer = config.Resolver.GetJsonSerializer();
            var client = config.Resolver.GetSubmissionClient();

            var response = client.GetSettings(config, serializer);
            if (!response.Success || response.Settings == null)
                return;

            var savedServerSettings = GetSavedServerSettings(config);
            config.Settings.Apply(response.Settings);

            // TODO: Store snapshot of settings after reading from config and attributes and use that to revert to defaults.
            // Remove any existing server settings that are not in the new server settings.
            foreach (string key in savedServerSettings.Keys.Except(response.Settings.Keys)) {
                if (config.Settings.ContainsKey(key))
                    config.Settings.Remove(key);
            }

            var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
            persistedClientData[String.Concat(config.GetQueueName(), "-ServerConfigVersion")] = response.SettingsVersion.ToString();

            var fileStorage = config.Resolver.GetFileStorage();
            fileStorage.SaveObject(GetConfigPath(config), response.Settings);
        }
开发者ID:megakid,项目名称:Exceptionless.Net,代码行数:29,代码来源:SettingsManager.cs

示例4: CheckVersion

        public static void CheckVersion(int version, ExceptionlessConfiguration config) {
            if (String.IsNullOrEmpty(config.ApiKey) || String.Equals(config.ApiKey, "API_KEY_HERE", StringComparison.OrdinalIgnoreCase)) {
                config.Resolver.GetLog().Error(typeof(SettingsManager), "Unable to check version: ApiKey is not set.");
                return;
            }

            var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
            if (version <= persistedClientData.GetInt32(String.Concat(config.GetQueueName(), "-ServerConfigVersion"), -1))
                return;

            UpdateSettings(config);
        }
开发者ID:megakid,项目名称:Exceptionless.Net,代码行数:12,代码来源:SettingsManager.cs

示例5: UpdateSettings

        public static void UpdateSettings(ExceptionlessConfiguration config) {
            var serializer = config.Resolver.GetJsonSerializer();
            var client = config.Resolver.GetSubmissionClient();

            var response = client.GetSettings(config, serializer);
            if (!response.Success)
                return;

            config.Settings.Apply(response.Settings);

            var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
            persistedClientData[String.Concat(config.GetQueueName(), "-ServerConfigVersion")] = response.SettingsVersion.ToString();

            var fileStorage = config.Resolver.GetFileStorage();
            fileStorage.SaveObject(GetConfigPath(config), response.Settings, serializer);
        }
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:16,代码来源:SettingsManager.cs

示例6: GetVersion

        public static int GetVersion(ExceptionlessConfiguration config) {
            if (config == null)
                return 0;

            if (String.IsNullOrEmpty(config.ApiKey) || String.Equals(config.ApiKey, "API_KEY_HERE", StringComparison.OrdinalIgnoreCase)) {
                config.Resolver.GetLog().Error(typeof(SettingsManager), "Unable to get version: ApiKey is not set.");
                return 0;
            }

            try {
                var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
                return persistedClientData.GetInt32(String.Concat(config.GetQueueName(), "-ServerConfigVersion"), 0);
            } catch (Exception ex) {
                config.Resolver.GetLog().Error(typeof(SettingsManager), ex, "Error occurred getting settings version.");
                return 0;
            }
        }
开发者ID:InlineAsm,项目名称:Exceptionless.Net,代码行数:17,代码来源:SettingsManager.cs

示例7: UpdateSettings

        public static void UpdateSettings(ExceptionlessConfiguration config, int? version = null) {
            if (config == null || !config.IsValid || !config.Enabled)
                return;

            try {
                if (!version.HasValue || version < 0)
                    version = GetVersion(config);

                var serializer = config.Resolver.GetJsonSerializer();
                var client = config.Resolver.GetSubmissionClient();

                var response = client.GetSettings(config, version.Value, serializer);
                if (!response.Success || response.Settings == null)
                    return;

                var savedServerSettings = GetSavedServerSettings(config);
                config.Settings.Apply(response.Settings);

                // TODO: Store snapshot of settings after reading from config and attributes and use that to revert to defaults.
                // Remove any existing server settings that are not in the new server settings.
                foreach (string key in savedServerSettings.Keys.Except(response.Settings.Keys)) {
                    if (config.Settings.ContainsKey(key))
                        config.Settings.Remove(key);
                }

                var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
                persistedClientData[String.Concat(config.GetQueueName(), "-ServerConfigVersion")] = response.SettingsVersion.ToString();

                var fileStorage = config.Resolver.GetFileStorage();
                fileStorage.SaveObject(GetConfigPath(config), response.Settings);
            } catch (Exception ex) {
                config.Resolver.GetLog().Error(typeof(SettingsManager), ex, "Error occurred updating settings.");
            }
        }
开发者ID:InlineAsm,项目名称:Exceptionless.Net,代码行数:34,代码来源:SettingsManager.cs

示例8: GetConfigPath

 private static string GetConfigPath(ExceptionlessConfiguration config) {
     string queueName = config != null ? config.GetQueueName() : String.Empty;
     return Path.Combine(queueName ?? String.Empty, "server-settings.json");
 }
开发者ID:InlineAsm,项目名称:Exceptionless.Net,代码行数:4,代码来源:SettingsManager.cs

示例9: GetConfigPath

 private static string GetConfigPath(ExceptionlessConfiguration config) {
     return config.GetQueueName() + "\\server-settings.json";
 }
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:3,代码来源:SettingsManager.cs


注:本文中的ExceptionlessConfiguration.GetQueueName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。