public override int GetHashCode() { unchecked { var hashCode = MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidImage.GetHashCode(); hashCode = (hashCode * 397) ^ ExtensionMatchContentFormat.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); hashCode = (hashCode * 397) ^ (SupportedFileFormats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (SupportedImageSizes?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ IsAlphaChannelRequired.GetHashCode(); return(hashCode); } }
public bool Equals(CompositeBitmapImageElementConstraints other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ImageSizeRange.Equals(other.ImageSizeRange) && SizeSpecificImageMaxSize == other.SizeSpecificImageMaxSize && MaxSize == other.MaxSize && MaxFilenameLength == other.MaxFilenameLength && (ReferenceEquals(SupportedFileFormats, other.SupportedFileFormats) || SupportedFileFormats.SequenceEqual(other.SupportedFileFormats))); }
public async Task <ActionResult> UploadRequest([FromBody] UploadRequestArg arg) { if (!_context.IsLogged) { return(GetErrorResult("no_login")); } var user = await GetLoginUser(); if (arg.Size < 0 || !user.AllowFileUploadSize(arg.Size)) { return(GetErrorResult("size_out_of_range")); } var extNamePos = arg.Filename.LastIndexOf('.'); var extName = extNamePos >= 0 ? arg.Filename.Substring(extNamePos + 1).ToLower() : "mp3"; if (!SupportedFileFormats.Contains(extName) && _context.User.role != UserRole.SuperAdmin) { return(GetErrorResult("unsupported_file_format")); } var filename = Guid.NewGuid().ToString("D") + "." + extName; var filepath = "tracks/" + filename; if (_app.StorageService.Mode == StorageMode.Direct) { return(new JsonResult(new { mode = "direct" })); } else { var r = await _app.StorageService.RequestUpload(new RequestUploadOptions { DestFilePath = filepath, Length = arg.Size }); return(new JsonResult(new { mode = "put-url", url = r.Url, method = r.Method, tag = filepath + "|" + arg.Size + "|" + _app.SignTag(r.Url + "|" + filepath + "|" + arg.Size) })); } }
private void ListB_Files_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.All(x => SupportedFileFormats.IsAcceptableAudioFormat(x))) { e.Effect = DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; } } else { e.Effect = DragDropEffects.None; } }
public bool Equals(CompositeBitmapImageElementConstraints other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ImageSizeRange.Equals(other.ImageSizeRange) && SizeSpecificImageMaxSize == other.SizeSpecificImageMaxSize && MaxSize == other.MaxSize && MaxFilenameLength == other.MaxFilenameLength && BinaryExists == other.BinaryExists && ValidImage == other.ValidImage && ExtensionMatchContentFormat == other.ExtensionMatchContentFormat && (ReferenceEquals(SupportedFileFormats, other.SupportedFileFormats) || SupportedFileFormats.SequenceEqual(other.SupportedFileFormats))); }
public bool Equals(BitmapImageElementConstraints other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (SupportedFileFormats == null && other.SupportedFileFormats != null || SupportedFileFormats != null && other.SupportedFileFormats == null) { return(false); } if (SupportedImageSizes == null && other.SupportedImageSizes != null || SupportedImageSizes != null && other.SupportedImageSizes == null) { return(false); } return(MaxSize == other.MaxSize && MaxFilenameLength == other.MaxFilenameLength && BinaryExists == other.BinaryExists && ValidImage == other.ValidImage && ExtensionMatchContentFormat == other.ExtensionMatchContentFormat && (ReferenceEquals(SupportedFileFormats, other.SupportedFileFormats) || SupportedFileFormats.SequenceEqual(other.SupportedFileFormats)) && (ReferenceEquals(SupportedImageSizes, other.SupportedImageSizes) || SupportedImageSizes.SequenceEqual(other.SupportedImageSizes)) && IsAlphaChannelRequired == other.IsAlphaChannelRequired); }