first commit
This commit is contained in:
49
listas3/main.cs
Normal file
49
listas3/main.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using exercicios;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
namespace principal
|
||||
{
|
||||
class Programa
|
||||
{
|
||||
// Made by F. Raszeja
|
||||
static bool ParseStr(string val)
|
||||
{
|
||||
if (!val.Any(x=> char.IsLetter(x))){
|
||||
int tmp = int.Parse(val);
|
||||
if (tmp != 0 && tmp <= 8) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string sel = "";
|
||||
do{
|
||||
Console.Clear();
|
||||
|
||||
Console.BackgroundColor = ConsoleColor.White;
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
Console.WriteLine("Third Assignment List - 17/09/2020");
|
||||
Console.ResetColor();
|
||||
|
||||
Console.WriteLine("\n1-8\tExamples 1-8");
|
||||
Console.WriteLine("\texit\tQuit to Desktop");
|
||||
|
||||
Console.Write("--> ");
|
||||
sel = Console.ReadLine();
|
||||
|
||||
if(sel != "exit" && ParseStr(sel)){
|
||||
Type typesPrograma = Type.GetType("exercicios.Exercicio"+sel);
|
||||
MethodInfo aInvocar = typesPrograma.GetMethod(
|
||||
"Init", BindingFlags.Static | BindingFlags.Public);
|
||||
aInvocar.Invoke(null, null);
|
||||
}
|
||||
Console.WriteLine("\nPress any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
while(sel.ToLower() != "exit");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user