public void UpsertRecord(Record record) { var recordFileUri = GetRecordFileUri(record.Header.Id); var encryptedRecordBytes = Cryptor.GetEncryptedBytes(record, _password); DataGateway.DeleteFileIfAvailable(recordFileUri); DataGateway.PutBytes(recordFileUri, encryptedRecordBytes); }
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); } } }
public void DeleteRecord(string recordId) { var recordFile = GetRecordFileUri(recordId); DataGateway.DeleteFileIfAvailable(recordFile); }