コード例 #1
0
        public void ScanCurrentPath(bool searchSubfolders = false)
        {
            var certs = certificateOperations.GetCertificates(ScanPath.ToString(), searchSubfolders);

            Certificates.Clear();
            foreach (var cert in certs)
            {
                Certificates.Add(cert);
            }

            NotifyProperyChanged(nameof(CertificatesListText));
        }
コード例 #2
0
        public async Task <ScanPath> SaveCollectableScan(UserIdentity collector, Guid collectionId, IFormFile scan)
        {
            var filename = $"{Guid.NewGuid()}.jpg";              //TODO: do not assume file will be a jpg

            var paths    = PersistencePathCreator.CreateCollectableScanPath(collector, collectionId, filename);
            var scanPath = new ScanPath {
                Path = paths.PathToPersist
            };

            var directory = $"{webRoot}{paths.DirectoryPath}";

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            using (var stream = new FileStream($"{webRoot}{paths.FilestreamPath}", FileMode.Create))
            {
                await scan.CopyToAsync(stream);
            };

            return(scanPath);
        }