# < Summary

Information

Class: | Renci.SshNet.Sftp.Responses.SftpNameResponse
Assembly: | Renci.SshNet
File(s): | \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Responses\SftpNameResponse.cs

Line coverage
100%

Covered lines: | 40
Uncovered lines: | 0
Coverable lines: | 40
Total lines: | 72
Line coverage: | 100%

Branch coverage
100%

Covered branches: | 8
Total branches: | 8
Branch coverage: | 100%

Method coverage

Feature is only available for sponsors

Upgrade to PRO version

# Metrics

Method | Branch coverage | Cyclomatic complexity | Line coverage
--- | --- | --- | ---
get_SftpMessageType() | 100% | 1 | 100%
get_Count() | 100% | 1 | 100%
get_Encoding() | 100% | 1 | 100%
get_Files() | 100% | 1 | 100%
.ctor(...) | 100% | 1 | 100%
LoadData() | 100% | 4 | 100%
SaveData() | 100% | 4 | 100%
SupportsLongName(...) | 100% | 1 | 100%

# File(s)

## \home\appveyor\projects\ssh-net\src\Renci.SshNet\Sftp\Responses\SftpNameResponse.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Collections.Generic;`
|  | `3` |  | `using System.Text;`
|  | `4` |  | ``
|  | `5` |  | `namespace Renci.SshNet.Sftp.Responses`
|  | `6` |  | `{`
|  | `7` |  | `internal sealed class SftpNameResponse : SftpResponse`
|  | `8` |  | `{`
|  | `9` |  | `public override SftpMessageTypes SftpMessageType`
|  | `10` |  | `{`
| 72 | `11` |  | `get { return SftpMessageTypes.Name; }`
|  | `12` |  | `}`
|  | `13` |  | ``
| 56637 | `14` |  | `public uint Count { get; private set; }`
|  | `15` |  | ``
| 55151 | `16` |  | `public Encoding Encoding { get; private set; }`
|  | `17` |  | ``
| 56775 | `18` |  | `public KeyValuePair<string, SftpFileAttributes>[] Files { get; set; }`
|  | `19` |  | ``
|  | `20` |  | `public SftpNameResponse(uint protocolVersion, Encoding encoding)`
| 11651 | `21` |  | `: base(protocolVersion)`
| 11651 | `22` |  | `{`
| 11651 | `23` |  | `Files = Array.Empty<KeyValuePair<string, SftpFileAttributes>>();`
| 11651 | `24` |  | `Encoding = encoding;`
| 11651 | `25` |  | `}`
|  | `26` |  | ``
|  | `27` |  | `protected override void LoadData()`
| 11633 | `28` |  | `{`
| 11633 | `29` |  | `base.LoadData();`
|  | `30` |  | ``
| 11633 | `31` |  | `Count = ReadUInt32();`
| 11633 | `32` |  | `Files = new KeyValuePair<string, SftpFileAttributes>[Count];`
|  | `33` |  | ``
| 66742 | `34` |  | `for (var i = 0; i < Count; i++)`
| 21738 | `35` |  | `{`
| 21738 | `36` |  | `var fileName = ReadString(Encoding);`
| 21738 | `37` |  | `if (SupportsLongName(ProtocolVersion))`
| 21738 | `38` |  | `{`
| 21738 | `39` |  | `_ = ReadString(Encoding); // skip longname`
| 21738 | `40` |  | `}`
|  | `41` |  | ``
| 21738 | `42` |  | `Files[i] = new KeyValuePair<string, SftpFileAttributes>(fileName, ReadAttributes());`
| 21738 | `43` |  | `}`
| 11633 | `44` |  | `}`
|  | `45` |  | ``
|  | `46` |  | `protected override void SaveData()`
| 24 | `47` |  | `{`
| 24 | `48` |  | `base.SaveData();`
|  | `49` |  | ``
| 24 | `50` |  | `Write((uint) Files.Length); // count`
|  | `51` |  | ``
| 96 | `52` |  | `for (var i = 0; i < Files.Length; i++)`
| 24 | `53` |  | `{`
| 24 | `54` |  | `var file = Files[i];`
|  | `55` |  | ``
| 24 | `56` |  | `Write(file.Key, Encoding); // filename`
|  | `57` |  | ``
| 24 | `58` |  | `if (SupportsLongName(ProtocolVersion))`
| 24 | `59` |  | `{`
| 24 | `60` |  | `Write(0U); // longname`
| 24 | `61` |  | `}`
|  | `62` |  | ``
| 24 | `63` |  | `Write(file.Value.GetBytes()); // attrs`
| 24 | `64` |  | `}`
| 24 | `65` |  | `}`
|  | `66` |  | ``
|  | `67` |  | `private static bool SupportsLongName(uint protocolVersion)`
| 21762 | `68` |  | `{`
| 21762 | `69` |  | `return protocolVersion <= 3U;`
| 21762 | `70` |  | `}`
|  | `71` |  | `}`
|  | `72` |  | `}`

# Methods/Properties

get_SftpMessageType()
get_Count()
get_Encoding()
get_Files()
.ctor(System.UInt32,System.Text.Encoding)
LoadData()
SaveData()
SupportsLongName(System.UInt32)