Exemple #1
0
        static void Run(string symbolname, string srcfile, string dstpath, IList <int> zoomlevel, bool overwrite)
        {
            Console.Error.WriteLine("Symbolname: " + symbolname);
            Console.Error.WriteLine("File:       " + srcfile);
            Console.Error.WriteLine("Outputpath: " + dstpath);

            if (!File.Exists(srcfile))
            {
                throw new Exception("File '" + srcfile + "' not exist.");
            }

            string extension = Path.GetExtension(srcfile).ToUpper();

            if (extension == ".DEM")
            {
                using (GarminCore.BinaryReaderWriter dembr = new GarminCore.BinaryReaderWriter(srcfile, true)) {
                    CalculateDem(dembr, dstpath, Path.GetFileNameWithoutExtension(srcfile), overwrite, symbolname, zoomlevel);
                }
            }
            else if (extension == ".IMG")
            {
                GarminCore.DskImg.SimpleFilesystem sf = new GarminCore.DskImg.SimpleFilesystem();
                using (GarminCore.BinaryReaderWriter br = new GarminCore.BinaryReaderWriter(srcfile, true)) {
                    sf.Read(br);

                    for (int i = 0; i < sf.FileCount; i++)
                    {
                        string filename = sf.Filename(i);
                        if (Path.GetExtension(filename).ToUpper() == ".DEM")
                        {
                            using (GarminCore.BinaryReaderWriter dembr = sf.GetBinaryReaderWriter4File(filename)) {
                                CalculateDem(dembr, dstpath, Path.GetFileNameWithoutExtension(filename), overwrite, symbolname, zoomlevel);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 public Content4LogicalFile(GarminCore.DskImg.SimpleFilesystem sfs, int fileidx) : base(sfs.Filename(fileidx))
 {
     Filelength   = sfs.Filesize(fileidx);
     BinaryReader = sfs.GetBinaryReaderWriter4File(Filename);
     GarminFile   = null;
 }