// // GET: /Utilizadores/ public StatusAnswer Get(string id) { //O ! substitui o . string temp = id.Replace('!', '.'); string[] args = temp.Split('='); StatusAnswer toReturn = new StatusAnswer(); if (args.Length == 2) { string key = args[1]; if (key.Equals("BqdNvUKuFTo82lTdQeRuJ1crEvg4ZYt1")) { string password = Lib_Primavera.Utilizadores.ObterPasswordOriginal(args[0]); if (password == null) toReturn.status = "error"; else toReturn.status = password; } else toReturn.status = "error"; } else toReturn.status = "error"; return toReturn; }
// POST /Utilizadores/ public StatusAnswer Post(UtilizadorData id) { // json : { "email" : "*****@*****.**" , "password": "******" } StatusAnswer toReturn = new StatusAnswer(); string username = Lib_Primavera.Utilizadores.LoginUtilizador(id.email, id.password); if (username != null) { toReturn.status = username; } else { toReturn.status = "error"; } return(toReturn); }
// POST /Utilizadores/ public StatusAnswer Post(UtilizadorData id) { // json : { "email" : "*****@*****.**" , "password": "******" } StatusAnswer toReturn = new StatusAnswer(); string username = Lib_Primavera.Utilizadores.LoginUtilizador(id.email, id.password); if (username != null) { toReturn.status = username; } else { toReturn.status = "error"; } return toReturn; }
// // GET: /Utilizadores/ public StatusAnswer Get(string id) { //O ! substitui o . string temp = id.Replace('!', '.'); string[] args = temp.Split('='); StatusAnswer toReturn = new StatusAnswer(); if (args.Length == 2) { string key = args[1]; if (key.Equals("BqdNvUKuFTo82lTdQeRuJ1crEvg4ZYt1")) { string password = Lib_Primavera.Utilizadores.ObterPasswordOriginal(args[0]); if (password == null) { toReturn.status = "error"; } else { toReturn.status = password; } } else { toReturn.status = "error"; } } else { toReturn.status = "error"; } return(toReturn); }
private static void BuildStatusOutputs(List <ConsoleOutput> returnValue, StatusAnswer status) { var keywords = status.Keywords.ToList(); AddLine(ConsoleColor.DarkGray, $"\n{HorizontalLine}", returnValue); //AddLine(ConsoleColor.DarkGray, "Gears Scenario Debugger", returnValue); //AddLine(ConsoleColor.DarkGray, HorizontalLine, returnValue); WriteErrorsForCorruptObjects(status.Data, returnValue); Keyword selectedKeyword = null; if (status.Keywords.Any() && status.Keywords.Count() > status.Index && 0 <= status.Index) { selectedKeyword = status.Keywords.ElementAt(Math.Max(0, status.Index)) as Keyword; } // Memory variables if (status.Data.Contains <RememberedText>()) { foreach (var rememberedText in status.Data.GetAll <RememberedText>()) { Add(ConsoleColor.Magenta, $"[{rememberedText.Variable}]", returnValue); AddLine(ConsoleColor.DarkMagenta, $" = '{rememberedText.What}' ", returnValue); } } if (status.Data.Contains <IConfig>()) { foreach (var setting in status.Data.GetAll <IConfig>().Where(x => !(x is IProtected)).Distinct()) { Add(ConsoleColor.DarkMagenta, $"{setting}\n", returnValue); } } var isSteppedIn = false; if (keywords.Any(x => x is StepOut)) { AddLine(ConsoleColor.DarkCyan, HorizontalLine, returnValue); AddLine(ConsoleColor.Cyan, $"Stepped in RunScenario {/*keywords.OfType<StepOut>().First()*/StepOut.FileName}", returnValue); AddLine(ConsoleColor.DarkCyan, HorizontalLine, returnValue); isSteppedIn = true; } else { AddLine(ConsoleColor.Gray, $"Scenario with {keywords.Count} steps: ", returnValue); } var indent = isSteppedIn ? "\t---\t" : ""; //10 before if (status.Index > 10) { AddLine(ConsoleColor.DarkGray, indent + (status.Index - 10) + " additional steps...", returnValue); } for (int i = Math.Max(0, status.Index - 10); i < status.Index; i++) { WriteKeywordLine(keywords, i, returnValue, indent); } //Selected Add(ConsoleColor.Cyan, $"{indent} >{(status.Index + 1)}) {(selectedKeyword?.ToString() ?? " --- end of scenario ---")}", returnValue); if (selectedKeyword != null && selectedKeyword.IsLazy() && !selectedKeyword.IsLazyHydrated()) { Add(ConsoleColor.Magenta, "Expression", returnValue); } if (selectedKeyword != null && selectedKeyword.Skip) { Add(ConsoleColor.Green, " (Skip)", returnValue); } Add(ConsoleColor.DarkGray, "\n", returnValue); //10 after for (int i = Math.Min(keywords.Count(), status.Index + 1); i < Math.Min(status.Index + 10, keywords.Count()); i++) { //Console.Out.WriteColoredLine(ConsoleColor.DarkGray, " " + (1 + i) + ") " + keywords.ElementAt(i).ToString()); WriteKeywordLine(keywords, i, returnValue, indent); } if (keywords.Count() - status.Index > 10) { AddLine(ConsoleColor.DarkGray, " ...(" + (keywords.Count() - status.Index - 10) + ") more steps...", returnValue); } if (isSteppedIn) { Add(ConsoleColor.Cyan, "\nUse 'StepOut' to return to main scenario.\n", returnValue); } Add(ConsoleColor.White, "\nEnter command, type 'help', or press <enter> to continue:", returnValue); //if (selectedKeyword != null && !status.Interpreter.Language.FollowupOptions.IsNullOrEmpty()) //{ // Add(ConsoleColor.DarkGray, // $"\n\tAdditional FollowupOptions: {string.Join(", ", selectedKeyword.Interpreter.Language.FollowupOptions.Select(x => x.GetType().Name))}", // returnValue); //} }