コード例 #1
0
 public ThemeFontset Use(ThemeFontset other)
 {
     this.name = other.name;
     this.path = other.path;
     foreach (var item in other.fonts)
     {
         this.fonts[item.Key] = other.fonts[item.Key].Copy();
     }
     return(this);
 }
コード例 #2
0
 public static void Load()
 {
     if (Theme.loaded)
     {
         return;
     }
     Theme.loaded     = true;
     ThemeFontset.all = ThemeFontset.Import();
     ThemePalette.all = ThemePalette.Import();
     ThemeSkinset.all = ThemeSkinset.Import();
     ThemeIconset.all = ThemeIconset.Import();
     Theme.all        = Theme.Import().OrderBy(x => x.name != "Default").ToList();
 }
コード例 #3
0
 public void Deserialize(string data)
 {
     foreach (var line in data.GetLines())
     {
         if (line.Trim().IsEmpty())
         {
             continue;
         }
         var term  = line.Parse("", " ").Trim();
         var value = line.Parse(" ").Trim().Trim("=").Trim();
         if (term.Matches("CustomizablePalette", true))
         {
             this.customizablePalette = value.ToBool();
         }
         else if (term.Matches("CustomizableFontset", true))
         {
             this.customizableFontset = value.ToBool();
         }
         else if (term.Matches("CustomizableIconset", true))
         {
             this.customizableIconset = value.ToBool();
         }
         else if (term.Matches("Palette", true))
         {
             this.palette = ThemePalette.all.Find(x => x.name == value) ?? new ThemePalette();
         }
         else if (term.Matches("Fontset", true))
         {
             this.fontset = ThemeFontset.all.Find(x => x.name == value) ?? new ThemeFontset();
         }
         else if (term.Matches("Iconset", true))
         {
             this.iconset = ThemeIconset.all.Find(x => x.name == value) ?? new ThemeIconset();
         }
         else if (term.Matches("Skinset", true))
         {
             var variants = value.Split("+");
             this.defaultVariants = variants.Skip(1).ToArray();
             this.skinset         = ThemeSkinset.all.Find(x => x.name == variants[0]) ?? new ThemeSkinset();
         }
     }
 }
コード例 #4
0
 //=================================
 // Utilities
 //=================================
 public bool Matches(ThemeFontset other)
 {
     foreach (var item in this.fonts)
     {
         var name      = item.Key;
         var themeFont = item.Value;
         if (!other.fonts.ContainsKey(name))
         {
             return(false);
         }
         bool mismatchedFont       = themeFont.font != other.fonts[name].font;
         bool mismatchedSizeOffset = themeFont.sizeOffset != other.fonts[name].sizeOffset;
         bool mismatchedOffsetX    = themeFont.offsetX != other.fonts[name].offsetX;
         bool mismatchedOffsetY    = themeFont.offsetY != other.fonts[name].offsetY;
         if (mismatchedFont || mismatchedSizeOffset || mismatchedOffsetX || mismatchedOffsetY)
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #5
0
 public ThemeFontset(ThemeFontset other)
 {
     this.Use(other);
 }
コード例 #6
0
 public ThemeFontset UseBuffer(ThemeFontset other)
 {
     this.buffer = other.buffer;
     return(this);
 }