예제 #1
0
파일: MyDSI3.cs 프로젝트: windrobin/kumpro
 public MyDSI3(IPEndPoint afp) {
     Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     Sock.Connect(afp);
     st = new NetworkStream(Sock, false);
     br = new BER(st);
     t = new Thread(this.Receiver);
     t.Start();
 }
예제 #2
0
 public CreateDirPack(BER br) {
     NewDirectoryID = br.ReadUInt32();
 }
예제 #3
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);
            }
        }
예제 #4
0
 public FPUnixPrivs(BER br) {
     uid = br.ReadUInt32();
     gid = br.ReadUInt32();
     permissions = br.ReadUInt32();
     ua_permissions = br.ReadUInt32();
 }
예제 #5
0
        public VolumeParameters(BER br, ushort Bitmap) {
            Stream si = br.BaseStream;
            Int64 off = si.Position;

            ushort? VolNameOff = null;

            if (0 != (Bitmap & 1U)) VolAttribute = br.ReadUInt16();
            if (0 != (Bitmap & 2U)) VolSignature = br.ReadUInt16();
            if (0 != (Bitmap & 4U)) CreateDate = br.ReadUInt32();
            if (0 != (Bitmap & 8U)) ModDate = br.ReadUInt32();
            if (0 != (Bitmap & 16U)) VolBackupDate = br.ReadUInt32();
            if (0 != (Bitmap & 32U)) VolID = br.ReadUInt16();
            if (0 != (Bitmap & 64U)) VolBytesFree = br.ReadUInt32();
            if (0 != (Bitmap & 128U)) VolBytesTotal = br.ReadUInt32();

            if (0 != (Bitmap & 256U)) VolNameOff = br.ReadUInt16();
            if (0 != (Bitmap & 512U)) VolExtBytesFree = br.ReadUInt64();
            if (0 != (Bitmap & 1024U)) VolExtBytesTotal = br.ReadUInt64();
            if (0 != (Bitmap & 2048U)) VolBlockSize = br.ReadUInt32();

            if (VolNameOff != null) {
                si.Position = off + VolNameOff.Value;
                VolName = UtAfp.Read1Str(si);
            }
        }
예제 #6
0
 public GetFileDirParmsPack(BER br) {
     FileBitmap = br.ReadUInt16();
     DirectoryBitmap = br.ReadUInt16();
     FileDir = br.ReadByte();
     br.ReadByte();
     Parms = new FileParameters(br, (0 == (0x80 & FileDir)), (0 != (0x80 & FileDir)) ? DirectoryBitmap : FileBitmap);
 }
예제 #7
0
 public DHXReplyPack(BER br) {
     Id = br.ReadUInt16();
     Mb = br.ReadBytes(16);
     nonce_ss = br.ReadBytes(32);
 }
예제 #8
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));
 }
예제 #9
0
 public TwoWay2ndPack(BER br) {
     ClientKey = br.ReadBytes(8);
 }
예제 #10
0
        public GetSrvrInfoPack(BER br) {
            Stream si = br.BaseStream;

            MachineTypeOff = br.ReadUInt16();
            AFPVersionCountOff = br.ReadUInt16();
            UAMCountOff = br.ReadUInt16();
            VolumeIconAndMaskOff = br.ReadUInt16();
            Flags = br.ReadUInt16();
            ServerName = UtAfp.Read1Str(si);
            ServerSignatureOff = br.ReadUInt16();
            NetworkAddressesCountOff = br.ReadUInt16();
            DirectoryNamesCountOff = br.ReadUInt16();
            UTF8ServerNameOff = br.ReadUInt16();

            {
                si.Position = AFPVersionCountOff;
                int cnt = br.ReadByte();
                for (int x = 0; x < cnt; x++) {
                    AFPVersionsList.Add(UtAfp.Read1Str(si));
                }
            }
            {
                si.Position = UAMCountOff;
                int cnt = br.ReadByte();
                for (int x = 0; x < cnt; x++) {
                    UAMsList.Add(UtAfp.Read1Str(si));
                }
            }
        }
예제 #11
0
 public static string Read1Str(Stream si) {
     BER br = new BER(si);
     byte cb = br.ReadByte();
     return Encoding.GetEncoding(10001).GetString(br.ReadBytes(cb));
 }
예제 #12
0
 public VolStruc(BER br) {
     Flags = br.ReadByte();
     VolName = UtAfp.Read1Str(br.BaseStream);
 }
예제 #13
0
 public GetSrvrParmsPack(BER br) {
     ServerTime = br.ReadUInt32();
     {
         int cx = br.ReadByte();
         for (int x = 0; x < cx; x++) Volumes.Add(new VolStruc(br));
     }
 }
예제 #14
0
 public OpenVolPack(BER br) {
     Bitmap = br.ReadUInt16();
     Ent = new VolumeParameters(br, Bitmap);
 }
예제 #15
0
 public OpenForkPack(BER br) {
     Bitmap = br.ReadUInt16();
     Fork = br.ReadUInt16();
     Parms = new FileParameters(br, true, Bitmap);
 }
예제 #16
0
 public TwoWay1stPack(BER br) {
     Id = br.ReadUInt16();
     ServerKey = br.ReadBytes(8);
 }
예제 #17
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);
            }
        }
예제 #18
0
파일: MyDSI3.cs 프로젝트: windrobin/kumpro
 public TransmitRes(DSIPack pack) {
     this.pack = pack;
     this.br = new BER(new MemoryStream(pack.Payload, false));
 }