Skip to content

Comments

My ftp#4

Open
Volodya-Petrov wants to merge 7 commits intomainfrom
MyFTP
Open

My ftp#4
Volodya-Petrov wants to merge 7 commits intomainfrom
MyFTP

Conversation

@Volodya-Petrov
Copy link
Owner

No description provided.

/// <summary>
/// Скачивает файл с сервера
/// </summary>
public async Task<(long, byte[])> Get(string path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все длительные операции должны быть прерываемы, так что и List, и Get должны принимать CancellationToken

Copy link
Contributor

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще, уже почти, но надо кое-что поправить ещё


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно уже на .net 6 и C# 10 переходить, там всякие крутые штуки типа file-scoped namespaces и глобальных юзингов.

Copy link
Contributor

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Уже совсем почти зачтена :)

{
using var handle = server.StartServer();
Assert.Throws<AggregateException>(() => client.List("pluuuuug").Wait());
Assert.Throws<AggregateException>(() => client.List("pluuuuug", tokenSource.Token).Wait());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если Вы не собираетесь отменяться по этому tokenSource-у, то передавайте просто CancellationToken.None

Console.WriteLine("Введите, к какому порту обращаться:");
int.TryParse(Console.ReadLine(), out var port);
var client = new Client(ip, port);
var client = new Client(args[0], int.Parse(args[1]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо проверить, что они действительно были переданы, и если нет, вывести справку об использовании

Console.WriteLine("Get:\nФормат запроса:2 <path1: String> <path2: String>\npath1 - путь к файлу относительно того места, где запущен сервер\n" +
"npath2 - путь к файлу на локальной машине, где запущен клиент");
Console.WriteLine("Введите exit, если хотите закрыть соединение с сервером");
var request = Console.ReadLine().Split(' ');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это полумеры :) Ещё раз, хочу команду вида dotnet run -- 127.0.0.1 8888 --list .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants