Beispiel #1
0
        internal static LocalConfiguration InternalConvert(CarbonConfiguration carbonConfiguration)
        {
            LocalConfiguration addInConfiguration = new LocalConfiguration
            {
                AutoAdjustWidth = carbonConfiguration.WidthAdjustment,
                WindowControls  = carbonConfiguration.WindowControls,
                WindowTheme     = EnumExt.GetValueFromDescription <WindowTheme>(carbonConfiguration.WindowTheme),
                Theme           = EnumExt.GetValueFromDescription <Theme>(carbonConfiguration.Theme)
            };

            string[] splitString = carbonConfiguration.BackgroundColor.Replace("rgba(", string.Empty).Replace(")", string.Empty).Split(',');
            addInConfiguration.BackgroundColor = Color.FromArgb(int.Parse(splitString[3]), int.Parse(splitString[0]), int.Parse(splitString[1]), int.Parse(splitString[2]));

            addInConfiguration.DropShadow           = carbonConfiguration.DropShadow;
            addInConfiguration.DropShadowBlurRadius = int.Parse(carbonConfiguration.DropShadowOffsetY.Replace("px", string.Empty));
            addInConfiguration.DropShadowOffsetY    = int.Parse(carbonConfiguration.DropShadowBlurRadius.Replace("px", string.Empty));

            addInConfiguration.FontFamily    = EnumExt.GetValueFromDescription <CarbonTypes.FontFamily>(carbonConfiguration.FontFamily);
            addInConfiguration.FontSize      = int.Parse(carbonConfiguration.FontSize.Replace("px", string.Empty));
            addInConfiguration.LineNumbers   = carbonConfiguration.LineNumbers;
            addInConfiguration.LineHeight    = int.Parse(carbonConfiguration.LineHeight.Replace("%", string.Empty));
            addInConfiguration.ExportSize    = EnumExt.GetValueFromDescription <ExportSize>(carbonConfiguration.ExportSize);
            addInConfiguration.ShowWaterMark = carbonConfiguration.Watermark;

            addInConfiguration.PaddingHorizontal = int.Parse(carbonConfiguration.PaddingHorizontal.Replace("px", string.Empty));
            addInConfiguration.PaddingVertical   = int.Parse(carbonConfiguration.PaddingVertical.Replace("px", string.Empty));

            return(addInConfiguration);
        }
        internal static CarbonConfiguration InternalConvert(LocalConfiguration addInConfiguration, string name = "", int firstLineNumber = 1)
        {
            CarbonConfiguration carbonConfiguration = new CarbonConfiguration
            {
                WidthAdjustment = addInConfiguration.AutoAdjustWidth,
                WindowControls  = addInConfiguration.WindowControls,
                WindowTheme     = addInConfiguration.WindowTheme.GetId(),
                Theme           = addInConfiguration.Theme.GetId(),

                BackgroundColor          = $"rgba({addInConfiguration.BackgroundColor.R}, {addInConfiguration.BackgroundColor.G}, {addInConfiguration.BackgroundColor.B}, {addInConfiguration.BackgroundColor.A})",
                BackgroundMode           = "color",
                BackgroundImage          = null,
                BackgroundImageSelection = null,

                DropShadow           = addInConfiguration.DropShadow,
                DropShadowOffsetY    = $"{addInConfiguration.DropShadowOffsetY}px",
                DropShadowBlurRadius = $"{addInConfiguration.DropShadowBlurRadius}px",

                FontFamily = addInConfiguration.FontFamily.GetId(),
                FontSize   = $"{addInConfiguration.FontSize}px",

                LineNumbers     = addInConfiguration.LineNumbers,
                LineHeight      = $"{addInConfiguration.LineHeight}%",
                FirstLineNumber = firstLineNumber,

                ExportSize = addInConfiguration.ExportSize.GetId(),
                Watermark  = addInConfiguration.ShowWaterMark,

                PaddingHorizontal = $"{addInConfiguration.PaddingHorizontal}px",
                PaddingVertical   = $"{addInConfiguration.PaddingVertical}px",

                //Misc defaults;
                SquaredImage     = false,
                HiddenCharacters = false,
                Loading          = false,
                IsVisible        = true,
                Icon             = "/static/presets/6.png"
            };

            return(carbonConfiguration);
        }