public async Task <bool> VerifyResourceExists(UserContentType contentType, Guid contentGuid) { throw new NotImplementedException($"TODO: Finish properly implementing AWS S3 with bucket."); //This is actually how the old AWS client worked: https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/S3/Custom/_bcl/IO/S3FileInfo.cs //Kinda bad design tbh Amazon lol try { var request = new GetObjectMetadataRequest { BucketName = "TODO:UNKNOWN", Key = contentGuid.ToString().Replace('\\', '/') //S3helper.EncodeKey: https://github.com/aws/aws-sdk-net/blob/b691e46e57a3e24477e6a5fa2e849da44db7002f/sdk/src/Services/S3/Custom/_bcl/IO/S3Helper.cs }; ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(FileIORequestEventHandler); // If the object doesn't exist then a "NotFound" will be thrown await CloudClient.GetObjectMetadataAsync(request) .ConfigureAwaitFalse(); return(true); } catch (AmazonS3Exception e) { if (Logger.IsEnabled(LogLevel.Error)) { Logger.LogError($"Encountered AWS Error: {e.Message}"); } return(false); } }
public CustomModelLoaderCreationContext(long contentId, [NotNull] NetworkEntityGuid entityGuid) { if (contentId <= 0) { throw new ArgumentOutOfRangeException(nameof(contentId)); } ContentId = contentId; EntityGuid = entityGuid ?? throw new ArgumentNullException(nameof(entityGuid)); switch (EntityGuid.EntityType) { case EntityType.Player: ContentType = UserContentType.Avatar; break; case EntityType.GameObject: ContentType = UserContentType.GameObject; break; case EntityType.Creature: ContentType = UserContentType.Creature; break; default: throw new ArgumentOutOfRangeException(); } }
protected BaseCustomContentUploadEditorWindow(UserContentType contentType) { if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } ContentType = contentType; }
public ContentUploadTokenFactoryContext(UserContentType contentType) { if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } ContentType = contentType; }
protected BaseCustomContentController(IClaimsPrincipalReader claimsReader, ILogger <AuthorizationReadyController> logger, UserContentType contentType) : base(claimsReader, logger) { if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } ContentType = contentType; }
public async Task <bool> VerifyResourceExists(UserContentType contentType, Guid contentGuid) { //Container name format is {contentType}s. CloudBlobContainer container = BlobClient.GetContainerReference($"{contentType.ToString()}s"); SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30); sasConstraints.Permissions = SharedAccessBlobPermissions.Read; //download or retrievial should be READ ONLY. return(await container.GetBlockBlobReference($"{contentGuid.ToString()}.bin") .ExistsAsync()); }
public async Task <string> BuildRetrivalUrl(UserContentType contentType, Guid key) { //Container name format is {contentType}s. CloudBlobContainer container = BlobClient.GetContainerReference($"{contentType.ToString().ToLower()}s"); SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30); sasConstraints.Permissions = SharedAccessBlobPermissions.Read; //download or retrievial should be READ ONLY. ICloudBlob blob = await container.GetBlobReferenceFromServerAsync($"{key.ToString()}.bin"); return(new Uri(blob.Uri, blob.GetSharedAccessSignature(sasConstraints)).ToString()); }
public async Task <string> BuildUploadUrl(UserContentType contentType, Guid key) { //Container name format is {contentType}s. CloudBlobContainer container = BlobClient.GetContainerReference($"{contentType.ToString().ToLower()}s"); SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30); sasConstraints.Permissions = SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.Create; ICloudBlob blob = container.GetBlockBlobReference($"{key.ToString()}.bin"); return(new Uri(blob.Uri, blob.GetSharedAccessSignature(sasConstraints)).ToString()); }
internal static string FormatUrlContentToShow(UserContentType type) { switch (type) { case UserContentType.TeamCreation: return("<div class=\"row p-3 \"><div class=\"col-12 col-md-4 p-2 text-center align-middle\"><i class=\"fas fa-4x fa-users\"></i></div><div class=\"col-12 col-md-8\">{0}. <br> <br> <span class=\"font-weight-bold text-uppercase\">{1}</span> <br> {2}</div></div>"); case UserContentType.JobPosition: return("<div class=\"row p-3 \"><div class=\"col-12 col-md-4 p-2 text-center align-middle\"><i class=\"fas fa-4x fa-briefcase\"></i></div><div class=\"col-12 col-md-8\">{0}. <br> <br> <span class=\"font-weight-bold text-uppercase\">{1}</span> <br> <span class=\"text-capitalize\">{2}</span></div></div>"); default: return("Check this out!"); } }
public CustomModelLoaderCreationContext(long contentId, [NotNull] NetworkEntityGuid entityGuid, UserContentType contentType) { if (contentId <= 0) { throw new ArgumentOutOfRangeException(nameof(contentId)); } if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } ContentId = contentId; EntityGuid = entityGuid ?? throw new ArgumentNullException(nameof(entityGuid)); ContentType = contentType; }
public IActionResult LikeContent(Guid targetId, UserContentType contentType) { OperationResultVo response = userContentAppService.ContentLike(CurrentUserId, targetId); OperationResultVo <UserContentViewModel> content = userContentAppService.GetById(CurrentUserId, targetId); string myName = GetSessionValue(SessionValues.FullName); if (contentType == UserContentType.ComicStrip) { notificationAppService.Notify(CurrentUserId, myName, content.Value.UserId, NotificationType.ComicsLike, targetId); } else { notificationAppService.Notify(CurrentUserId, myName, content.Value.UserId, NotificationType.ContentLike, targetId); } return(Json(response)); }
/// <inheritdoc /> public DefaultLoadableContentResourceManager( [NotNull] ILog logger, UserContentType contentType) { if (!Enum.IsDefined(typeof(UserContentType), contentType)) { throw new InvalidEnumArgumentException(nameof(contentType), (int)contentType, typeof(UserContentType)); } //TODO: We haven't implemented the refcounted cleanup. We ref count, but don't yet dispose. ProjectVersionStage.AssertAlpha(); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); ContentType = contentType; ResourceHandleCache = new Dictionary <long, ReferenceCountedPrefabContentResourceHandle>(); ReleaseUnmanagedResources(); }
protected BasePrefabedCustomContentUploadEditorWindow(UserContentType contentType) : base(contentType) { }
//TODO: Why should this expose handling for contenttype. Create a factory service for it. /// <inheritdoc /> public Task <string> BuildRetrivalUrl(UserContentType contentType, Guid key) { return(GetPresignedS3URL(key, HttpVerb.GET)); }
//TODO: Why should this expose handling for contenttype. Create a factory service for it. /// <inheritdoc /> public Task <string> BuildUploadUrl(UserContentType contentType, Guid key) { return(GetPresignedS3URL(key, HttpVerb.PUT)); }