Esempio n. 1
0
 public GenDataTransfer(GenerateType type, int quantity, TitleOptions options, TextOutput output)
 {
     Type        = type;
     Quantity    = quantity;
     TitleOption = options;
     Output      = output;
 }
Esempio n. 2
0
        private void Title()
        {
            TitleOptions titleOptions = new TitleOptions();

            titleOptions.Text = "Title";

            Chameleon.SetTitle(titleOptions);
        }
        private void LstTitleOptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox      listBox   = (ListBox)sender;
            TitleOptions listValue = (TitleOptions)listBox.SelectedItem;

            Locator.Instance.TextGenerate.SelTitleOption = listValue;
            TitleOptions viewModelValue = Locator.Instance.TextGenerate.SelTitleOption;

            if (listValue != viewModelValue)
            {
                listBox.SelectedItem = viewModelValue;
            }
        }
Esempio n. 4
0
        // Public members

        public static string ToTitleCase(string input, TitleOptions options = TitleOptions.None)
        {
            if (string.IsNullOrEmpty(input))
            {
                return(string.Empty);
            }

            string output = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(input.ToLowerInvariant());

            // Fix possessive "'s" so it's not capitalized (since "ToTitleCase" capitalizes it).
            // E.g. Widow'S Peak -> Widow's Peak
            output = Regex.Replace(output, @"\b(['’])S\b", "$1s");

            if (options.HasFlag(TitleOptions.CapitalizeRomanNumerals))
            {
                // Fix Roman numerals so that they are completely capitalized (e.g. III, IV).
                // Regex adapted from: https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch06s09.html

                output = Regex.Replace(output, @"\b(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})\b", x => x.Value.ToUpper(), RegexOptions.IgnoreCase);
            }

            return(output);
        }
Esempio n. 5
0
        internal static void ApplyCustomizations(Arguments arguments, ref ImageOptions image, ref TitleOptions title)
        {
            Regex colorExtraction = new Regex(@"(\d+)");

            if (arguments.ImageWidth != image.InitialWidth)
            {
                image.InitialWidth = arguments.ImageWidth;
            }

            if (arguments.ImageHeight != image.InitialHeight)
            {
                image.InitialHeight = arguments.ImageHeight;
            }

            if (!string.IsNullOrEmpty(arguments.BackgroundColor))
            {
                byte[] colorVals = colorExtraction.Matches(arguments.BackgroundColor).Select(x =>
                                                                                             byte.Parse(x.Value)
                                                                                             ).ToArray();
                image.BackgroundColor = new Rgba32(colorVals[0], colorVals[1], colorVals[2], colorVals[3]);
            }

            if (arguments.HorizontalDistanceBetweenPoints != image.MinimumHorizontalClearance)
            {
                image.MinimumHorizontalClearance = arguments.HorizontalDistanceBetweenPoints;
            }

            if (arguments.VerticalDistanceToImageEdge != image.MinimumVerticalClearance)
            {
                image.MinimumVerticalClearance = arguments.VerticalDistanceToImageEdge;
            }

            if (arguments.CanImageBeResized != image.CanResize)
            {
                image.CanResize = arguments.CanImageBeResized;
            }

            if (arguments.DoAxesScaleIndependently != image.ScaleImageAxesIndepentently)
            {
                image.ScaleImageAxesIndepentently = arguments.DoAxesScaleIndependently;
            }

            if (!string.IsNullOrEmpty(arguments.TitleColor))
            {
                byte[] colorVals = colorExtraction.Matches(arguments.TitleColor).Select(x =>
                                                                                        byte.Parse(x.Value)
                                                                                        ).ToArray();
                title.Color = new Rgba32(colorVals[0], colorVals[1], colorVals[2], colorVals[3]);
            }

            if (arguments.TitleLocation != title.Position)
            {
                title.Position = arguments.TitleLocation;
            }

            if (arguments.HorizontalOffset != title.XOffset)
            {
                title.XOffset = arguments.HorizontalOffset;
            }

            if (arguments.VerticalOffset != title.YOffset)
            {
                title.YOffset = arguments.VerticalOffset;
            }
        }