コード例 #1
0
 internal static NSch.SftpATTRS GetATTR(Buffer buf)
 {
     NSch.SftpATTRS attr = new NSch.SftpATTRS();
     attr.flags = buf.GetInt();
     if ((attr.flags & SSH_FILEXFER_ATTR_SIZE) != 0)
     {
         attr.size = buf.GetLong();
     }
     if ((attr.flags & SSH_FILEXFER_ATTR_UIDGID) != 0)
     {
         attr.uid = buf.GetInt();
         attr.gid = buf.GetInt();
     }
     if ((attr.flags & SSH_FILEXFER_ATTR_PERMISSIONS) != 0)
     {
         attr.permissions = buf.GetInt();
     }
     if ((attr.flags & SSH_FILEXFER_ATTR_ACMODTIME) != 0)
     {
         attr.atime = buf.GetInt();
     }
     if ((attr.flags & SSH_FILEXFER_ATTR_ACMODTIME) != 0)
     {
         attr.mtime = buf.GetInt();
     }
     if ((attr.flags & SSH_FILEXFER_ATTR_EXTENDED) != 0)
     {
         int count = buf.GetInt();
         if (count > 0)
         {
             attr.extended = new string[count * 2];
             for (int i = 0; i < count; i++)
             {
                 attr.extended[i * 2]     = Util.Byte2str(buf.GetString());
                 attr.extended[i * 2 + 1] = Util.Byte2str(buf.GetString());
             }
         }
     }
     return(attr);
 }
コード例 #2
0
ファイル: SftpATTRS.cs プロジェクト: LunarLanding/ngit
		internal static NSch.SftpATTRS GetATTR(Buffer buf)
		{
			NSch.SftpATTRS attr = new NSch.SftpATTRS();
			attr.flags = buf.GetInt();
			if ((attr.flags & SSH_FILEXFER_ATTR_SIZE) != 0)
			{
				attr.size = buf.GetLong();
			}
			if ((attr.flags & SSH_FILEXFER_ATTR_UIDGID) != 0)
			{
				attr.uid = buf.GetInt();
				attr.gid = buf.GetInt();
			}
			if ((attr.flags & SSH_FILEXFER_ATTR_PERMISSIONS) != 0)
			{
				attr.permissions = buf.GetInt();
			}
			if ((attr.flags & SSH_FILEXFER_ATTR_ACMODTIME) != 0)
			{
				attr.atime = buf.GetInt();
			}
			if ((attr.flags & SSH_FILEXFER_ATTR_ACMODTIME) != 0)
			{
				attr.mtime = buf.GetInt();
			}
			if ((attr.flags & SSH_FILEXFER_ATTR_EXTENDED) != 0)
			{
				int count = buf.GetInt();
				if (count > 0)
				{
					attr.extended = new string[count * 2];
					for (int i = 0; i < count; i++)
					{
						attr.extended[i * 2] = Util.Byte2str(buf.GetString());
						attr.extended[i * 2 + 1] = Util.Byte2str(buf.GetString());
					}
				}
			}
			return attr;
		}