示例#1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    string            token    = refreshToken();
                    var               urlArral = ConfigExtensions.GetListAppSettings <string>("url");
                    HttpRequestClient http     = new HttpRequestClient();
                    http.ContentType = "application/json";
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("Authorization", "Bearer " + token);
                    http.dicion = dictionary;
                    foreach (var url in from url in urlArral let html = http.HttpGet(url) where html.StatusCode == HttpStatusCode.OK select url)
                    {
                        _logger.LogInformation("执行------>>>>>" + url + "-------<<<<成功");
                    }

                    //需要执行的任务
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex.Message);
                }

                await Task.Delay(Convert.ToInt32(ConfigExtensions.Configuration["Interval"]), stoppingToken);
            }
        }
示例#2
0
        public Task <DataResult <bool> > DeleteAsync(int accessaryUnitId)
        {
            return(Task.Run(() => {
                if (!accessaryRepository.ExistByCondition(x => x.UnitId == accessaryUnitId))
                {
                    accessaryUnitRepository.Delete(accessaryUnitId);
                    _unitOfWork.SaveChanges();

                    return new DataResult <bool> {
                        Errors = new List <ErrorDescriber>(), Target = true
                    };
                }
                else
                {
                    var dependentErrorMessage = ConfigExtensions <string> .GetValue("dependentErrorMessage");
                    dependentErrorMessage = dependentErrorMessage.Replace("%ItemType%", "đơn vị tính");

                    return new DataResult <bool>
                    {
                        Target = false,
                        Errors = new List <ErrorDescriber> {
                            new ErrorDescriber(dependentErrorMessage)
                        }
                    };
                }
            }));
        }
示例#3
0
 public override void leftClickHeld(int x, int y)
 {
     if (this.greyedOut)
     {
         return;
     }
     base.leftClickHeld(x, y);
     this.value = ((x >= this.bounds.X) ? ((x <= this.bounds.Right - 10 * Game1.pixelZoom) ? ((int)((double)((float)(x - this.bounds.X) / (float)(this.bounds.Width - 10 * Game1.pixelZoom)) * (double)this.sliderMaxValue)) : this.sliderMaxValue) : 0);
     if (this.whichOption == 0)
     {
         MapModMain.config.heartLevelMin = this.value;
     }
     else if (this.whichOption == 1)
     {
         MapModMain.config.heartLevelMax = this.value;
     }
     ConfigExtensions.WriteConfig <Configuration>(MapModMain.config);
 }
示例#4
0
 /// <summary>
 /// Initializes the logger.
 /// </summary>
 private static void InitLogger()
 {
     try
     {
         _disableLogging   = ConfigApplicationFactory.DisableLogging;
         _logBufferSize    = Math.Max(0, ConfigExtensions.GetAppSettingValueInt("LogBufferSize", BUFFER_SIZE));
         _idleTimeInteval  = Math.Max(60000, ConfigExtensions.GetAppSettingValueInt("LogIdleTimeInterval", 0));
         _noIdleTimer      = ConfigExtensions.GetAppSettingValueBool("LogNoIdleTimer", false);
         _immediateLogging = ConfigExtensions.GetAppSettingValueBool("ImmediateLogging", true);
         if (!_immediateLogging && _logBufferSize <= 0)
         {
             _logBufferSize = BUFFER_SIZE;
         }
     }
     catch (Exception ex)
     {
         EventLogExceptionAdapter.WriteException(ex);
     }
 }
示例#5
0
        static void Main(string[] args)
        {
            var externalConfigPath = @"ConfigTest\Some.External.config";
            var config             = ConfigExtensions.ParseConfig <SomeModuleConfig>(externalConfigPath);

            if (config.IsFailure)
            {
                config = ConfigExtensions.GetMissingValues <SomeModuleConfig>(externalConfigPath)
                         .OnSuccess(missingValues => ConfigExtensions.AddMissingValues(externalConfigPath, missingValues, (name, type) => RerieveMissingValue(new KeyValuePair <string, Type>(name, type)).Value)
                                    .OnSuccess(() => ConfigExtensions.ParseConfig <SomeModuleConfig>(externalConfigPath))
                                    );
            }
            if (config.IsFailure)
            {
                throw new Exception(config.Error);
            }


            //var des = nameValueCollectionNode.DeserializeAsXml<List<add>>(Encoding.UTF8);
        }
        public static string[] GetVirtualPaths(BundConfigType type, string folderName)
        {
            string[] filePaths = null;
            var      folder    = ConfigExtensions <string> .GetValue(folderName);

            if (type == BundConfigType.Css)
            {
                var cssDirectory = string.Concat(defaultCssFilePath, folder);
                var directory    = HostingEnvironment.MapPath(cssDirectory);
                filePaths = new DirectoryInfo(directory).EnumerateFiles("*.*", SearchOption.AllDirectories)
                            .Where(d => d.Name.EndsWith(".css") || d.Name.EndsWith(".map") || d.Name.EndsWith(".less"))
                            .Select(d => string.Concat(cssDirectory, d.Name)).ToArray();
            }
            else if (type == BundConfigType.Js)
            {
                var jsDirectory = string.Concat(defaultJsFilePath, folder);
                var directory   = HostingEnvironment.MapPath(jsDirectory);
                filePaths = new DirectoryInfo(directory).GetFiles("*.js", SearchOption.TopDirectoryOnly)
                            .Select(d => string.Concat(jsDirectory, d.Name)).ToArray();
            }
            return(filePaths);
        }
