Пример #1
0
 public NimbusMessageBox(NimbusTheme theme)
     : base(theme)
 {
     InitializeComponent();
     AllowResize = false;
     this.TopMost = true;
 }
Пример #2
0
        public static NimbusTheme FromFile(string filename)
        {
            NimbusTheme toReturn = new NimbusTheme();

            toReturn.LocalPath = Path.GetDirectoryName(filename);
            if (File.Exists(filename))
            {
                Console.WriteLine("Reading theme");
                using (StreamReader s = File.OpenText(filename))
                {
                    string read = null;
                    while ((read = s.ReadLine()) != null)
                    {
                        ProcessIniLine(read, toReturn);
                    }
                    s.Close();
                    s.Dispose();
                }
            }
            else
            {
                throw new ThemingError(null, String.Format("Theme file {0} not found", filename));
            }

            return(toReturn);
        }
Пример #3
0
        public NimbusMain(NimbusTheme theme)
            : base(theme)
        {
            InitializeComponent();
            splash = new Splash(theme);
            splash.Show();
            #if DEBUG
            ConsoleManager.Show();
            #endif

            SetSettings();
            RenewRegistry();
            InitialiseFactory();
            SetEvents();
            CreateContextMenu();
            ConfigureCaptionButtons();
            ConfigureNotifyIcon();

            ConfigureControls();
            ShowCollection();
            brwLibrary.Navigate(Globals.Homepage);
            //brwLibrary.Navigate("http://svn.thethoughtradar.com/test.html");
            //brwLibrary.Navigate("http://trac.webkit.org/export/41842/trunk/LayoutTests/scrollbars/overflow-scrollbar-combinations.html");
            CheckForUpdatesDelegate chk = new CheckForUpdatesDelegate(CheckForUpdates);
            chk.BeginInvoke(null, null);
        }
Пример #4
0
        public static LoginResult ShowLogin(NimbusTheme theme)
        {
            LoginForm logfrm = new LoginForm(theme);

            logfrm.ShowDialog();
            return LoginForm.loginResult;
        }
Пример #5
0
 public LoginForm(NimbusTheme theme)
 {
     this.Theme = theme;
     InitializeComponent();
     btnCancel.Clicked += new EventHandler(btnCancel_Clicked);
     btnLogin.Clicked += new EventHandler(btnLogin_Clicked);
 }
Пример #6
0
 public FriendsList(NimbusTheme theme)
     : base(theme)
 {
     InitializeComponent();
     //this.Show();
     //events
     lstFriends.MouseDoubleClick += new MouseEventHandler(lstFriends_MouseDoubleClick);
 }
Пример #7
0
 public NimbusForm(NimbusTheme theme)
 {
     this.Theme = theme;
     this.Icon = theme.Icon;
     this.BackColor = theme.BackgroundColor;
     this.CaptionFont = new Font(theme.CaptionFontFamily, theme.CaptionFontSize);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.DoubleBuffered = true;
 }
Пример #8
0
 //:base(theme)
 public Slip(NimbusTheme theme, string text)
 {
     InitializeComponent();
     this.ForeColor = Color.FromArgb(57, 116, 145);
     this.BackColor = theme.BackgroundColor;
     this.TopMost = true;
     this.text = text;
     this.DoubleBuffered = true;
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.ShowInTaskbar = false;
 }
Пример #9
0
        public Splash(NimbusTheme Theme)
        {
            this.ShowInTaskbar = false;
            this.Theme = Theme;
            this.TopMost = true;
            this.StartPosition = FormStartPosition.CenterScreen;
            bg = Image.FromFile(Theme.SplashFile);

            versionText = String.Format("Version: {0}", FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion);
            InitializeComponent();
        }
Пример #10
0
 public NimbusContextMenu(NimbusTheme theme)
 {
     this.theme = theme;
     MenuItems = new List<NMenuItem>();
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     TopMost = true;
     Font = new Font(theme.CaptionFontFamily, theme.CaptionFontSize);
     DoubleBuffered = true;
     ShowInTaskbar = false;
     this.Deactivate += new EventHandler(NimbusContextMenu_Deactivate);
 }
Пример #11
0
 public void SetTheme(NimbusTheme theme)
 {
     this.theme = theme;
 }
Пример #12
0
 //:base(theme)
 public Slip(NimbusTheme theme)
 {
     InitializeComponent();
 }
Пример #13
0
 public void SetTheme(NimbusTheme theme)
 {
     Font = new Font(theme.ButtonFont, 34f, FontStyle.Bold);
 }
