示例#1
0
        public static async Task HandleHoundCIMessages(SocketUserMessage message,
                                                       SocketCommandContext context,
                                                       SocketGuildChannel channel)
        {
            if (null == channel || channel.Name != "github" || message.Embeds.Count <= 0)
            {
                return;
            }

            bool purgeHoundBotMsgs = AppSettingsUtil.AppSettingsBool("deleteHoundBotMsgs",
                                                                     false, false);

            if (!purgeHoundBotMsgs)
            {
                return;
            }

            // #github channel contains messages from many different sources.
            // check if the sender is 'houndci-bot' before deleting.
            foreach (Embed e in message.Embeds)
            {
                EmbedAuthor author = (EmbedAuthor)e.Author;
                if (author.ToString() == "houndci-bot")
                {
                    //logger.InfoFormat("Deleting the houndci-bot message: {0} => {1}: {2}",
                    //                   e.Url, e.Title, e.Description);
                    await context.Message.DeleteAsync();
                }
            }
        }
示例#2
0
        private static async Task HandleLineCount(SocketUserMessage message, SocketCommandContext context)
        {
            if (!Utils.LineCountCheck(message.Content))
            {
                string url = await HassBotUtils.Utils.Paste2Ubuntu(message.Content, context.User.Username);

                if (url == string.Empty)
                {
                    // untutu paste failed... try hastebin
                    url = HassBotUtils.Utils.Paste2HasteBin(message.Content);
                    if (url == string.Empty)
                    {
                        // hastebin paste ALSO failed... just warn the user, and drop a poop emoji :)
                        var    poopEmoji   = new Emoji(POOP);
                        string msxLimitMsg = AppSettingsUtil.AppSettingsString("maxLineLimitMessage", false, MAX_LINE_LIMIT);
                        await message.Channel.SendMessageAsync(string.Format(msxLimitMsg, context.User.Mention));

                        await context.Message.AddReactionAsync(poopEmoji);

                        return;
                    }
                }

                // publish the URL link
                string adjective = HassBotUtils.Utils.GetFlippinAdjective();
                string response  = string.Format(HASTEBIN_MESSAGE, context.User.Mention, adjective, url);
                await message.Channel.SendMessageAsync(response);

                // and, delete the original message!
                await context.Message.DeleteAsync();
            }
        }
示例#3
0
        public static async Task ChangeNickName(DiscordSocketClient client,
                                                SocketCommandContext context)
        {
            // Change Nick Name 💎
            // Get the Home Assistant Server Guild
            ulong serverGuild = (ulong)AppSettingsUtil.AppSettingsLong("serverGuild", true, 330944238910963714);
            var   guild       = client.GetGuild(serverGuild);

            if (null == guild)
            {
                return;
            }

            var user = guild.GetUser(context.User.Id);

            if (user.Nickname.Contains("🔹"))
            {
                await user.ModifyAsync(
                    x => {
                    string newNick = user.Nickname.Replace("🔹", string.Empty);
                    x.Nickname     = newNick;
                }
                    );
            }
        }
示例#4
0
        private async Task StartInternal()
        {
            // when the bot starts, start hourly timer to refresh sitemap
            if (null == siteMapRefreshTimer)
            {
                siteMapRefreshTimer          = new System.Timers.Timer(60 * 60 * 1000);
                siteMapRefreshTimer.Elapsed += SiteMapRefreshTimer_Elapsed;
            }
            siteMapRefreshTimer.Enabled = true;

            // create client and command objects
            _client   = new DiscordSocketClient();
            _commands = new CommandService();
            _services = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton(_commands)
                        .BuildServiceProvider();

            // register commands
            await RegisterCommandsAsync();

            string token = AppSettingsUtil.AppSettingsString(TOKEN, true, string.Empty);
            await _client.LoginAsync(TokenType.Bot, token);

            await _client.StartAsync();

            // wait forever and process commands!
            await Task.Delay(Timeout.Infinite);
        }
示例#5
0
 static RedisHelper()
 {
     redisCacheConnectionString  = AppSettingsUtil.GetAppSettingEntry("izenda.cache.rediscache.connectionstring");
     redisCacheAdditionalOptions = AppSettingsUtil.GetAppSettingEntry("izenda.cache.rediscache.additionaloptions");
     connection = GetConnection();
     database   = connection.GetDatabase();
 }
