public override void AddFilesToCabinet(FileCabinet fc)
        {
            string fName = filename;

            bool copy = true;

            string fileName = fc.TempDirectory + string.Format("{0}\\{1}.txt", fc.PackageID, this.ID.ToString());
            string path     = fName.Substring(0, fName.LastIndexOf('\\') + 1);
            string path2    = fileName.Substring(0, fileName.LastIndexOf('\\') + 1);

            if (copy)
            {
                if (!Directory.Exists(path2))
                {
                    Directory.CreateDirectory(path2);
                }
                if (File.Exists(fName) && !File.Exists(fileName))
                {
                    File.Copy(fName, fileName);
                }
            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
        }
Exemple #2
0
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return;
            }

            string fName = filename;

            bool copy = !fName.Contains(ID.ToString());

            string fileName = fc.TempDirectory + string.Format("{0}\\{1}.png", fc.PackageID, this.ID.ToString());
            string path     = fName.Substring(0, fName.LastIndexOf('\\') + 1);

            if (copy)
            {
                if (File.Exists(fName) && !File.Exists(fileName))
                {
                    File.Copy(fName, fileName);
                }
            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            if (imageSet.WcsImage != null)
            {
                string fName = imageSet.WcsImage.Filename;

                bool   copy      = !fName.Contains(ID.ToString());
                string extension = Path.GetExtension(fName);

                string fileName = fc.TempDirectory + string.Format("{0}\\{1}{2}", fc.PackageID, this.ID.ToString(), extension);
                string path     = fName.Substring(0, fName.LastIndexOf('\\') + 1);

                if (fName != fileName)
                {
                    if (File.Exists(fName) && !File.Exists(fileName))
                    {
                        File.Copy(fName, fileName);
                    }
                }

                if (File.Exists(fileName))
                {
                    fc.AddFile(fileName);
                }
            }
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            var fName = filename;

            var copy = true;

            var fileName = fc.TempDirectory + string.Format("{0}\\{1}.txt", fc.PackageID, ID);
            var path = fName.Substring(0, fName.LastIndexOf('\\') + 1);
            var path2 = fileName.Substring(0, fileName.LastIndexOf('\\') + 1);

            if (copy)
            {
                if (!Directory.Exists(path2))
                {
                    Directory.CreateDirectory(path2);
                }
                if (File.Exists(fName) && !File.Exists(fileName))
                {
                    File.Copy(fName, fileName);
                }

            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            if (imageSet.WcsImage != null)
            {
                string fName = imageSet.WcsImage.Filename;

                bool copy = !fName.Contains(ID.ToString());
                string extension = Path.GetExtension(fName);

                string fileName = fc.TempDirectory + string.Format("{0}\\{1}{2}", fc.PackageID, this.ID.ToString(), extension);
                string path = fName.Substring(0, fName.LastIndexOf('\\') + 1);

                if (fName != fileName)
                {
                    if (File.Exists(fName) && !File.Exists(fileName))
                    {
                        File.Copy(fName, fileName);
                    }

                }

                if (File.Exists(fileName))
                {
                    fc.AddFile(fileName);
                }

            }
        }
Exemple #6
0
        public void SaveToFile(string saveFilename)
        {
            GC.Collect();
            SaveToXml(false);

            FileCabinet fc = new FileCabinet(saveFilename, BaseWorkingDirectory);

            fc.PackageID      = this.Id;
            this.saveFileName = saveFilename;
            fc.AddFile(filename);

            List <Guid> masterList = CreateLayerMasterList();

            string path = fc.TempDirectory + string.Format("{0}", fc.PackageID);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }



            foreach (Guid id in masterList)
            {
                if (LayerManager.LayerList.ContainsKey(id))
                {
                    LayerManager.LayerList[id].AddFilesToCabinet(fc);
                }
            }

            fc.Package();
            TourDirty = false;
        }
Exemple #7
0
        public void MergeTour(string filename)
        {
            FileCabinet cab = new FileCabinet(filename, BaseWorkingDirectory);

            cab.Extract(false, WorkingDirectory);

            MergeTourStopsFromXml(cab.MasterFile);
        }
Exemple #8
0
        public static TourDocument FromFile(string filename, bool forEdit)
        {
            FileCabinet cab = new FileCabinet(filename, BaseWorkingDirectory);

            cab.Extract();
            TourDocument newTour = TourDocument.FromXml(cab.MasterFile);

            if (forEdit)
            {
                newTour.SaveFileName = filename;
            }

            return(newTour);
        }
