Inheritance: SmbComTransactionResponse
コード例 #1
0
ファイル: SmbFile.cs プロジェクト: Cyber-Forensic/Potato
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 private long QueryFsInformation(int level)
 {
     Trans2QueryFsInformationResponse response;
     response = new Trans2QueryFsInformationResponse(level);
     Send(new Trans2QueryFsInformation(level), response);
     if (Type == TypeShare)
     {
         _size = response.Info.GetCapacity();
         _sizeExpiration = Runtime.CurrentTimeMillis() + AttrExpirationPeriod;
     }
     return response.Info.GetFree();
 }
コード例 #2
0
ファイル: SmbFile.cs プロジェクト: Cyber-Forensic/Potato
 /// <summary>Returns the length of this <tt>SmbFile</tt> in bytes.</summary>
 /// <remarks>
 /// Returns the length of this <tt>SmbFile</tt> in bytes. If this object
 /// is a <tt>TYPE_SHARE</tt> the total capacity of the disk shared in
 /// bytes is returned. If this object is a directory or a type other than
 /// <tt>TYPE_SHARE</tt>, 0L is returned.
 /// </remarks>
 /// <returns>
 /// The length of the file in bytes or 0 if this
 /// <code>SmbFile</code> is not a file.
 /// </returns>
 /// <exception cref="SmbException">SmbException</exception>
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 public virtual long Length()
 {
     if (_sizeExpiration > Runtime.CurrentTimeMillis())
     {
         return _size;
     }
     if (GetType() == TypeShare)
     {
         Trans2QueryFsInformationResponse response;
         int level = Trans2QueryFsInformationResponse.SMB_INFO_ALLOCATION;
         response = new Trans2QueryFsInformationResponse(level);
         Send(new Trans2QueryFsInformation(level), response);
         _size = response.Info.GetCapacity();
     }
     else
     {
         if (GetUncPath0().Length > 1 && Type != TypeNamedPipe)
         {
             IInfo info = QueryPath(GetUncPath0(), Trans2QueryPathInformationResponse.SMB_QUERY_FILE_STANDARD_INFO
                 );
             _size = info.GetSize();
         }
         else
         {
             _size = 0L;
         }
     }
     _sizeExpiration = Runtime.CurrentTimeMillis() + AttrExpirationPeriod;
     return _size;
 }