Ejemplo n.º 1
0
 public ImagePipeline Raw(RawOptions options)
 {
     Guard.NotNull(options, nameof(options));
     baton.RawOptions        = options;
     baton.OutputInfo.Format = "raw";
     return(this);
 }
 public void EndEdit()
 {
     _backupName    = null;
     _rawBackup     = null;
     _optionsBackup = null;
     Name           = Name.Trim();
     Name           = File.InvalidCharacters.ToList().Aggregate(Name, (x, y) => x.Replace(y.ToString(), ""));
 }
 public void BeginEdit()
 {
     _backupName = Name;
     if (_file.RawOptions != null)
     {
         _rawBackup = BatchImageProcessor.Model.Utility.ObjectCopier.Clone(_file.RawOptions);
     }
     if (_file.Options != null)
     {
         _optionsBackup = BatchImageProcessor.Model.Utility.ObjectCopier.Clone(_file.Options);
     }
 }
Ejemplo n.º 4
0
        // Interface methods
        public async Task <RawOptions> GenerateOptions(string category, int userId)
        {
            // TODO: [TESTS] (OptionsService.GetRawOptionsForCategory) Add tests
            var builder = new ServiceMetricBuilder(nameof(OptionsService), nameof(GenerateOptions))
                          .WithCategory(MetricCategory.Option, MetricSubCategory.Generate)
                          .WithCustomInt1(userId)
                          .WithCustomTag1(category);

            var generated = new RawOptions(category);

            try
            {
                using (builder.WithTiming())
                {
                    List <OptionEntity> dbOptions;
                    using (builder.WithCustomTiming1())
                    {
                        builder.IncrementQueryCount();
                        dbOptions = await _optionRepo.GetRawOptionsForCategory(category, userId);

                        builder.WithResultsCount(dbOptions.Count);
                    }

                    foreach (var dbOption in dbOptions)
                    {
                        generated.AddOption(dbOption);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogUnexpectedException(ex);
                builder.WithException(ex);
            }
            finally
            {
                await _metrics.SubmitPointAsync(builder.Build());
            }

            return(generated);
        }
Ejemplo n.º 5
0
 public ImagePipeline Raw(RawOptions options)
 {
     Guard.NotNull(options, nameof(options));
     result.RawOptions = options;
     return(this);
 }