Example #1
0
        private IFile LoadFiles(string path)
        {
            IFile file;

            try
            {
                string fileExt = Path.GetExtension(path);
                file = FileFactory.CreateInstance(path);
                file.Load();
                return(file);
            }
            catch (Exception e)
            {
                if (path.Length == 0)
                {
                    Debug.Log("Path is empty.");
                    return(null);
                }
                Debug.Log(e);
                return(null);
            }
        }
Example #2
0
        public void Load()
        {
            FileCode = Util.FromBigEndian(br.ReadInt32());
            br.BaseStream.Seek(20, SeekOrigin.Current);
            FileLength  = Util.FromBigEndian(br.ReadInt32()) * 2;
            FileVersion = br.ReadInt32();
            ShpType     = (ShapeType)br.ReadInt32();

            TotalXYRange = new RangeXY();
            ZRange       = new Range();
            MRange       = new Range();
            TotalXYRange.Load(ref br);
            ZRange.Load(ref br);
            MRange.Load(ref br);

            int  ContentLength = FileLength - 100;
            long curPoint      = 0;

            RecordSet = new List <ShxRecord>();
            while (curPoint < ContentLength)
            {
                ShxRecord record = new ShxRecord();
                record.Load(ref br);
                RecordSet.Add(record);

                curPoint += record.GetLength();
            }
            try
            {
                ContentsFile = (ShpFile)FileFactory.CreateInstance(shpPath);
            }
            catch (Exception)
            {
                ContentsFile = null;
            }
        }