public async Task <string> postCipherCaeser([FromForm] UploadDataZigZag objFile)
        {
            try
            {
                if (objFile.files.Length > 0)
                {
                    if (!Directory.Exists(_environment.WebRootPath + "\\Upload\\"))
                    {
                        Directory.CreateDirectory(_environment.WebRootPath + "\\Upload\\");
                    }
                    using (FileStream fileStream = System.IO.File.Create(_environment.WebRootPath + "\\Upload\\" + objFile.files.FileName))
                    {
                        objFile.files.CopyTo(fileStream);
                        fileStream.Flush();
                        fileStream.Close();
                        string s = @_environment.WebRootPath;
                        //Implementacion imp = new Implementacion(fileStream.Name, s);
                        ImplementationCaesar.Cifrado(fileStream.Name, s, objFile.Palabra);

                        return("\\Upload\\" + objFile.files.FileName);
                    }
                }
                else
                {
                    return("Failed");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message.ToString());
            }
        }
        public async Task <string> postDecipherEspiral([FromForm] UploadDataZigZag objFile)
        {
            try
            {
                if (objFile.files.Length > 0)
                {
                    if (!Directory.Exists(_environment.WebRootPath + "\\Upload\\"))
                    {
                        Directory.CreateDirectory(_environment.WebRootPath + "\\Upload\\");
                    }
                    using (FileStream fileStream = System.IO.File.Create(_environment.WebRootPath + "\\Upload\\" + objFile.files.FileName))
                    {
                        objFile.files.CopyTo(fileStream);
                        fileStream.Flush();
                        fileStream.Close();
                        string s = @_environment.WebRootPath;

                        ImplementationEspiral.Descifrado(fileStream.Name, s, objFile.Tamaño);

                        return("\\Upload\\" + objFile.files.FileName);
                    }
                }
                else
                {
                    return("Failed");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message.ToString());
            }
        }
Beispiel #3
0
        public string DescifrarZigZag([FromForm] UploadDataZigZag DescifrarZigZag)
        {
            if (!Directory.Exists(_environment.WebRootPath + "\\ArchivosDescifradosZigZag\\"))
            {
                Directory.CreateDirectory(_environment.WebRootPath + "\\ArchivosDescifradosZigZag\\");
            }
            ZigZag DescifradoZigZag = new ZigZag();

            DescifradoZigZag.DescifradoZigZag(DescifrarZigZag.ArchivoCargado, DescifrarZigZag.TamañoCarriles, DescifrarZigZag.NuevoNombre, _environment.WebRootPath + "\\ArchivosDescifradosZigZag\\");
            return("El archivo descifrado se encuentra en la carpeta 'ArchivosDescifradosZigZag' en la Carpeta 'wwwroot' dentro de la carpeta del Laboratorio");
        }