public void Upload(string FileName, System.IO.Stream Data)
        {
            ReneCommunicatorFile inValue = new ReneCommunicatorFile();

            inValue.FileName        = FileName;
            inValue.Data            = Data;
            inValue.FileDestination = "..\\..\\..\\ReneServerDownloads\\";
            ((IReneCommunicatorService)(this)).Upload(inValue);
        }
Example #2
0
        public void Download(ReneCommunicatorFile request)
        {
            string fileName   = request.FileName;
            string uploadPath = request.FileDestination;

            if (uploadPath.Equals(""))
            {
                uploadPath = System.Environment.CurrentDirectory;
            }
            string filePath = Path.Combine(Path.GetFullPath(uploadPath), fileName);

            FileStream fs = null;

            try
            {
                fs = File.Create(filePath);
                byte[] buffer = new byte[1024];
                int    read   = 0;
                while ((read = request.Data.Read(buffer, 0, buffer.Length)) != 0)
                {
                    fs.Write(buffer, 0, read);
                }
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }

                if (request.Data != null)
                {
                    request.Data.Close();
                    request.Data.Dispose();
                }
            }
        }
 /* Upload */
 /* ******************** */
 void IReneCommunicatorService.Upload(ReneCommunicatorFile request)
 {
     base.Channel.Upload(request);
 }