Пример #14
0
        public static void ProcessIniLine(string read, NimbusTheme theme)
        {
            if (read.StartsWith("//"))
            {
                return;                        //is a comment
            }
            string trigger = read.Split('=')[0].ToLower();
            string val     = read.Split('=')[1];

            switch (trigger)
            {
            case "backgroundcolor":
            {
                try
                {
                    theme.BackgroundColor = ParseColor(val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "panelcolor":
            {
                try
                {
                    theme.PanelColor = ParseColor(val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "icon":
            {
                try
                {
                    theme.Icon = new Icon(theme.LocalPath + "\\" + val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captionbarcolor":
            {
                try
                {
                    theme.CaptionBarColor = ParseColor(val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "toolbarcolor":
            {
                try
                {
                    theme.ToolbarColor = ParseColor(val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captionfont":
            {
                try
                {
                    theme.CaptionFontFamily = theme.LoadFontFamily(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "buttonfont":
            {
                try
                {
                    theme.ButtonFont = theme.LoadFontFamily(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captionfontsize":
            {
                try
                {
                    theme.CaptionFontSize = Int32.Parse(val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captiontextcolor":
            {
                try
                {
                    theme.CaptionTextColor = ParseColor(val);
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captiontitleoffsetx":
            {
                try
                {
                    theme.CaptionOffsetX = Int32.Parse(val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "captiontitleoffsety":
            {
                try
                {
                    theme.CaptionOffsetY = Int32.Parse(val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "nexuswatermark":
            {
                try
                {
                    theme.NexusWatermark = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "closenormal":
            {
                try
                {
                    theme.CloseButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "closehover":
            {
                try
                {
                    theme.CloseButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "closepressed":
            {
                try
                {
                    theme.CloseButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "minimizenormal":
            {
                try
                {
                    theme.MinimizeButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "minimizehover":
            {
                try
                {
                    theme.MinimizeButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "minimizepressed":
            {
                try
                {
                    theme.MinimizeButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "maximizenormal":
            {
                try
                {
                    theme.MaximizeButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "maximizehover":
            {
                try
                {
                    theme.MaximizeButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "maximizepressed":
            {
                try
                {
                    theme.MaximizeButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "librarynormal":
            {
                try
                {
                    theme.LibraryButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "libraryhover":
            {
                try
                {
                    theme.LibraryButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "librarypressed":
            {
                try
                {
                    theme.LibraryButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "gamesnormal":
            {
                try
                {
                    theme.GamesButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "gameshover":
            {
                try
                {
                    theme.GamesButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "gamespressed":
            {
                try
                {
                    theme.GamesButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "confignormal":
            {
                try
                {
                    theme.ConfigButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "confighover":
            {
                try
                {
                    theme.ConfigButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "configpressed":
            {
                try
                {
                    theme.ConfigButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "friendsnormal":
            {
                try
                {
                    theme.FriendsButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "friendshover":
            {
                try
                {
                    theme.FriendsButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "friendspressed":
            {
                try
                {
                    theme.FriendsButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "backbuttonnormal":
            {
                try
                {
                    theme.BackButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "backbuttonhover":
            {
                try
                {
                    theme.BackButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "backbuttonpressed":
            {
                try
                {
                    theme.BackButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "forwardbuttonnormal":
            {
                try
                {
                    theme.ForwardButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "forwardbuttonhover":
            {
                try
                {
                    theme.ForwardButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "forwardbuttonpressed":
            {
                try
                {
                    theme.ForwardButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "splash":
            {
                try
                {
                    theme.SplashFile = theme.LocalPath + "\\" + val.Trim();
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "toolbarleft":
            {
                try
                {
                    theme.ToolbarLeft = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "toolbarright":
            {
                try
                {
                    theme.ToolbarRight = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "toolbarstretch":
            {
                try
                {
                    theme.ToolbarStretch = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "shadowtopright":
            {
                try
                {
                    theme.ShadowTopRight = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "shadowbottomleft":
            {
                try
                {
                    theme.ShadowBottomLeft = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "shadowhorizontal":
            {
                try
                {
                    theme.ShadowHorizontal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "shadowvertical":
            {
                try
                {
                    theme.ShadowVertical = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }

            case "shadowcorner":
            {
                try
                {
                    theme.ShadowCorner = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                }
                catch
                {
                    throw new ThemingError(null, String.Format("Error parsing {0}", read));
                }
                break;
            }
            }
        }
Пример #15
0
        public static void ProcessIniLine(string read, NimbusTheme theme)
        {
            if (read.StartsWith("//")) return; //is a comment
            string trigger = read.Split('=')[0].ToLower();
            string val = read.Split('=')[1];
            switch (trigger)
            {
                case "backgroundcolor":
                    {
                        try
                        {
                            theme.BackgroundColor = ParseColor(val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "panelcolor":
                    {
                        try
                        {
                            theme.PanelColor = ParseColor(val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "icon":
                    {
                        try
                        {
                            theme.Icon = new Icon(theme.LocalPath + "\\" + val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captionbarcolor":
                    {
                        try
                        {
                            theme.CaptionBarColor = ParseColor(val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "toolbarcolor":
                    {
                        try
                        {
                            theme.ToolbarColor = ParseColor(val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captionfont":
                    {
                        try
                        {
                            theme.CaptionFontFamily = theme.LoadFontFamily(theme.LocalPath + "\\" + val.Trim());

                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "buttonfont":
                    {
                        try
                        {
                            theme.ButtonFont = theme.LoadFontFamily(theme.LocalPath + "\\" + val.Trim());

                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captionfontsize":
                    {
                        try
                        {
                            theme.CaptionFontSize = Int32.Parse(val.Trim());

                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captiontextcolor":
                    {
                        try
                        {
                            theme.CaptionTextColor = ParseColor(val);
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captiontitleoffsetx":
                    {
                        try
                        {
                            theme.CaptionOffsetX = Int32.Parse(val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "captiontitleoffsety":
                    {
                        try
                        {
                            theme.CaptionOffsetY = Int32.Parse(val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "nexuswatermark":
                    {
                        try
                        {
                            theme.NexusWatermark = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "closenormal":
                    {
                        try
                        {
                            theme.CloseButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "closehover":
                    {
                        try
                        {
                            theme.CloseButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "closepressed":
                    {
                        try
                        {
                            theme.CloseButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "minimizenormal":
                    {
                        try
                        {
                            theme.MinimizeButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "minimizehover":
                    {
                        try
                        {
                            theme.MinimizeButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "minimizepressed":
                    {
                        try
                        {
                            theme.MinimizeButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "maximizenormal":
                    {
                        try
                        {
                            theme.MaximizeButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "maximizehover":
                    {
                        try
                        {
                            theme.MaximizeButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "maximizepressed":
                    {
                        try
                        {
                            theme.MaximizeButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "librarynormal":
                    {
                        try
                        {
                            theme.LibraryButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "libraryhover":
                    {
                        try
                        {
                            theme.LibraryButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "librarypressed":
                    {
                        try
                        {
                            theme.LibraryButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "gamesnormal":
                    {
                        try
                        {
                            theme.GamesButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "gameshover":
                    {
                        try
                        {
                            theme.GamesButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "gamespressed":
                    {
                        try
                        {
                            theme.GamesButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "confignormal":
                    {
                        try
                        {
                            theme.ConfigButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "confighover":
                    {
                        try
                        {
                            theme.ConfigButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "configpressed":
                    {
                        try
                        {
                            theme.ConfigButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "friendsnormal":
                    {
                        try
                        {
                            theme.FriendsButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "friendshover":
                    {
                        try
                        {
                            theme.FriendsButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "friendspressed":
                    {
                        try
                        {
                            theme.FriendsButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "backbuttonnormal":
                    {
                        try
                        {
                            theme.BackButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "backbuttonhover":
                    {
                        try
                        {
                            theme.BackButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "backbuttonpressed":
                    {
                        try
                        {
                            theme.BackButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "forwardbuttonnormal":
                    {
                        try
                        {
                            theme.ForwardButton.Normal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "forwardbuttonhover":
                    {
                        try
                        {
                            theme.ForwardButton.Hover = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "forwardbuttonpressed":
                    {
                        try
                        {
                            theme.ForwardButton.Pressed = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "splash":
                    {
                        try
                        {
                            theme.SplashFile = theme.LocalPath + "\\" + val.Trim();
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "toolbarleft":
                    {
                        try
                        {
                            theme.ToolbarLeft = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "toolbarright":
                    {
                        try
                        {
                            theme.ToolbarRight = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "toolbarstretch":
                    {
                        try
                        {
                            theme.ToolbarStretch = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "shadowtopright":
                    {
                        try
                        {
                            theme.ShadowTopRight = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "shadowbottomleft":
                    {
                        try
                        {
                            theme.ShadowBottomLeft = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "shadowhorizontal":
                    {
                        try
                        {
                            theme.ShadowHorizontal = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "shadowvertical":
                    {
                        try
                        {
                            theme.ShadowVertical = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }
                case "shadowcorner":
                    {
                        try
                        {
                            theme.ShadowCorner = Image.FromFile(theme.LocalPath + "\\" + val.Trim());
                        }
                        catch
                        {
                            throw new ThemingError(null, String.Format("Error parsing {0}", read));
                        }
                        break;
                    }

            }
        }
Пример #16
0
        public static NimbusTheme FromFile(string filename)
        {
            NimbusTheme toReturn = new NimbusTheme();
            toReturn.LocalPath = Path.GetDirectoryName(filename);
            if (File.Exists(filename))
            {
                Console.WriteLine("Reading theme");
                using (StreamReader s = File.OpenText(filename))
                {
                    string read = null;
                    while ((read = s.ReadLine()) != null)
                    {
                        ProcessIniLine(read, toReturn);
                    }
                    s.Close();
                    s.Dispose();
                }

            }
            else throw new ThemingError(null, String.Format("Theme file {0} not found", filename));

            return toReturn;
        }