Exemplo n.º 1
0
        /// <summary>
        /// <see cref="Button_D_Register"/>クリック時の挙動
        /// </summary>
        private void Button_D_Register_Click(object sender, EventArgs e)
        {
            var             fontsize     = (int)NumericUpDown_D_Size.Value;
            var             fontcolor    = new asd.Color((int)NumericUpDown_D_FR.Value, (int)NumericUpDown_D_FG.Value, (int)NumericUpDown_D_FB.Value, (int)NumericUpDown_D_FA.Value);
            var             outlinesize  = (int)NumericUpDown_D_OutLineSize.Value;
            var             outlinecolor = new asd.Color((int)NumericUpDown_D_OR.Value, (int)NumericUpDown_D_OG.Value, (int)NumericUpDown_D_OB.Value, (int)NumericUpDown_D_OA.Value);
            var             path         = TextBox_Path_D.Text;
            DynamicFontInfo fontinfo;

            if (!asd.Engine.File.Exists(path))
            {
                Console.WriteLine("FilePath Is Wrong");
                return;
            }
            try
            {
                fontinfo = DynamicFontInfo.GetInstance(path, fontsize, fontcolor, outlinesize, outlinecolor);
            }
            catch (System.IO.IOException)
            {
                Console.WriteLine("Failed to create font");
                return;
            }
            if (DataBase.Fonts.Contains(fontinfo))
            {
                Console.WriteLine("Font is duplicated");
                return;
            }
            DataBase.Fonts.Add(fontinfo);
            Console.WriteLine("Succeeded to create font");
            FormReset_D();
            ResetListView(true);
            ResetComboBox();
        }
Exemplo n.º 2
0
        private static FontInfoBase FromPackagePrivate(PackagedFont package)
        {
            switch (package)
            {
            case PackagedDynamicFont d: return(DynamicFontInfo.GetInstance(d.Path, d.Size, d.Color, d.OutLineSize, d.OutLineColor));

            case PackagedStaticFont s: return(StaticFontInfo.GetInstance(s.Path));

            default: throw new ArgumentException();
            }
        }