50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
|
using System;
|
|||
|
using exercicios;
|
|||
|
using System.Reflection;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace listas4
|
|||
|
{
|
|||
|
class Program
|
|||
|
{
|
|||
|
// 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 <= 7) return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
static void Main(string[] args)
|
|||
|
{
|
|||
|
string sel = "";
|
|||
|
do{
|
|||
|
Console.Clear();
|
|||
|
|
|||
|
Console.BackgroundColor = ConsoleColor.White;
|
|||
|
Console.ForegroundColor = ConsoleColor.Black;
|
|||
|
Console.WriteLine("Fourth Assignment List");
|
|||
|
Console.ResetColor();
|
|||
|
|
|||
|
Console.WriteLine("\n1-7\tExamples 1-7");
|
|||
|
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");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|