상속: ServerMessageBlock
        /// <exception cref="SharpCifs.Smb.SmbException"></exception>
        public virtual void SetLength(long newLength)
        {
            // ensure file is open
            if (_file.IsOpen() == false)
            {
                _file.Open(_openFlags, 0, SmbFile.AttrNormal, _options);
            }
            SmbComWriteResponse rsp = new SmbComWriteResponse();

            _file.Send(new SmbComWrite(_file.Fid, (int)(newLength & unchecked (0xFFFFFFFFL)), 0, _tmp, 0, 0), rsp);
        }
예제 #2
0
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 /// <exception cref="System.UriFormatException"></exception>
 /// <exception cref="UnknownHostException"></exception>
 internal SmbFileOutputStream(SmbFile file, bool append, int openFlags)
 {
     this._file      = file;
     this._append    = append;
     this._openFlags = openFlags;
     _access         = ((int)(((uint)openFlags) >> 16)) & 0xFFFF;
     if (append)
     {
         try
         {
             _fp = file.Length();
         }
         catch (SmbAuthException sae)
         {
             throw;
         }
         catch (SmbException)
         {
             _fp = 0L;
         }
     }
     if (file is SmbNamedPipe && file.Unc.StartsWith("\\pipe\\"))
     {
         file.Unc = Runtime.Substring(file.Unc, 5);
         file.Send(new TransWaitNamedPipe("\\pipe" + file.Unc),
                   new TransWaitNamedPipeResponse());
     }
     file.Open(openFlags,
               _access | SmbConstants.FileWriteData,
               SmbFile.AttrNormal,
               0);
     this._openFlags &= ~(SmbFile.OCreat | SmbFile.OTrunc);
     _writeSize       = file.Tree.Session.transport.SndBufSize - 70;
     _useNtSmbs       = file.Tree.Session.transport.HasCapability(SmbConstants.CapNtSmbs);
     if (_useNtSmbs)
     {
         _reqx = new SmbComWriteAndX();
         _rspx = new SmbComWriteAndXResponse();
     }
     else
     {
         _req = new SmbComWrite();
         _rsp = new SmbComWriteResponse();
     }
 }
예제 #3
0
		/// <exception cref="SharpCifs.Smb.SmbException"></exception>
		/// <exception cref="System.UriFormatException"></exception>
		/// <exception cref="UnknownHostException"></exception>
		internal SmbFileOutputStream(SmbFile file, bool append, int openFlags)
		{
			this._file = file;
			this._append = append;
			this._openFlags = openFlags;
			_access = ((int)(((uint)openFlags) >> 16)) & 0xFFFF;
			if (append)
			{
				try
				{
					_fp = file.Length();
				}
				catch (SmbAuthException sae)
				{
					throw;
				}
				catch (SmbException)
				{
					_fp = 0L;
				}
			}
			if (file is SmbNamedPipe && file.Unc.StartsWith("\\pipe\\"))
			{
				file.Unc = Runtime.Substring(file.Unc, 5);
				file.Send(new TransWaitNamedPipe("\\pipe" + file.Unc), new TransWaitNamedPipeResponse
					());
			}
			file.Open(openFlags, _access | SmbConstants.FileWriteData, SmbFile.AttrNormal, 
				0);
			this._openFlags &= ~(SmbFile.OCreat | SmbFile.OTrunc);
			_writeSize = file.Tree.Session.transport.SndBufSize - 70;
			_useNtSmbs = file.Tree.Session.transport.HasCapability(SmbConstants.CapNtSmbs
				);
			if (_useNtSmbs)
			{
				_reqx = new SmbComWriteAndX();
				_rspx = new SmbComWriteAndXResponse();
			}
			else
			{
				_req = new SmbComWrite();
				_rsp = new SmbComWriteResponse();
			}
		}
예제 #4
0
		/// <exception cref="SharpCifs.Smb.SmbException"></exception>
		public virtual void SetLength(long newLength)
		{
			// ensure file is open
			if (_file.IsOpen() == false)
			{
				_file.Open(_openFlags, 0, SmbFile.AttrNormal, _options);
			}
			SmbComWriteResponse rsp = new SmbComWriteResponse();
			_file.Send(new SmbComWrite(_file.Fid, (int)(newLength & unchecked(0xFFFFFFFFL)), 0, _tmp, 0, 0), rsp);
		}