Esempio n. 1
0
        public Size GetDefaultMapSize(string blogId)
        {
            IProperties blogProps     = GetBlogSettings(blogId);
            int         defaultWidth  = blogProps.GetInt(DEFAULT_MAP_WIDTH, DefaultMapSize.Width);
            int         defaultHeight = blogProps.GetInt(DEFAULT_MAP_HEIGHT, DefaultMapSize.Height);

            return(MapSettings.EnsurePositiveSize(new Size(defaultWidth, defaultHeight), DefaultMapSize));
        }
Esempio n. 2
0
 public static MarginStyle GetImageMargin(IProperties props)
 {
     if (props.GetBoolean(CUSTOM_MARGIN, false))
     {
         int top    = props.GetInt(MARGIN_TOP, WriterDefaultMargin.Top);
         int right  = props.GetInt(MARGIN_RIGHT, WriterDefaultMargin.Right);
         int bottom = props.GetInt(MARGIN_BOTTOM, WriterDefaultMargin.Bottom);
         int left   = props.GetInt(MARGIN_LEFT, WriterDefaultMargin.Left);
         return(new MarginStyle(top, right, bottom, left, StyleSizeUnit.PX));
     }
     else
     {
         return(WriterDefaultMargin);
     }
 }
Esempio n. 3
0
        public static Size GetDefaultImageSize(IProperties settings)
        {
            ImageSizeName boundsSize = GetDefaultBoundsSizeName(settings);
            Size          defaultBoundsSize;

            if (boundsSize != ImageSizeName.Custom)
            {
                defaultBoundsSize = ImageSizeHelper.GetSizeConstraints(boundsSize);
            }
            else
            {
                int defaultWidth  = settings.GetInt(DEFAULT_WIDTH, 240);
                int defaultHeight = settings.GetInt(DEFAULT_HEIGHT, 240);
                defaultBoundsSize = new Size(defaultWidth, defaultHeight);
            }
            return(defaultBoundsSize);
        }
        public ImageBorderMargin(IProperties properties)
        {
            _width  = properties.GetInt(WIDTH, 0);
            _height = properties.GetInt(HEIGHT, 0);
            int calcCount = properties.GetInt(COUNT, 0);

            _calculations = new List <BorderCalculation>(calcCount);
            for (int i = 0; i < calcCount; i++)
            {
                string prefix = CALC + i.ToString(CultureInfo.InvariantCulture);
                _calculations.Add(new BorderCalculation(
                                      properties.GetInt(prefix + WIDTH_ADD, 0),
                                      properties.GetInt(prefix + HEIGHT_ADD, 0),
                                      properties.GetFloat(prefix + WIDTH_FACTOR, 1f),
                                      properties.GetFloat(prefix + HEIGHT_FACTOR, 1f)));
            }
        }
Esempio n. 5
0
        public static Options ToOptions(this IProperties source)
        {
            var options = new Options();

            if (source == null)
            {
                return(options);
            }
            options.InLineStyles    = source.GetBoolean(nameof(Options.InLineStyles), defaultOptions.InLineStyles);
            options.MaxHeight       = source.GetInt(nameof(Options.MaxHeight), defaultOptions.MaxHeight);
            options.BackgroundColor = source.GetString(nameof(Options.BackgroundColor), defaultOptions.BackgroundColor);
            options.FontSize        = source.GetInt(nameof(Options.FontSize), defaultOptions.FontSize);
            options.FontFamiles     = (source.GetString(nameof(Options.FontFamiles), string.Join(", ", defaultOptions.FontFamiles)) ?? "")
                                      .Split(',').Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
            options.TabSpaces = source.GetInt(nameof(Options.TabSpaces), defaultOptions.TabSpaces);
            return(options);
        }
 public static Size GetDefaultImageSize(IProperties settings)
 {
     ImageSizeName boundsSize = GetDefaultBoundsSizeName(settings);
     Size defaultBoundsSize;
     if (boundsSize != ImageSizeName.Custom)
         defaultBoundsSize = ImageSizeHelper.GetSizeConstraints(boundsSize);
     else
     {
         int defaultWidth = settings.GetInt(DEFAULT_WIDTH, 240);
         int defaultHeight = settings.GetInt(DEFAULT_HEIGHT, 240);
         defaultBoundsSize = new Size(defaultWidth, defaultHeight);
     }
     return defaultBoundsSize;
 }
 public ImageBorderMargin(IProperties properties)
 {
     _width = properties.GetInt(WIDTH, 0);
     _height = properties.GetInt(HEIGHT, 0);
     int calcCount = properties.GetInt(COUNT, 0);
     _calculations = new List<BorderCalculation>(calcCount);
     for (int i = 0; i < calcCount; i++)
     {
         string prefix = CALC + i.ToString(CultureInfo.InvariantCulture);
         _calculations.Add(new BorderCalculation(
             properties.GetInt(prefix + WIDTH_ADD, 0),
             properties.GetInt(prefix + HEIGHT_ADD, 0),
             properties.GetFloat(prefix + WIDTH_FACTOR, 1f),
             properties.GetFloat(prefix + HEIGHT_FACTOR, 1f)));
     }
 }
 public static MarginStyle GetImageMargin(IProperties props)
 {
     if (props.GetBoolean(CUSTOM_MARGIN, false))
     {
         int top = props.GetInt(MARGIN_TOP, WriterDefaultMargin.Top);
         int right = props.GetInt(MARGIN_RIGHT, WriterDefaultMargin.Right);
         int bottom = props.GetInt(MARGIN_BOTTOM, WriterDefaultMargin.Bottom);
         int left = props.GetInt(MARGIN_LEFT, WriterDefaultMargin.Left);
         return new MarginStyle(top, right, bottom, left, StyleSizeUnit.PX);
     }
     else
     {
         return WriterDefaultMargin;
     }
 }
Esempio n. 9
0
 public int GetInt(string name, int defaultValue)
 {
     return(CurrProperties.GetInt(name, defaultValue));
 }