示例#1
0
        public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream)
        {
            requestStream.ReadUInt8(); // Pad

            AfpVolumeBitmap volumeBitmap = requestStream.ReadEnum <AfpVolumeBitmap>();
            string          volumeName   = requestStream.ReadPascalString();

            IStorageProvider provider = session.Server.Shares
                                        .Where(s => s.Name == volumeName)
                                        .FirstOrDefault();

            if (provider == null)
            {
                return(AfpResultCode.FPObjectNotFound);
            }

            IAfpVolume volume = session.OpenVolume(provider);

            if (volume == null)
            {
                return(AfpResultCode.FPAccessDenied);
            }

            responseStream.WriteEnum(volumeBitmap);
            responseStream.WriteVolumeInfo(volume, volumeBitmap);

            return(AfpResultCode.FPNoErr);
        }
        public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream)
        {
            requestStream.ReadUInt8(); // Pad

            AfpVolumeBitmap volumeBitmap = requestStream.ReadEnum<AfpVolumeBitmap>();
            string volumeName = requestStream.ReadPascalString();

            IStorageProvider provider = session.Server.Shares
                .Where(s => s.Name == volumeName)
                .FirstOrDefault();

            if (provider == null) {
                return AfpResultCode.FPObjectNotFound;
            }

            IAfpVolume volume = session.OpenVolume(provider);

            if (volume == null) {
                return AfpResultCode.FPAccessDenied;
            }

            responseStream.WriteEnum(volumeBitmap);
            responseStream.WriteVolumeInfo(volume, volumeBitmap);

            return AfpResultCode.FPNoErr;
        }
        public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream)
        {
            requestStream.ReadUInt8(); // Pad

            ushort volumeId = requestStream.ReadUInt16();
            AfpVolumeBitmap bitmap = requestStream.ReadEnum<AfpVolumeBitmap>();

            IAfpVolume volume = session.GetVolume(volumeId);

            if (volume == null) {
                return AfpResultCode.FPObjectNotFound;
            }

            responseStream.WriteEnum(bitmap);
            responseStream.WriteVolumeInfo(volume, bitmap);

            return AfpResultCode.FPNoErr;
        }
        public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream)
        {
            requestStream.ReadUInt8(); // Pad

            ushort          volumeId = requestStream.ReadUInt16();
            AfpVolumeBitmap bitmap   = requestStream.ReadEnum <AfpVolumeBitmap>();

            IAfpVolume volume = session.GetVolume(volumeId);

            if (volume == null)
            {
                return(AfpResultCode.FPObjectNotFound);
            }

            responseStream.WriteEnum(bitmap);
            responseStream.WriteVolumeInfo(volume, bitmap);

            return(AfpResultCode.FPNoErr);
        }