示例#6
0
        /// <summary>
        /// To upload object to AWS S3 Bucket
        /// </summary>
        /// <param name="transactionType"></param>
        /// <param name="currentClientId"></param>
        /// <param name="imageName"></param>
        /// <param name="imagePath"></param>
        /// <param name="keyName"></param>
        /// <returns></returns>
        public int UploadImagesToS3(string transactionType, int currentClientId, string imageName, string imagePath, string keyName)
        {
            try
            {
                using (var client = new AmazonS3Client(awsAccessKeyId, awsSecretAccessKey, Amazon.RegionEndpoint.EUWest2))
                //  using (var client = new AmazonS3Client(Amazon.RegionEndpoint.EUWest2))
                {
                    string objectKey = AppSettingsUtil.GetPathForKeyNameBucket(transactionType, currentClientId);
                    objectKey = objectKey + "/" + keyName;

                    //Creates PutObjectRequest of AmazonS3
                    var putObjectRequest = new PutObjectRequest
                    {
                        BucketName = bucketName,
                        Key        = objectKey,
                        FilePath   = imagePath,
                    };

                    //Adds an object to a bucket
                    client.PutObject(putObjectRequest);
                    File.Delete(imagePath);
                    return(currentClientId);
                }
            }
            catch (Exception ex)
            {
                Program.ErrorLogging(ex);
                return(0);
            }
        }
示例#7
0
        private async Task WelcomeCommand()
        {
            StringBuilder sb = new StringBuilder();

            string serverName          = AppSettingsUtil.AppSettingsString("discordServerName", true, string.Empty);
            string welcomerulesChannel = AppSettingsUtil.AppSettingsString("welcomerulesChannel", false, string.Empty);

            sb.Append(string.Format(Constants.WELCOME_MESSAGE, serverName));

            if (string.Empty != welcomerulesChannel)
            {
                sb.Append(string.Format(Constants.WELCOME_RULES_MESSAGE, "<#" + welcomerulesChannel + ">"));
            }
            // sb.Append(Constants.CODE_SHARING_MESSAGE);

            // mentioned users
            string mentionedUsers = base.MentionedUsers();
            var    embed          = new EmbedBuilder();

            embed.WithTitle(Constants.EMOJI_NAMASTE);
            embed.WithColor(Color.DarkRed);
            embed.AddInlineField(Constants.WELCOME_TITLE,
                                 mentionedUsers + sb.ToString());
            await ReplyAsync(string.Empty, false, embed);
        }
示例#8
0
        private async Task WelcomeCommand()
        {
            StringBuilder sb = new StringBuilder();

            string serverName          = AppSettingsUtil.AppSettingsString("discordServerName", true, string.Empty);
            string welcomerulesChannel = AppSettingsUtil.AppSettingsString("welcomerulesChannel", false, string.Empty);

            sb.Append(string.Format("Welcome to {0} Discord Channel! ", serverName));

            if (string.Empty != welcomerulesChannel)
            {
                sb.Append(string.Format("Please read {0} \n", welcomerulesChannel));
            }
            sb.Append("For sharing code, please use <https://www.hastebin.com>\n");
            sb.Append("If it is less than 10 lines of code, **make sure** it is formatted using below format:\n\\`\\`\\`yaml\ncode\n\\`\\`\\`\n");

            // mentioned users
            string mentionedUsers = base.MentionUsers();
            var    embed          = new EmbedBuilder();

            embed.WithTitle("Welcome! :pray: ");
            embed.WithColor(Color.DarkRed);
            embed.AddInlineField("Welcome:", mentionedUsers + sb.ToString());
            await ReplyAsync("", false, embed);
        }
        private void SetCustomWindowSizeFromAppSettings()
        {
            IsSettingWindowSize = true;

            string customSize = AppSettingsUtil.GetAppSetting(SettingKey.CustomWindowSize);

            if (String.IsNullOrEmpty(customSize))
            {
                IsSettingWindowSize = false;
                return;
            }

            string[] dimensions = customSize.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);


            bool didParseWidth  = double.TryParse(dimensions[0], out double newWidth);
            bool didParseHeight = double.TryParse(dimensions[1], out double newHeight);

            if (didParseWidth && didParseHeight)
            {
                this.Width  = newWidth;
                this.Height = newHeight;
            }

            IsSettingWindowSize = false;
        }
