/// <summary> /// <see cref="Button_S_Register"/>クリック時の挙動 /// </summary> private void Button_S_Register_Click(object sender, EventArgs e) { var path = TextBox_S_Path.Text; StaticFontInfo fontinfo; if (!asd.Engine.File.Exists(path)) { Console.WriteLine("FilePath Is Wrong"); return; } try { fontinfo = StaticFontInfo.GetInstance(path); } 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_S(); ResetListView(true); ResetComboBox(); }
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(); } }