Ejemplo n.º 1
0
 public static void Shutdown()
 {
     if (appImages != null)
     {
         appImages.Dispose();
         appImages = null;
     }
 }
Ejemplo n.º 2
0
 protected void Dispose(bool disposing)
 {
     if (iniFile != null)
     {
         iniFile.Dispose();
         iniFile = null;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Closes this instance and disposes the translation file.
 /// </summary>
 public static void Close()
 {
     if (iniFile != null)
     {
         iniFile.Dispose();
         iniFile = null;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Customs the site icon name.
        /// </summary>
        /// <param name="siteAddress">The site address.</param>
        /// <returns></returns>
        public static string CustomSiteIcon(string siteAddress)
        {
            if (File.Exists(GlobalConfig.SiteImagesFileName))
            {
                Uri        siteUri   = new Uri(siteAddress);
                string     imageName = null;
                string     siteHost  = siteUri.Host;
                string[]   parts     = siteHost.Split('.');
                MemIniFile iniFile   = new MemIniFile(GlobalConfig.SiteImagesFileName);
                try
                {
                    iniFile.Load();
                    foreach (var part in parts)
                    {
                        imageName = iniFile.ReadString("site", part);
                        if (!string.IsNullOrEmpty(imageName))
                        {
                            if (FileOperations.FileExists(imageName))
                            {
                                //return FileOperations.StripFileName(imageName);
                                return(imageName);
                            }
                        }
                    }

                    //no image for url part, return default image
                    if (iniFile.SectionExists("default"))
                    {
                        imageName = iniFile.ReadString("default", "url");
                        if (!string.IsNullOrEmpty(imageName))
                        {
                            if (FileOperations.FileExists(imageName))
                            {
                                //return FileOperations.StripFileName(imageName);
                                return(imageName);
                            }
                        }
                    }
                }
                finally
                {
                    iniFile.Dispose();
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
 public ActionLoader(string fileName)
 {
     iniFile = new MemIniFile(fileName);
     iniFile.Load();
     converter = new KeysConverter();
 }
Ejemplo n.º 6
0
        public bool LoadFromFile()
        {
            string iniFileName;

            if (!File.Exists(skinFileName))
            {
                return(false);
            }

            iniFileName = skinFileName;


            MemIniFile ini = new MemIniFile(iniFileName);

            try
            {
                ini.Load();
                ColorConverter cc = new ColorConverter();
                imageSize         = ini.ReadInteger("Menu", "ImageSize", 16);
                itemHeight        = ini.ReadInteger("Menu", "ItemHeight", 20);
                leftMargin        = ini.ReadInteger("Menu", "LeftMargin", 38);
                topMargin         = ini.ReadInteger("Menu", "TopMargin", 28);
                TextTopMargin     = ini.ReadInteger("Menu", "TextTopMargin", 28);
                TextBottomMargin  = ini.ReadInteger("Menu", "TextBottomMargin", 28);
                bottomMargin      = ini.ReadInteger("Menu", "BottomMargin", topMargin);
                textLeftMargin    = ini.ReadInteger("Menu", "TextLeftMargin", 28);
                textRightMargin   = ini.ReadInteger("Menu", "TextRightMargin", 24);
                textOffset        = ini.ReadInteger("Menu", "TextOffset", 4);
                outerBorderLeft   = ini.ReadInteger("Menu", "OuterBorderLeft", 21);
                outerBorderTop    = ini.ReadInteger("Menu", "OuterBorderTop", 21);
                scrollDividerSize = ini.ReadInteger("Menu", "DividerSize", 6);
                springBottom      = ini.ReadBool("Menu", "SpringBottom", false);

                fontName = ini.ReadString("Krento", "FontName", "Tahoma");
                fontSize = ini.ReadInteger("Krento", "FontSize", 12);
                caption  = ini.ReadString("Krento", "Caption", Path.GetFileNameWithoutExtension(Path.GetDirectoryName(skinFileName)));

                foreColor     = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "ForeColor", "White"));
                selectedColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "SelectedColor",
                                                                                    "238, 175, 238, 238"));
                disabledColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "DisabledColor", "Gray"));


                string backgroundName = ini.ReadString("Menu", "Image", string.Empty);

                if (!string.IsNullOrEmpty(backgroundName))
                {
                    if (background != null)
                    {
                        background.Dispose();
                        background = null;
                    }
                    try
                    {
                        string skinFolder = Path.GetDirectoryName(skinFileName);
                        background = FastBitmap.FromFile(Path.Combine(skinFolder, backgroundName));
                    }
                    catch
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }


                string highlightName = ini.ReadString("Menu", "Highlight", string.Empty);

                if (!string.IsNullOrEmpty(highlightName))
                {
                    if (highlight != null)
                    {
                        highlight.Dispose();
                        highlight = null;
                    }
                    try
                    {
                        string skinFolder = Path.GetDirectoryName(skinFileName);
                        highlight = FastBitmap.FromFile(Path.Combine(skinFolder, highlightName));
                    }
                    catch
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            finally
            {
                ini.Dispose();
            }

            return(true);
        }
Ejemplo n.º 7
0
        internal static void SaveGlobalSettings()
        {
            bool keyAlt;
            bool keyCtrl;
            bool keyShift;
            bool keyWin;

            MemIniFile iniFile;

            iniFile = new MemIniFile(GlobalConfig.KrentoSettingsFileName);
            try
            {
                iniFile.Load();
                iniFile.WriteString(Sections.General, Parameters.MouseButton, MouseHook.ToString());

                if (!string.IsNullOrEmpty(IconName))
                {
                    iniFile.WriteString(Sections.General, Parameters.IconName, IconName);
                }

                string shortCircleName = FileOperations.UnExpandPath(CircleName);
                iniFile.WriteString(Sections.General, Parameters.CircleName, shortCircleName);

                iniFile.WriteBool(Sections.Shortcut, Parameters.CircleSelector, CircleSelector);
                iniFile.WriteBool(Sections.General, Parameters.UseKeyboardActivation, UseKeyboardActivation);
                iniFile.WriteBool(Sections.General, Parameters.UseMouseActivation, UseMouseActivation);

                iniFile.WriteBool(Sections.General, Parameters.ShowTrayIcon, ShowTrayIcon);
                iniFile.WriteBool(Sections.General, Parameters.ShowPopupAlerts, ShowPopupAlerts);
                iniFile.WriteString(Sections.General, Parameters.Language, Language);

                keyWin   = ((GlobalSettings.Modifiers & Keys.LWin) != 0);
                keyShift = ((GlobalSettings.Modifiers & Keys.Shift) != 0);
                keyAlt   = ((GlobalSettings.Modifiers & Keys.Alt) != 0);
                keyCtrl  = ((GlobalSettings.Modifiers & Keys.Control) != 0);

                iniFile.WriteBool(Sections.Shortcut, Parameters.Alt, keyAlt);
                iniFile.WriteBool(Sections.Shortcut, Parameters.Ctrl, keyCtrl);
                iniFile.WriteBool(Sections.Shortcut, Parameters.Win, keyWin);
                iniFile.WriteBool(Sections.Shortcut, Parameters.Shift, keyShift);

                iniFile.WriteString(Sections.Shortcut, Parameters.Key, Shortcut.ToString());

                keyShift = ((GlobalSettings.MouseModifiers & Keys.Shift) != 0);
                keyAlt   = ((GlobalSettings.MouseModifiers & Keys.Alt) != 0);
                keyCtrl  = ((GlobalSettings.MouseModifiers & Keys.Control) != 0);

                iniFile.WriteBool(Sections.Mouse, Parameters.ActivateCursor, ActivateCursor);
                iniFile.WriteBool(Sections.Mouse, Parameters.UseRightClick, UseRightClick);
                iniFile.WriteBool(Sections.Mouse, Parameters.DesktopClick, DesktopClick);

                iniFile.WriteBool(Sections.Mouse, Parameters.Alt, keyAlt);
                iniFile.WriteBool(Sections.Mouse, Parameters.Ctrl, keyCtrl);
                iniFile.WriteBool(Sections.Mouse, Parameters.Shift, keyShift);

                iniFile.WriteBool(Sections.General, Parameters.CheckUpdate, CheckUpdate);
                iniFile.WriteBool(Sections.General, Parameters.ShowSplashScreen, ShowSplashScreen);
                iniFile.WriteBool(Sections.General, Parameters.StartVisible, StartVisible);
                iniFile.WriteBool(Sections.General, Parameters.UseSound, UseSound);

                iniFile.WriteInteger(Sections.Help, Parameters.PortNumber, PortNumber);
                iniFile.WriteBool(Sections.Help, Parameters.ActivateServer, ActivateServer);

                iniFile.WriteBool(Sections.Manager, Parameters.HideOnClick, HideOnClick);
                iniFile.WriteInteger(Sections.Manager, Parameters.FadeDelay, FadeDelay);
                iniFile.WriteInteger(Sections.Manager, Parameters.WindowHeight, WindowHeight);
                iniFile.WriteInteger(Sections.Manager, Parameters.WindowWidth, WindowWidth);
                iniFile.WriteInteger(Sections.Manager, Parameters.StoneSize, StoneSize);
                iniFile.WriteInteger(Sections.Manager, Parameters.IconSize, IconSize);
                iniFile.WriteInteger(Sections.Manager, Parameters.Transparency, Transparency);
                iniFile.WriteInteger(Sections.Manager, Parameters.Raduis, Radius);
                iniFile.WriteBool(Sections.Manager, Parameters.RotateOnClick, RotateOnClick);
                iniFile.WriteBool(Sections.Manager, Parameters.IgnoreFullScreen, IgnoreFullScreen);
                iniFile.WriteBool(Sections.Manager, Parameters.ManagerButtons, ShowManagerButtons);
                iniFile.WriteInteger(Sections.Manager, Parameters.DefaultStonesNumber, DefaultStonesNumber);
                iniFile.WriteBool(Sections.Manager, Parameters.LiveReflection, LiveReflection);
                iniFile.WriteBool(Sections.Manager, Parameters.ShowStoneHint, ShowStoneHint);
                iniFile.WriteBool(Sections.Manager, Parameters.FlatRing, FlatRing);

                string shortMenuSkin = FileOperations.UnExpandPath(MenuSkin);
                if (!string.IsNullOrEmpty(shortMenuSkin))
                {
                    iniFile.WriteString(Sections.Menu, Parameters.Theme, shortMenuSkin);
                }
                else
                {
                    iniFile.DeleteKey(Sections.Menu, Parameters.Theme);
                }

                DefaultCircle = GlobalConfig.DefaultCircleName;
                string defaultCircleFile = FileOperations.UnExpandPath(DefaultCircle);
                if (!string.IsNullOrEmpty(defaultCircleFile))
                {
                    iniFile.WriteString(Sections.General, Parameters.DefaultCircle, defaultCircleFile);
                }
                else
                {
                    iniFile.DeleteKey(Sections.General, Parameters.DefaultCircle);
                }

                iniFile.Save();
            }
            finally
            {
                iniFile.Dispose();
            }
        }
Ejemplo n.º 8
0
        internal static void LoadGlobalSettings()
        {
            MemIniFile iniFile;
            bool       keyAlt;
            bool       keyCtrl;
            bool       keyShift;
            bool       keyWin;
            int        goodNumber;

            iniFile = new MemIniFile(GlobalConfig.KrentoSettingsFileName);
            try
            {
                iniFile.Load();
                try
                {
                    MouseHook = (MouseHookButton)Enum.Parse(typeof(MouseHookButton), iniFile.ReadString(Sections.General, "MouseButton", "Wheel"));
                }
                catch
                {
                    MouseHook = MouseHookButton.Wheel;
                }

                try
                {
                    Shortcut = (Keys)Enum.Parse(typeof(Keys), iniFile.ReadString(Sections.Shortcut, Parameters.Key, "S"));
                }
                catch
                {
                    Shortcut = Keys.S;
                }

                CircleSelector        = iniFile.ReadBool(Sections.Shortcut, Parameters.CircleSelector, false);
                UseKeyboardActivation = iniFile.ReadBool(Sections.General, Parameters.UseKeyboardActivation, true);
                UseMouseActivation    = iniFile.ReadBool(Sections.General, Parameters.UseMouseActivation, true);

                keyAlt   = iniFile.ReadBool(Sections.Shortcut, Parameters.Alt, false);
                keyCtrl  = iniFile.ReadBool(Sections.Shortcut, Parameters.Ctrl, false);
                keyWin   = iniFile.ReadBool(Sections.Shortcut, Parameters.Win, true);
                keyShift = iniFile.ReadBool(Sections.Shortcut, Parameters.Shift, false);

                if ((Shortcut == Keys.None))
                {
                    keyAlt   = false;
                    keyWin   = true;
                    keyCtrl  = false;
                    keyShift = false;
                    Shortcut = Keys.S;
                }

                //for previous version compatibility
                if (keyWin && (Shortcut == Keys.C))
                {
                    Shortcut = Keys.S;
                }

                Modifiers = Keys.None;
                if (keyAlt)
                {
                    Modifiers = Modifiers | Keys.Alt;
                }
                if (keyCtrl)
                {
                    Modifiers = Modifiers | Keys.Control;
                }
                if (keyShift)
                {
                    Modifiers = Modifiers | Keys.Shift;
                }
                if (keyWin)
                {
                    Modifiers = Modifiers | Keys.LWin;
                }


                keyAlt   = iniFile.ReadBool(Sections.Mouse, Parameters.Alt, false);
                keyCtrl  = iniFile.ReadBool(Sections.Mouse, Parameters.Ctrl, false);
                keyShift = iniFile.ReadBool(Sections.Mouse, Parameters.Shift, false);

                MouseModifiers = Keys.None;
                if (keyAlt)
                {
                    MouseModifiers = MouseModifiers | Keys.Alt;
                }
                if (keyCtrl)
                {
                    MouseModifiers = MouseModifiers | Keys.Control;
                }
                if (keyShift)
                {
                    MouseModifiers = MouseModifiers | Keys.Shift;
                }

                ActivateCursor = iniFile.ReadBool(Sections.Mouse, Parameters.ActivateCursor, false);

                UseRightClick = iniFile.ReadBool(Sections.Mouse, Parameters.UseRightClick, false);
                DesktopClick  = iniFile.ReadBool(Sections.Mouse, Parameters.DesktopClick, false);

                DefaultCircle = iniFile.ReadString(Sections.General, Parameters.DefaultCircle, GlobalConfig.DefaultCircleName);
                DefaultCircle = FileOperations.StripFileName(DefaultCircle);

                GlobalConfig.DefaultCircleName = DefaultCircle;

                CircleName = iniFile.ReadString(Sections.General, Parameters.CircleName, DefaultCircle);
                CircleName = FileOperations.StripFileName(CircleName);

                StartVisible = iniFile.ReadBool(Sections.General, Parameters.StartVisible, false);

                CheckUpdate = iniFile.ReadBool(Sections.General, Parameters.CheckUpdate, true);

                ShowPopupAlerts  = iniFile.ReadBool(Sections.General, Parameters.ShowPopupAlerts, true);
                ShowTrayIcon     = iniFile.ReadBool(Sections.General, Parameters.ShowTrayIcon, true);
                ShowSplashScreen = iniFile.ReadBool(Sections.General, Parameters.ShowSplashScreen, true);
                Language         = iniFile.ReadString(Sections.General, Parameters.Language, CultureInfo.CurrentCulture.Name);
                UseSound         = iniFile.ReadBool(Sections.General, Parameters.UseSound, true);

                IconName       = iniFile.ReadString(Sections.General, Parameters.IconName, null);
                GlyphName      = iniFile.ReadString(Sections.General, Parameters.GlyphName, null);
                SplashName     = iniFile.ReadString(Sections.General, Parameters.SplashName, null);
                AboutBoxName   = iniFile.ReadString(Sections.General, Parameters.AboutBoxName, null);
                AboutStoneName = iniFile.ReadString(Sections.General, Parameters.AboutStoneName, null);

                // read web server settings

                PortNumber     = iniFile.ReadInteger(Sections.Help, Parameters.PortNumber, 8053);
                ActivateServer = iniFile.ReadBool(Sections.Help, Parameters.ActivateServer, true);

                HideOnClick      = iniFile.ReadBool(Sections.Manager, Parameters.HideOnClick, false);
                FadeDelay        = iniFile.ReadInteger(Sections.Manager, Parameters.FadeDelay, 100);
                WindowWidth      = iniFile.ReadInteger(Sections.Manager, Parameters.WindowWidth, 300);
                WindowHeight     = iniFile.ReadInteger(Sections.Manager, Parameters.WindowHeight, 80);
                RotateOnClick    = iniFile.ReadBool(Sections.Manager, Parameters.RotateOnClick, false);
                IgnoreFullScreen = iniFile.ReadBool(Sections.Manager, Parameters.IgnoreFullScreen, true);

                DefaultStonesNumber = iniFile.ReadInteger(Sections.Manager, Parameters.DefaultStonesNumber, 0);
                goodNumber          = Math.Max(DefaultStonesNumber, 0);
                DefaultStonesNumber = Math.Min(64, goodNumber);

                StoneSize  = iniFile.ReadInteger(Sections.Manager, Parameters.StoneSize, 128);
                goodNumber = Math.Min(StoneSize, 512);
                StoneSize  = Math.Max(64, goodNumber);

                IconSize            = iniFile.ReadInteger(Sections.Manager, Parameters.IconSize, 64);
                goodNumber          = Math.Min(IconSize, 512);
                IconSize            = Math.Max(64, goodNumber);
                FileImage.ImageSize = IconSize;

                Transparency = iniFile.ReadInteger(Sections.Manager, Parameters.Transparency, 230);
                goodNumber   = Math.Min(Transparency, 255);
                Transparency = Math.Max(10, goodNumber);

                Radius     = iniFile.ReadInteger(Sections.Manager, Parameters.Raduis, 200);
                goodNumber = Math.Min(Radius, 1000);
                Radius     = Math.Max(100, goodNumber);

                ShowManagerButtons = iniFile.ReadBool(Sections.Manager, Parameters.ManagerButtons, true);
                LiveReflection     = iniFile.ReadBool(Sections.Manager, Parameters.LiveReflection, false);
                ShowStoneHint      = iniFile.ReadBool(Sections.Manager, Parameters.ShowStoneHint, true);
                FlatRing           = iniFile.ReadBool(Sections.Manager, Parameters.FlatRing, false);

                MenuSkin = iniFile.ReadString(Sections.Menu, Parameters.Theme, string.Empty);
                KrentoMenu.SkinFileName = FileOperations.StripFileName(MenuSkin);
            }
            finally
            {
                iniFile.Dispose();
            }
        }
Ejemplo n.º 9
0
 public static void Startup()
 {
     appImages = new MemIniFile(GlobalConfig.AppImagesFileName, true);
 }
Ejemplo n.º 10
0
 public IniFileAccessArgs(MemIniFile iniFile)
 {
     this.iniFile = iniFile;
 }
Ejemplo n.º 11
0
        public bool LoadFromFile()
        {
            string iniFileName = "";
            string stoneName;
            string backgroundName;
            string skinFolder = "";

            if (!File.Exists(skinFileName))
            {
                return(false);
            }
            else
            {
                iniFileName = skinFileName;
                skinFolder  = Path.GetDirectoryName(skinFileName);
            }


            MemIniFile ini = new MemIniFile(iniFileName);

            try
            {
                ini.Load();

                MenuSkin = ini.ReadString("Menu", "Theme", null);

                ColorConverter     cc = new ColorConverter();
                RectangleConverter rc = new RectangleConverter();
                fontName = ini.ReadString("Info", "FontName", "Tahoma");
                fontSize = ini.ReadInteger("Info", "FontSize", 14);
                try
                {
                    foreColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Info", "Color", "White"));
                }
                catch
                {
                    foreColor = Color.White;
                }

                try
                {
                    HintOutlineColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Hint", "OutlineColor", "Black"));
                }
                catch
                {
                    HintOutlineColor = Color.Black;
                }

                try
                {
                    HintBorderColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Hint", "BorderColor", "Gainsboro"));
                }
                catch
                {
                    HintBorderColor = Color.Gainsboro;
                }

                try
                {
                    HintBodyColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Hint", "BodyColor", "Black"));
                }
                catch
                {
                    HintBodyColor = Color.Black;
                }

                ButtonStoneSize  = ini.ReadInteger("Hint", "ButtonSize", 26);
                ButtonStoneSpace = ini.ReadInteger("Hint", "ButtonSpace", 4);

                try
                {
                    MenuBorderColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "BorderColor", "Gainsboro"));
                }
                catch
                {
                    MenuBorderColor = Color.Gainsboro;
                }

                try
                {
                    MenuOutlineColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "OutlineColor", "Black"));
                }
                catch
                {
                    MenuOutlineColor = Color.Black;
                }

                try
                {
                    MenuBodyColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "BodyColor", "Black"));
                }
                catch
                {
                    MenuBodyColor = Color.Black;
                }

                try
                {
                    MenuNormalTextColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "NormalTextColor", "White"));
                }
                catch
                {
                    MenuNormalTextColor = Color.White;
                }

                try
                {
                    MenuDisabledTextColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "DisabledTextColor", "Gray"));
                }
                catch
                {
                    MenuDisabledTextColor = Color.Gray;
                }

                try
                {
                    MenuSelectedTextColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "SelectedTextColor", "Black"));
                }
                catch
                {
                    MenuSelectedTextColor = Color.Black;
                }

                MenuFontSize = ini.ReadInteger("Menu", "FontSize", 12);

                MenuFontName = ini.ReadString("Menu", "FontName", "Tahoma");

                try
                {
                    MenuHighlightColor = (Color)cc.ConvertFromInvariantString(ini.ReadString("Menu", "HighlightColor", "Orange"));
                }
                catch
                {
                    MenuHighlightColor = Color.Orange;
                }


                ButtonStoneAbout = ini.ReadString("Hint", "ButtonStoneAbout", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStoneAbout))
                {
                    ButtonStoneAbout = Path.Combine(skinFolder, ButtonStoneAbout);
                }


                ButtonStoneSelect = ini.ReadString("Hint", "ButtonStoneSelect", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStoneSelect))
                {
                    ButtonStoneSelect = Path.Combine(skinFolder, ButtonStoneSelect);
                }


                ButtonStoneEdit = ini.ReadString("Hint", "ButtonStoneEdit", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStoneEdit))
                {
                    ButtonStoneEdit = Path.Combine(skinFolder, ButtonStoneEdit);
                }

                ButtonStoneDelete = ini.ReadString("Hint", "ButtonStoneDelete", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStoneDelete))
                {
                    ButtonStoneDelete = Path.Combine(skinFolder, ButtonStoneDelete);
                }


                ButtonBackNormal = ini.ReadString("ButtonBack", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonBackNormal))
                {
                    ButtonBackNormal = Path.Combine(skinFolder, ButtonBackNormal);
                }

                ButtonBackFocused = ini.ReadString("ButtonBack", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonBackFocused))
                {
                    ButtonBackFocused = Path.Combine(skinFolder, ButtonBackFocused);
                }

                ButtonBackPressed = ini.ReadString("ButtonBack", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonBackPressed))
                {
                    ButtonBackPressed = Path.Combine(skinFolder, ButtonBackPressed);
                }


                ButtonStartMenuNormal = ini.ReadString("ButtonStartMenu", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStartMenuNormal))
                {
                    ButtonStartMenuNormal = Path.Combine(skinFolder, ButtonStartMenuNormal);
                }

                ButtonStartMenuFocused = ini.ReadString("ButtonStartMenu", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStartMenuFocused))
                {
                    ButtonStartMenuFocused = Path.Combine(skinFolder, ButtonStartMenuFocused);
                }

                ButtonStartMenuPressed = ini.ReadString("ButtonStartMenu", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonStartMenuPressed))
                {
                    ButtonStartMenuPressed = Path.Combine(skinFolder, ButtonStartMenuPressed);
                }

                ButtonForwardNormal = ini.ReadString("ButtonForward", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonForwardNormal))
                {
                    ButtonForwardNormal = Path.Combine(skinFolder, ButtonForwardNormal);
                }
                else
                {
                    ButtonForwardFocused = ini.ReadString("ButtonForward", "Focused", string.Empty);
                }
                if (!string.IsNullOrEmpty(ButtonForwardFocused))
                {
                    ButtonForwardFocused = Path.Combine(skinFolder, ButtonForwardFocused);
                }

                ButtonForwardPressed = ini.ReadString("ButtonForward", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonForwardPressed))
                {
                    ButtonForwardPressed = Path.Combine(skinFolder, ButtonForwardPressed);
                }

                ButtonPowerNormal = ini.ReadString("ButtonPower", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonPowerNormal))
                {
                    ButtonPowerNormal = Path.Combine(skinFolder, ButtonPowerNormal);
                }

                ButtonPowerFocused = ini.ReadString("ButtonPower", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonPowerFocused))
                {
                    ButtonPowerFocused = Path.Combine(skinFolder, ButtonPowerFocused);
                }

                ButtonPowerPressed = ini.ReadString("ButtonPower", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonPowerPressed))
                {
                    ButtonPowerPressed = Path.Combine(skinFolder, ButtonPowerPressed);
                }

                ButtonHomeNormal = ini.ReadString("ButtonHome", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonHomeNormal))
                {
                    ButtonHomeNormal = Path.Combine(skinFolder, ButtonHomeNormal);
                }

                ButtonHomeFocused = ini.ReadString("ButtonHome", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonHomeFocused))
                {
                    ButtonHomeFocused = Path.Combine(skinFolder, ButtonHomeFocused);
                }

                ButtonHomePressed = ini.ReadString("ButtonHome", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonHomePressed))
                {
                    ButtonHomePressed = Path.Combine(skinFolder, ButtonHomePressed);
                }

                ButtonLauncherNormal = ini.ReadString("ButtonLauncher", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonLauncherNormal))
                {
                    ButtonLauncherNormal = Path.Combine(skinFolder, ButtonLauncherNormal);
                }

                ButtonLauncherFocused = ini.ReadString("ButtonLauncher", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonLauncherFocused))
                {
                    ButtonLauncherFocused = Path.Combine(skinFolder, ButtonLauncherFocused);
                }

                ButtonLauncherPressed = ini.ReadString("ButtonLauncher", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonLauncherPressed))
                {
                    ButtonLauncherPressed = Path.Combine(skinFolder, ButtonLauncherPressed);
                }

                ButtonSettingsNormal = ini.ReadString("ButtonSettings", "Normal", string.Empty);
                if (!string.IsNullOrEmpty(ButtonSettingsNormal))
                {
                    ButtonSettingsNormal = Path.Combine(skinFolder, ButtonSettingsNormal);
                }

                ButtonSettingsFocused = ini.ReadString("ButtonSettings", "Focused", string.Empty);
                if (!string.IsNullOrEmpty(ButtonSettingsFocused))
                {
                    ButtonSettingsFocused = Path.Combine(skinFolder, ButtonSettingsFocused);
                }

                ButtonSettingsPressed = ini.ReadString("ButtonSettings", "Pressed", string.Empty);
                if (!string.IsNullOrEmpty(ButtonSettingsPressed))
                {
                    ButtonSettingsPressed = Path.Combine(skinFolder, ButtonSettingsPressed);
                }

                ManagerWidth  = ini.ReadInteger("Background", "ManagerWidth", GlobalSettings.WindowWidth);
                ManagerHeight = ini.ReadInteger("Background", "ManagerHeight", GlobalSettings.WindowHeight);
                Radius        = ini.ReadInteger("Background", "Radius", GlobalSettings.Radius);

                string sectionName = "Background";

                if (ini.SectionExists("Background"))
                {
                    sectionName = "Background";
                }
                else
                if (ini.SectionExists("Tile"))
                {
                    sectionName = "Tile";
                }
                else
                if (ini.SectionExists("BackgroundTop"))
                {
                    sectionName = "BackgroundTop";
                }
                else
                if (ini.SectionExists("BackgroundBottom"))
                {
                    sectionName = "BackgroundBottom";
                }

                if (ini.ValueExists(sectionName, "LeftMargin"))
                {
                    leftMargin = ini.ReadInteger(sectionName, "LeftMargin", 0);
                }
                else
                {
                    leftMargin = ini.ReadInteger(sectionName, "LeftWidth", 0);
                }

                textOffset = ini.ReadInteger("Background", "TextOffset", leftMargin);

                if (ini.ValueExists(sectionName, "RightMargin"))
                {
                    rightMargin = ini.ReadInteger(sectionName, "RightMargin", 0);
                }
                else
                {
                    rightMargin = ini.ReadInteger(sectionName, "RightWidth", 0);
                }

                if (ini.ValueExists(sectionName, "TopMargin"))
                {
                    topMargin = ini.ReadInteger(sectionName, "TopMargin", 0);
                }
                else
                {
                    topMargin = ini.ReadInteger(sectionName, "TopHeight", 0);
                }

                if (ini.ValueExists(sectionName, "BottomMargin"))
                {
                    bottomMargin = ini.ReadInteger(sectionName, "BottomMargin", 0);
                }
                else
                {
                    bottomMargin = ini.ReadInteger(sectionName, "BottomHeight", 0);
                }

                if (ini.ValueExists(sectionName, "Outside-LeftMargin"))
                {
                    outsideLeftMargin = ini.ReadInteger(sectionName, "Outside-LeftMargin", 0);
                }
                else
                {
                    outsideLeftMargin = ini.ReadInteger(sectionName, "OutsideBorderLeft", 0);
                }

                if (ini.ValueExists(sectionName, "Outside-TopMargin"))
                {
                    outsideTopMargin = ini.ReadInteger(sectionName, "Outside-TopMargin", 0);
                }
                else
                {
                    outsideTopMargin = ini.ReadInteger(sectionName, "OutsideBorderTop", 0);
                }

                if (ini.ValueExists(sectionName, "Outside-BottomMargin"))
                {
                    outsideBottomMargin = ini.ReadInteger(sectionName, "Outside-BottomMargin", 0);
                }
                else
                {
                    outsideBottomMargin = ini.ReadInteger(sectionName, "OutsideBorderBottom", 0);
                }

                if (ini.ValueExists(sectionName, "Outside-RightMargin"))
                {
                    outsideRightMargin = ini.ReadInteger(sectionName, "Outside-RightMargin", 0);
                }
                else
                {
                    outsideRightMargin = ini.ReadInteger(sectionName, "OutsideBorderRight", 0);
                }

                backgroundName = ini.ReadString(sectionName, "Image", string.Empty);

                ButtonSize = ini.ReadInteger("Background", "ButtonSize", 60);


                //read stone info
                indicatorRect   = (Rectangle)rc.ConvertFromInvariantString(ini.ReadString("Stone", "Indicator-Rect", "0, 0, 100, 100"));
                IndicatorLeft   = ini.ReadInteger("Stone", "Indicator-Left", 0);
                IndicatorBottom = ini.ReadInteger("Stone", "Indicator-Bottom", 0);

                indicatorImageName = ini.ReadString("Stone", "Indicator", string.Empty);
                if (!string.IsNullOrEmpty(indicatorImageName))
                {
                    indicatorImageName = Path.Combine(skinFolder, indicatorImageName);
                }


                if (ini.SectionExists("Stone"))
                {
                    stoneMarginTop    = ini.ReadInteger("Stone", "OutsideBorderTop", 0);
                    stoneMarginBottom = ini.ReadInteger("Stone", "OutsideBorderBottom", 0);
                    stoneMarginLeft   = ini.ReadInteger("Stone", "OutsideBorderLeft", 0);
                    stoneMarginRight  = ini.ReadInteger("Stone", "OutsideBorderRight", 0);
                    stoneBorder       = ini.ReadInteger("Stone", "Border", 0);
                    stoneName         = ini.ReadString("Stone", "Image", backgroundName);
                }
                else
                {
                    stoneMarginTop    = outsideTopMargin;
                    stoneMarginBottom = outsideBottomMargin;
                    stoneMarginLeft   = outsideLeftMargin;
                    stoneMarginRight  = outsideRightMargin;
                    stoneName         = backgroundName;
                    stoneBorder       = 0;
                }

                if (string.IsNullOrEmpty(backgroundName))
                {
                    return(false);
                }
                else
                {
                    if (background != null)
                    {
                        background.Dispose();
                        background = null;
                    }
                    try
                    {
                        background = FastBitmap.FromFile(Path.Combine(skinFolder, backgroundName));
                        if (background == null)
                        {
                            return(false);
                        }
                    }
                    catch
                    {
                        return(false);
                    }
                }

                if (string.IsNullOrEmpty(stoneName))
                {
                    return(false);
                }
                else
                {
                    if (stone != null)
                    {
                        stone.Dispose();
                        stone = null;
                    }
                    try
                    {
                        stone = FastBitmap.FromFile(Path.Combine(skinFolder, stoneName));
                        if (stone == null)
                        {
                            return(false);
                        }
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            finally
            {
                ini.Dispose();
            }
            return(true);
        }