示例#10
0
        public AssetStoreViewModel()
        {
            IsInstallingAsset = false;
            DisplayMaps       = true;
            SetSelectedCategoriesFromAppSettings();
            FetchAllPreviewImages = AppSettingsUtil.GetAppSetting(SettingKey.FetchAllPreviewImages).Equals("true", StringComparison.OrdinalIgnoreCase);

            if (AppSettingsUtil.GetAppSetting(SettingKey.DeleteDownloadAfterAssetInstall) == "")
            {
                DeleteDownloadAfterInstall = true; // default to true if does not exist in app config
            }
            else
            {
                DeleteDownloadAfterInstall = AppSettingsUtil.GetAppSetting(SettingKey.DeleteDownloadAfterAssetInstall).Equals("true", StringComparison.OrdinalIgnoreCase);
            }

            InstallStatusList = new List <string>()
            {
                defaultInstallStatusValue, "Installed", "Not Installed"
            };
            SelectedInstallStatus = defaultInstallStatusValue;

            AuthorList = new List <AuthorDropdownViewModel>()
            {
                new AuthorDropdownViewModel(defaultAuthorValue, 0)
            };
            AuthorToFilterBy = AuthorList[0];

            _catalogCache = GetCurrentCatalog();
            ReloadAllAssets();
            CheckForCatalogUpdatesAsync(clearCache: false);
        }
示例#11
0
        private void OnLogicallyConnected(object sender, EventArgs e)
        {
            this.Dispatcher.Invoke(new Action(() =>
            {
                cb_targetIP.IsEnabled   = false;
                bt_connect.IsEnabled    = false;
                bt_disconnect.IsEnabled = true;

                string remoteAddr = cb_targetIP.Text;
                UsLogging.Printf(LogWndOpt.Bold, "connected to [u]{0}[/u].", remoteAddr);

                if (AppSettingsUtil.AppendAsRecentlyConnected(remoteAddr))
                {
                    cb_targetIP.Items.Add(remoteAddr);
                    UsLogging.Printf("{0} is appended into the recent connection list.", remoteAddr);
                }

                // query switches and sliders
                {
                    UsCmd cmd = new UsCmd();
                    cmd.WriteNetCmd(eNetCmd.CL_QuerySwitches);
                    NetManager.Instance.Send(cmd);
                }
                {
                    UsCmd cmd = new UsCmd();
                    cmd.WriteNetCmd(eNetCmd.CL_QuerySliders);
                    NetManager.Instance.Send(cmd);
                }
            }));
        }
示例#12
0
        /// <summary>
        /// Deduces the rollbar configuration.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns></returns>
        public static IRollbarConfig DeduceRollbarConfig(IConfiguration configuration)
        {
            if (RollbarLocator.RollbarInstance.Config.AccessToken != null)
            {
                return(RollbarLocator.RollbarInstance.Config);
            }

            // Here we assume that the Rollbar singleton was not explicitly preconfigured
            // anywhere in the code (Program.cs or Startup.cs),
            // so we are trying to configure it from IConfiguration:

            Assumption.AssertNotNull(configuration, nameof(configuration));

            const string  defaultAccessToken = "none";
            RollbarConfig rollbarConfig      = new RollbarConfig(defaultAccessToken);

            AppSettingsUtil.LoadAppSettings(ref rollbarConfig, configuration);

            if (rollbarConfig.AccessToken == defaultAccessToken)
            {
                const string error = "Rollbar.NET notifier is not configured properly. A valid access token needs to be specified.";
                throw new Exception(error);
            }

            RollbarLocator.RollbarInstance
            .Configure(rollbarConfig);

            return(rollbarConfig);
        }
        public void LoadRollbarTelemetryAppSettingsTest()
        {
            TelemetryConfig config = new TelemetryConfig(false, 5, TelemetryType.None, TimeSpan.FromMilliseconds(100));

            Console.WriteLine(JsonConvert.SerializeObject(config));

            Assert.AreEqual(false, config.TelemetryEnabled);
            Assert.AreEqual(5, config.TelemetryQueueDepth);
            Assert.AreEqual(TelemetryType.None, config.TelemetryAutoCollectionTypes);
            Assert.AreEqual(TimeSpan.FromMilliseconds(100), config.TelemetryAutoCollectionInterval);

            AppSettingsUtil.LoadAppSettings(ref config, Path.Combine(Environment.CurrentDirectory, "TestData"), "appsettings.json");
            Console.WriteLine(JsonConvert.SerializeObject(config));

            // The test data looks like this:
            //===============================
            //"RollbarTelemetry": {
            //    "TelemetryEnabled": true,
            //    "TelemetryQueueDepth": 100,
            //    "TelemetryAutoCollectionTypes": "Network, Log, Error",
            //    "TelemetryAutoCollectionInterval":  "00:00:00.3000000",
            //},

            Assert.AreEqual(true, config.TelemetryEnabled);
            Assert.AreEqual(100, config.TelemetryQueueDepth);
            Assert.AreEqual(TelemetryType.Network | TelemetryType.Log | TelemetryType.Error, config.TelemetryAutoCollectionTypes);
            Assert.AreEqual(TimeSpan.FromMilliseconds(300), config.TelemetryAutoCollectionInterval);
        }
