diff --git a/.idea/.idea.SendToSftp/.idea/indexLayout.xml b/.idea/.idea.SendToSftp/.idea/indexLayout.xml new file mode 100644 index 0000000..f1feadf --- /dev/null +++ b/.idea/.idea.SendToSftp/.idea/indexLayout.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SendToSftp/.idea/modules.xml b/.idea/.idea.SendToSftp/.idea/modules.xml new file mode 100644 index 0000000..cd07328 --- /dev/null +++ b/.idea/.idea.SendToSftp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SendToSftp/.idea/vcs.xml b/.idea/.idea.SendToSftp/.idea/vcs.xml new file mode 100644 index 0000000..9e3e2fc --- /dev/null +++ b/.idea/.idea.SendToSftp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.SendToSftp/riderModule.iml b/.idea/.idea.SendToSftp/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.SendToSftp/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index e05ee0b..b63042d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# SendToSFTP +# SendToSftp Send a file to an server via SFTP and the Send to menu in Windows ## Usage -Setup connection.json at the same location as SendToSFTP.exe, should look like this: +Setup connection.json at the same location as SendToSftp.exe, should look like this: ``` { "Ip": "192.168.0.141", @@ -13,7 +13,7 @@ Setup connection.json at the same location as SendToSFTP.exe, should look like t ``` The multithreaded option can be a bit unstable. -To add it to the Send To menu in Windows, press Win + R and type `shell:sendto`, this will open an explorer window. Paste a shortcut to the SendToSFTP.exe here. Renaming it will rename it in the Send to menu. +To add it to the Send To menu in Windows, press Win + R and type `shell:sendto`, this will open an explorer window. Paste a shortcut to the SendToSftp.exe here. Renaming it will rename it in the Send to menu. ## Compile First make sure you have the [dotnet core sdk](https://www.microsoft.com/net/download/windows) installed diff --git a/SendToSftp/Program.cs b/SendToSftp/Program.cs index 6ce7851..852faf8 100644 --- a/SendToSftp/Program.cs +++ b/SendToSftp/Program.cs @@ -30,7 +30,7 @@ private static void Main(string[] args) return; } - Console.WriteLine("Connecting to " + connection.Ip + "..."); + Console.WriteLine("Connecting to " + connection.Ip + "...\n"); using (var client = new SftpClient(connection.Ip, connection.User, connection.Password)) { client.Connect(); @@ -51,8 +51,8 @@ private static void Main(string[] args) lock (LockObject) { - Console.SetCursorPosition(line + 1, 0); - Console.WriteLine("\n\n\nDone!"); + Console.SetCursorPosition(0, line + 1); + Console.WriteLine("Done!"); } } } @@ -66,13 +66,15 @@ private static void Main(string[] args) } } + private const string LoadingCharacter = "."; + private static void Upload(string file, SftpClient client, string desinationPath, int row) { var uploadFile = new FileInfo(file); using (var fileStream = new FileStream(uploadFile.FullName, FileMode.Open)) { var col = 0; - var sendMsg = "Sending " + uploadFile.Name + " "; + var sendMsg = "Sending " + uploadFile.Name; float completion = 0; var consoleWidth = Console.WindowWidth; @@ -96,7 +98,7 @@ private static void Upload(string file, SftpClient client, string desinationPath { Console.SetCursorPosition(col, row); for (var i = 0; i < consoleWidth - col; i++) - Console.Write("="); + Console.Write(LoadingCharacter); Console.WriteLine(); } @@ -108,7 +110,7 @@ private static void Upload(string file, SftpClient client, string desinationPath lock (LockObject) { Console.SetCursorPosition(col, row); - Console.Write("="); + Console.Write(LoadingCharacter); } col++;