Esempio n. 1
0
        public RequestFileMessage setMStream(ResponseFileMessage request)
        {
            string filePath = Path.Combine(System.Environment.CurrentDirectory, request.name2);

            filePath = Path.Combine(System.Environment.CurrentDirectory, request.name2);
            SaveFile(request.data, filePath);

            RequestFileMessage response = new RequestFileMessage();

            response.name1 = request.name2;

            return(response);
        }
Esempio n. 2
0
        public ResponseFileMessage getMStream(RequestFileMessage request)
        {
            FileStream file;
            string     filePath = Path.Combine(System.Environment.CurrentDirectory, request.name1);

            try
            {
                file = File.OpenRead(filePath);
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.ToString());
                throw ex;
            }

            ResponseFileMessage response = new ResponseFileMessage();

            response.name2 = request.name1;
            response.size  = file.Length;
            response.data  = file;

            return(response);
        }