示例#14
0
        /// <summary>
        /// 配置文件初始化
        /// </summary>
        /// <param name="fileDir">文件目录</param>
        /// <param name="fileName">文件名称</param>
        public static void Configure(string fileDir, string fileName)
        {
            var configPath = Path.Combine(fileDir, fileName);

            if (!File.Exists(configPath))
            {
                string errMsg = $"配置文件:{configPath}不存在!!!";
                throw new FileNotFoundException(errMsg);
            }

            //加载配置文件
            Config = AppSettingsUtil.GetValue <RabbitmqOptions>(fileDir, fileName);
            if (Config == null)
            {
                string errMsg = $"配置文件:{configPath}初始化异常!!!";
                throw new TypeInitializationException("RabbitmqConfig", null);
            }

            //创建链接工厂
            var connectionStrings = Config.ConnectionString;

            ConnectionFactory = new ConnectionFactory()
            {
                Port = connectionStrings.Port,
                AutomaticRecoveryEnabled = true,
                HostName           = connectionStrings.Host,
                Password           = connectionStrings.Password,
                UserName           = connectionStrings.UserName,
                RequestedHeartbeat = connectionStrings.TimeOut
            };
            //创建链接
            Connection = ConnectionFactory.CreateConnection();
        }
示例#15
0
 public void Param(AppSettings appSettings)
 {
     AppSettingsUtil.Modified(nameof(appSettings.CacheStorage), appSettings.CacheStorage);
     AppSettingsUtil.Modified(nameof(appSettings.RedisReaderPath), appSettings.RedisReaderPath);
     AppSettingsUtil.Modified(nameof(appSettings.RedisWriterPath), appSettings.RedisWriterPath);
     AppSettingsUtil.Modified(nameof(appSettings.IsAuthentication), appSettings.IsAuthentication.ToString());
 }
示例#16
0
        public static void ReloadData()
        {
            string siteMap = AppSettingsUtil.AppSettingsString("sitemapPath", true, string.Empty);

            Helper.DownloadSiteMap();
            doc.Load(siteMap);
        }
