/// <summary>
        /// Analyzes raster file, displaying possible open strategies
        /// </summary>
        /// <param name="filename">
        /// The path.
        /// </param>
        /// <param name="theForm">
        /// The the Form.
        /// </param>
        /// <returns>
        /// True on success
        /// </returns>
        private static bool AnalyzeFiles(string filename, Form1 theForm)
        {
            error = false;

            // running check for all files with such extensions
            var manager = new FileManager();

            var count = 0;

            // getting list of extension for images and grids
            var img    = new Image();
            var filter = img.CdlgFilter.Replace("*.", string.Empty);
            var dict   = filter.Split(new[] { '|' }).ToDictionary(item => item);

            var grid = new Grid();

            filter = grid.CdlgFilter.Replace("*.", string.Empty);
            var dict2 = filter.Split(new[] { '|' }).ToDictionary(item => item);

            dict = dict.Keys.Union(dict2.Keys).ToDictionary(item => item);

            var notSupportedExtensions = new HashSet <string>();

            if (File.Exists(filename))
            {
                var extension = Path.GetExtension(filename);
                if (extension != null)
                {
                    var ext = extension.Substring(1).ToLower();

                    if (dict.ContainsKey(ext))
                    {
                        Write(string.Format("{0}. Filename: {1}", count++, Path.GetFileName(filename)));
                        Write(string.Format("Is supported: {0}", manager.IsSupported[filename]));
                        Write(string.Format("Is RGB image: {0}", manager.IsRgbImage[filename]));
                        Write(string.Format("Is grid: {0}", manager.IsGrid[filename]));
                        Write(string.Format("DEFAULT OPEN STRATEGY: {0}", manager.OpenStrategy[filename]));
                        Write(
                            string.Format(
                                "Can open as RGB image: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosRgbImage]));
                        Write(
                            string.Format(
                                "Can open as direct grid: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosDirectGrid]));
                        Write(
                            string.Format(
                                "Can open as proxy grid: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosProxyForGrid]));
                        Write(string.Format("------------------------------------------"));

                        Write(string.Format(string.Empty));

                        // TODO: try to open with these strategies
                        var rst = manager.OpenRaster(filename, tkFileOpenStrategy.fosAutoDetect, theForm);
                        if (rst != null)
                        {
                            MyAxMap.Clear();
                            MyAxMap.Tiles.Visible = false;
                            if (MyAxMap.AddLayer(rst, true) == -1)
                            {
                                Error("Cannot add the raster file to the map");
                            }
                        }
                        else
                        {
                            Error("Cannot load the raster file");
                        }
                    }
                    else
                    {
                        if (!notSupportedExtensions.Contains(ext))
                        {
                            notSupportedExtensions.Add(ext);
                        }
                    }
                }
            }
            else
            {
                Error(filename + " does not exists.");
            }

            if (notSupportedExtensions.Any())
            {
                Write("The following extensions, are among common dialog filters:");
                foreach (var extension in notSupportedExtensions.ToList())
                {
                    Write(extension);
                }
            }

            return(!error);
        }