From 12a1cf594a2680593a04c146bcf9b020bc785db8 Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Tue, 26 Jul 2016 21:32:34 +0200 Subject: [PATCH] added first part of wizard (authtype choosing) --- PoGo.NecroBot.CLI/Settings.cs | 37 +++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/PoGo.NecroBot.CLI/Settings.cs b/PoGo.NecroBot.CLI/Settings.cs index dc2476dd3..1bc63b9e2 100644 --- a/PoGo.NecroBot.CLI/Settings.cs +++ b/PoGo.NecroBot.CLI/Settings.cs @@ -19,10 +19,39 @@ namespace PoGo.NecroBot.CLI { internal class AuthSettings { - public AuthType AuthType = AuthType.Google; - public string GoogleRefreshToken = ""; - public string PtcUsername = "username2"; - public string PtcPassword = "pw"; + public AuthSettings() + { + if (File.Exists(Directory.GetCurrentDirectory() + "\\config\\auth.json")) return; + string type; + do + { + Console.WriteLine("Please choose your AuthType"); + Console.WriteLine("(0) for Google Authentication"); + Console.WriteLine("(1) for Pokemon Trainer Club"); + type = Console.ReadLine(); + } while (type != "1" && type != "0"); + AuthType = type.Equals("0") ? AuthType.Google : AuthType.Ptc; + if (AuthType == AuthType.Google) + { + Console.Clear(); + return; + } + do + { + Console.WriteLine("Username:"); + PtcUsername = Console.ReadLine(); + } while (string.IsNullOrEmpty(PtcUsername)); + do + { + Console.WriteLine("Password:"); + PtcPassword = Console.ReadLine(); + } while (string.IsNullOrEmpty(PtcPassword)); + Console.Clear(); + } + public AuthType AuthType; + public string GoogleRefreshToken; + public string PtcUsername; + public string PtcPassword; [JsonIgnore]