diff --git a/Yosu.Soundcloud.Core/Resolving/QueryResolver.cs b/Yosu.Soundcloud.Core/Resolving/QueryResolver.cs index 45373e9..acb616e 100644 --- a/Yosu.Soundcloud.Core/Resolving/QueryResolver.cs +++ b/Yosu.Soundcloud.Core/Resolving/QueryResolver.cs @@ -45,7 +45,7 @@ public async Task ResolveAsync( track!.ArtworkUrl ??= track.User?.AvatarUrl; - return new QueryResult(QueryResultKind.Track, track!.Title!, new[] { track }); + return new QueryResult(QueryResultKind.Track, track!.Title!, [track]); } // Search diff --git a/Yosu.Soundcloud.Core/Tagging/MediaFile.cs b/Yosu.Soundcloud.Core/Tagging/MediaFile.cs index 92c83f5..c9f9482 100644 --- a/Yosu.Soundcloud.Core/Tagging/MediaFile.cs +++ b/Yosu.Soundcloud.Core/Tagging/MediaFile.cs @@ -11,11 +11,11 @@ internal partial class MediaFile : IDisposable public MediaFile(TagFile file) => _file = file; public void SetThumbnail(byte[] thumbnailData) => - _file.Tag.Pictures = new IPicture[] { new Picture(thumbnailData) }; + _file.Tag.Pictures = [new Picture(thumbnailData)]; - public void SetArtist(string artist) => _file.Tag.Performers = new[] { artist }; + public void SetArtist(string artist) => _file.Tag.Performers = [artist]; - public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = new[] { artistSort }; + public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = [artistSort]; public void SetTitle(string title) => _file.Tag.Title = title; diff --git a/Yosu.Soundcloud.Core/Tagging/MediaTagInjector.cs b/Yosu.Soundcloud.Core/Tagging/MediaTagInjector.cs index 2eed6df..1698b2d 100644 --- a/Yosu.Soundcloud.Core/Tagging/MediaTagInjector.cs +++ b/Yosu.Soundcloud.Core/Tagging/MediaTagInjector.cs @@ -56,7 +56,7 @@ private async Task InjectMusicMetadataAsync( private static void InjectTrackMetadataAsync(MediaFile mediaFile, Track track) { mediaFile.SetTitle(track.Title!); - mediaFile.SetPerformers(new[] { track.User!.Username! }); + mediaFile.SetPerformers([track.User!.Username!]); mediaFile.SetAlbum(track.User.Username!); } diff --git a/Yosu.Spotify.Core/Resolving/QueryResolver.cs b/Yosu.Spotify.Core/Resolving/QueryResolver.cs index ef0228b..283de15 100644 --- a/Yosu.Spotify.Core/Resolving/QueryResolver.cs +++ b/Yosu.Spotify.Core/Resolving/QueryResolver.cs @@ -68,7 +68,7 @@ await _spotify.Albums.GetAllTracksAsync(album.Id, cancellationToken) if (isUrl && TrackId.TryParse(query) is { } trackId) { var track = await _spotify.Tracks.GetAsync(trackId, cancellationToken); - return new QueryResult(QueryResultKind.Track, track.Title, new[] { track }); + return new QueryResult(QueryResultKind.Track, track.Title, [track]); } // Search diff --git a/Yosu.Spotify.Core/Tagging/MediaFile.cs b/Yosu.Spotify.Core/Tagging/MediaFile.cs index 2b23b71..9f3d01f 100644 --- a/Yosu.Spotify.Core/Tagging/MediaFile.cs +++ b/Yosu.Spotify.Core/Tagging/MediaFile.cs @@ -67,12 +67,12 @@ public void SetThumbnail(byte[] thumbnailData) Data = thumbnailData }; - _file.Tag.Pictures = new IPicture[] { picture }; + _file.Tag.Pictures = [picture]; } - public void SetArtist(string artist) => _file.Tag.Performers = new[] { artist }; + public void SetArtist(string artist) => _file.Tag.Performers = [artist]; - public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = new[] { artistSort }; + public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = [artistSort]; public void SetTitle(string title) => _file.Tag.Title = title; diff --git a/Yosu.Youtube.Converter/FFmpeg/ProgressCallback/ProgressCallback.android.cs b/Yosu.Youtube.Converter/FFmpeg/ProgressCallback/ProgressCallback.android.cs index 2cbcc1e..c343348 100644 --- a/Yosu.Youtube.Converter/FFmpeg/ProgressCallback/ProgressCallback.android.cs +++ b/Yosu.Youtube.Converter/FFmpeg/ProgressCallback/ProgressCallback.android.cs @@ -22,7 +22,7 @@ public void Apply(Laerdal.FFmpeg.Android.Statistics newStatistics) public static void Init(IProgress? progress, string filePath) { - Init(progress, new[] { filePath }); + Init(progress, [filePath]); } public static void Init(IProgress? progress, IEnumerable filePaths) diff --git a/Yosu.Youtube.Core/Downloading/VideoDownloadOption.cs b/Yosu.Youtube.Core/Downloading/VideoDownloadOption.cs index 2a7b5e1..f57df7b 100644 --- a/Yosu.Youtube.Core/Downloading/VideoDownloadOption.cs +++ b/Yosu.Youtube.Core/Downloading/VideoDownloadOption.cs @@ -53,7 +53,7 @@ IEnumerable GetVideoAndAudioOptions() yield return new VideoDownloadOption( videoStreamInfo.Container, false, - new IStreamInfo[] { videoStreamInfo, audioStreamInfo } + [videoStreamInfo, audioStreamInfo] ); } } diff --git a/Yosu.Youtube.Core/Tagging/MediaFile.cs b/Yosu.Youtube.Core/Tagging/MediaFile.cs index 3a11965..b4fa04d 100644 --- a/Yosu.Youtube.Core/Tagging/MediaFile.cs +++ b/Yosu.Youtube.Core/Tagging/MediaFile.cs @@ -67,12 +67,12 @@ public void SetThumbnail(byte[] thumbnailData) Data = thumbnailData }; - _file.Tag.Pictures = new IPicture[] { picture }; + _file.Tag.Pictures = [picture]; } - public void SetArtist(string artist) => _file.Tag.Performers = new[] { artist }; + public void SetArtist(string artist) => _file.Tag.Performers = [artist]; - public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = new[] { artistSort }; + public void SetArtistSort(string artistSort) => _file.Tag.PerformersSort = [artistSort]; public void SetTitle(string title) => _file.Tag.Title = title; diff --git a/Yosu/Controls/ProgressBar.cs b/Yosu/Controls/ProgressBar.cs index 7f3dd2f..b03ff02 100644 --- a/Yosu/Controls/ProgressBar.cs +++ b/Yosu/Controls/ProgressBar.cs @@ -232,8 +232,8 @@ private void DrawProgress() progressPaint.Shader = SKShader.CreateLinearGradient( new SKPoint(_drawRect.Left, _drawRect.MidY), new SKPoint(_drawRect.Right, _drawRect.MidY), - new[] { GradientColor.ToSKColor(), ProgressColor.ToSKColor() }, - new[] { 0.0f, 1.0f }, + [GradientColor.ToSKColor(), ProgressColor.ToSKColor()], + [0.0f, 1.0f], SKShaderTileMode.Clamp ); } diff --git a/Yosu/Platforms/Android/Extensions/ActivityExtensions.cs b/Yosu/Platforms/Android/Extensions/ActivityExtensions.cs index 5376638..67a715e 100644 --- a/Yosu/Platforms/Android/Extensions/ActivityExtensions.cs +++ b/Yosu/Platforms/Android/Extensions/ActivityExtensions.cs @@ -80,8 +80,8 @@ public static async Task CopyFileAsync( { MediaScannerConnection.ScanFile( context, - new[] { newFilePath }, - new[] { mimeType }, + [newFilePath], + [mimeType], null ); } @@ -178,6 +178,6 @@ private static async Task CopyFileUsingMediaStoreAsync( if (output is not null) await input.CopyToAsync(output, defaultBufferSize, cancellationToken); - MediaScannerConnection.ScanFile(context, new[] { newFilePath }, new[] { mimeType }, null); + MediaScannerConnection.ScanFile(context, [newFilePath], [mimeType], null); } } diff --git a/Yosu/Platforms/Android/MainActivity.cs b/Yosu/Platforms/Android/MainActivity.cs index 2aed538..4103b08 100644 --- a/Yosu/Platforms/Android/MainActivity.cs +++ b/Yosu/Platforms/Android/MainActivity.cs @@ -13,20 +13,20 @@ namespace Yosu; [IntentFilter( - actions: new[] { Intent.ActionView }, + actions: [Intent.ActionView], Label = "Download in Yosu", - Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, - DataSchemes = new[] { "http", "https" }, - DataHosts = new[] { "youtube.com", "youtu.be", "on.soundcloud.com" }, - DataPathPatterns = new[] { "/.*" } + Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], + DataSchemes = ["http", "https"], + DataHosts = ["youtube.com", "youtu.be", "on.soundcloud.com"], + DataPathPatterns = ["/.*"] )] [IntentFilter( - actions: new[] { Intent.ActionView }, + actions: [Intent.ActionView], Label = "Download in Yosu", - Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, - DataSchemes = new[] { "http", "https" }, - DataHosts = new[] { "soundcloud.com", "www.soundcloud.com", "m.soundcloud.com" }, - DataPathPatterns = new[] { "/.*/.*" } + Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], + DataSchemes = ["http", "https"], + DataHosts = ["soundcloud.com", "www.soundcloud.com", "m.soundcloud.com"], + DataPathPatterns = ["/.*/.*"] )] //[IntentFilter( // actions: new[] { Intent.ActionSend }, @@ -65,7 +65,7 @@ protected override async void OnCreate(Bundle? savedInstanceState) { ActivityCompat.RequestPermissions( this, - new string[] { Manifest.Permission.PostNotifications }, + [Manifest.Permission.PostNotifications], PostNotificationsRequestCode ); } diff --git a/Yosu/Utils/ObservableRangeCollection.cs b/Yosu/Utils/ObservableRangeCollection.cs index 6c8930b..ccd38b3 100644 --- a/Yosu/Utils/ObservableRangeCollection.cs +++ b/Yosu/Utils/ObservableRangeCollection.cs @@ -128,7 +128,7 @@ public void RemoveRange( /// /// Clears the current collection and replaces it with the specified item. /// - public void Replace(T item) => ReplaceRange(new T[] { item }); + public void Replace(T item) => ReplaceRange([item]); /// /// Clears the current collection and replaces it with the specified collection. diff --git a/Yosu/ViewModels/MainCollectionViewModel.cs b/Yosu/ViewModels/MainCollectionViewModel.cs index c6e35e8..5b4fb4f 100644 --- a/Yosu/ViewModels/MainCollectionViewModel.cs +++ b/Yosu/ViewModels/MainCollectionViewModel.cs @@ -164,11 +164,11 @@ async Task Download(DownloadViewModelBase entity) break; case SoundcloudDownloadViewModel download: - _soundcloudViewModel.EnqueueDownloads(new[] { download }); + _soundcloudViewModel.EnqueueDownloads([download]); break; case SpotifyDownloadViewModel download: - _spotifyViewModel.EnqueueDownloads(new[] { download }); + _spotifyViewModel.EnqueueDownloads([download]); break; } } diff --git a/Yosu/ViewModels/YoutubeViewModel.cs b/Yosu/ViewModels/YoutubeViewModel.cs index afcda20..835d3a9 100644 --- a/Yosu/ViewModels/YoutubeViewModel.cs +++ b/Yosu/ViewModels/YoutubeViewModel.cs @@ -46,7 +46,7 @@ public class YoutubeViewModel public Container SelectedContainer { get; set; } = Container.Mp4; public IReadOnlyList AvailableContainers { get; } = - new[] { Container.Mp4, Container.WebM, Container.Mp3, new Container("ogg") }; + [Container.Mp4, Container.WebM, Container.Mp3, new Container("ogg")]; public IReadOnlyList AvailableVideoQualityPreferences { get; } = Enum.GetValues().Reverse().ToArray();