Exemple #9
0
        public static LayerContainer FromFile(string filename, bool forEdit, string parentFrame, bool referenceFrameRightClick)
        {
            FileCabinet cab = new FileCabinet(filename, BaseWorkingDirectory);

            cab.Extract();
            LayerContainer newDoc = LayerContainer.FromXml(cab.MasterFile, parentFrame, referenceFrameRightClick);

            if (forEdit)
            {
                newDoc.SaveFileName = filename;
            }

            return(newDoc);
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            string fName = shapefile.FileName;

            bool copy = !fName.Contains(ID.ToString());

            string fileName    = fc.TempDirectory + string.Format("{0}\\{1}.shp", fc.PackageID, this.ID.ToString());
            string prjFileName = fc.TempDirectory + string.Format("{0}\\{1}.prj", fc.PackageID, this.ID.ToString());
            string dbFileName  = fc.TempDirectory + string.Format("{0}\\{1}.dbf", fc.PackageID, this.ID.ToString());

            string prjFile   = fName.ToUpper().Replace(".SHP", ".PRJ");
            string dbaseFile = fName.ToUpper().Replace(".SHP", ".DBF");

            if (copy)
            {
                if (File.Exists(fName))
                {
                    File.Copy(fName, fileName);
                }

                if (File.Exists(prjFile))
                {
                    File.Copy(prjFile, prjFileName);
                }

                if (File.Exists(dbaseFile))
                {
                    File.Copy(dbaseFile, dbFileName);
                }
                shapefile.FileName = fileName;
            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
            if (File.Exists(prjFileName))
            {
                fc.AddFile(prjFileName);
            }

            // dBase file has the same name but a different (.dbf) extension.
            if (File.Exists(dbFileName))
            {
                fc.AddFile(dbFileName);
            }
        }
Exemple #11
0
        public void SaveToFile(string saveFilename, bool tempFile, bool excludeAudio)
        {
            CleanUp();
            GC.Collect();
            SaveToXml(false);

            FileCabinet fc = new FileCabinet(saveFilename, BaseWorkingDirectory);

            fc.PackageID = this.Id;
            if (!tempFile)
            {
                this.saveFileName = saveFilename;
            }

            fc.AddFile(filename);

            if (authorImage != null)
            {
                fc.AddFile(WorkingDirectory + "Author.Png");
            }

            foreach (TourStop stop in TourStops)
            {
                stop.AddFilesToCabinet(fc, excludeAudio);
            }

            List <Guid> masterList = CreateLayerMasterList();

            foreach (Guid id in masterList)
            {
                if (LayerManager.LayerList.ContainsKey(id))
                {
                    LayerManager.LayerList[id].AddFilesToCabinet(fc);
                }
            }

            fc.Package();
            TourDirty = false;
        }
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     return;
 }
        private static void ExtractCacheCabinet(string filename, bool eraseFirst)
        {
            string dataDir = Properties.Settings.Default.CahceDirectory;
            if (eraseFirst)
            {
                if (Directory.Exists(dataDir))
                {
                    Directory.Delete(dataDir, true);
                }
            }

            FileCabinet cab = new FileCabinet(filename, dataDir);
            cab.Extract();

        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            if (object3d != null)
            {
                string fName = object3d.Filename;

                bool copy = true;
                //bool copy = !fName.Contains(ID.ToString());
                string ext = ObjType ? "obj" : "3ds";
                string fileName = fc.TempDirectory + string.Format("{0}\\{1}.{2}", fc.PackageID, this.ID.ToString(), ext);
                string path = fName.Substring(0, fName.LastIndexOf('\\') + 1);
                string path2 = fileName.Substring(0, fileName.LastIndexOf('\\') + 1);

                if (copy)
                {
                    if (!Directory.Exists(path2))
                    {
                        Directory.CreateDirectory(path2);
                    }
                    if (File.Exists(fName) && !File.Exists(fileName))
                    {
                        File.Copy(fName, fileName);
                    }

                    foreach (string meshfile in object3d.meshFilenames)
                    {
                        if (!String.IsNullOrEmpty(meshfile))
                        {
                            string textureFilename = fc.TempDirectory + string.Format("{0}\\{1}", fc.PackageID, meshfile);
                            string mFilename = path + "\\" + meshfile;
                            string newfilename = Object3d.FindFile(mFilename);
                            if (string.IsNullOrEmpty(newfilename))
                            {
                                newfilename = Object3d.FindFileFuzzy(mFilename);
                            }

                            if (File.Exists(newfilename) && !File.Exists(textureFilename))
                            {
                                File.Copy(newfilename, textureFilename);
                            }
                        }
                    }
                }

                if (File.Exists(fileName))
                {
                    fc.AddFile(fileName);
                }

                foreach (string meshfile in object3d.meshFilenames)
                {
                    if (!string.IsNullOrEmpty(meshfile))
                    {
                        string textureFilename = fc.TempDirectory + string.Format("{0}\\{1}", fc.PackageID, meshfile);
                        fc.AddFile(textureFilename);
                    }
                }
            }
        }
