Esempio n. 1
0
        public static Bitmap FromFile(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return(null);
            }

            if (FileOperations.FileExists(filename))
            {
                if (FileOperations.FileExtensionIs(filename, ".png"))
                {
                    int    w = 0;
                    int    h = 0;
                    IntPtr ppvBits;
                    IntPtr hBitmap = NativeMethods.LoadBitmapPNG(filename, ref w, ref h, out ppvBits);
                    if (hBitmap != IntPtr.Zero)
                    {
                        Bitmap     result = new Bitmap(w, h, PixelFormat.Format32bppArgb);
                        BitmapData data   = result.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                        NativeMethods.RtlMoveMemory(data.Scan0, ppvBits, h * data.Stride); // copies the bitmap
                        result.UnlockBits(data);
                        NativeMethods.DeleteObject(hBitmap);
                        result = BitmapPainter.ConvertTo32Bit(result, true);
                        return(result);
                    }
                }

                if (FileOperations.FileExtensionIs(filename, ".jpg") || FileOperations.FileExtensionIs(filename, ".jpeg"))
                {
                    int    w = 0;
                    int    h = 0;
                    IntPtr ppvBits;
                    IntPtr hBitmap = NativeMethods.LoadBitmapJPG(filename, ref w, ref h, out ppvBits);
                    if (hBitmap != IntPtr.Zero)
                    {
                        Bitmap     result = new Bitmap(w, h, PixelFormat.Format24bppRgb);
                        BitmapData data   = result.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                        NativeMethods.RtlMoveMemory(data.Scan0, ppvBits, h * data.Stride); // copies the bitmap
                        result.UnlockBits(data);
                        NativeMethods.DeleteObject(hBitmap);
                        Bitmap realResult = BitmapPainter.ConvertTo32Bit(result, true);
                        return(realResult);
                    }
                }

                if (FileOperations.FileExtensionIs(filename, ".ico"))
                {
                    Icon   icon   = new Icon(FileOperations.StripFileName(filename));
                    Bitmap result = icon.ToBitmap();
                    icon.Dispose();
                    return(result);
                }

                Bitmap image = null;
                IntPtr zero  = IntPtr.Zero;
                int    imageType;

                if (NativeMethods.GdipLoadImageFromFile(FileOperations.StripFileName(filename), out zero) != 0)
                {
                    return(null);
                }

                if (NativeMethods.GdipGetImageType(zero, out imageType) != 0)
                {
                    return(null);
                }

                if (imageType == 1)
                {
                    image = (Bitmap)typeof(System.Drawing.Bitmap).InvokeMember("FromGDIplus", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { zero });
                }

                if (!NativeMethods.IsAnimatedGIF(filename))
                {
                    image = BitmapPainter.ConvertTo32Bit(image, true);
                }

                return(image);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public void Merge(string extraFile)
        {
            string s;
            string currentSection = null;

            string[] content;
            Encoding extraEncoding;

            if (string.IsNullOrEmpty(extraFile))
            {
                return;
            }

            if (!FileOperations.FileExists(extraFile))
            {
                return;
            }

            extraEncoding = NativeMethods.GetFileEncoding(extraFile);

            using (StreamReader reader = new StreamReader(extraFile, extraEncoding, false, 512))
            {
                while ((s = reader.ReadLine()) != null)
                {
                    //s = s.Trim();

                    if (string.IsNullOrEmpty(s))
                    {
                        continue;
                    }

                    if (s[0] == ';')
                    {
                        continue;
                    }

                    if ((s[0] == openSection) && (s[s.Length - 1] == closeSection))
                    {
                        currentSection = s.Substring(1, s.Length - 2);
                        sections.Add(currentSection);
                    }
                    else
                    {
                        if (currentSection == null)
                        {
                            continue;
                        }

                        int j = s.IndexOf(divider);
                        if (j > 0)
                        {
                            content = s.Split(new char[1] {
                                divider
                            }, 2);
                            if (content.Length == 2)
                            {
                                sections[currentSection].Add(content[0].Trim(), content[1].Trim());
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public FileItem(string fileName)
 {
     this.fileName = FileOperations.StripFileName(fileName);
     name          = Path.GetFileNameWithoutExtension(FileOperations.StripFileName(fileName));
 }
Esempio n. 4
0
        public static Image DownloadSiteIcon(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(BitmapPainter.ResizeBitmap(FastBitmap.FromFile(FileOperations.StripFileName(imageName)), FileImage.ImageSize, FileImage.ImageSize, true));
                            }
                        }
                    }

                    //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(BitmapPainter.ResizeBitmap(FastBitmap.FromFile(FileOperations.StripFileName(imageName)), FileImage.ImageSize, FileImage.ImageSize, true));
                            }
                        }
                    }
                }
                finally
                {
                    iniFile.Dispose();
                }
            }

            return(null);
        }
