private static void GenerateRegistryFile(ITaskRunner taskRunner, bool addFile)
        {
            string regFileName = Path.Combine(
                taskRunner.MapMakerSettings.OutputPath,
                String.Format(
                    CultureInfo.InvariantCulture,
                    addFile ? "{0}_add.reg" : "{0}_delete.reg",
                    taskRunner.MapMakerSettings.ProductCode));

            using (StreamWriter writer = new StreamWriter(regFileName))
            {
                writer.WriteLine("REGEDIT4");
                writer.WriteLine();
                writer.WriteLine(
                    @"[{0}HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Families\{1}]",
                    addFile ? "" : "-",
                    taskRunner.MapMakerSettings.FamilyName);

                if (addFile)
                {
                    writer.WriteLine(
                        @"""ID""=hex:{0:x},{1:x}",
                        taskRunner.MapMakerSettings.FamilyCode & 0xff,
                        (taskRunner.MapMakerSettings.FamilyCode >> 8) & 0xff);
                    writer.WriteLine(@"""TYP""=""{0}""",
                                     MakeRegeditFriendlyPath(Path.GetFullPath(
                                                                 taskRunner.GetProductFile(GenerateTypeFileTask.TypeFile).
                                                                 ProductFileName)));
                    writer.WriteLine();

                    writer.WriteLine(
                        @"[HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Families\{0}\{1}]",
                        taskRunner.MapMakerSettings.FamilyName,
                        taskRunner.MapMakerSettings.ProductCode);
                    writer.WriteLine(@"""LOC""=""{0}""",
                                     MakeRegeditFriendlyPath(Path.GetFullPath(taskRunner.MapMakerSettings.OutputPath)));
                    writer.WriteLine(@"""BMAP""=""{0}""",
                                     MakeRegeditFriendlyPath(Path.GetFullPath(
                                                                 taskRunner.GetProductFile(GeneratePreviewAndTdbFilesTask.PreviewImgFile).
                                                                 ProductFileName)));
                    writer.WriteLine(@"""TDB""=""{0}""",
                                     MakeRegeditFriendlyPath(Path.GetFullPath(
                                                                 taskRunner.GetProductFile(GeneratePreviewAndTdbFilesTask.TdbFile).ProductFileName)));
                }
            }

            taskRunner.RegisterProductFile(
                new ProductFile(
                    addFile ? MapSourceAddRegFile : MapSourceDeleteRegFile,
                    regFileName,
                    false));
        }
Exemple #2
0
        public void Execute(ITaskRunner taskRunner)
        {
            string sendMapMapListFileName = Path.GetFullPath(
                Path.Combine(
                    taskRunner.MapMakerSettings.TempDir,
                    String.Format(
                        CultureInfo.InvariantCulture,
                        "filelist_{0}.txt",
                        taskRunner.MapMakerSettings.ProductCode)));

            using (FileStream stream = File.Open(sendMapMapListFileName, FileMode.Create))
            {
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    writer.WriteLine(":region");
                    // first add the TYP file
                    writer.WriteLine(Path.GetFileName(
                                         taskRunner.GetProductFile(GenerateTypeFileTask.TypeFile).ProductFileName));

                    foreach (ProductFile file in taskRunner.ListProductFiles(GenerateMapImgFilesTask.MapImgFileName))
                    {
                        writer.WriteLine(Path.GetFileName(file.ProductFileName));
                    }
                }
            }

            taskRunner.RegisterProductFile(new ProductFile(SendMapListFileType, sendMapMapListFileName, false));
        }
Exemple #3
0
        public void Execute(ITaskRunner taskRunner)
        {
            ProductFile file = taskRunner.GetProductFile(GeneratePreviewPolishFileTask.PolishPreviewFile);

            if (file == null)
            {
                consoleLogger.WriteLine(log, Level.Warn, "WARNING: there is no polish preview file to process, preview file will not be generated");
                return;
            }

            taskRunner.RunCPreview(
                "\"{0}\"",
                file.ProductFileName);

            string previewIntermediateFile = Path.GetFullPath(
                Path.Combine(
                    taskRunner.MapMakerSettings.TempDir,
                    String.Format(
                        CultureInfo.InvariantCulture,
                        "{0}.mp",
                        taskRunner.MapMakerSettings.ProductCode)));

            taskRunner.RunCGpsMapper(
                "\"{0}\"",
                previewIntermediateFile);

            taskRunner.RegisterProductFile(new ProductFile(PreviewImgFile, Path.ChangeExtension(previewIntermediateFile, ".img"), false));
            taskRunner.RegisterProductFile(new ProductFile(TdbFile, Path.ChangeExtension(previewIntermediateFile, ".tdb"), false));
        }
Exemple #4
0
        public void Execute(ITaskRunner taskRunner)
        {
            ProductFile polishTypeFile = taskRunner.GetProductFile(GenerateMapTypesPolishFileTask.PolishTypeFile);

            string typeFileName = (Path.Combine(
                                       Path.GetDirectoryName(polishTypeFile.ProductFileName),
                                       Path.GetFileNameWithoutExtension(polishTypeFile.ProductFileName)));

            taskRunner.RunCGpsMapper(
                "typ \"{0}\" \"{1}\"",
                Path.GetFileName(polishTypeFile.ProductFileName),
                Path.GetFileName(typeFileName));

            taskRunner.RegisterProductFile(new ProductFile(TypeFile, typeFileName, false));
        }
        public void Execute(ITaskRunner taskRunner)
        {
            // first send a dummy map, so that we avoid the "memory effect"
            string dummyMapPath = Path.GetFullPath(
                Path.Combine(
                    Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                    "DummyMap.img"));

            taskRunner.RunSendMap(".", "\"{0}\"", dummyMapPath);

            string listFileName = taskRunner.GetProductFile(GenerateMapListFileTask.SendMapListFileType).ProductFileName;

            // now send the real map
            taskRunner.RunSendMap(
                Path.GetDirectoryName(listFileName),
                "-f \"{0}\"",
                Path.GetFileName(listFileName));
        }