Example #1
0
        public static void Main(string[] args)
        {
            CriptografiaService criptografia   = new CriptografiaService();
            DecriptEncript      decriptEncript = new DecriptEncript();

            decriptEncript = criptografia.GetJson();
            decriptEncript.DecriptCriptografia();
            decriptEncript.EncriptCriptogragia();
            decriptEncript.CriptografiaSHA1();

            criptografia.CreateFile(decriptEncript);
            criptografia.SendFile();
        }
Example #2
0
        public void CreateFile(DecriptEncript decriptEncript)
        {
            string   fileName = @"/Users/thiagoaraujo/TI/project/Codenation/answer.json";
            FileInfo fi       = new FileInfo(fileName);

            try
            {
                if (fi.Exists)
                {
                    fi.Delete();
                }

                using (FileStream fs = fi.Create())
                {
                    byte[] jsonByte = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(decriptEncript));
                    fs.Write(jsonByte, 0, jsonByte.Length);
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine(Ex.ToString());
            }
        }