示例#17
0
        /// <summary>
        /// To upload object to AWS S3 Bucket
        /// </summary>
        /// <param name="transactionType"></param>
        /// <param name="currentClientId"></param>
        /// <param name="imageName"></param>
        /// <param name="imagePath"></param>
        /// <param name="keyName"></param>
        /// <returns></returns>
        public int UploadImagesToS3ByTransferUtil(string transactionType, int currentClientId, string imageName, string imagePath, string keyName, Stream file)
        {
            try
            {
                using (var client = new AmazonS3Client(awsAccessKeyId, awsSecretAccessKey, Amazon.RegionEndpoint.EUWest2))
                //  using (var client = new AmazonS3Client(Amazon.RegionEndpoint.EUWest2))
                {
                    string objectKey = AppSettingsUtil.GetPathForKeyNameBucket(transactionType, currentClientId);
                    objectKey = objectKey + "/" + keyName;

                    using (var transferUtility = new TransferUtility(client))
                    {
                        //Creates PutObjectRequest of AmazonS3
                        var transferUtilityUploadRequest = new TransferUtilityUploadRequest
                        {
                            BucketName  = bucketName,
                            Key         = objectKey,
                            InputStream = file
                        };

                        //Adds an object to a bucket
                        transferUtility.Upload(transferUtilityUploadRequest);
                        MakeImagePublicReadOnly(objectKey);
                        File.Delete(imagePath);

                        return(currentClientId);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.ErrorLogging(ex);
                return(0);
            }
        }
示例#18
0
        public static void ReloadData()
        {
            string sitemapUrl  = AppSettingsUtil.AppSettingsString("sitemapUrl", true, string.Empty);
            string siteMapPath = AppSettingsUtil.AppSettingsString("sitemapPath", true, string.Empty);

            Helper.DownloadFile(sitemapUrl, siteMapPath);
            doc.Load(siteMapPath);
        }
示例#19
0
        /// <summary>
        /// Deduces the rollbar telemetry configuration.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns></returns>
        public static ITelemetryConfig DeduceRollbarTelemetryConfig(IConfiguration configuration)
        {
            TelemetryConfig config = new TelemetryConfig();

            AppSettingsUtil.LoadAppSettings(ref config, configuration);

            TelemetryCollector.Instance.Config.Reconfigure(config);

            return(config);
        }
示例#20
0
        public ProjectWatcherViewModel()
        {
            _importViewModel = new ComputerImportViewModel()
            {
                IsZipFileImport = false
            };
            PathToProject = AppSettingsUtil.GetAppSetting(SettingKey.ProjectWatcherPath);

            UnwatchProject();
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string sessionPath = AppSettingsUtil.GetAppSetting(SettingKey.PathToSession);

            if (string.IsNullOrEmpty(sessionPath))
            {
                sessionPath = SessionPath.GetPathFromRegistry();
            }

            SessionPath.ToSession = sessionPath;
        }
示例#22
0
        private static async Task HandleLineCount(SocketUserMessage message, SocketCommandContext context)
        {
            if (!Utils.LineCountCheck(message.Content))
            {
                var    poopEmoji   = new Emoji(POOP);
                string msxLimitMsg = AppSettingsUtil.AppSettingsString("maxLineLimitMessage", false, MAX_LINE_LIMIT);
                await message.Channel.SendMessageAsync(string.Format(msxLimitMsg, context.User.Mention));

                await context.Message.AddReactionAsync(poopEmoji);
            }
        }
        private void mainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (IsSettingWindowSize || IsLoaded == false)
            {
                return;
            }

            string newSize = $"{this.ActualWidth},{this.ActualHeight}";

            AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.CustomWindowSize, newSize);
        }
示例#24
0
 public UploadAssetViewModel()
 {
     IsUploadingAsset      = false;
     HasAuthenticated      = false;
     SelectedCategory      = "";
     StatusMessage         = DefaultStatusMesssage;
     PathToCredentialsFile = AppSettingsUtil.GetAppSetting(SettingKey.PathToCredentialsFile);
     Author             = AppSettingsUtil.GetAppSetting(SettingKey.UploaderAuthor);
     SelectedBucketName = AppSettingsUtil.GetAppSetting(SettingKey.AssetStoreSelectedBucket);
     InitAvailableCategories();
 }
