Exemplo n.º 1
0
        /// <summary>
        /// Load grids from the specified folder
        /// </summary>
        /// <param name="strGridsFolder"></param>
        /// <param name="recursive"></param>
        public void InitializeExternalGrids(string strGridsFolder, bool recursive)
        {
            SearchOption opt = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;

            string[]      gridTypes = new[] { "*.los", "*.gsb", "*.dat", "*.lla" };
            List <string> names     = new List <string>();

            foreach (string gridType in gridTypes)
            {
                string[] tmp = Directory.GetFiles(strGridsFolder, gridType, opt);
                names.AddRange(tmp);
            }

            foreach (string s in names)
            {
                string coreName = "@" + Path.GetFileNameWithoutExtension(s);
                if (_tables.ContainsKey(coreName))
                {
                    continue;
                }
                string ext = Path.GetExtension(s).ToLower();
                if (ext != ".los" && ext != ".gsb" && ext != ".dat")
                {
                    continue;
                }
                if (ext == ".los" && !File.Exists(s.Replace(".los", ".las")))
                {
                    continue;
                }
                NadTable nt = NadTable.FromSourceName(s, false);
                _tables.Add(coreName, nt);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of NadTables
        /// </summary>
        public NadTables()
        {
            _tables = new Dictionary <string, NadTable>();
            Assembly a = Assembly.GetExecutingAssembly();

            string[] names = a.GetManifestResourceNames();

            foreach (string s in names)
            {
                string[] ss       = s.Split('.');
                string   coreName = "@" + ss[ss.Length - 2];
                if (_tables.ContainsKey(coreName))
                {
                    continue;
                }
                string ext = Path.GetExtension(s).ToLower();
                if (ext != ".lla" && ext != ".dat" && ext != ".gsb")
                {
                    continue;
                }
                Stream text = a.GetManifestResourceStream(s);
                if (text == null)
                {
                    continue;
                }
                NadTable nt = NadTable.FromSourceName(s);
                _tables.Add(coreName, nt);
            }
        }