Initial commit.

This commit is contained in:
2019-07-17 21:01:14 +02:00
parent 528d83d6b6
commit db87c14a75
37 changed files with 2261 additions and 3 deletions

View File

@@ -1,4 +1,10 @@
using System;
using DearFTP.Utils;
using System;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace DearFTP
{
@@ -6,7 +12,47 @@ namespace DearFTP
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
if (args.Length != 0)
{
ProceedArguments(args);
}
// Make sure to use unique format
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
Console.WriteLine("Welcome to DearFTP !");
Console.WriteLine();
var server = new FtpServer();
Task.Run(() => server.Start());
while (Console.ReadLine() != "stop") { }
server.Stop();
Environment.Exit(0);
}
private static void ProceedArguments(string[] args)
{
string command = args[0].ToLower().Replace("-", "");
string[] arguments = args.Skip(1).ToArray();
if (command == "hash" && arguments.Length > 0)
{
foreach (string password in arguments)
{
Console.WriteLine(PasswordHash.GetHash(password));
}
}
else
{
Console.WriteLine("Invalid usage.");
Environment.Exit(1);
}
Environment.Exit(0);
}
}
}