예제 #1
0
        private async Task StartServer()
        {
            //using (var context = new ZZContext())
            //{
            //    var permissaoRep = new Repository<PermissaoTela>(context);

            //    await permissaoRep.Insert(new PermissaoTela { NomeTela = ServerCommands.UserPlanta, Codigo = "UP" });
            //    await permissaoRep.Save();
            //}

            ServerConn = new TcpListener(IPAddress.Parse(AdressPool.ZZ_EF_APK.Ip), AdressPool.ZZ_EF_APK.Port);
            ServerConn.Start();

            //await InitializeData();

            while (true)
            {
                try
                {
                    var client = await ServerConn.AcceptTcpClientAsync().ConfigureAwait(false);

                    ConsoleEx.WriteLine("Cliente chegando!!!");
                    var cli = new ZZClientManager(client, true, this);
                }
                catch (Exception e)
                {
                    Console.WriteLine("{0} Erro ", e);
                    break;
                }
            }
        }
예제 #2
0
 public bool VerifyUserAuthorization(string username, ZZClientManager client)
 {
     if (_authorizedUserList.Contains(username))
     {
         ConsoleEx.WriteLine("Um usuario autorizado se conectou");
         _authorizedClients.Add(username, client);
         return(true);
     }
     return(false);
 }