You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

LogViewerConfig.cs 2.0 kB

10 years ago
10 years ago
10 years ago
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Drawing;
  3. namespace Shadowsocks.Model
  4. {
  5. [Serializable]
  6. public class LogViewerConfig
  7. {
  8. public string fontName;
  9. public float fontSize;
  10. public string bgColor;
  11. public string textColor;
  12. public bool topMost;
  13. public bool wrapText;
  14. public bool toolbarShown;
  15. public LogViewerConfig()
  16. {
  17. this.fontName = "Consolas";
  18. this.fontSize = 8;
  19. this.bgColor = "black";
  20. this.textColor = "white";
  21. this.topMost = false;
  22. this.wrapText = false;
  23. this.toolbarShown = false;
  24. }
  25. public Font GetFont()
  26. {
  27. try
  28. {
  29. return new Font(fontName, fontSize, FontStyle.Regular);
  30. }
  31. catch (Exception)
  32. {
  33. return new Font("Console", 8F);
  34. }
  35. }
  36. public void SetFont(Font font)
  37. {
  38. fontName = font.Name;
  39. fontSize = font.Size;
  40. }
  41. public Color GetBackgroundColor()
  42. {
  43. try
  44. {
  45. return ColorTranslator.FromHtml(bgColor);
  46. }
  47. catch (Exception)
  48. {
  49. return ColorTranslator.FromHtml("black");
  50. }
  51. }
  52. public void SetBackgroundColor(Color color)
  53. {
  54. bgColor = ColorTranslator.ToHtml(color);
  55. }
  56. public Color GetTextColor()
  57. {
  58. try
  59. {
  60. return ColorTranslator.FromHtml(textColor);
  61. }
  62. catch (Exception)
  63. {
  64. return ColorTranslator.FromHtml("white");
  65. }
  66. }
  67. public void SetTextColor(Color color)
  68. {
  69. textColor = ColorTranslator.ToHtml(color);
  70. }
  71. }
  72. }