コード例 #1
0
        public void UpsertRecord(Record record)
        {
            var recordFileUri        = GetRecordFileUri(record.Header.Id);
            var encryptedRecordBytes = Cryptor.GetEncryptedBytes(record, _password);

            DataGateway.DeleteFileIfAvailable(recordFileUri);
            DataGateway.PutBytes(recordFileUri, encryptedRecordBytes);
        }
コード例 #2
0
        public void ReorganizeFiles(string recordId)
        {
            var validFiles  = new List <string>();
            var recordFiles = DataGateway.GetFileNames(GetEffectiveWorkingDirectory(), recordId + ".rcd");

            if (recordFiles.Count != 0)
            {
                var record = GetRecord(recordId);
                validFiles.AddRange(record.FileRecords.Select(x => x.AssociatedRecordId + "_" + x.FileId).ToList());
            }

            var pattern = recordId + "_*.encfile";
            var files   = DataGateway.GetFileNames(GetEffectiveWorkingDirectory(), pattern);

            foreach (var file in files)
            {
                var fileWithOutPath          = Path.GetFileName(file);
                var fileNameWithoutExtention = Path.GetFileNameWithoutExtension(fileWithOutPath);
                if (!validFiles.Contains(fileNameWithoutExtention))
                {
                    DataGateway.DeleteFileIfAvailable(file);
                }
            }
        }
コード例 #3
0
        public void DeleteRecord(string recordId)
        {
            var recordFile = GetRecordFileUri(recordId);

            DataGateway.DeleteFileIfAvailable(recordFile);
        }