Exemple #15
0
 public virtual void AddFilesToCabinet(FileCabinet fc)
 {
     return;
 }
Exemple #16
0
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     base.AddFilesToCabinet(fc);
 }
        public static LayerContainer FromFile(string filename, bool forEdit, string parentFrame, bool referenceFrameRightClick)
        {
            var cab = new FileCabinet(filename, BaseWorkingDirectory);
            cab.Extract();
            var newDoc = FromXml(cab.MasterFile, parentFrame,  referenceFrameRightClick);
            if (forEdit)
            {
                newDoc.SaveFileName = filename;
            }

            return newDoc;
        }
        public void SaveToFile(string saveFilename)
        {
            GC.Collect();
            SaveToXml(false);

            var fc = new FileCabinet(saveFilename, BaseWorkingDirectory);
            fc.PackageID = Id;
            saveFileName = saveFilename;
            fc.AddFile(filename);

            var masterList = CreateLayerMasterList();

            var path = fc.TempDirectory + string.Format("{0}", fc.PackageID);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            foreach (var id in masterList)
            {
                if (LayerManager.LayerList.ContainsKey(id))
                {
                    LayerManager.LayerList[id].AddFilesToCabinet(fc);
                }
            }

            fc.Package();
            TourDirty = false;
        }
        private static void InjestDirectory(FileCabinet cab, string path)
        {
            foreach (string dir in Directory.GetDirectories(path))
            {
                InjestDirectory(cab, dir);

            }
            foreach (string file in Directory.GetFiles(path))
            {
                cab.AddFile(file);

            }
        }
        private static void ExtractDataCabinet(bool eraseFirst)
        {

            string appdir = Path.GetDirectoryName(Application.ExecutablePath);
            string dataDir = Properties.Settings.Default.CahceDirectory + "data";
            if (eraseFirst)
            {
                if (Directory.Exists(dataDir))
                {
                    Directory.Delete(dataDir, true);
                }
            }
            string filename = appdir + "\\datafiles.cabinet";
            FileCabinet cab = new FileCabinet(filename, dataDir);
            cab.Extract();
            File.WriteAllText(Properties.Settings.Default.CahceDirectory + "data\\wwtv5.2.7.txt", "WWT Version 5.5.7 installed");
        }
        internal void AddFilesToCabinet(FileCabinet fc, bool excludeAudio)
        {
            if (thumbnail != null)
            {
                fc.AddFile(string.Format("{0}{1}.thumb.png", this.owner.WorkingDirectory, id));
            }

            if (!excludeAudio)
            {
                if (musicTrack != null)
                {
                    musicTrack.AddFilesToCabinet(fc);
                }

                if (voiceTrack != null)
                {
                    voiceTrack.AddFilesToCabinet(fc);
                }
            }

            // TODO Add files that were loaded for display..

            foreach (Overlay overlay in overlays)
            {
                overlay.AddFilesToCabinet(fc);
            }
        }
        public static void ExtractCache()
        {
            SaveFileDialog saveDialog = new SaveFileDialog();
            saveDialog.Filter = Language.GetLocalizedText(1056, "WWT Cabinet File(*.cabinet)|*.cabinet");
            saveDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            saveDialog.AddExtension = true;
            saveDialog.DefaultExt = ".cabinet";

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Microsoft\\WorldWideTelescope";

                    FileCabinet cab = new FileCabinet(saveDialog.FileName, Properties.Settings.Default.CahceDirectory);

                    InjestDirectory(cab, path);
                    cab.Package();
                }
                catch (Exception ex)
                {
                    UiTools.ShowMessageBox(ex.Message, "Error Saving cache");
                }
            }
        }
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     return;
 }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            //if (string.IsNullOrEmpty(fileName))
            {
                fileName = fc.TempDirectory + string.Format("{0}\\{1}.txt", fc.PackageID,ID);
            }
            var dir = fileName.Substring(0, fileName.LastIndexOf("\\"));
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            if (!File.Exists(fileName) || dataDirty)
            {
                table.Save(fileName);
            }

            fc.AddFile(fileName);

            base.AddFilesToCabinet(fc);
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            string fName = filename;

            bool copy = !fName.Contains(ID.ToString());

            string fileName = fc.TempDirectory + string.Format("{0}\\{1}.png", fc.PackageID, this.ID.ToString());
            string path = fName.Substring(0, fName.LastIndexOf('\\') + 1);

            if (copy)
            {
                if (File.Exists(fName) && !File.Exists(fileName))
                {
                    File.Copy(fName, fileName);
                }

            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
        }
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            var fName = shapefile.FileName;

            var copy = !fName.Contains(ID.ToString());

            var fileName = fc.TempDirectory + string.Format("{0}\\{1}.shp", fc.PackageID, ID);
            var prjFileName = fc.TempDirectory + string.Format("{0}\\{1}.prj", fc.PackageID, ID);
            var dbFileName = fc.TempDirectory + string.Format("{0}\\{1}.dbf", fc.PackageID, ID);

            var prjFile = fName.ToUpper().Replace(".SHP", ".PRJ");
            var dbaseFile = fName.ToUpper().Replace(".SHP", ".DBF");

            if (copy)
            {
                if (File.Exists(fName))
                {
                    File.Copy(fName, fileName);
                }

                if (File.Exists(prjFile))
                {
                    File.Copy(prjFile, prjFileName);
                }

                if (File.Exists(dbaseFile))
                {
                    File.Copy(dbaseFile, dbFileName);
                }
                shapefile.FileName = fileName;
            }

            if (File.Exists(fileName))
            {
                fc.AddFile(fileName);
            }
            if (File.Exists(prjFileName))
            {
                fc.AddFile(prjFileName);
            }

            // dBase file has the same name but a different (.dbf) extension.
            if (File.Exists(dbFileName))
            {
                fc.AddFile(dbFileName);
            }
        }
