Beispiel #1
0
            public void CreateKMZ()
            {
                ZipEngine zip = new ZipEngine();
                List<Mohid.Files.FileInfo> files = new List<Mohid.Files.FileInfo>();

                ChangeList.Add("<<name>>", null);

                FileTools.FindFiles(ref files, SearchPath, ImageExtension, true, null);

                foreach (Mohid.Files.FileInfo image_file in files)
                {
                   if (string.IsNullOrWhiteSpace(KMZOutput.FullName))
                  KMZOutput.FullName = image_file.FileName.Name + ".kmz";
                   else
                  KMZOutput.Extension = "kmz";

                   if (Regex.IsMatch(image_file.FileName.FullName, ImageFileNameMask))
                   {
                  if (OverwriteKMZ == CopyOptions.IGNORE)
                     if (File.Exists(KMZOutput.FullPath))
                        continue;

                  if (ChangeTemplate)
                  {
                     ChangeList["<<name>>"] = image_file.FileName.Name;
                     TextFile.Replace(KMLTemplate.FullPath, KMLOutput.FullPath, ref ChangeList);
                  }
                  else
                     FileTools.CopyFile(KMLTemplate, KMLOutput, CopyOptions.OVERWRIGHT);

                  zip.AddFile(SearchPath.Path + image_file.FileName.FullName, KMZImageFolder.Path);
                  zip.AddFile(KMLOutput.FullPath, "");
                  zip.SaveZipToFile(KMZOutput);
                  zip.ClearList();
                   }
                }
            }