Exemplo n.º 1
0
        public ResponseFileMessage getMStream(RequestFileMessage request)
        {
            ResponseFileMessage wynik = new ResponseFileMessage();
            string nazwa = request.nazwa1;

            FileStream myFile;

            Console.WriteLine("-->Wywolano getStream");
            string filePath = Path.Combine(System.Environment.CurrentDirectory, ".\\" + nazwa);

            // wyjatek na wypadek bledu otwarcia pliku
            try
            {
                myFile = File.OpenRead(filePath);
            }
            catch (IOException ex)
            {
                Console.WriteLine(String.Format("Wyjatek otwarcia pliku {0} :", filePath));
                Console.WriteLine(ex.ToString());
                throw ex;
            }
            wynik.nazwa2  = "amazing_name.jpg";
            wynik.rozmiar = myFile.Length;
            wynik.dane    = myFile;
            return(wynik);
        }
Exemplo n.º 2
0
        public ResponseFileMessage getMStream(RequestFileMessage request)
        {
            FileStream myFile;

            Console.WriteLine("--->Wywolano getMSream.");
            ResponseFileMessage wynik = new ResponseFileMessage();
            string nazwa    = request.nazwa1;
            string filepath = Path.Combine(System.Environment.CurrentDirectory, ".\\image.jpg");

            try
            {
                myFile = File.OpenRead(filepath);
            }
            catch (IOException ex)
            {
                Console.WriteLine(String.Format("Wyjatek otwarcia pliku {0}", filepath));
                Console.WriteLine(ex.ToString());
                throw ex;
            }
            wynik.nazwa2  = "mklient.jpg";
            wynik.rozmiar = myFile.Length;
            wynik.dane    = myFile;
            return(wynik);
        }