Exemplo n.º 1
0
        public ClientWorker(TcpClient tcpClient)
        {
            log            = LogSingleTon.Instance;
            _tcpClient     = tcpClient;
            _networkStream = tcpClient.GetStream();
            binReader      = new BinaryReader(_networkStream);
            binWriter      = new BinaryWriter(_networkStream);
            _t             = new Thread(doWork);

            _t.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor de la clase
        /// </summary>
        /// <param name="imagesString">Recibe un string que es el cuerpo de la petición</param>
        public ImageRequestProcessor(string imagesString)
        {
            log        = LogSingleTon.Instance;
            _imageList = new List <Image>();
            binCod     = new BinaryCodec <Image>();
            string[] imagesArray = imagesString.Split(",");

            foreach (string img in imagesArray)
            {
                if (img.Length >= 2)
                {
                    string   firstLetter  = img.Substring(0, 1);
                    string   secondLetter = img.Substring(1, 1);
                    string[] files        = Directory.GetFiles("D:\\Aplicaciones\\PictoManagementServer\\Images\\" + firstLetter + "\\" + secondLetter + "\\");
                    foreach (string file in files)
                    {
                        string filename = file.Split("D:\\Aplicaciones\\PictoManagementServer\\Images\\ " + firstLetter + "\\" + secondLetter + "\\")[0];
                        if (filename.Contains(img))
                        {
                            _imageList.Add(new Image(img, file));
                        }
                    }
                }

                else
                {
                    string[] files = Directory.GetFiles("D:\\Aplicaciones\\PictoManagementServer\\Images\\");
                    foreach (string file in files)
                    {
                        string filename = file.Split("D:\\Aplicaciones\\PictoManagementServer\\Images\\")[1];
                        if (filename.Contains(img))
                        {
                            _imageList.Add(new Image(img, file));
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor de la clase, genera la conexión con la base de datos.
 /// </summary>
 public DashboardRequestProcessor()
 {
     _sqlConnection = new SqlConnection(_sqlCnStr);
     log            = LogSingleTon.Instance;
 }
 /// <summary>
 /// Constructor de la clase, genera un tcpListener con el puerto indicado
 /// </summary>
 /// <param name="port">Puerto donde va a escuchar el tcpListener</param>
 public TcpServer(int port)
 {
     listClients = new List <ClientWorker>();
     log         = LogSingleTon.Instance;
     tcpListener = new TcpListener(IPAddress.Any, port);
 }