auth info: Simplify

This commit is contained in:
Hylke Bons 2016-03-27 11:54:44 +01:00
parent c0bda40378
commit b10c432641

View file

@ -60,7 +60,7 @@ namespace SparkleLib {
foreach (string file_path in IO.Directory.GetFiles (Path)) { foreach (string file_path in IO.Directory.GetFiles (Path)) {
if (file_path.EndsWith (".key")) { if (file_path.EndsWith (".key")) {
PrivateKeyFilePath = file_path; PrivateKeyFilePath = file_path;
PublicKeyFilePath = file_path + ".pub"; PublicKeyFilePath = file_path + ".pub";
key_found = true; key_found = true;
break; break;
@ -69,7 +69,7 @@ namespace SparkleLib {
if (key_found) { if (key_found) {
PrivateKey = IO.File.ReadAllText (PrivateKeyFilePath); PrivateKey = IO.File.ReadAllText (PrivateKeyFilePath);
PublicKey = IO.File.ReadAllText (PublicKeyFilePath); PublicKey = IO.File.ReadAllText (PublicKeyFilePath);
} else { } else {
CreateKeyPair (); CreateKeyPair ();
@ -83,11 +83,8 @@ namespace SparkleLib {
string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd_HH\\hmm") + ".key"; string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd_HH\\hmm") + ".key";
string computer_name = Dns.GetHostName (); string computer_name = Dns.GetHostName ();
if (computer_name.EndsWith (".local")) if (computer_name.EndsWith (".local") || computer_name.EndsWith (".config"))
computer_name = computer_name.Substring (0, computer_name.Length - ".local".Length); computer_name = computer_name.Substring (0, computer_name.LastIndexOf ("."));
if (computer_name.EndsWith (".config"))
computer_name = computer_name.Substring (0, computer_name.Length - ".config".Length);
string arguments = string arguments =
"-t rsa " + // Crypto type "-t rsa " + // Crypto type