Files
DearFTP/DearFTP/Program.cs
Eveldee 94431aebb8 Clean code
Remove unused usings
Remove blank lines
Fix style issues
2019-07-20 16:16:23 +02:00

57 lines
1.3 KiB
C#

using DearFTP.Utils;
using System;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespace DearFTP
{
class Program
{
static void Main(string[] args)
{
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);
}
}
}