Exemple #27
0
        public void MergeTour(string filename)
        {
            var cab = new FileCabinet(filename, BaseWorkingDirectory);
            cab.Extract(false, WorkingDirectory);

            MergeTourStopsFromXml(cab.MasterFile);
        }
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     base.AddFilesToCabinet(fc);
 }
Exemple #29
0
        public void SaveToFile(string saveFilename, bool tempFile, bool excludeAudio)
        {
            CleanUp();
            GC.Collect();
            SaveToXml(false);

            var fc = new FileCabinet(saveFilename, BaseWorkingDirectory);
            fc.PackageID = Id;
            if (!tempFile)
            {
                saveFileName = saveFilename;
            }

            fc.AddFile(filename);

            if (authorImage != null)
            {
                fc.AddFile(WorkingDirectory + "Author.Png");
            }

            foreach (var stop in TourStops)
            {
                stop.AddFilesToCabinet(fc, excludeAudio);
            }

            var masterList = CreateLayerMasterList();

            foreach (var id in masterList)
            {
                if (LayerManager.LayerList.ContainsKey(id))
                {
                    LayerManager.LayerList[id].AddFilesToCabinet(fc);
                }
            }

            fc.Package();
            TourDirty = false;
        }
 public virtual void AddFilesToCabinet(FileCabinet fc)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemple #31
0
        public static TourDocument FromFile(string filename, bool forEdit)
        {
            var cab = new FileCabinet(filename, BaseWorkingDirectory);
            cab.Extract();
            var newTour =  FromXml(cab.MasterFile);
            if (forEdit)
            {
                newTour.SaveFileName = filename;
            }

            return newTour;
        }
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     fc.AddFile(Owner.Owner.WorkingDirectory + filename);
 }
Exemple #33
0
 public virtual void AddFilesToCabinet(FileCabinet fc)
 {
     return;
 }