示例#7
0
 public override void receiveLeftClick(int x, int y)
 {
     if (!isActive)
     {
         if (whichOption < 4)
         {
             Game1.playSound("drumkit6");
             base.receiveLeftClick(x, y);
             this.isActive  = true;
             this.greyedOut = false;
             MapModMain.config.nameTooltipMode = whichOption;
         }
         else if (whichOption > 3)
         {
             Game1.playSound("drumkit6");
             base.receiveLeftClick(x, y);
             this.isActive  = true;
             this.greyedOut = false;
             MapModMain.config.immersionLevel = whichOption - 3;
         }
     }
     ConfigExtensions.WriteConfig <Configuration>(MapModMain.config);
 }
        public void CanReadFromAppConfigFileWithLinkedSettingsFile()
        {
            var conf = ConfigExtensions.ParseConfig <Conf>(configFullLinked);

            CheckCorrect(conf.Value);
        }
        public void CanReadFromAppConfigFile()
        {
            var conf = ConfigExtensions.ParseConfig <Conf>(configFull);

            CheckCorrect(conf.Value);
        }
        public void CanReadFromAppSettingsFile()
        {
            var conf = ConfigExtensions.ParseConfig <Conf>(configAppSettings);

            CheckCorrect(conf.Value);
        }
示例#11
0
 public RedisService(ConfigExtensions configExtensions,
                     RedisContext redisContext)
 {
     this.redisContext = redisContext;
 }