示例#25
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(config =>
            {
                config.LoginPath         = "/Accounts/Login";
                config.AccessDeniedPath  = "/Accounts/AccessDenied";
                config.ExpireTimeSpan    = TimeSpan.FromMinutes(30);
                config.SlidingExpiration = true;
            });

            //services.AddSession();
            services.AddSession(config =>
            {
                config.IdleTimeout = TimeSpan.FromMinutes(30); // default: 20 dakika
            });

            #region IoC Container
            // IoC Container kütüphaneleri: Autofac ve Ninject
            // services.AddScoped() // istek (request) boyunca objenin referansýný (genelde interface veya abstract class) kullandýðýmýz yerde obje (somut class'tan oluþturulacak) bir kere oluþturulur ve yanýt (response) dönene kadar bu obje hayatta kalýr.
            // services.AddSingleton() // web uygulamasý baþladýðýnda objenin referansýný (genelde interface veya abstract class) kullandýðýmýz yerde obje (somut class'tan oluþuturulacak) bir kere oluþturulur ve uygulama çalýþtýðý (IIS üzerinden uygulama durdurulmadýðý veya yeniden baþlatýlmadýðý) sürece bu obje hayatta kalýr.
            // services.AddTransient() // istek (request) baðýmsýz ihtiyaç olan objenin referansýný (genelde interface veya abstract class) kullandýðýmýz her yerde bu objeyi new'ler.

            ConnectionConfig.ConnectionString = Configuration.GetConnectionString("ETradeContext");

            // Unable to resolve service hatalarý burada giderilir!
            services.AddScoped <DbContext, ETradeContext>();
            services.AddScoped <ProductRepositoryBase, ProductRepository>();
            services.AddScoped <CategoryRepositoryBase, CategoryRepository>();
            services.AddScoped <UserRepositoryBase, UserRepository>();
            services.AddScoped <CountryRepositoryBase, CountryRepository>();
            services.AddScoped <CityRepositoryBase, CityRepository>();
            services.AddScoped <RoleRepositoryBase, RoleRepository>();
            services.AddScoped <IProductService, ProductService>();
            services.AddScoped <ICategoryService, CategoryService>();
            services.AddScoped <IUserService, UserService>();
            services.AddScoped <ICountryService, CountryService>();
            services.AddScoped <ICityService, CityService>();
            services.AddScoped <IRoleService, RoleService>();
            services.AddScoped <IAccountService, AccountService>();

            // ASP.NET Core kullanýmý:
            //IConfigurationSection section = Configuration.GetSection("AppSettings");
            //AppSettings appSettings = new AppSettings();
            //section.Bind(appSettings);

            // AppCore üzerinden kullaným:
            AppSettingsUtilBase appSettingsUtil = new AppSettingsUtil(Configuration);
            appSettingsUtil.Bind <AppSettings>();
            #endregion
        }
示例#26
0
        public override void WillEnterForeground(UIApplication application)
        {
            base.WillEnterForeground(application);

            if (!AnalyticsService.IsOptOut)
            {
                EasyTracker.Current.OnApplicationActivated(application);
            }

            Mvx.Resolve <ILocationService>().RefreshLocation();

            AppSettingsUtil.HandleResetCache(_settings);
        }
示例#27
0
        static Sitemap()
        {
            string siteMap = AppSettingsUtil.AppSettingsString("sitemapPath", true, string.Empty);

            if (System.IO.File.Exists(siteMap))
            {
                doc.Load(siteMap);
            }
            else
            {
                ReloadData();
            }
        }
示例#28
0
文件: Helper.cs 项目: CCOSTAN/HassBot
 public static void DownloadSiteMap()
 {
     using (var client = new WebClient()) {
         string sitemapUrl  = AppSettingsUtil.AppSettingsString("sitemapUrl", true, string.Empty);
         string sitemapPath = AppSettingsUtil.AppSettingsString("sitemapPath", true, string.Empty);
         try {
             client.DownloadFile(sitemapUrl, sitemapPath);
             logger.Info(SITEMAP_UPDATED);
         }
         catch (Exception e) {
             logger.Error(ERR_DOWNLOADING, e);
         }
     }
 }
示例#29
0
 private void UpdateAppSettingsWithSelectedCategories()
 {
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreDecksChecked, DisplayDecks.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreGriptapesChecked, DisplayGriptapes.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreHatsChecked, DisplayHats.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreMapsChecked, DisplayMaps.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStorePantsChecked, DisplayPants.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreShirtsChecked, DisplayShirts.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreShoesChecked, DisplayShoes.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreTrucksChecked, DisplayTrucks.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreWheelsChecked, DisplayWheels.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreMeshesChecked, DisplayMeshes.ToString());
     AppSettingsUtil.AddOrUpdateAppSettings(SettingKey.AssetStoreCharactersChecked, DisplayCharacters.ToString());
 }
示例#30
0
        public static List <BlockedDomainDTO> LoadBlockedDomains()
        {
            string remoteurl = AppSettingsUtil.AppSettingsString("BlockedDomainsUrl", true, string.Empty);
            string localPath = AppSettingsUtil.AppSettingsString("BlockedDomainsLocalPath", true, string.Empty);

            Helper.DownloadFile(remoteurl, localPath);

            if (!File.Exists(localPath))
            {
                return(null);
            }
            string json = File.ReadAllText(localPath);

            return(JsonConvert.DeserializeObject <List <BlockedDomainDTO> >(json));
        }