Esempio n. 1
0
        public static string exportSingleFile(string tileName, string srcPath, bool neverWrapPdb)
        {
            string newSrcPath = srcPath;

            string fileNameDst = tileName + ".jpg";
            string dstPath = Path.Combine(Project.exportDestFolder, fileNameDst);

            // format conversions:
            switch(Project.pdaExportImageFormat)
            {
                case 0:		// bmp websafe
                case 1:		// bmp optimized
                    newSrcPath = CameraTrack.convertAndSaveTileImage(tileName, srcPath, Path.GetTempPath());
                    fileNameDst = tileName + ".bmp";
                    dstPath = Path.Combine(Project.exportDestFolder, fileNameDst);
                    break;
                case 2:		// jpeg
                    break;
            }

            // now either pack it in PDB, or just copy to destination:
            if(!neverWrapPdb && Project.pdaExportWrapPdb)
            {
                PalmPdbFormat ppf = new PalmPdbFormat();
                string catalogName = tileName; //dstPath;

                string fileNamePdb = tileName + ".pdb";
                dstPath = Path.Combine(Project.exportDestFolder, fileNamePdb);

                int format = Project.pdaExportImageFormat + (Project.pdaExportUseWebsafeGrayscalePalette ? 4 : 0);
                ppf.PackImageIntoPdb(catalogName, newSrcPath, dstPath, format);
            }
            else
            {
                if(File.Exists(dstPath))
                {
                    File.Delete(dstPath);
                }
                File.Copy(newSrcPath, dstPath, true);
            }

            // get rid of temp file:
            if(!newSrcPath.Equals(srcPath))
            {
                try
                {
                    File.Delete(newSrcPath);
                }
                catch {}
            }
            return dstPath;
        }
Esempio n. 2
0
        //, string imagesPdbFilePath)
        // takes destination names for .pdb files. May throw file-related exceptions.
        public void save(string catalogName, string descrPdbFilePath)
        {
            int LINES_PER_CHUNK = 200;

            PalmPdbFormat ppf = new PalmPdbFormat();

            FileStream fsIn = new FileStream(m_descrFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
            TextReader textReader = new StreamReader(fsIn);

            /*
            // create a .pdb file from text, broken into chunks of reasonable size to fit into 32kb/record limitation:
            ppf.MakeTextPdb("descr", LINES_PER_CHUNK, textReader, descrPdbFilePath);

            fsIn.Close();

            // pack all .bmp files from the specified source folder into a .pdb file:
            ppf.PackImagesIntoPdb(catalogName, m_camtrackFolderPath, imagesPdbFilePath);
            */

            ppf.PackImagesAndDescrIntoPdb(catalogName, m_camtrackFolderPath, descrPdbFilePath, LINES_PER_CHUNK, textReader);

            fsIn.Close();
        }