示例#12
0
        private static IHostBuilder CreateWebHostBuilder(string[] args)
        {
            return(Host.CreateDefaultBuilder(args)
                   .ConfigureHostConfiguration(config => config.AddAzureBlobJson(ConfigExtensions.GetJobTrackerConfig()))
                   .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup <Startup>())
                   .UseOrleans((context, siloBuilder) =>
            {
                var jobTrackerConfig =
                    context.Configuration.GetSection(nameof(JobTrackerConfig)).Get <JobTrackerConfig>();
                var siloConfig = jobTrackerConfig.SiloConfig;
                var tableStorageOption = new Action <AzureTableStorageOptions>(tableStorageOptions =>
                {
                    tableStorageOptions.ConnectionString = siloConfig.JobEntityPersistConfig.ConnStr;
                    if (string.IsNullOrEmpty(siloConfig.JobEntityPersistConfig.TableName))
                    {
                        return;
                    }
                    tableStorageOptions.TableName = siloConfig.JobEntityPersistConfig.TableName;
                    tableStorageOptions.UseJson = true;
                });

                var blobStorageOption = new Action <AzureBlobStorageOptions>(blobStorageOptions =>
                {
                    blobStorageOptions.ConnectionString = siloConfig.ReadOnlyJobIndexPersistConfig.ConnStr;
                    if (string.IsNullOrEmpty(siloConfig.ReadOnlyJobIndexPersistConfig.ContainerName))
                    {
                        return;
                    }
                    blobStorageOptions.ContainerName = siloConfig.ReadOnlyJobIndexPersistConfig.ContainerName;
                    blobStorageOptions.UseJson = true;
                });
                var reminderStorageOptions = new Action <AzureTableReminderStorageOptions>(storageOptions =>
                {
                    storageOptions.ConnectionString = siloConfig.ReminderPersistConfig.ConnStr;
                    storageOptions.TableName = siloConfig.ReminderPersistConfig.TableName;
                });

                siloBuilder
                .ConfigureApplicationParts(parts =>
                                           parts.AddApplicationPart(typeof(JobGrain).Assembly).WithReferences().WithCodeGeneration())
                .AddIncomingGrainCallFilter <BufferFilter>()
                .AddAzureTableGrainStorage(Constants.JobEntityStoreName, tableStorageOption)
                .AddAzureTableGrainStorage(Constants.CounterStoreName, tableStorageOption)
                .AddAzureTableGrainStorage(Constants.JobRefStoreName, tableStorageOption)
                .AddAzureTableGrainStorage(Constants.JobIdStoreName, tableStorageOption)
                .AddAzureTableGrainStorage(Constants.JobIdOffsetStoreName, tableStorageOption)
                .AddAzureBlobGrainStorage(Constants.ReadOnlyJobIndexStoreName, blobStorageOption)
                .AddAzureBlobGrainStorage(Constants.AttachmentStoreName, blobStorageOption)
                .AddAzureBlobGrainStorage(Constants.AppendStoreName, blobStorageOption)
                .UseAzureTableReminderService(reminderStorageOptions)
                .AddStartupTask(async(sp, token) =>
                {
                    var factory = sp.GetRequiredService <IGrainFactory>();
                    await factory.GetGrain <IMergeIndexReminder>(Constants.MergeIndexReminderDefaultGrainId)
                    .ActiveAsync();
                    await factory.GetGrain <IMergeIndexTimer>(Constants.MergeIndexTimerDefaultGrainId)
                    .KeepAliveAsync();
                })
                .Configure <GrainCollectionOptions>(grainCollectionOptions =>
                {
                    grainCollectionOptions.CollectionAge =
                        siloConfig.GrainCollectionAge ?? TimeSpan.FromMinutes(10);
                    grainCollectionOptions.ClassSpecificCollectionAge[
                        typeof(AggregateJobIndexGrain).FullName ?? throw new
                        InvalidOperationException()] = TimeSpan.FromMinutes(5);
                    grainCollectionOptions.ClassSpecificCollectionAge[
                        typeof(RollingJobIndexGrain).FullName ?? throw new
                        InvalidOperationException()] = TimeSpan.FromMinutes(5);
                });
示例#13
0
 public TestService(testContext testContext, ConfigExtensions configExtensions)
 {
     this.testContext      = testContext;
     this.configExtensions = configExtensions;
 }
示例#14
0
        public override void receiveLeftClick(int x, int y)
        {
            if (this.greyedOut)
            {
                return;
            }
            Game1.soundBank.PlayCue("drumkit6");
            base.receiveLeftClick(x, y);
            this.isChecked = !this.isChecked;
            int whichOption = this.whichOption;

            switch (whichOption)
            {
            case 7:
                MapModMain.config.showAbigail = this.isChecked;
                break;

            case 8:
                MapModMain.config.showAlex = this.isChecked;
                break;

            case 9:
                MapModMain.config.showCaroline = this.isChecked;
                break;

            case 10:
                MapModMain.config.showClint = this.isChecked;
                break;

            case 11:
                MapModMain.config.showDemetrius = this.isChecked;
                break;

            case 12:
                MapModMain.config.showElliott = this.isChecked;
                break;

            case 13:
                MapModMain.config.showEmily = this.isChecked;
                break;

            case 14:
                MapModMain.config.showEvelyn = this.isChecked;
                break;

            case 15:
                MapModMain.config.showGeorge = this.isChecked;
                break;

            case 16:
                MapModMain.config.showGus = this.isChecked;
                break;

            case 17:
                MapModMain.config.showHaley = this.isChecked;
                break;

            case 18:
                MapModMain.config.showHarvey = this.isChecked;
                break;

            case 19:
                MapModMain.config.showJas = this.isChecked;
                break;

            case 20:
                MapModMain.config.showJodi = this.isChecked;
                break;

            case 21:
                MapModMain.config.showKent = this.isChecked;
                break;

            case 22:
                MapModMain.config.showLeah = this.isChecked;
                break;

            case 23:
                MapModMain.config.showLewis = this.isChecked;
                break;

            case 24:
                MapModMain.config.showLinus = this.isChecked;
                break;

            case 25:
                MapModMain.config.showMarnie = this.isChecked;
                break;

            case 26:
                MapModMain.config.showMaru = this.isChecked;
                break;

            case 27:
                MapModMain.config.showPam = this.isChecked;
                break;

            case 28:
                MapModMain.config.showPenny = this.isChecked;
                break;

            case 29:
                MapModMain.config.showPierre = this.isChecked;
                break;

            case 30:
                MapModMain.config.showRobin = this.isChecked;
                break;

            case 31:
                MapModMain.config.showSam = this.isChecked;
                break;

            case 32:
                MapModMain.config.showSebastian = this.isChecked;
                break;

            case 33:
                MapModMain.config.showShane = this.isChecked;
                break;

            case 34:
                MapModMain.config.showVincent = this.isChecked;
                break;

            case 35:
                MapModMain.config.showWilly = this.isChecked;
                break;

            case 36:
                MapModMain.config.onlySameLocation = this.isChecked;
                break;

            case 37:
                MapModMain.config.showSandy = this.isChecked;
                break;

            case 38:
                MapModMain.config.showWizard = this.isChecked;
                break;

            case 39:
                MapModMain.config.showMarlon = this.isChecked;
                break;

            case 40:
                MapModMain.config.showTravelingMerchant = this.isChecked;
                break;

            case 41:
                MapModMain.config.byHeartLevel = this.isChecked;
                break;

            case 42:
                MapModMain.config.markQuests = this.isChecked;
                break;

            case 43:
                MapModMain.config.showCustomNPC1 = this.isChecked;
                break;

            case 44:
                MapModMain.config.showCustomNPC2 = this.isChecked;
                break;

            case 45:
                MapModMain.config.showCustomNPC3 = this.isChecked;
                break;

            case 46:
                MapModMain.config.showCustomNPC4 = this.isChecked;
                break;

            case 47:
                MapModMain.config.showCustomNPC5 = this.isChecked;
                break;

            default:
                break;
            }
            ConfigExtensions.WriteConfig <Configuration>(MapModMain.config);
        }