예제 #1
0
        public FileParameters(BER br, bool IsFile, ushort Bitmap) {
            Stream si = br.BaseStream;
            Int64 off = si.Position;

            IsDirectory = !IsFile;

            ushort? LongNameOff = null;
            ushort? ShortNameOff = null;

            if (0 != (Bitmap & 1U)) Attributes = br.ReadUInt16();
            if (0 != (Bitmap & 2U)) ParentDirectoryID = br.ReadUInt32();
            if (0 != (Bitmap & 4U)) CreationDate = br.ReadUInt32();
            if (0 != (Bitmap & 8U)) ModificationDate = br.ReadUInt32();
            if (0 != (Bitmap & 16U)) BackupDate = br.ReadUInt32();
            if (0 != (Bitmap & 32U)) FinderInfo = br.ReadBytes(32);
            if (0 != (Bitmap & 64U)) LongNameOff = br.ReadUInt16();
            if (0 != (Bitmap & 128U)) ShortNameOff = br.ReadUInt16();
            if (0 != (Bitmap & 256U)) NodeID = br.ReadUInt32();
            if (IsFile) {
                if (0 != (Bitmap & 512U)) DataForkSize = br.ReadUInt32();
                if (0 != (Bitmap & 1024U)) ResourceForkSize = br.ReadUInt32();
                if (0 != (Bitmap & 2048U)) ExtDataForkSize = br.ReadInt64();
                if (0 != (Bitmap & 4096U)) throw new NotSupportedException("Launch limit");
                if (0 != (Bitmap & 8192U)) throw new NotSupportedException("UTF-8 name");
                if (0 != (Bitmap & 16384U)) ExtResourceForkSize = br.ReadInt64();
                if (0 != (Bitmap & 32768U)) UnixPrivs = new FPUnixPrivs(br);
            }
            else {
                if (0 != (Bitmap & 512U)) OffspringCount = br.ReadUInt16();
                if (0 != (Bitmap & 1024U)) throw new NotSupportedException("Owner ID");
                if (0 != (Bitmap & 2048U)) throw new NotSupportedException("Group ID");
                if (0 != (Bitmap & 4096U)) AccessRights = br.ReadUInt32();
                if (0 != (Bitmap & 8192U)) throw new NotSupportedException("Unicode Name");
                if (0 != (Bitmap & 16384U)) throw new NotSupportedException("?");
                if (0 != (Bitmap & 32768U)) UnixPrivs = new FPUnixPrivs(br);
            }

            if (LongNameOff.HasValue) {
                si.Position = off + LongNameOff.Value;
                LongName = UtAfp.Read1Str(si);
            }
            if (ShortNameOff.HasValue) {
                si.Position = off + ShortNameOff.Value;
                ShortName = UtAfp.Read1Str(si);
            }
        }
예제 #2
0
        public EnumerateExtPack(BER br) {
            FileBitmap = br.ReadUInt16();
            DirectoryBitmap = br.ReadUInt16();
            ActualCount = br.ReadUInt16();

            for (int x = 0; x < ActualCount; x++) {
                ushort cb = br.ReadUInt16();
                ushort fd = br.ReadUInt16();
                BER brInner = new BER(new MemoryStream(br.ReadBytes(cb - 4), false));

                bool isDir = ((fd & 0x8000) != 0);

                Ents.Add(new FileParameters(brInner, !isDir, isDir ? DirectoryBitmap : FileBitmap));

                UtPadding.Read2(br.BaseStream);
            }
        }
예제 #3
0
 public DHXReplyPack(BER br) {
     Id = br.ReadUInt16();
     Mb = br.ReadBytes(16);
     nonce_ss = br.ReadBytes(32);
 }
예제 #4
0
 public TwoWay1stPack(BER br) {
     Id = br.ReadUInt16();
     ServerKey = br.ReadBytes(8);
 }
예제 #5
0
 public TwoWay2ndPack(BER br) {
     ClientKey = br.ReadBytes(8);
 }
예제 #6
0
 public DSIPack(Stream si) {
     BER br = new BER(si);
     Flags = br.ReadByte();
     Command = br.ReadByte();
     RequestID = br.ReadUInt16();
     ErrorCode = br.ReadInt32();
     TotalDataLength = br.ReadUInt32();
     Reserved = br.ReadUInt32();
     Payload = br.ReadBytes(Convert.ToInt32(TotalDataLength));
 }
예제 #7
0
 public static string Read1Str(Stream si) {
     BER br = new BER(si);
     byte cb = br.ReadByte();
     return Encoding.GetEncoding(10001).GetString(br.ReadBytes(cb));
 }