Beispiel #1
0
 public int SetAllocationSize(string filename, long length, DokanFileInfo info)
 {
     try
     {
         string      path    = GetPath(filename);
         ChannelSftp channel = GetChannel();
         SftpATTRS   attr    = channel.stat(path);
         if (attr.getSize() < length)
         {
             attr.setSIZE(length);
         }
         channel.setStat(path, attr);
     }
     catch (SftpException)
     {
         return(-1);
     }
     catch (Exception e)
     {
         connectionError_ = true;
         Debug(e.ToString());
         Reconnect();
         return(-1);
     }
     return(0);
 }
Beispiel #2
0
        public NtStatus SetEndOfFile(
            string filename,
            long length,
            DokanFileInfo info)
        {
            try
            {
                string      path    = GetPath(filename);
                ChannelSftp channel = GetChannel();
                SftpATTRS   attr    = channel.stat(path);

                attr.setSIZE(length);
                channel.setStat(path, attr);

                return(NtStatus.Success);
            }
            catch (SftpException)
            {
                return(NtStatus.Error);
            }
            catch (Exception e)
            {
                connectionError_ = true;
                Debug(e.ToString());
                Reconnect();
                return(NtStatus.Error);
            }
        }