Ejemplo n.º 1
0
        //Control gắn Watermark vào và download về máy
        public void DownloadFile(string id)
        {
            string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id);

            file = new WaveSteg(new FileStream(FilePath, FileMode.Open, FileAccess.Read));
            sh   = new StagnoHelper(file);

            message = "Bản quyền thuộc về công ty TNHH KhueChin, bạn đã tải về lúc: " + DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy zzz");
            sh.HideMessage(message);
            file.WriteFile(FilePath);

            Response.ContentType = "application/zip";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath));
            Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath)));
            Response.End();
            Response.Flush();
        }
Ejemplo n.º 2
0
        public void DownloadFile(string id)
        {
            string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id);

            file = new WaveSteg(new FileStream(FilePath, FileMode.Open, FileAccess.Read));
            sh   = new StagnoHelper(file);

            var sess = (UserLogin)Session[CommonConstants.User_Session];

            message = sess.username;
            sh.HideMessage(message);
            file.WriteFile(FilePath);


            Response.ContentType = "application/zip";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath));
            Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath)));
            Response.End();
            Response.Flush();
        }