Ejemplo n.º 1
0
 public override void Load(System.IO.BinaryReader br, bool loadByteArray)
 {
     base.Load(br, loadByteArray);
     byte[] temp = br.ReadBytes(4);
     this.VersionName = NCZUtility.ConvertToLegalString(Encoding.ASCII.GetString(br.ReadBytes(14)));
     this.Data        = br.ReadBytes(6);
 }
Ejemplo n.º 2
0
        public void Load()
        {
            try
            {
                int loopCount = 0;
                using (BinaryReader _br = new BinaryReader(File.Open(_path, FileMode.Open, FileAccess.Read, FileShare.Read)))//Create BinaryReader
                {
                    byte initialByte;
                    while (_br.BaseStream.CanSeek)
                    {
                        loopCount++;
                        initialByte = _br.ReadByte();

                        NCZObjectTypes type = (NCZObjectTypes)Enum.Parse(typeof(NCZObjectTypes), initialByte.ToString());

                        switch (type)
                        {
                        case NCZObjectTypes.FileHeader:
                            if (!_nczObjectList.HasFileHeader)
                            {
                                NCZFileHeader fileHeader = new NCZFileHeader();
                                fileHeader.Load(_br, true);
                                _nczObjectList.Add(fileHeader);
                            }
                            break;

                        case NCZObjectTypes.VisibleExtent:
                            //this part is included in the original project
                            break;

                        case NCZObjectTypes.Other:
                            //this part is included in the original project
                            break;

                        case NCZObjectTypes.Version:
                            if (!_nczObjectList.HasVersion)
                            {
                                NCZVersion version = new NCZVersion();
                                version.Load(_br, false);
                                _nczObjectList.Add(version);
                                NCZVersion = NCZUtility.NCZVersion(version.VersionName);
                            }
                            break;

                        case NCZObjectTypes.Geometry:
                            NCZGeometry geometry = new NCZGeometry();
                            geometry.Load(_br, false);
                            if (geometry.Geometry != null)
                            {
                                _nczObjectList.Add(geometry);
                            }
                            break;

                        case NCZObjectTypes.Metadata:
                            //this part is included in the original project
                            break;

                        case NCZObjectTypes.GeometryLink:
                            //this part is included in the original project.
                            break;

                        default:
                            break;
                        }
                    }
                }
                Console.WriteLine("Dongu Sayisi:" + loopCount);
            }
            catch (Exception ex)
            {
                if (ex.GetType() == typeof(IOException))
                {
                    NCZFileLogger.Log(LogLevel.ERROR, _path + " dosya okunurken hata olustu:" + ex.ToString());
                }
            }
        }