コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        public override void AddFilesToCabinet(FileCabinet fc)
        {
            if (imageSet.WcsImage != null)
            {
                var fName = imageSet.WcsImage.Filename;

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

                var fileName = fc.TempDirectory + string.Format("{0}\\{1}{2}", fc.PackageID, ID, extension);
                var 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);
                }

            }
        }
コード例 #4
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;
        }
コード例 #5
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);
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
ファイル: Tour.cs プロジェクト: hxhlb/wwt-windows-client
        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;
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);

            }
        }
コード例 #12
0
        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);
                    }
                }
            }
        }
コード例 #13
0
ファイル: Tour.cs プロジェクト: bluephoton/wwt-windows-client
        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;
        }
コード例 #14
0
        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);
            }
        }
コード例 #15
0
        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);
            }
        }
コード例 #16
0
 public override void AddFilesToCabinet(FileCabinet fc)
 {
     fc.AddFile(Owner.Owner.WorkingDirectory + filename);
 }
コード例 #17
0
        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;
        }