Esempio n. 5
0
        public unsafe void Load()
        {
            string s;
            string currentSection = null;

            string[] content;


            sections.Clear();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            if (!FileOperations.FileExists(fileName))
            {
                return;
            }

            TextFileReader reader = null;

            try
            {
                try
                {
                    reader = new TextFileReader(fileName, encoding);
                    while ((s = reader.ReadLine()) != null)
                    {
                        if (string.IsNullOrEmpty(s))
                        {
                            continue;
                        }

                        if (s[0] == ';')
                        {
                            continue;
                        }

                        if ((s[0] == openSection) && (s[s.Length - 1] == closeSection))
                        {
                            currentSection = s.Substring(1, s.Length - 2);
                            sections.Add(currentSection);
                        }
                        else
                        {
                            if (currentSection == null)
                            {
                                continue;
                            }

                            int j = s.IndexOf(divider);
                            if (j > 0)
                            {
                                content = s.Split(new char[1] {
                                    divider
                                }, 2);
                                if (content.Length == 2)
                                {
                                    sections[currentSection].Add(content[0].Trim(), content[1].Trim());
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    TraceDebug.Trace("MemIniFile.Load: " + ex.Message);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Get the image for the specified file type.
        /// You can provide the full file name, for example doc1.docx
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>Image or null. The size of the image = size of the icon</returns>
        private static Image FileTypeImage(string fileName)
        {
            Image      result = null;
            Icon       icon   = null;
            IconFlags  flags;
            IntPtr     hIcon = IntPtr.Zero;
            IntPtr     shellInfo;
            IconSize   size;
            IImageList iImageList = null;

            if (!string.IsNullOrEmpty(fileName))
            {
                SHFILEINFO fileInfo = new SHFILEINFO();
                fileName = FileSearch.FullPath(fileName);

                if (FileOperations.FileOrFolderExists(fileName))
                {
                    fileInfo.dwAttributes = (uint)File.GetAttributes(fileName);
                }

                //first try to query the icon location and get the icon from there
                flags     = IconFlags.LargeIcon | IconFlags.IconLocation | IconFlags.UseFileAttributes;
                shellInfo = NativeMethods.SHGetFileInfo(fileName, 0, ref fileInfo, (uint)Marshal.SizeOf(fileInfo), flags);
                if (shellInfo == (IntPtr)1)
                {
                    //we have the result, try to parse it
                    if (FileOperations.FileIsIcon(fileInfo.szDisplayName))
                    {
                        icon   = new Icon(fileInfo.szDisplayName);
                        result = ConvertIconToBitmap(icon);
                        icon.Dispose();
                        return(result);
                    }
                    else
                    if (FileOperations.FileIsExe(fileName))
                    {
                        result = ExtractIconFromExecutable(fileInfo.szDisplayName, (int)fileInfo.iIcon);
                    }
                }

                if (result != null)
                {
                    return(result);
                }

                //if we have no result: continue to search using system image list
                flags = IconFlags.LargeIcon | IconFlags.SysIconIndex;
                if (!FileOperations.FileOrFolderExists(fileName))
                {
                    flags = flags | IconFlags.UseFileAttributes;
                }
                shellInfo = NativeMethods.SHGetFileInfo(fileName, 0, ref fileInfo, (uint)Marshal.SizeOf(fileInfo), flags);

                if (shellInfo == IntPtr.Zero)
                {
                    return(null);
                }


                size = IconSize.ExtraLarge;

                if (InteropHelper.RunningOnXP)
                {
                    Guid iidImageList = new Guid("46EB5926-582E-4017-9FDF-E8998DAA0950");
                    NativeMethods.SHGetImageList(
                        (int)size,
                        ref iidImageList,
                        ref iImageList
                        );
                    // the image list handle is the IUnknown pointer, but
                    // using Marshal.GetIUnknownForObject doesn't return
                    // the right value.  It really doesn't hurt to make
                    // a second call to get the handle:
                    NativeMethods.SHGetImageListHandle((int)size, ref iidImageList, ref shellInfo);
                }

                if (iImageList == null)
                {
                    hIcon = NativeMethods.ImageList_GetIcon(shellInfo, (int)fileInfo.iIcon, NativeMethods.ILD_TRANSPARENT);
                }
                else
                {
                    iImageList.GetIcon((int)fileInfo.iIcon, (int)NativeMethods.ILD_TRANSPARENT, ref hIcon);
                }

                if (hIcon == IntPtr.Zero)
                {
                    return(null);
                }

                icon = Icon.FromHandle(hIcon);
                //do not destroy icon from the system image list
                //NativeMethods.DestroyIcon(hIcon);
                result = ConvertIconToBitmap(icon);
            }


            if (icon != null)
            {
                icon.Dispose();
            }

            if (result != null)
            {
                result = BitmapPainter.ResizeBitmap(result, imageSize, imageSize, true);
            }

            return(result);
        }
Esempio n. 7
0
        private static Image FileNameImageInternal(string fileName)
        {
            Image result = null;
            Icon  icon   = null;

            if (!string.IsNullOrEmpty(fileName))
            {
                fileName = FileOperations.StripFileName(fileName);
                //if we have only name of the file without path
                //try to find it in the search path of Windows
                fileName = FileSearch.FullPath(fileName);

                if (!FileOperations.FileOrFolderExists(fileName))
                {
                    result = FileTypeImage(fileName);
                    return(result);
                }

                //if this is a link to executable with original
                //executable icon
                if (FileOperations.FileIsLink(fileName))
                {
                    result = TryExtractImageFromShellLink(fileName);
                    if (result != null)
                    {
                        return(result);
                    }
                }

                if (FileOperations.FileIsImage(fileName))
                {
                    try
                    {
                        result = Image.FromFile(fileName);
                        result = BitmapPainter.ResizeBitmap(result, imageSize, imageSize, true);
                    }
                    catch
                    {
                        result = null;
                    }
                    if (result != null)
                    {
                        return(result);
                    }
                }

                // 1. The file is icon
                // 2. The file is exe or dll
                // 3. The file is a shell link .lnk
                // 4. Other file types
                if (FileOperations.FileIsIcon(fileName))
                {
                    //Simply load icon from file
                    icon = new Icon(fileName);
                }
                else
                //Extract icon from exe or dll directly
                if (FileOperations.FileIsExe(fileName))
                {
                    return(ExtractIconFromExecutable(fileName));
                }
                else
                {
                    result = FileTypeImage(fileName);
                    return(result);
                }

                result = ConvertIconToBitmap(icon);
            }

            if (icon != null)
            {
                icon.Dispose();
            }

            return(result);
        }
Esempio n. 8
0
 public KrentoMenuSkin(string skinFileName)
 {
     this.skinFileName = FileOperations.StripFileName(skinFileName);
 }
Esempio n. 9
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();
            }
        }
Esempio n. 10
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();
            }
        }