public bool LoadFromPack(string filename) { var fs = File.Open(filename, FileMode.Open); var br = new BinaryReader(fs); if (fs.Length < 5) { return(false); //2015.07.05. } Name = br.ReadString(); //Név Description = br.ReadString(); //Leírás Creators = br.ReadString(); //Készítő(k) int count = br.ReadInt32(); //2015.05.03. for (int i = 0; i < count; i++) { string tmp = br.ReadString(); Type type = Type.GetType(tmp); ThemeControl control = new ThemeControl(br); Controls.Add(type, control); //2015.07.03. } Themes.Add(this); if (CurrentTheme == null) //TODO: TMP { CurrentTheme = this; //2015.07.05. } return(true); }
public static void SkinThis(Type controltype, Graphics graphics) //controltype: 2015.07.03. { //2015.05.22. if (CurrentTheme == null) { return; } if (!CurrentTheme.Controls.ContainsKey(controltype)) { //2015.07.03. //MessageBox.Show("Cannot theme this control type: " + controltype); //TODO: Több téma támogatása egyszerre (Minecraft resource pack) return; } ThemeControl control = CurrentTheme.Controls[controltype]; switch (control.ControlType) { case ThemeControlTypes.Colors: graphics.FillRectangle(new SolidBrush(control.Color), graphics.ClipBounds); //2015.07.05. break; case ThemeControlTypes.Dynamic: //2015.07.05. IScriptTheme script = null; //TODO script.SkinThis(controltype, control, graphics); break; case ThemeControlTypes.Image: //2015.07.05. graphics.DrawImage(control.Image, new Rectangle(new Point(), graphics.ClipBounds.Size.ToSize())); break; } }