Exemple #1
0
        private string GenerateHash(string fileName)
        {
            var getHash = new FileHash(fileName);
            var hash    = getHash.GenerateFileHash();

            return(hash);
        }
Exemple #2
0
        private EFile LoadData(string filename)
        {
            var file            = savedFiles.Find(x => x.FileName.Contains(filename)).FileLocation;
            var fileDetails     = DBController.ReadFileDetails(file);
            var genHash         = new FileHash($"{file}.aes");
            var fullFileDetails = DBController.ReadEncryptedFileDetails(genHash.GenerateFileHash());

            fullFileDetails.FileLocation = fileDetails.FileLocation;
            fullFileDetails.FileName     = fileDetails.FileName;
            fullFileDetails.IsStored     = fileDetails.IsStored;
            return(fullFileDetails);
        }
        public static EFile ReadFileDetails(string filename)
        {
            var filehash    = new FileHash(filename);
            var normalFile  = ReadFromDB("files", "filename", filename);
            var filedetails = new EFile()
            {
                FileHash     = normalFile[1],
                FileLocation = normalFile[2],
                IsStored     = Convert.ToBoolean(normalFile[3])
            };

            if (!string.IsNullOrEmpty(filedetails.FileLocation))
            {
                var info = new FileInfo(filedetails.FileLocation);
                filedetails.FileName = info.Name;
            }

            return(filedetails);
        }