From 9a1b29979fcf3013cabb6db0eeeedcaa40d2bcca Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:28:05 +0100 Subject: [PATCH 01/29] other: rename "Sources" folder to "src" --- {Sources => src}/BandcampDownloader.sln | 0 {Sources => src}/BandcampDownloader/App.xaml | 0 .../BandcampDownloader/App.xaml.cs | 0 .../BandcampDownloader.csproj | 598 +++++++++--------- .../Business Objects/Album.cs | 0 .../Business Objects/JSON/JsonAlbum.cs | 78 +-- .../Business Objects/JSON/JsonAlbumData.cs | 20 +- .../Business Objects/JSON/JsonMp3File.cs | 0 .../Business Objects/JSON/JsonTrack.cs | 0 .../Business Objects/Track.cs | 0 .../Business Objects/TrackFile.cs | 0 .../BandcampDownloader/FodyWeavers.xml | 0 .../BandcampDownloader/FodyWeavers.xsd | 0 .../Helpers/BandcampHelper.cs | 218 +++---- .../BandcampDownloader/Helpers/FileHelper.cs | 0 .../BandcampDownloader/Helpers/LogHelper.cs | 0 .../BandcampDownloader/Helpers/TagHelper.cs | 0 .../Helpers/UpdatesHelper.cs | 0 .../Miscellaneous/Constants.cs | 72 +-- .../Miscellaneous/DoubleRule.cs | 0 .../Miscellaneous/DownloadProgress.cs | 0 .../Miscellaneous/EnumerationExtension.cs | 0 .../Miscellaneous/Exceptions.cs | 0 .../Miscellaneous/Extensions.cs | 124 ++-- .../Miscellaneous/LogType.cs | 20 +- .../Miscellaneous/UserSettings.cs | 250 ++++---- .../Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Properties/Settings.settings | 0 .../Resources/ArrowCircle225Left.png | Bin .../BandcampDownloader/Resources/Cloud.ico | Bin .../BandcampDownloader/Resources/Cloud.png | Bin .../Resources/ExclamationSmall.png | Bin .../Resources/InformationSmallWhite.png | Bin .../Value Converters/BooleanAndConverter.cs | 0 .../Value Converters/ComparisonConverter.cs | 0 .../DoubleToPercentConverter.cs | 0 .../InverseBooleanConverter.cs | 0 .../InverseBooleanToVisibilityConverter.cs | 0 .../Windows/UserControlSettingsAdvanced.xaml | 0 .../UserControlSettingsAdvanced.xaml.cs | 0 .../Windows/UserControlSettingsCoverArt.xaml | 0 .../UserControlSettingsCoverArt.xaml.cs | 0 .../Windows/UserControlSettingsDownloads.xaml | 0 .../UserControlSettingsDownloads.xaml.cs | 0 .../Windows/UserControlSettingsGeneral.xaml | 0 .../UserControlSettingsGeneral.xaml.cs | 0 .../Windows/UserControlSettingsNetwork.xaml | 0 .../UserControlSettingsNetwork.xaml.cs | 0 .../Windows/UserControlSettingsTags.xaml | 0 .../Windows/UserControlSettingsTags.xaml.cs | 0 .../Windows/WindowMain.xaml | 0 .../Windows/WindowMain.xaml.cs | 0 .../Windows/WindowSettings.xaml | 0 .../Windows/WindowSettings.xaml.cs | 0 .../BandcampDownloader/app.config | 0 .../BandcampDownloader/packages.config | 22 +- 59 files changed, 701 insertions(+), 701 deletions(-) rename {Sources => src}/BandcampDownloader.sln (100%) rename {Sources => src}/BandcampDownloader/App.xaml (100%) rename {Sources => src}/BandcampDownloader/App.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/BandcampDownloader.csproj (97%) rename {Sources => src}/BandcampDownloader/Business Objects/Album.cs (100%) rename {Sources => src}/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs (97%) rename {Sources => src}/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs (95%) rename {Sources => src}/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs (100%) rename {Sources => src}/BandcampDownloader/Business Objects/JSON/JsonTrack.cs (100%) rename {Sources => src}/BandcampDownloader/Business Objects/Track.cs (100%) rename {Sources => src}/BandcampDownloader/Business Objects/TrackFile.cs (100%) rename {Sources => src}/BandcampDownloader/FodyWeavers.xml (100%) rename {Sources => src}/BandcampDownloader/FodyWeavers.xsd (100%) rename {Sources => src}/BandcampDownloader/Helpers/BandcampHelper.cs (97%) rename {Sources => src}/BandcampDownloader/Helpers/FileHelper.cs (100%) rename {Sources => src}/BandcampDownloader/Helpers/LogHelper.cs (100%) rename {Sources => src}/BandcampDownloader/Helpers/TagHelper.cs (100%) rename {Sources => src}/BandcampDownloader/Helpers/UpdatesHelper.cs (100%) rename {Sources => src}/BandcampDownloader/Miscellaneous/Constants.cs (98%) rename {Sources => src}/BandcampDownloader/Miscellaneous/DoubleRule.cs (100%) rename {Sources => src}/BandcampDownloader/Miscellaneous/DownloadProgress.cs (100%) rename {Sources => src}/BandcampDownloader/Miscellaneous/EnumerationExtension.cs (100%) rename {Sources => src}/BandcampDownloader/Miscellaneous/Exceptions.cs (100%) rename {Sources => src}/BandcampDownloader/Miscellaneous/Extensions.cs (97%) rename {Sources => src}/BandcampDownloader/Miscellaneous/LogType.cs (94%) rename {Sources => src}/BandcampDownloader/Miscellaneous/UserSettings.cs (96%) rename {Sources => src}/BandcampDownloader/Properties/AssemblyInfo.cs (100%) rename {Sources => src}/BandcampDownloader/Properties/Resources.Designer.cs (100%) rename {Sources => src}/BandcampDownloader/Properties/Resources.resx (100%) rename {Sources => src}/BandcampDownloader/Properties/Settings.Designer.cs (100%) rename {Sources => src}/BandcampDownloader/Properties/Settings.settings (100%) rename {Sources => src}/BandcampDownloader/Resources/ArrowCircle225Left.png (100%) rename {Sources => src}/BandcampDownloader/Resources/Cloud.ico (100%) rename {Sources => src}/BandcampDownloader/Resources/Cloud.png (100%) rename {Sources => src}/BandcampDownloader/Resources/ExclamationSmall.png (100%) rename {Sources => src}/BandcampDownloader/Resources/InformationSmallWhite.png (100%) rename {Sources => src}/BandcampDownloader/Value Converters/BooleanAndConverter.cs (100%) rename {Sources => src}/BandcampDownloader/Value Converters/ComparisonConverter.cs (100%) rename {Sources => src}/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs (100%) rename {Sources => src}/BandcampDownloader/Value Converters/InverseBooleanConverter.cs (100%) rename {Sources => src}/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsTags.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/WindowMain.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/WindowMain.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/Windows/WindowSettings.xaml (100%) rename {Sources => src}/BandcampDownloader/Windows/WindowSettings.xaml.cs (100%) rename {Sources => src}/BandcampDownloader/app.config (100%) rename {Sources => src}/BandcampDownloader/packages.config (98%) diff --git a/Sources/BandcampDownloader.sln b/src/BandcampDownloader.sln similarity index 100% rename from Sources/BandcampDownloader.sln rename to src/BandcampDownloader.sln diff --git a/Sources/BandcampDownloader/App.xaml b/src/BandcampDownloader/App.xaml similarity index 100% rename from Sources/BandcampDownloader/App.xaml rename to src/BandcampDownloader/App.xaml diff --git a/Sources/BandcampDownloader/App.xaml.cs b/src/BandcampDownloader/App.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/App.xaml.cs rename to src/BandcampDownloader/App.xaml.cs diff --git a/Sources/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj similarity index 97% rename from Sources/BandcampDownloader/BandcampDownloader.csproj rename to src/BandcampDownloader/BandcampDownloader.csproj index 30312575..0b672fba 100644 --- a/Sources/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -1,300 +1,300 @@ - - - - - Debug - x86 - 8.0.30703 - 2.0 - {F6E97E00-B958-4745-974E-14C6A72E5D03} - WinExe - Properties - BandcampDownloader - BandcampDownloader - v4.5.2 - - - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - false - 0 - 1.0.0.0 - false - true - - - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - prompt - false - - - bin\Release\ - TRACE - true - pdbonly - AnyCPU - prompt - false - - - Resources\Cloud.ico - - - - ..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll - - - ..\packages\Config.Net.4.11.0\lib\net452\Config.Net.dll - - - ..\packages\HtmlAgilityPack.1.8.11\lib\Net45\HtmlAgilityPack.dll - - - ..\packages\ImageResizer.4.2.5\lib\net45\ImageResizer.dll - - - - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NLog.4.5.11\lib\net45\NLog.dll - - - - - - - - - - - - - 4.0 - - - - ..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll - - - - - - - - MSBuild:Compile - Designer - - - - - - - - - - - - - - - - - - - UserControlSettingsAdvanced.xaml - - - UserControlSettingsCoverArt.xaml - - - UserControlSettingsDownloads.xaml - - - UserControlSettingsGeneral.xaml - - - UserControlSettingsNetwork.xaml - - - UserControlSettingsTags.xaml - - - - App.xaml - Code - - - - - - - - - - - WindowMain.xaml - - - WindowSettings.xaml - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - Designer - - - Designer - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - False - Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + Debug + x86 + 8.0.30703 + 2.0 + {F6E97E00-B958-4745-974E-14C6A72E5D03} + WinExe + Properties + BandcampDownloader + BandcampDownloader + v4.5.2 + + + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + false + 0 + 1.0.0.0 + false + true + + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + false + + + bin\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + false + + + Resources\Cloud.ico + + + + ..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll + + + ..\packages\Config.Net.4.11.0\lib\net452\Config.Net.dll + + + ..\packages\HtmlAgilityPack.1.8.11\lib\Net45\HtmlAgilityPack.dll + + + ..\packages\ImageResizer.4.2.5\lib\net45\ImageResizer.dll + + + + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NLog.4.5.11\lib\net45\NLog.dll + + + + + + + + + + + + + 4.0 + + + + ..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + + + + + + UserControlSettingsAdvanced.xaml + + + UserControlSettingsCoverArt.xaml + + + UserControlSettingsDownloads.xaml + + + UserControlSettingsGeneral.xaml + + + UserControlSettingsNetwork.xaml + + + UserControlSettingsTags.xaml + + + + App.xaml + Code + + + + + + + + + + + WindowMain.xaml + + + WindowSettings.xaml + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + Designer + + + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/Sources/BandcampDownloader/Business Objects/Album.cs b/src/BandcampDownloader/Business Objects/Album.cs similarity index 100% rename from Sources/BandcampDownloader/Business Objects/Album.cs rename to src/BandcampDownloader/Business Objects/Album.cs diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs b/src/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs similarity index 97% rename from Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs rename to src/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs index 1823f4e7..4c7e2304 100644 --- a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs +++ b/src/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs @@ -1,40 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; - -namespace BandcampDownloader { - - internal class JsonAlbum { - public String urlEnd = "_0.jpg"; - public String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site - - [JsonProperty("current")] - public JsonAlbumData AlbumData { get; set; } - - [JsonProperty("art_id")] - public String ArtId { get; set; } - - [JsonProperty("artist")] - public String Artist { get; set; } - - [JsonProperty("album_release_date")] - public DateTime ReleaseDate { get; set; } - - [JsonProperty("trackinfo")] - public List Tracks { get; set; } - - public Album ToAlbum() { - return new Album() { - Artist = Artist, - // Some albums do not have a cover art - ArtworkUrl = ArtId == null ? null : urlStart + ArtId.PadLeft(10, '0') + urlEnd, - ReleaseDate = ReleaseDate, - Title = AlbumData.AlbumTitle, - // Some tracks do not have their URL filled on some albums (pre-release...) - // Forget those tracks here - Tracks = Tracks.Where(t => t.File != null).Select(t => t.ToTrack()).ToList() - }; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; + +namespace BandcampDownloader { + + internal class JsonAlbum { + public String urlEnd = "_0.jpg"; + public String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site + + [JsonProperty("current")] + public JsonAlbumData AlbumData { get; set; } + + [JsonProperty("art_id")] + public String ArtId { get; set; } + + [JsonProperty("artist")] + public String Artist { get; set; } + + [JsonProperty("album_release_date")] + public DateTime ReleaseDate { get; set; } + + [JsonProperty("trackinfo")] + public List Tracks { get; set; } + + public Album ToAlbum() { + return new Album() { + Artist = Artist, + // Some albums do not have a cover art + ArtworkUrl = ArtId == null ? null : urlStart + ArtId.PadLeft(10, '0') + urlEnd, + ReleaseDate = ReleaseDate, + Title = AlbumData.AlbumTitle, + // Some tracks do not have their URL filled on some albums (pre-release...) + // Forget those tracks here + Tracks = Tracks.Where(t => t.File != null).Select(t => t.ToTrack()).ToList() + }; + } + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs b/src/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs similarity index 95% rename from Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs rename to src/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs index 959e2f61..d040069d 100644 --- a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs +++ b/src/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs @@ -1,11 +1,11 @@ -using System; -using Newtonsoft.Json; - -namespace BandcampDownloader { - - internal class JsonAlbumData { - - [JsonProperty("title")] - public String AlbumTitle { get; set; } - } +using System; +using Newtonsoft.Json; + +namespace BandcampDownloader { + + internal class JsonAlbumData { + + [JsonProperty("title")] + public String AlbumTitle { get; set; } + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs b/src/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs similarity index 100% rename from Sources/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs rename to src/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonTrack.cs b/src/BandcampDownloader/Business Objects/JSON/JsonTrack.cs similarity index 100% rename from Sources/BandcampDownloader/Business Objects/JSON/JsonTrack.cs rename to src/BandcampDownloader/Business Objects/JSON/JsonTrack.cs diff --git a/Sources/BandcampDownloader/Business Objects/Track.cs b/src/BandcampDownloader/Business Objects/Track.cs similarity index 100% rename from Sources/BandcampDownloader/Business Objects/Track.cs rename to src/BandcampDownloader/Business Objects/Track.cs diff --git a/Sources/BandcampDownloader/Business Objects/TrackFile.cs b/src/BandcampDownloader/Business Objects/TrackFile.cs similarity index 100% rename from Sources/BandcampDownloader/Business Objects/TrackFile.cs rename to src/BandcampDownloader/Business Objects/TrackFile.cs diff --git a/Sources/BandcampDownloader/FodyWeavers.xml b/src/BandcampDownloader/FodyWeavers.xml similarity index 100% rename from Sources/BandcampDownloader/FodyWeavers.xml rename to src/BandcampDownloader/FodyWeavers.xml diff --git a/Sources/BandcampDownloader/FodyWeavers.xsd b/src/BandcampDownloader/FodyWeavers.xsd similarity index 100% rename from Sources/BandcampDownloader/FodyWeavers.xsd rename to src/BandcampDownloader/FodyWeavers.xsd diff --git a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs b/src/BandcampDownloader/Helpers/BandcampHelper.cs similarity index 97% rename from Sources/BandcampDownloader/Helpers/BandcampHelper.cs rename to src/BandcampDownloader/Helpers/BandcampHelper.cs index 42e3e3b1..12b9914c 100644 --- a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs +++ b/src/BandcampDownloader/Helpers/BandcampHelper.cs @@ -1,110 +1,110 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using HtmlAgilityPack; -using Newtonsoft.Json; - -namespace BandcampDownloader { - - internal static class BandcampHelper { - - /// - /// Retrieves the data on the album of the specified Bandcamp page. - /// - /// The HTML source code of a Bandcamp album page. - /// The data on the album of the specified Bandcamp page. - public static Album GetAlbum(String htmlCode) { - // Keep the interesting part of htmlCode only - String albumData; - try { - albumData = GetAlbumData(htmlCode); - } catch (Exception e) { - throw new Exception("Could not retrieve album data in HTML code.", e); - } - - // Fix some wrongly formatted JSON in source code - albumData = FixJson(albumData); - - // Deserialize JSON - Album album; - try { - var settings = new JsonSerializerSettings { - NullValueHandling = NullValueHandling.Ignore, - MissingMemberHandling = MissingMemberHandling.Ignore - }; - album = JsonConvert.DeserializeObject(albumData, settings).ToAlbum(); - } catch (Exception e) { - throw new Exception("Could not deserialize JSON data.", e); - } - - // Extract lyrics from album page - HtmlDocument htmlDoc = new HtmlDocument(); - htmlDoc.LoadHtml(htmlCode); - foreach (Track track in album.Tracks) { - HtmlNode lyricsElement = htmlDoc.GetElementbyId("_lyrics_" + track.Number); - if (lyricsElement != null) { - track.Lyrics = lyricsElement.InnerText.Trim(); - } - } - - return album; - } - - /// - /// Retrieves all the albums URL existing on the specified Bandcamp page. - /// - /// The HTML source code of a Bandcamp page. - /// The albums URL existing on the specified Bandcamp page. - public static List GetAlbumsUrl(String htmlCode) { - // Get artist bandcamp page - var regex = new Regex("band_url = \"(?.*)\""); - if (!regex.IsMatch(htmlCode)) { - throw new NoAlbumFoundException(); - } - String artistPage = regex.Match(htmlCode).Groups["url"].Value; - - // Get albums ("real" albums or track-only pages) relative urls - regex = new Regex("href=\"(?/(album|track)/.*)\""); - if (!regex.IsMatch(htmlCode)) { - throw new NoAlbumFoundException(); - } - - var albumsUrl = new List(); - foreach (Match m in regex.Matches(htmlCode)) { - albumsUrl.Add(artistPage + m.Groups["url"].Value); - } - - // Remove duplicates - albumsUrl = albumsUrl.Distinct().ToList(); - return albumsUrl; - } - - private static String FixJson(String albumData) { - // Some JSON is not correctly formatted in bandcamp pages, so it needs to be fixed before we can deserialize it - - // In trackinfo property, we have for instance: - // url: "http://verbalclick.bandcamp.com" + "/album/404" - // -> Remove the " + " - var regex = new Regex("(?url: \".+)\" \\+ \"(?.+\",)"); - String fixedData = regex.Replace(albumData, "${root}${album}"); - - return fixedData; - } - - private static String GetAlbumData(String htmlCode) { - String startString = "var TralbumData = {"; - String stopString = "};"; - - if (htmlCode.IndexOf(startString) == -1) { - // Could not find startString - throw new Exception("Could not find the following string in HTML code: var TralbumData = {"); - } - - String albumDataTemp = htmlCode.Substring(htmlCode.IndexOf(startString) + startString.Length - 1); - String albumData = albumDataTemp.Substring(0, albumDataTemp.IndexOf(stopString) + 1); - - return albumData; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using HtmlAgilityPack; +using Newtonsoft.Json; + +namespace BandcampDownloader { + + internal static class BandcampHelper { + + /// + /// Retrieves the data on the album of the specified Bandcamp page. + /// + /// The HTML source code of a Bandcamp album page. + /// The data on the album of the specified Bandcamp page. + public static Album GetAlbum(String htmlCode) { + // Keep the interesting part of htmlCode only + String albumData; + try { + albumData = GetAlbumData(htmlCode); + } catch (Exception e) { + throw new Exception("Could not retrieve album data in HTML code.", e); + } + + // Fix some wrongly formatted JSON in source code + albumData = FixJson(albumData); + + // Deserialize JSON + Album album; + try { + var settings = new JsonSerializerSettings { + NullValueHandling = NullValueHandling.Ignore, + MissingMemberHandling = MissingMemberHandling.Ignore + }; + album = JsonConvert.DeserializeObject(albumData, settings).ToAlbum(); + } catch (Exception e) { + throw new Exception("Could not deserialize JSON data.", e); + } + + // Extract lyrics from album page + HtmlDocument htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(htmlCode); + foreach (Track track in album.Tracks) { + HtmlNode lyricsElement = htmlDoc.GetElementbyId("_lyrics_" + track.Number); + if (lyricsElement != null) { + track.Lyrics = lyricsElement.InnerText.Trim(); + } + } + + return album; + } + + /// + /// Retrieves all the albums URL existing on the specified Bandcamp page. + /// + /// The HTML source code of a Bandcamp page. + /// The albums URL existing on the specified Bandcamp page. + public static List GetAlbumsUrl(String htmlCode) { + // Get artist bandcamp page + var regex = new Regex("band_url = \"(?.*)\""); + if (!regex.IsMatch(htmlCode)) { + throw new NoAlbumFoundException(); + } + String artistPage = regex.Match(htmlCode).Groups["url"].Value; + + // Get albums ("real" albums or track-only pages) relative urls + regex = new Regex("href=\"(?/(album|track)/.*)\""); + if (!regex.IsMatch(htmlCode)) { + throw new NoAlbumFoundException(); + } + + var albumsUrl = new List(); + foreach (Match m in regex.Matches(htmlCode)) { + albumsUrl.Add(artistPage + m.Groups["url"].Value); + } + + // Remove duplicates + albumsUrl = albumsUrl.Distinct().ToList(); + return albumsUrl; + } + + private static String FixJson(String albumData) { + // Some JSON is not correctly formatted in bandcamp pages, so it needs to be fixed before we can deserialize it + + // In trackinfo property, we have for instance: + // url: "http://verbalclick.bandcamp.com" + "/album/404" + // -> Remove the " + " + var regex = new Regex("(?url: \".+)\" \\+ \"(?.+\",)"); + String fixedData = regex.Replace(albumData, "${root}${album}"); + + return fixedData; + } + + private static String GetAlbumData(String htmlCode) { + String startString = "var TralbumData = {"; + String stopString = "};"; + + if (htmlCode.IndexOf(startString) == -1) { + // Could not find startString + throw new Exception("Could not find the following string in HTML code: var TralbumData = {"); + } + + String albumDataTemp = htmlCode.Substring(htmlCode.IndexOf(startString) + startString.Length - 1); + String albumData = albumDataTemp.Substring(0, albumDataTemp.IndexOf(stopString) + 1); + + return albumData; + } + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Helpers/FileHelper.cs b/src/BandcampDownloader/Helpers/FileHelper.cs similarity index 100% rename from Sources/BandcampDownloader/Helpers/FileHelper.cs rename to src/BandcampDownloader/Helpers/FileHelper.cs diff --git a/Sources/BandcampDownloader/Helpers/LogHelper.cs b/src/BandcampDownloader/Helpers/LogHelper.cs similarity index 100% rename from Sources/BandcampDownloader/Helpers/LogHelper.cs rename to src/BandcampDownloader/Helpers/LogHelper.cs diff --git a/Sources/BandcampDownloader/Helpers/TagHelper.cs b/src/BandcampDownloader/Helpers/TagHelper.cs similarity index 100% rename from Sources/BandcampDownloader/Helpers/TagHelper.cs rename to src/BandcampDownloader/Helpers/TagHelper.cs diff --git a/Sources/BandcampDownloader/Helpers/UpdatesHelper.cs b/src/BandcampDownloader/Helpers/UpdatesHelper.cs similarity index 100% rename from Sources/BandcampDownloader/Helpers/UpdatesHelper.cs rename to src/BandcampDownloader/Helpers/UpdatesHelper.cs diff --git a/Sources/BandcampDownloader/Miscellaneous/Constants.cs b/src/BandcampDownloader/Miscellaneous/Constants.cs similarity index 98% rename from Sources/BandcampDownloader/Miscellaneous/Constants.cs rename to src/BandcampDownloader/Miscellaneous/Constants.cs index 68cd94ed..b3e54cbb 100644 --- a/Sources/BandcampDownloader/Miscellaneous/Constants.cs +++ b/src/BandcampDownloader/Miscellaneous/Constants.cs @@ -1,37 +1,37 @@ -using System; -using System.IO; -using System.Reflection; - -namespace BandcampDownloader { - - internal static class Constants { - /// - /// The version number of BandcampDownloader. - /// - public static readonly String AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(); - /// - /// The URL redirecting to the latest release on GitHub. - /// - public static readonly String LatestReleaseWebsite = "https://github.com/Otiel/BandcampDownloader/releases/latest"; - /// - /// The absolute path to the log file. - /// - public static readonly String LogFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.log"; - /// - /// The log file maximum size in bytes. - /// - public static readonly long MaxLogSize = 1024 * 1024; - /// - /// The website URL of BandcampDownloader. - /// - public static readonly String ProjectWebsite = "https://github.com/Otiel/BandcampDownloader"; - /// - /// The help text displayed in the URL list textbox. - /// - public static readonly String UrlsHint = "Paste URLs of albums to download here. You can specify multiple URLs by writing one URL per line.\n\nA Bandcamp URL looks like: http://[artist].bandcamp.com/album/[album] or http://[artist].bandcamp.com/track/[track]\nPaste artist pages: http://[artist].bandcamp.com and check \"☑ Download artist discography\" to download all their albums."; - /// - /// The absolute path to the settings file. - /// - public static readonly String UserSettingsFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.ini"; - } +using System; +using System.IO; +using System.Reflection; + +namespace BandcampDownloader { + + internal static class Constants { + /// + /// The version number of BandcampDownloader. + /// + public static readonly String AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(); + /// + /// The URL redirecting to the latest release on GitHub. + /// + public static readonly String LatestReleaseWebsite = "https://github.com/Otiel/BandcampDownloader/releases/latest"; + /// + /// The absolute path to the log file. + /// + public static readonly String LogFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.log"; + /// + /// The log file maximum size in bytes. + /// + public static readonly long MaxLogSize = 1024 * 1024; + /// + /// The website URL of BandcampDownloader. + /// + public static readonly String ProjectWebsite = "https://github.com/Otiel/BandcampDownloader"; + /// + /// The help text displayed in the URL list textbox. + /// + public static readonly String UrlsHint = "Paste URLs of albums to download here. You can specify multiple URLs by writing one URL per line.\n\nA Bandcamp URL looks like: http://[artist].bandcamp.com/album/[album] or http://[artist].bandcamp.com/track/[track]\nPaste artist pages: http://[artist].bandcamp.com and check \"☑ Download artist discography\" to download all their albums."; + /// + /// The absolute path to the settings file. + /// + public static readonly String UserSettingsFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.ini"; + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Miscellaneous/DoubleRule.cs b/src/BandcampDownloader/Miscellaneous/DoubleRule.cs similarity index 100% rename from Sources/BandcampDownloader/Miscellaneous/DoubleRule.cs rename to src/BandcampDownloader/Miscellaneous/DoubleRule.cs diff --git a/Sources/BandcampDownloader/Miscellaneous/DownloadProgress.cs b/src/BandcampDownloader/Miscellaneous/DownloadProgress.cs similarity index 100% rename from Sources/BandcampDownloader/Miscellaneous/DownloadProgress.cs rename to src/BandcampDownloader/Miscellaneous/DownloadProgress.cs diff --git a/Sources/BandcampDownloader/Miscellaneous/EnumerationExtension.cs b/src/BandcampDownloader/Miscellaneous/EnumerationExtension.cs similarity index 100% rename from Sources/BandcampDownloader/Miscellaneous/EnumerationExtension.cs rename to src/BandcampDownloader/Miscellaneous/EnumerationExtension.cs diff --git a/Sources/BandcampDownloader/Miscellaneous/Exceptions.cs b/src/BandcampDownloader/Miscellaneous/Exceptions.cs similarity index 100% rename from Sources/BandcampDownloader/Miscellaneous/Exceptions.cs rename to src/BandcampDownloader/Miscellaneous/Exceptions.cs diff --git a/Sources/BandcampDownloader/Miscellaneous/Extensions.cs b/src/BandcampDownloader/Miscellaneous/Extensions.cs similarity index 97% rename from Sources/BandcampDownloader/Miscellaneous/Extensions.cs rename to src/BandcampDownloader/Miscellaneous/Extensions.cs index 87e725ff..0692ae49 100644 --- a/Sources/BandcampDownloader/Miscellaneous/Extensions.cs +++ b/src/BandcampDownloader/Miscellaneous/Extensions.cs @@ -1,63 +1,63 @@ -using System; -using System.Text.RegularExpressions; -using System.Windows.Controls; -using NLog; - -namespace BandcampDownloader { - - internal static class Extensions { - - /// - /// Returns true if scroll position of the current RichTextBox is at the end; false otherwise. - /// - public static Boolean IsScrolledToEnd(this RichTextBox richTextBox) { - return richTextBox.VerticalOffset > richTextBox.ExtentHeight - richTextBox.ViewportHeight - 10; - } - - /// - /// Replaces the forbidden chars \ / : * ? " < > | from the System.String - /// object by an underscore _ in order to be used for a Windows file or folder. - /// - public static String ToAllowedFileName(this String fileName) { - if (fileName == null) { - throw new ArgumentNullException("fileName"); - } - - fileName = fileName.Replace("\\", "_"); - fileName = fileName.Replace("/", "_"); - fileName = fileName.Replace(":", "_"); - fileName = fileName.Replace("*", "_"); - fileName = fileName.Replace("?", "_"); - fileName = fileName.Replace("\"", "_"); - fileName = fileName.Replace("<", "_"); - fileName = fileName.Replace(">", "_"); - fileName = fileName.Replace("|", "_"); - fileName = fileName.Replace(Environment.NewLine, "_"); - fileName = Regex.Replace(fileName, @"\s+", " "); - - return fileName; - } - - /// - /// Returns the NLog.LogLevel associated to the specified LogType. - /// - public static LogLevel ToNLogLevel(this LogType logType) { - switch (logType) { - case LogType.VerboseInfo: - return LogLevel.Debug; - case LogType.Info: - return LogLevel.Info; - case LogType.IntermediateSuccess: - return LogLevel.Info; - case LogType.Success: - return LogLevel.Info; - case LogType.Warning: - return LogLevel.Warn; - case LogType.Error: - return LogLevel.Error; - default: - throw new NotImplementedException(); - } - } - } +using System; +using System.Text.RegularExpressions; +using System.Windows.Controls; +using NLog; + +namespace BandcampDownloader { + + internal static class Extensions { + + /// + /// Returns true if scroll position of the current RichTextBox is at the end; false otherwise. + /// + public static Boolean IsScrolledToEnd(this RichTextBox richTextBox) { + return richTextBox.VerticalOffset > richTextBox.ExtentHeight - richTextBox.ViewportHeight - 10; + } + + /// + /// Replaces the forbidden chars \ / : * ? " < > | from the System.String + /// object by an underscore _ in order to be used for a Windows file or folder. + /// + public static String ToAllowedFileName(this String fileName) { + if (fileName == null) { + throw new ArgumentNullException("fileName"); + } + + fileName = fileName.Replace("\\", "_"); + fileName = fileName.Replace("/", "_"); + fileName = fileName.Replace(":", "_"); + fileName = fileName.Replace("*", "_"); + fileName = fileName.Replace("?", "_"); + fileName = fileName.Replace("\"", "_"); + fileName = fileName.Replace("<", "_"); + fileName = fileName.Replace(">", "_"); + fileName = fileName.Replace("|", "_"); + fileName = fileName.Replace(Environment.NewLine, "_"); + fileName = Regex.Replace(fileName, @"\s+", " "); + + return fileName; + } + + /// + /// Returns the NLog.LogLevel associated to the specified LogType. + /// + public static LogLevel ToNLogLevel(this LogType logType) { + switch (logType) { + case LogType.VerboseInfo: + return LogLevel.Debug; + case LogType.Info: + return LogLevel.Info; + case LogType.IntermediateSuccess: + return LogLevel.Info; + case LogType.Success: + return LogLevel.Info; + case LogType.Warning: + return LogLevel.Warn; + case LogType.Error: + return LogLevel.Error; + default: + throw new NotImplementedException(); + } + } + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Miscellaneous/LogType.cs b/src/BandcampDownloader/Miscellaneous/LogType.cs similarity index 94% rename from Sources/BandcampDownloader/Miscellaneous/LogType.cs rename to src/BandcampDownloader/Miscellaneous/LogType.cs index cff9e95a..3ec04075 100644 --- a/Sources/BandcampDownloader/Miscellaneous/LogType.cs +++ b/src/BandcampDownloader/Miscellaneous/LogType.cs @@ -1,11 +1,11 @@ -namespace BandcampDownloader { - - internal enum LogType { - VerboseInfo, - Info, - IntermediateSuccess, - Success, - Warning, - Error, - } +namespace BandcampDownloader { + + internal enum LogType { + VerboseInfo, + Info, + IntermediateSuccess, + Success, + Warning, + Error, + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Miscellaneous/UserSettings.cs b/src/BandcampDownloader/Miscellaneous/UserSettings.cs similarity index 96% rename from Sources/BandcampDownloader/Miscellaneous/UserSettings.cs rename to src/BandcampDownloader/Miscellaneous/UserSettings.cs index 45bf8471..bcd63163 100644 --- a/Sources/BandcampDownloader/Miscellaneous/UserSettings.cs +++ b/src/BandcampDownloader/Miscellaneous/UserSettings.cs @@ -1,126 +1,126 @@ -using System; -using System.ComponentModel; -using Config.Net; - -namespace BandcampDownloader { - - public enum ProxyType { - None, - System, - Manual, - } - - public enum TagEditAction { - [Description("Empty tag")] - Empty, - [Description("Save in tag")] - Modify, - [Description("Do not modify")] - DoNotModify - } - - public enum TagRemoveAction { - [Description("Empty tag")] - Empty, - [Description("Do not modify")] - DoNotModify - } - - public interface IUserSettings { - - [Option(DefaultValue = 0.05)] - Double AllowedFileSizeDifference { get; set; } - - [Option(DefaultValue = true)] - Boolean CheckForUpdates { get; set; } - - [Option(DefaultValue = true)] - Boolean CoverArtInFolderConvertToJpg { get; set; } - - [Option(DefaultValue = 1000)] - int CoverArtInFolderMaxSize { get; set; } - - [Option(DefaultValue = false)] - Boolean CoverArtInFolderResize { get; set; } - - [Option(DefaultValue = true)] - Boolean CoverArtInTagsConvertToJpg { get; set; } - - [Option(DefaultValue = 1000)] - int CoverArtInTagsMaxSize { get; set; } - - [Option(DefaultValue = true)] - Boolean CoverArtInTagsResize { get; set; } - - [Option(DefaultValue = false)] - Boolean DownloadArtistDiscography { get; set; } - - [Option(DefaultValue = 7)] - int DownloadMaxTries { get; set; } - - [Option(DefaultValue = false)] - Boolean DownloadOneAlbumAtATime { get; set; } - - // Time in seconds between retries - [Option(DefaultValue = 0.2)] - Double DownloadRetryCooldown { get; set; } - - // Exponential per cooldown - ex. (value of 1.2 would yield cooldowns of x^(1.2^0), x^(1.2^1), x^(1.2^2), ..) - [Option(DefaultValue = 4.0)] - Double DownloadRetryExponent { get; set; } - - [Option(DefaultValue = "")] - String DownloadsPath { get; set; } - - [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")] - String FileNameFormat { get; set; } - - [Option(DefaultValue = true)] - Boolean ModifyTags { get; set; } - - [Option(DefaultValue = ProxyType.System)] - ProxyType Proxy { get; set; } - - [Option(DefaultValue = "")] - String ProxyHttpAddress { get; set; } - - [Option(DefaultValue = "")] - int ProxyHttpPort { get; set; } - - [Option(DefaultValue = true)] - Boolean RetrieveFilesSize { get; set; } - - [Option(DefaultValue = false)] - Boolean SaveCoverArtInFolder { get; set; } - - [Option(DefaultValue = true)] - Boolean SaveCoverArtInTags { get; set; } - - [Option(DefaultValue = false)] - Boolean ShowVerboseLog { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagAlbumArtist { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagAlbumTitle { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagArtist { get; set; } - - [Option(DefaultValue = TagRemoveAction.Empty)] - TagRemoveAction TagComments { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagLyrics { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagTrackNumber { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagTrackTitle { get; set; } - - [Option(DefaultValue = TagEditAction.Modify)] - TagEditAction TagYear { get; set; } - } +using System; +using System.ComponentModel; +using Config.Net; + +namespace BandcampDownloader { + + public enum ProxyType { + None, + System, + Manual, + } + + public enum TagEditAction { + [Description("Empty tag")] + Empty, + [Description("Save in tag")] + Modify, + [Description("Do not modify")] + DoNotModify + } + + public enum TagRemoveAction { + [Description("Empty tag")] + Empty, + [Description("Do not modify")] + DoNotModify + } + + public interface IUserSettings { + + [Option(DefaultValue = 0.05)] + Double AllowedFileSizeDifference { get; set; } + + [Option(DefaultValue = true)] + Boolean CheckForUpdates { get; set; } + + [Option(DefaultValue = true)] + Boolean CoverArtInFolderConvertToJpg { get; set; } + + [Option(DefaultValue = 1000)] + int CoverArtInFolderMaxSize { get; set; } + + [Option(DefaultValue = false)] + Boolean CoverArtInFolderResize { get; set; } + + [Option(DefaultValue = true)] + Boolean CoverArtInTagsConvertToJpg { get; set; } + + [Option(DefaultValue = 1000)] + int CoverArtInTagsMaxSize { get; set; } + + [Option(DefaultValue = true)] + Boolean CoverArtInTagsResize { get; set; } + + [Option(DefaultValue = false)] + Boolean DownloadArtistDiscography { get; set; } + + [Option(DefaultValue = 7)] + int DownloadMaxTries { get; set; } + + [Option(DefaultValue = false)] + Boolean DownloadOneAlbumAtATime { get; set; } + + // Time in seconds between retries + [Option(DefaultValue = 0.2)] + Double DownloadRetryCooldown { get; set; } + + // Exponential per cooldown - ex. (value of 1.2 would yield cooldowns of x^(1.2^0), x^(1.2^1), x^(1.2^2), ..) + [Option(DefaultValue = 4.0)] + Double DownloadRetryExponent { get; set; } + + [Option(DefaultValue = "")] + String DownloadsPath { get; set; } + + [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")] + String FileNameFormat { get; set; } + + [Option(DefaultValue = true)] + Boolean ModifyTags { get; set; } + + [Option(DefaultValue = ProxyType.System)] + ProxyType Proxy { get; set; } + + [Option(DefaultValue = "")] + String ProxyHttpAddress { get; set; } + + [Option(DefaultValue = "")] + int ProxyHttpPort { get; set; } + + [Option(DefaultValue = true)] + Boolean RetrieveFilesSize { get; set; } + + [Option(DefaultValue = false)] + Boolean SaveCoverArtInFolder { get; set; } + + [Option(DefaultValue = true)] + Boolean SaveCoverArtInTags { get; set; } + + [Option(DefaultValue = false)] + Boolean ShowVerboseLog { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagAlbumArtist { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagAlbumTitle { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagArtist { get; set; } + + [Option(DefaultValue = TagRemoveAction.Empty)] + TagRemoveAction TagComments { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagLyrics { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagTrackNumber { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagTrackTitle { get; set; } + + [Option(DefaultValue = TagEditAction.Modify)] + TagEditAction TagYear { get; set; } + } } \ No newline at end of file diff --git a/Sources/BandcampDownloader/Properties/AssemblyInfo.cs b/src/BandcampDownloader/Properties/AssemblyInfo.cs similarity index 100% rename from Sources/BandcampDownloader/Properties/AssemblyInfo.cs rename to src/BandcampDownloader/Properties/AssemblyInfo.cs diff --git a/Sources/BandcampDownloader/Properties/Resources.Designer.cs b/src/BandcampDownloader/Properties/Resources.Designer.cs similarity index 100% rename from Sources/BandcampDownloader/Properties/Resources.Designer.cs rename to src/BandcampDownloader/Properties/Resources.Designer.cs diff --git a/Sources/BandcampDownloader/Properties/Resources.resx b/src/BandcampDownloader/Properties/Resources.resx similarity index 100% rename from Sources/BandcampDownloader/Properties/Resources.resx rename to src/BandcampDownloader/Properties/Resources.resx diff --git a/Sources/BandcampDownloader/Properties/Settings.Designer.cs b/src/BandcampDownloader/Properties/Settings.Designer.cs similarity index 100% rename from Sources/BandcampDownloader/Properties/Settings.Designer.cs rename to src/BandcampDownloader/Properties/Settings.Designer.cs diff --git a/Sources/BandcampDownloader/Properties/Settings.settings b/src/BandcampDownloader/Properties/Settings.settings similarity index 100% rename from Sources/BandcampDownloader/Properties/Settings.settings rename to src/BandcampDownloader/Properties/Settings.settings diff --git a/Sources/BandcampDownloader/Resources/ArrowCircle225Left.png b/src/BandcampDownloader/Resources/ArrowCircle225Left.png similarity index 100% rename from Sources/BandcampDownloader/Resources/ArrowCircle225Left.png rename to src/BandcampDownloader/Resources/ArrowCircle225Left.png diff --git a/Sources/BandcampDownloader/Resources/Cloud.ico b/src/BandcampDownloader/Resources/Cloud.ico similarity index 100% rename from Sources/BandcampDownloader/Resources/Cloud.ico rename to src/BandcampDownloader/Resources/Cloud.ico diff --git a/Sources/BandcampDownloader/Resources/Cloud.png b/src/BandcampDownloader/Resources/Cloud.png similarity index 100% rename from Sources/BandcampDownloader/Resources/Cloud.png rename to src/BandcampDownloader/Resources/Cloud.png diff --git a/Sources/BandcampDownloader/Resources/ExclamationSmall.png b/src/BandcampDownloader/Resources/ExclamationSmall.png similarity index 100% rename from Sources/BandcampDownloader/Resources/ExclamationSmall.png rename to src/BandcampDownloader/Resources/ExclamationSmall.png diff --git a/Sources/BandcampDownloader/Resources/InformationSmallWhite.png b/src/BandcampDownloader/Resources/InformationSmallWhite.png similarity index 100% rename from Sources/BandcampDownloader/Resources/InformationSmallWhite.png rename to src/BandcampDownloader/Resources/InformationSmallWhite.png diff --git a/Sources/BandcampDownloader/Value Converters/BooleanAndConverter.cs b/src/BandcampDownloader/Value Converters/BooleanAndConverter.cs similarity index 100% rename from Sources/BandcampDownloader/Value Converters/BooleanAndConverter.cs rename to src/BandcampDownloader/Value Converters/BooleanAndConverter.cs diff --git a/Sources/BandcampDownloader/Value Converters/ComparisonConverter.cs b/src/BandcampDownloader/Value Converters/ComparisonConverter.cs similarity index 100% rename from Sources/BandcampDownloader/Value Converters/ComparisonConverter.cs rename to src/BandcampDownloader/Value Converters/ComparisonConverter.cs diff --git a/Sources/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs b/src/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs similarity index 100% rename from Sources/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs rename to src/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs diff --git a/Sources/BandcampDownloader/Value Converters/InverseBooleanConverter.cs b/src/BandcampDownloader/Value Converters/InverseBooleanConverter.cs similarity index 100% rename from Sources/BandcampDownloader/Value Converters/InverseBooleanConverter.cs rename to src/BandcampDownloader/Value Converters/InverseBooleanConverter.cs diff --git a/Sources/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs b/src/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs similarity index 100% rename from Sources/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs rename to src/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml b/src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml b/src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml b/src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml b/src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml b/src/BandcampDownloader/Windows/UserControlSettingsTags.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml rename to src/BandcampDownloader/Windows/UserControlSettingsTags.xaml diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs b/src/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs rename to src/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/WindowMain.xaml b/src/BandcampDownloader/Windows/WindowMain.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/WindowMain.xaml rename to src/BandcampDownloader/Windows/WindowMain.xaml diff --git a/Sources/BandcampDownloader/Windows/WindowMain.xaml.cs b/src/BandcampDownloader/Windows/WindowMain.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/WindowMain.xaml.cs rename to src/BandcampDownloader/Windows/WindowMain.xaml.cs diff --git a/Sources/BandcampDownloader/Windows/WindowSettings.xaml b/src/BandcampDownloader/Windows/WindowSettings.xaml similarity index 100% rename from Sources/BandcampDownloader/Windows/WindowSettings.xaml rename to src/BandcampDownloader/Windows/WindowSettings.xaml diff --git a/Sources/BandcampDownloader/Windows/WindowSettings.xaml.cs b/src/BandcampDownloader/Windows/WindowSettings.xaml.cs similarity index 100% rename from Sources/BandcampDownloader/Windows/WindowSettings.xaml.cs rename to src/BandcampDownloader/Windows/WindowSettings.xaml.cs diff --git a/Sources/BandcampDownloader/app.config b/src/BandcampDownloader/app.config similarity index 100% rename from Sources/BandcampDownloader/app.config rename to src/BandcampDownloader/app.config diff --git a/Sources/BandcampDownloader/packages.config b/src/BandcampDownloader/packages.config similarity index 98% rename from Sources/BandcampDownloader/packages.config rename to src/BandcampDownloader/packages.config index b3a7d1ec..49055997 100644 --- a/Sources/BandcampDownloader/packages.config +++ b/src/BandcampDownloader/packages.config @@ -1,12 +1,12 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file From 281ad9843c247dcfc7a7d12e428cec8305a18fe9 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:30:54 +0100 Subject: [PATCH 02/29] other: rename "Docs" folder to "docs" (lowercase) --- CONTRIBUTING.md | 2 +- README.md | 6 +++--- {Docs => docs}/Cloud.png | Bin {Docs => docs}/DownloadButton.png | Bin {Docs => docs}/Screenshot.png | Bin {Docs => docs}/commits-conventions.md | 0 6 files changed, 4 insertions(+), 4 deletions(-) rename {Docs => docs}/Cloud.png (100%) rename {Docs => docs}/DownloadButton.png (100%) rename {Docs => docs}/Screenshot.png (100%) rename {Docs => docs}/commits-conventions.md (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f380f182..3e2da2e4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,4 +13,4 @@ This repository follows [git flow](https://nvie.com/posts/a-successful-git-branc ## Commits -Please follow the [commit message conventions](/Docs/commits-conventions.md). +Please follow the [commit message conventions](/docs/commits-conventions.md). diff --git a/README.md b/README.md index 320942f4..b6417a39 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ![Logo](Docs/Cloud.png) Bandcamp Downloader +# ![Logo](docs/Cloud.png) Bandcamp Downloader -[![Download](Docs/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest) +[![Download](docs/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest) ## Description @@ -21,7 +21,7 @@ _BandcampDownloader_ is a Windows application written in C# (targeting .NET Fram ## Screenshot -![Screenshot](Docs/Screenshot.png) +![Screenshot](docs/Screenshot.png) ## Release notes diff --git a/Docs/Cloud.png b/docs/Cloud.png similarity index 100% rename from Docs/Cloud.png rename to docs/Cloud.png diff --git a/Docs/DownloadButton.png b/docs/DownloadButton.png similarity index 100% rename from Docs/DownloadButton.png rename to docs/DownloadButton.png diff --git a/Docs/Screenshot.png b/docs/Screenshot.png similarity index 100% rename from Docs/Screenshot.png rename to docs/Screenshot.png diff --git a/Docs/commits-conventions.md b/docs/commits-conventions.md similarity index 100% rename from Docs/commits-conventions.md rename to docs/commits-conventions.md From 8f9d8913cc0b4845ac5db921a695fee9e541959a Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:39:00 +0100 Subject: [PATCH 03/29] other: move pictures under "images" folder --- README.md | 6 +++--- docs/{ => images}/Cloud.png | Bin docs/{ => images}/DownloadButton.png | Bin docs/{ => images}/Screenshot.png | Bin 4 files changed, 3 insertions(+), 3 deletions(-) rename docs/{ => images}/Cloud.png (100%) rename docs/{ => images}/DownloadButton.png (100%) rename docs/{ => images}/Screenshot.png (100%) diff --git a/README.md b/README.md index b6417a39..1549fe3b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ![Logo](docs/Cloud.png) Bandcamp Downloader +# ![Logo](docs/images/Cloud.png) Bandcamp Downloader -[![Download](docs/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest) +[![Download](docs/images/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest) ## Description @@ -21,7 +21,7 @@ _BandcampDownloader_ is a Windows application written in C# (targeting .NET Fram ## Screenshot -![Screenshot](docs/Screenshot.png) +![Screenshot](docs/images/Screenshot.png) ## Release notes diff --git a/docs/Cloud.png b/docs/images/Cloud.png similarity index 100% rename from docs/Cloud.png rename to docs/images/Cloud.png diff --git a/docs/DownloadButton.png b/docs/images/DownloadButton.png similarity index 100% rename from docs/DownloadButton.png rename to docs/images/DownloadButton.png diff --git a/docs/Screenshot.png b/docs/images/Screenshot.png similarity index 100% rename from docs/Screenshot.png rename to docs/images/Screenshot.png From 7aa934356867ce2d4efd4622d63485ed36d54382 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:53:46 +0100 Subject: [PATCH 04/29] docs: center pictures --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 320942f4..668d46fa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ![Logo](Docs/Cloud.png) Bandcamp Downloader -[![Download](Docs/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest) +

+ Download +

## Description @@ -21,7 +23,9 @@ _BandcampDownloader_ is a Windows application written in C# (targeting .NET Fram ## Screenshot -![Screenshot](Docs/Screenshot.png) +

+ Screenshot +

## Release notes From a8a02c3cc3fd2fdfcf53c4aba119bbb6ddf5009a Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:54:25 +0100 Subject: [PATCH 05/29] docs: improve app description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 668d46fa..5a24fc7a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Description -_BandcampDownloader_ is a Windows application written in C# (targeting .NET Framework 4.5.2) that helps downloading albums from [bandcamp.com](https://bandcamp.com). _BandcampDownloader_ retrieves the 128 kbps MP3 files that are streamed on the website. +_BandcampDownloader_ is a Windows application that helps downloading albums from [bandcamp.com](https://bandcamp.com) by retrieving the 128 kbps MP3 files streamed on the website. Its goal isn't to pirate albums, but simply to make life easier for those who prefer to listen to music on their favorite player. ## Features From fdee1405b82094fba70c954ca9a23b4e5265e6d5 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 14:57:07 +0100 Subject: [PATCH 06/29] docs: remove italics around app name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a24fc7a..e8eee91a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Description -_BandcampDownloader_ is a Windows application that helps downloading albums from [bandcamp.com](https://bandcamp.com) by retrieving the 128 kbps MP3 files streamed on the website. Its goal isn't to pirate albums, but simply to make life easier for those who prefer to listen to music on their favorite player. +BandcampDownloader is a Windows application that helps downloading albums from [bandcamp.com](https://bandcamp.com) by retrieving the 128 kbps MP3 files streamed on the website. Its goal isn't to pirate albums, but simply to make life easier for those who prefer to listen to music on their favorite player. ## Features @@ -33,7 +33,7 @@ See the [changelog](CHANGELOG.md). ## License -_BandcampDownloader_ is licensed under the MIT license - see the [LICENSE](LICENSE) file for details. +BandcampDownloader is licensed under the MIT license - see the [LICENSE](LICENSE) file for details. ## Credits From d6a9de4676db186c844455ca722097700d499463 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 10 Dec 2018 16:12:16 +0100 Subject: [PATCH 07/29] docs: remove extra newline --- docs/commits-conventions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/commits-conventions.md b/docs/commits-conventions.md index d03f5f72..ae393a4e 100644 --- a/docs/commits-conventions.md +++ b/docs/commits-conventions.md @@ -25,7 +25,6 @@ ### Allowed `` values: - Type | Release | Description | Changelog ---------|---------|-------------|---------- feat | `minor` | New feature or enhancement (for the user - not a new feature for a build script). | Visible From 08612a7a5b1c58bc45a814147bef651f1f7e5811 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 13:46:48 +0100 Subject: [PATCH 08/29] refactor: rename "Windows" folder to "UI" --- .../BandcampDownloader.csproj | 32 +++++++++---------- .../UserControlSettingsAdvanced.xaml | 0 .../UserControlSettingsAdvanced.xaml.cs | 0 .../UserControlSettingsCoverArt.xaml | 0 .../UserControlSettingsCoverArt.xaml.cs | 0 .../UserControlSettingsDownloads.xaml | 0 .../UserControlSettingsDownloads.xaml.cs | 0 .../UserControlSettingsGeneral.xaml | 0 .../UserControlSettingsGeneral.xaml.cs | 0 .../UserControlSettingsNetwork.xaml | 0 .../UserControlSettingsNetwork.xaml.cs | 0 .../UserControlSettingsTags.xaml | 0 .../UserControlSettingsTags.xaml.cs | 0 .../{Windows => UI}/WindowMain.xaml | 0 .../{Windows => UI}/WindowMain.xaml.cs | 0 .../{Windows => UI}/WindowSettings.xaml | 0 .../{Windows => UI}/WindowSettings.xaml.cs | 0 17 files changed, 16 insertions(+), 16 deletions(-) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsAdvanced.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsAdvanced.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsCoverArt.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsCoverArt.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsDownloads.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsDownloads.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsGeneral.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsGeneral.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsNetwork.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsNetwork.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsTags.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/UserControlSettingsTags.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/WindowMain.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/WindowMain.xaml.cs (100%) rename src/BandcampDownloader/{Windows => UI}/WindowSettings.xaml (100%) rename src/BandcampDownloader/{Windows => UI}/WindowSettings.xaml.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 0b672fba..07707e05 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -139,22 +139,22 @@ - + UserControlSettingsAdvanced.xaml - + UserControlSettingsCoverArt.xaml - + UserControlSettingsDownloads.xaml - + UserControlSettingsGeneral.xaml - + UserControlSettingsNetwork.xaml - + UserControlSettingsTags.xaml @@ -170,41 +170,41 @@ - + WindowMain.xaml - + WindowSettings.xaml - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + Designer MSBuild:Compile - + MSBuild:Compile Designer - + MSBuild:Compile Designer diff --git a/src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml b/src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml rename to src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml.cs diff --git a/src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml b/src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml rename to src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml.cs diff --git a/src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml b/src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml rename to src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml.cs diff --git a/src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml rename to src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml.cs diff --git a/src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml b/src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml rename to src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml.cs diff --git a/src/BandcampDownloader/Windows/UserControlSettingsTags.xaml b/src/BandcampDownloader/UI/UserControlSettingsTags.xaml similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsTags.xaml rename to src/BandcampDownloader/UI/UserControlSettingsTags.xaml diff --git a/src/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs b/src/BandcampDownloader/UI/UserControlSettingsTags.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs rename to src/BandcampDownloader/UI/UserControlSettingsTags.xaml.cs diff --git a/src/BandcampDownloader/Windows/WindowMain.xaml b/src/BandcampDownloader/UI/WindowMain.xaml similarity index 100% rename from src/BandcampDownloader/Windows/WindowMain.xaml rename to src/BandcampDownloader/UI/WindowMain.xaml diff --git a/src/BandcampDownloader/Windows/WindowMain.xaml.cs b/src/BandcampDownloader/UI/WindowMain.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/WindowMain.xaml.cs rename to src/BandcampDownloader/UI/WindowMain.xaml.cs diff --git a/src/BandcampDownloader/Windows/WindowSettings.xaml b/src/BandcampDownloader/UI/WindowSettings.xaml similarity index 100% rename from src/BandcampDownloader/Windows/WindowSettings.xaml rename to src/BandcampDownloader/UI/WindowSettings.xaml diff --git a/src/BandcampDownloader/Windows/WindowSettings.xaml.cs b/src/BandcampDownloader/UI/WindowSettings.xaml.cs similarity index 100% rename from src/BandcampDownloader/Windows/WindowSettings.xaml.cs rename to src/BandcampDownloader/UI/WindowSettings.xaml.cs From e929ef3650c2f83b3ca369886bb906cafb9ac1ed Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:17:22 +0100 Subject: [PATCH 09/29] refactor: rename "Business Objects" folder to "Model" --- src/BandcampDownloader/BandcampDownloader.csproj | 14 +++++++------- .../{Business Objects => Model}/Album.cs | 0 .../{Business Objects => Model}/JSON/JsonAlbum.cs | 0 .../JSON/JsonAlbumData.cs | 0 .../JSON/JsonMp3File.cs | 0 .../{Business Objects => Model}/JSON/JsonTrack.cs | 0 .../{Business Objects => Model}/Track.cs | 0 .../{Business Objects => Model}/TrackFile.cs | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename src/BandcampDownloader/{Business Objects => Model}/Album.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/JSON/JsonAlbum.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/JSON/JsonAlbumData.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/JSON/JsonMp3File.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/JSON/JsonTrack.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/Track.cs (100%) rename src/BandcampDownloader/{Business Objects => Model}/TrackFile.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 07707e05..27b3a912 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -124,10 +124,10 @@ Designer - - - - + + + + @@ -157,13 +157,13 @@ UserControlSettingsTags.xaml - + App.xaml Code - - + + diff --git a/src/BandcampDownloader/Business Objects/Album.cs b/src/BandcampDownloader/Model/Album.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/Album.cs rename to src/BandcampDownloader/Model/Album.cs diff --git a/src/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs rename to src/BandcampDownloader/Model/JSON/JsonAlbum.cs diff --git a/src/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs b/src/BandcampDownloader/Model/JSON/JsonAlbumData.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs rename to src/BandcampDownloader/Model/JSON/JsonAlbumData.cs diff --git a/src/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs b/src/BandcampDownloader/Model/JSON/JsonMp3File.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs rename to src/BandcampDownloader/Model/JSON/JsonMp3File.cs diff --git a/src/BandcampDownloader/Business Objects/JSON/JsonTrack.cs b/src/BandcampDownloader/Model/JSON/JsonTrack.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/JSON/JsonTrack.cs rename to src/BandcampDownloader/Model/JSON/JsonTrack.cs diff --git a/src/BandcampDownloader/Business Objects/Track.cs b/src/BandcampDownloader/Model/Track.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/Track.cs rename to src/BandcampDownloader/Model/Track.cs diff --git a/src/BandcampDownloader/Business Objects/TrackFile.cs b/src/BandcampDownloader/Model/TrackFile.cs similarity index 100% rename from src/BandcampDownloader/Business Objects/TrackFile.cs rename to src/BandcampDownloader/Model/TrackFile.cs From c3440c21f092bd87db1b48fcfbac642bc5685e99 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:17:56 +0100 Subject: [PATCH 10/29] refactor: rename "Value Converters" folder to "Converters" --- src/BandcampDownloader/BandcampDownloader.csproj | 10 +++++----- .../BooleanAndConverter.cs | 0 .../ComparisonConverter.cs | 0 .../DoubleToPercentConverter.cs | 0 .../InverseBooleanConverter.cs | 0 .../InverseBooleanToVisibilityConverter.cs | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename src/BandcampDownloader/{Value Converters => Converters}/BooleanAndConverter.cs (100%) rename src/BandcampDownloader/{Value Converters => Converters}/ComparisonConverter.cs (100%) rename src/BandcampDownloader/{Value Converters => Converters}/DoubleToPercentConverter.cs (100%) rename src/BandcampDownloader/{Value Converters => Converters}/InverseBooleanConverter.cs (100%) rename src/BandcampDownloader/{Value Converters => Converters}/InverseBooleanToVisibilityConverter.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 27b3a912..95df466c 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -134,11 +134,11 @@ - - - - - + + + + + UserControlSettingsAdvanced.xaml diff --git a/src/BandcampDownloader/Value Converters/BooleanAndConverter.cs b/src/BandcampDownloader/Converters/BooleanAndConverter.cs similarity index 100% rename from src/BandcampDownloader/Value Converters/BooleanAndConverter.cs rename to src/BandcampDownloader/Converters/BooleanAndConverter.cs diff --git a/src/BandcampDownloader/Value Converters/ComparisonConverter.cs b/src/BandcampDownloader/Converters/ComparisonConverter.cs similarity index 100% rename from src/BandcampDownloader/Value Converters/ComparisonConverter.cs rename to src/BandcampDownloader/Converters/ComparisonConverter.cs diff --git a/src/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs b/src/BandcampDownloader/Converters/DoubleToPercentConverter.cs similarity index 100% rename from src/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs rename to src/BandcampDownloader/Converters/DoubleToPercentConverter.cs diff --git a/src/BandcampDownloader/Value Converters/InverseBooleanConverter.cs b/src/BandcampDownloader/Converters/InverseBooleanConverter.cs similarity index 100% rename from src/BandcampDownloader/Value Converters/InverseBooleanConverter.cs rename to src/BandcampDownloader/Converters/InverseBooleanConverter.cs diff --git a/src/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs b/src/BandcampDownloader/Converters/InverseBooleanToVisibilityConverter.cs similarity index 100% rename from src/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs rename to src/BandcampDownloader/Converters/InverseBooleanToVisibilityConverter.cs From efb0f790cbc5805c9da4ce0a2602f0912f317d93 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:19:29 +0100 Subject: [PATCH 11/29] refactor: move "Converters" folder under "UI" --- src/BandcampDownloader/BandcampDownloader.csproj | 10 +++++----- .../{ => UI}/Converters/BooleanAndConverter.cs | 0 .../{ => UI}/Converters/ComparisonConverter.cs | 0 .../{ => UI}/Converters/DoubleToPercentConverter.cs | 0 .../{ => UI}/Converters/InverseBooleanConverter.cs | 0 .../Converters/InverseBooleanToVisibilityConverter.cs | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename src/BandcampDownloader/{ => UI}/Converters/BooleanAndConverter.cs (100%) rename src/BandcampDownloader/{ => UI}/Converters/ComparisonConverter.cs (100%) rename src/BandcampDownloader/{ => UI}/Converters/DoubleToPercentConverter.cs (100%) rename src/BandcampDownloader/{ => UI}/Converters/InverseBooleanConverter.cs (100%) rename src/BandcampDownloader/{ => UI}/Converters/InverseBooleanToVisibilityConverter.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 95df466c..6804959d 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -134,11 +134,11 @@ - - - - - + + + + + UserControlSettingsAdvanced.xaml diff --git a/src/BandcampDownloader/Converters/BooleanAndConverter.cs b/src/BandcampDownloader/UI/Converters/BooleanAndConverter.cs similarity index 100% rename from src/BandcampDownloader/Converters/BooleanAndConverter.cs rename to src/BandcampDownloader/UI/Converters/BooleanAndConverter.cs diff --git a/src/BandcampDownloader/Converters/ComparisonConverter.cs b/src/BandcampDownloader/UI/Converters/ComparisonConverter.cs similarity index 100% rename from src/BandcampDownloader/Converters/ComparisonConverter.cs rename to src/BandcampDownloader/UI/Converters/ComparisonConverter.cs diff --git a/src/BandcampDownloader/Converters/DoubleToPercentConverter.cs b/src/BandcampDownloader/UI/Converters/DoubleToPercentConverter.cs similarity index 100% rename from src/BandcampDownloader/Converters/DoubleToPercentConverter.cs rename to src/BandcampDownloader/UI/Converters/DoubleToPercentConverter.cs diff --git a/src/BandcampDownloader/Converters/InverseBooleanConverter.cs b/src/BandcampDownloader/UI/Converters/InverseBooleanConverter.cs similarity index 100% rename from src/BandcampDownloader/Converters/InverseBooleanConverter.cs rename to src/BandcampDownloader/UI/Converters/InverseBooleanConverter.cs diff --git a/src/BandcampDownloader/Converters/InverseBooleanToVisibilityConverter.cs b/src/BandcampDownloader/UI/Converters/InverseBooleanToVisibilityConverter.cs similarity index 100% rename from src/BandcampDownloader/Converters/InverseBooleanToVisibilityConverter.cs rename to src/BandcampDownloader/UI/Converters/InverseBooleanToVisibilityConverter.cs From 0e4d2c0dcc27d915e21ee11c2d0e4bdf12d9c3e1 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:21:37 +0100 Subject: [PATCH 12/29] refactor: move windows to "Dialogs" folder --- .../BandcampDownloader.csproj | 32 +++++++++---------- .../UserControlSettingsAdvanced.xaml | 0 .../UserControlSettingsAdvanced.xaml.cs | 0 .../UserControlSettingsCoverArt.xaml | 0 .../UserControlSettingsCoverArt.xaml.cs | 0 .../UserControlSettingsDownloads.xaml | 0 .../UserControlSettingsDownloads.xaml.cs | 0 .../Settings}/UserControlSettingsGeneral.xaml | 0 .../UserControlSettingsGeneral.xaml.cs | 0 .../Settings}/UserControlSettingsNetwork.xaml | 0 .../UserControlSettingsNetwork.xaml.cs | 0 .../Settings}/UserControlSettingsTags.xaml | 0 .../Settings}/UserControlSettingsTags.xaml.cs | 0 .../Settings}/WindowSettings.xaml | 0 .../Settings}/WindowSettings.xaml.cs | 0 .../UI/{ => Dialogs}/WindowMain.xaml | 0 .../UI/{ => Dialogs}/WindowMain.xaml.cs | 0 17 files changed, 16 insertions(+), 16 deletions(-) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsAdvanced.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsAdvanced.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsCoverArt.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsCoverArt.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsDownloads.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsDownloads.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsGeneral.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsGeneral.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsNetwork.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsNetwork.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsTags.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/UserControlSettingsTags.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/WindowSettings.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs/Settings}/WindowSettings.xaml.cs (100%) rename src/BandcampDownloader/UI/{ => Dialogs}/WindowMain.xaml (100%) rename src/BandcampDownloader/UI/{ => Dialogs}/WindowMain.xaml.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 6804959d..998ba433 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -139,22 +139,22 @@ - + UserControlSettingsAdvanced.xaml - + UserControlSettingsCoverArt.xaml - + UserControlSettingsDownloads.xaml - + UserControlSettingsGeneral.xaml - + UserControlSettingsNetwork.xaml - + UserControlSettingsTags.xaml @@ -170,41 +170,41 @@ - + WindowMain.xaml - + WindowSettings.xaml - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + MSBuild:Compile Designer - + Designer MSBuild:Compile - + MSBuild:Compile Designer - + MSBuild:Compile Designer diff --git a/src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsAdvanced.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml.cs diff --git a/src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsCoverArt.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml.cs diff --git a/src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsDownloads.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml.cs diff --git a/src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsGeneral.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs diff --git a/src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsNetwork.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml.cs diff --git a/src/BandcampDownloader/UI/UserControlSettingsTags.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsTags.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml diff --git a/src/BandcampDownloader/UI/UserControlSettingsTags.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/UserControlSettingsTags.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml.cs diff --git a/src/BandcampDownloader/UI/WindowSettings.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml similarity index 100% rename from src/BandcampDownloader/UI/WindowSettings.xaml rename to src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml diff --git a/src/BandcampDownloader/UI/WindowSettings.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/WindowSettings.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml.cs diff --git a/src/BandcampDownloader/UI/WindowMain.xaml b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml similarity index 100% rename from src/BandcampDownloader/UI/WindowMain.xaml rename to src/BandcampDownloader/UI/Dialogs/WindowMain.xaml diff --git a/src/BandcampDownloader/UI/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs similarity index 100% rename from src/BandcampDownloader/UI/WindowMain.xaml.cs rename to src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs From 9b36586e152be65c2b1f8cf42582c773733a1347 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:30:00 +0100 Subject: [PATCH 13/29] refactor: move "DoubleRule" to "Validation" folder --- src/BandcampDownloader/BandcampDownloader.csproj | 2 +- .../{Miscellaneous => UI/Validation}/DoubleRule.cs | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/BandcampDownloader/{Miscellaneous => UI/Validation}/DoubleRule.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 998ba433..09f259aa 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -130,7 +130,7 @@ - + diff --git a/src/BandcampDownloader/Miscellaneous/DoubleRule.cs b/src/BandcampDownloader/UI/Validation/DoubleRule.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/DoubleRule.cs rename to src/BandcampDownloader/UI/Validation/DoubleRule.cs From 6305e3f0d1453f390435d5bf484339c47c9d1818 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:33:41 +0100 Subject: [PATCH 14/29] refactor: move Constants, Settings to "Core" folder --- src/BandcampDownloader/BandcampDownloader.csproj | 6 +++--- src/BandcampDownloader/{Miscellaneous => Core}/Constants.cs | 0 src/BandcampDownloader/{Miscellaneous => Core}/LogType.cs | 0 .../{Miscellaneous => Core}/UserSettings.cs | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/BandcampDownloader/{Miscellaneous => Core}/Constants.cs (100%) rename src/BandcampDownloader/{Miscellaneous => Core}/LogType.cs (100%) rename src/BandcampDownloader/{Miscellaneous => Core}/UserSettings.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 09f259aa..2861829f 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -165,11 +165,11 @@ - - + + - + WindowMain.xaml diff --git a/src/BandcampDownloader/Miscellaneous/Constants.cs b/src/BandcampDownloader/Core/Constants.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/Constants.cs rename to src/BandcampDownloader/Core/Constants.cs diff --git a/src/BandcampDownloader/Miscellaneous/LogType.cs b/src/BandcampDownloader/Core/LogType.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/LogType.cs rename to src/BandcampDownloader/Core/LogType.cs diff --git a/src/BandcampDownloader/Miscellaneous/UserSettings.cs b/src/BandcampDownloader/Core/UserSettings.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/UserSettings.cs rename to src/BandcampDownloader/Core/UserSettings.cs From fde4d5756b1248bb30bd2ecd9fe7e08de3dc697d Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:40:11 +0100 Subject: [PATCH 15/29] refactor: move extensions and exceptions under "Helpers" folder --- src/BandcampDownloader/BandcampDownloader.csproj | 6 +++--- .../{Miscellaneous => Helpers}/EnumerationExtension.cs | 0 .../{Miscellaneous => Helpers}/Exceptions.cs | 0 .../{Miscellaneous => Helpers}/Extensions.cs | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/BandcampDownloader/{Miscellaneous => Helpers}/EnumerationExtension.cs (100%) rename src/BandcampDownloader/{Miscellaneous => Helpers}/Exceptions.cs (100%) rename src/BandcampDownloader/{Miscellaneous => Helpers}/Extensions.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 2861829f..3fc290fe 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -132,8 +132,8 @@ - - + + @@ -167,7 +167,7 @@ - + diff --git a/src/BandcampDownloader/Miscellaneous/EnumerationExtension.cs b/src/BandcampDownloader/Helpers/EnumerationExtension.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/EnumerationExtension.cs rename to src/BandcampDownloader/Helpers/EnumerationExtension.cs diff --git a/src/BandcampDownloader/Miscellaneous/Exceptions.cs b/src/BandcampDownloader/Helpers/Exceptions.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/Exceptions.cs rename to src/BandcampDownloader/Helpers/Exceptions.cs diff --git a/src/BandcampDownloader/Miscellaneous/Extensions.cs b/src/BandcampDownloader/Helpers/Extensions.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/Extensions.cs rename to src/BandcampDownloader/Helpers/Extensions.cs From 6676e52b91124b9a04dc86e41d18539be165e740 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 14:42:27 +0100 Subject: [PATCH 16/29] refactor: move "DownloadProgress" to "Model" folder --- src/BandcampDownloader/BandcampDownloader.csproj | 2 +- .../{Miscellaneous => Model}/DownloadProgress.cs | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/BandcampDownloader/{Miscellaneous => Model}/DownloadProgress.cs (100%) diff --git a/src/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj index 3fc290fe..50372bda 100644 --- a/src/BandcampDownloader/BandcampDownloader.csproj +++ b/src/BandcampDownloader/BandcampDownloader.csproj @@ -131,7 +131,7 @@ - + diff --git a/src/BandcampDownloader/Miscellaneous/DownloadProgress.cs b/src/BandcampDownloader/Model/DownloadProgress.cs similarity index 100% rename from src/BandcampDownloader/Miscellaneous/DownloadProgress.cs rename to src/BandcampDownloader/Model/DownloadProgress.cs From 13d4eb757adf8755944d0930eced02a718aec867 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 15:22:15 +0100 Subject: [PATCH 17/29] refactor: change field access to private readonly --- src/BandcampDownloader/Model/JSON/JsonAlbum.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BandcampDownloader/Model/JSON/JsonAlbum.cs b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs index 4c7e2304..d8e8aa62 100644 --- a/src/BandcampDownloader/Model/JSON/JsonAlbum.cs +++ b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs @@ -6,8 +6,8 @@ namespace BandcampDownloader { internal class JsonAlbum { - public String urlEnd = "_0.jpg"; - public String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site + private readonly String urlEnd = "_0.jpg"; + private readonly String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site [JsonProperty("current")] public JsonAlbumData AlbumData { get; set; } From 8dbd2610a8aa65fb64802c98c79ae0a1ee9950d5 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 15:34:13 +0100 Subject: [PATCH 18/29] refactor: fix StartupUri --- src/BandcampDownloader/App.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BandcampDownloader/App.xaml b/src/BandcampDownloader/App.xaml index f91ba61d..64fbf6ec 100644 --- a/src/BandcampDownloader/App.xaml +++ b/src/BandcampDownloader/App.xaml @@ -2,5 +2,5 @@ x:Class="BandcampDownloader.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - StartupUri="Windows/WindowMain.xaml"> + StartupUri="UI/Dialogs/WindowMain.xaml"> \ No newline at end of file From 8d5371d57661b58e221563c10cf7dfff4b0402c0 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 15:35:00 +0100 Subject: [PATCH 19/29] refactor: reorganize Exceptions --- src/BandcampDownloader/Helpers/Exceptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BandcampDownloader/Helpers/Exceptions.cs b/src/BandcampDownloader/Helpers/Exceptions.cs index b5c6edd7..0e3b8d98 100644 --- a/src/BandcampDownloader/Helpers/Exceptions.cs +++ b/src/BandcampDownloader/Helpers/Exceptions.cs @@ -2,9 +2,9 @@ namespace BandcampDownloader { - internal class NoAlbumFoundException: Exception { + internal class CouldNotCheckForUpdatesException: Exception { } - internal class CouldNotCheckForUpdatesException: Exception { + internal class NoAlbumFoundException: Exception { } } \ No newline at end of file From e56d208bea87b30bedcf4cca3f98366ccec4f315 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 15:37:20 +0100 Subject: [PATCH 20/29] refactor: add _ prefix to private fields --- .../Helpers/EnumerationExtension.cs | 8 +- .../Model/JSON/JsonAlbum.cs | 6 +- .../UI/Dialogs/WindowMain.xaml.cs | 120 +++++++++--------- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/BandcampDownloader/Helpers/EnumerationExtension.cs b/src/BandcampDownloader/Helpers/EnumerationExtension.cs index 90632765..2fb01af3 100644 --- a/src/BandcampDownloader/Helpers/EnumerationExtension.cs +++ b/src/BandcampDownloader/Helpers/EnumerationExtension.cs @@ -12,21 +12,21 @@ public class EnumerationMember { public Object Value { get; set; } } - private Type enumType; + private Type _enumType; public Type EnumType { get { - return enumType; + return _enumType; } private set { - if (enumType == value) { + if (_enumType == value) { return; } var underlyingType = Nullable.GetUnderlyingType(value) ?? value; if (!underlyingType.IsEnum) { throw new ArgumentException("Type must be an Enum."); } - enumType = value; + _enumType = value; } } diff --git a/src/BandcampDownloader/Model/JSON/JsonAlbum.cs b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs index d8e8aa62..d1a992db 100644 --- a/src/BandcampDownloader/Model/JSON/JsonAlbum.cs +++ b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs @@ -6,8 +6,8 @@ namespace BandcampDownloader { internal class JsonAlbum { - private readonly String urlEnd = "_0.jpg"; - private readonly String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site + private readonly String _urlEnd = "_0.jpg"; + private readonly String _urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site [JsonProperty("current")] public JsonAlbumData AlbumData { get; set; } @@ -28,7 +28,7 @@ public Album ToAlbum() { return new Album() { Artist = Artist, // Some albums do not have a cover art - ArtworkUrl = ArtId == null ? null : urlStart + ArtId.PadLeft(10, '0') + urlEnd, + ArtworkUrl = ArtId == null ? null : _urlStart + ArtId.PadLeft(10, '0') + _urlEnd, ReleaseDate = ReleaseDate, Title = AlbumData.AlbumTitle, // Some tracks do not have their URL filled on some albums (pre-release...) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index b0c3c699..466dfe8b 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -32,31 +32,31 @@ public partial class WindowMain: Window { /// /// True if there are active downloads; false otherwise. /// - private Boolean activeDownloads = false; + private Boolean _activeDownloads = false; /// /// Used to update the downloaded bytes / files count on the UI. /// - private ConcurrentQueue downloadProgresses; + private ConcurrentQueue _downloadProgresses; /// /// The files to download, or being downloaded, or downloaded. Used to compute the current received bytes and the total bytes to download. /// - private List filesDownload; + private List _filesDownload; /// /// Used to compute and display the download speed. /// - private DateTime lastDownloadSpeedUpdate; + private DateTime _lastDownloadSpeedUpdate; /// /// Used to compute and display the download speed. /// - private long lastTotalReceivedBytes = 0; + private long _lastTotalReceivedBytes = 0; /// /// Used when user clicks on 'Cancel' to abort all current downloads. /// - private List pendingDownloads; + private List _pendingDownloads; /// /// Used when user clicks on 'Cancel' to manage the cancelation (UI...). /// - private Boolean userCancelled; + private Boolean _userCancelled; #endregion @@ -127,7 +127,7 @@ private void CheckForUpdates() { /// The album to download. /// The path where to save the album. private void DownloadAlbum(Album album, String downloadsFolder) { - if (this.userCancelled) { + if (this._userCancelled) { // Abort return; } @@ -159,7 +159,7 @@ private void DownloadAlbum(Album album, String downloadsFolder) { // Wait for all tracks to be downloaded before saying the album is downloaded Task.WaitAll(tasks); - if (!this.userCancelled) { + if (!this._userCancelled) { // Tasks have not been aborted if (tracksDownloaded.All(x => x == true)) { Log($"Successfully downloaded album \"{album.Title}\"", LogType.Success); @@ -190,7 +190,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac if (File.Exists(trackPath)) { long length = new FileInfo(trackPath).Length; - foreach (TrackFile trackFile in filesDownload) { + foreach (TrackFile trackFile in _filesDownload) { if (track.Mp3Url == trackFile.Url && trackFile.Size > length - (trackFile.Size * App.UserSettings.AllowedFileSizeDifference) && trackFile.Size < length + (trackFile.Size * App.UserSettings.AllowedFileSizeDifference)) { @@ -222,7 +222,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac // Update progress bar when downloading webClient.DownloadProgressChanged += (s, e) => { - this.downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived)); + this._downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived)); UpdateProgress(); }; @@ -253,7 +253,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac } // Note the file as downloaded - TrackFile currentFile = this.filesDownload.Where(f => f.Url == track.Mp3Url).First(); + TrackFile currentFile = this._filesDownload.Where(f => f.Url == track.Mp3Url).First(); currentFile.Downloaded = true; Log($"Downloaded track \"{GetFileName(album, track)}\" from album \"{album.Title}\"", LogType.IntermediateSuccess); } else if (!e.Cancelled && e.Error != null) { @@ -272,20 +272,20 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac doneEvent.Set(); }; - lock (this.pendingDownloads) { - if (this.userCancelled) { + lock (this._pendingDownloads) { + if (this._userCancelled) { // Abort return false; } // Register current download - this.pendingDownloads.Add(webClient); + this._pendingDownloads.Add(webClient); // Start download webClient.DownloadFileAsync(new Uri(track.Mp3Url), trackPath); } // Wait for download to be finished doneEvent.WaitOne(); - lock (this.pendingDownloads) { - this.pendingDownloads.Remove(webClient); + lock (this._pendingDownloads) { + this._pendingDownloads.Remove(webClient); } } } while (!trackDownloaded && tries < App.UserSettings.DownloadMaxTries); @@ -336,7 +336,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { // Update progress bar when downloading webClient.DownloadProgressChanged += (s, e) => { - this.downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived)); + this._downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived)); UpdateProgress(); }; @@ -383,7 +383,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { } // Note the file as downloaded - TrackFile currentFile = this.filesDownload.Where(f => f.Url == album.ArtworkUrl).First(); + TrackFile currentFile = this._filesDownload.Where(f => f.Url == album.ArtworkUrl).First(); currentFile.Downloaded = true; Log($"Downloaded artwork for album \"{album.Title}\"", LogType.IntermediateSuccess); } else if (!e.Cancelled && e.Error != null) { @@ -397,21 +397,21 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { doneEvent.Set(); }; - lock (this.pendingDownloads) { - if (this.userCancelled) { + lock (this._pendingDownloads) { + if (this._userCancelled) { // Abort return null; } // Register current download - this.pendingDownloads.Add(webClient); + this._pendingDownloads.Add(webClient); // Start download webClient.DownloadFileAsync(new Uri(album.ArtworkUrl), artworkTempPath); } // Wait for download to be finished doneEvent.WaitOne(); - lock (this.pendingDownloads) { - this.pendingDownloads.Remove(webClient); + lock (this._pendingDownloads) { + this._pendingDownloads.Remove(webClient); } } } while (!artworkDownloaded && tries < App.UserSettings.DownloadMaxTries); @@ -448,7 +448,7 @@ private List GetAlbums(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this.userCancelled) { + if (this._userCancelled) { // Abort return new List(); } @@ -502,7 +502,7 @@ private List GetArtistDiscography(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this.userCancelled) { + if (this._userCancelled) { // Abort return new List(); } @@ -541,7 +541,7 @@ private List GetArtistDiscography(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this.userCancelled) { + if (this._userCancelled) { // Abort return new List(); } @@ -603,7 +603,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC int tries = 0; if (App.UserSettings.RetrieveFilesSize) { do { - if (this.userCancelled) { + if (this._userCancelled) { // Abort return new List(); } @@ -636,7 +636,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC // Temporarily save the index or we will have a race condition exception when i hits its maximum value int trackIndex = i; - if (this.userCancelled) { + if (this._userCancelled) { // Abort return new List(); } @@ -647,7 +647,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC int tries = 0; if (App.UserSettings.RetrieveFilesSize) { do { - if (this.userCancelled) { + if (this._userCancelled) { // Abort break; } @@ -792,29 +792,29 @@ private void UpdateControlsState(Boolean downloadStarted) { private void UpdateProgress() { DateTime now = DateTime.Now; - this.downloadProgresses.TryDequeue(out DownloadProgress downloadProgress); + this._downloadProgresses.TryDequeue(out DownloadProgress downloadProgress); // Compute new progress values - TrackFile currentFile = this.filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First(); + TrackFile currentFile = this._filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First(); currentFile.BytesReceived = downloadProgress.BytesReceived; - long totalReceivedBytes = this.filesDownload.Sum(f => f.BytesReceived); - long bytesToDownload = this.filesDownload.Sum(f => f.Size); - Double downloadedFilesCount = this.filesDownload.Count(f => f.Downloaded); + long totalReceivedBytes = this._filesDownload.Sum(f => f.BytesReceived); + long bytesToDownload = this._filesDownload.Sum(f => f.Size); + Double downloadedFilesCount = this._filesDownload.Count(f => f.Downloaded); Double bytesPerSecond; - if (this.lastTotalReceivedBytes == 0) { + if (this._lastTotalReceivedBytes == 0) { // First time we update the progress bytesPerSecond = 0; - this.lastTotalReceivedBytes = totalReceivedBytes; - this.lastDownloadSpeedUpdate = now; - } else if ((now - this.lastDownloadSpeedUpdate).TotalMilliseconds > 500) { + this._lastTotalReceivedBytes = totalReceivedBytes; + this._lastDownloadSpeedUpdate = now; + } else if ((now - this._lastDownloadSpeedUpdate).TotalMilliseconds > 500) { // Last update of progress happened more than 500 milliseconds ago // We only update the download speed every 500+ milliseconds bytesPerSecond = - ((Double) (totalReceivedBytes - this.lastTotalReceivedBytes)) / - (now - this.lastDownloadSpeedUpdate).TotalSeconds; - this.lastTotalReceivedBytes = totalReceivedBytes; - this.lastDownloadSpeedUpdate = now; + ((Double) (totalReceivedBytes - this._lastTotalReceivedBytes)) / + (now - this._lastDownloadSpeedUpdate).TotalSeconds; + this._lastTotalReceivedBytes = totalReceivedBytes; + this._lastDownloadSpeedUpdate = now; // Update UI this.Dispatcher.Invoke(new Action(() => { @@ -825,7 +825,7 @@ private void UpdateProgress() { // Update UI this.Dispatcher.Invoke(new Action(() => { - if (!this.userCancelled) { + if (!this._userCancelled) { // Update progress label labelProgress.Content = ((Double) totalReceivedBytes / (1024 * 1024)).ToString("0.00") + " MB" + @@ -867,7 +867,7 @@ private void ButtonBrowse_Click(object sender, RoutedEventArgs e) { } private void ButtonOpenSettingsWindow_Click(object sender, RoutedEventArgs e) { - var windowSettings = new WindowSettings(activeDownloads) { + var windowSettings = new WindowSettings(_activeDownloads) { Owner = this, ShowInTaskbar = false, }; @@ -881,12 +881,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { return; } - this.userCancelled = false; + this._userCancelled = false; - this.pendingDownloads = new List(); + this._pendingDownloads = new List(); // Set controls to "downloading..." state - this.activeDownloads = true; + this._activeDownloads = true; UpdateControlsState(true); Log("Starting download...", LogType.Info); @@ -897,7 +897,7 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { var urls = new List(); var albums = new List(); - this.downloadProgresses = new ConcurrentQueue(); + this._downloadProgresses = new ConcurrentQueue(); Task.Factory.StartNew(() => { // Get URLs of albums to download @@ -912,14 +912,14 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { albums = GetAlbums(urls); }).ContinueWith(x => { // Save files to download (we'll need the list to update the progressBar) - this.filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder); + this._filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder); }).ContinueWith(x => { // Set progressBar max value long maxProgressBarValue; if (App.UserSettings.RetrieveFilesSize) { - maxProgressBarValue = this.filesDownload.Sum(f => f.Size); // Bytes to download + maxProgressBarValue = this._filesDownload.Sum(f => f.Size); // Bytes to download } else { - maxProgressBarValue = this.filesDownload.Count; // Number of files to download + maxProgressBarValue = this._filesDownload.Count; // Number of files to download } if (maxProgressBarValue > 0) { this.Dispatcher.Invoke(new Action(() => { @@ -947,12 +947,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { Task.WaitAll(tasks); } }).ContinueWith(x => { - if (this.userCancelled) { + if (this._userCancelled) { // Display message if user cancelled Log("Downloads cancelled by user", LogType.Info); } // Set controls to "ready" state - this.activeDownloads = false; + this._activeDownloads = false; UpdateControlsState(false); // Play a sound try { @@ -967,12 +967,12 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) { return; } - this.userCancelled = true; + this._userCancelled = true; Cursor = Cursors.Wait; Log("Cancelling downloads. Please wait...", LogType.Info); - lock (this.pendingDownloads) { - if (this.pendingDownloads.Count == 0) { + lock (this._pendingDownloads) { + if (this._pendingDownloads.Count == 0) { // Nothing to cancel Cursor = Cursors.Arrow; return; @@ -985,9 +985,9 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) { TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; TaskbarItemInfo.ProgressValue = 0; - lock (this.pendingDownloads) { + lock (this._pendingDownloads) { // Stop current downloads - foreach (WebClient webClient in this.pendingDownloads) { + foreach (WebClient webClient in this._pendingDownloads) { webClient.CancelAsync(); } } @@ -1016,7 +1016,7 @@ private void TextBoxUrls_LostFocus(object sender, RoutedEventArgs e) { } private void WindowMain_Closing(object sender, CancelEventArgs e) { - if (this.activeDownloads) { + if (this._activeDownloads) { // There are active downloads, ask for confirmation if (MessageBox.Show("There are currently active downloads. Are you sure you want to close the application and stop all downloads?", "Bandcamp Downloader", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) == MessageBoxResult.Cancel) { // Cancel closing the window From 059cb3b49b5926a94d008c73ba02d4b04dbe3425 Mon Sep 17 00:00:00 2001 From: Otiel Date: Wed, 12 Dec 2018 15:38:57 +0100 Subject: [PATCH 21/29] refactor: remove "this." when calling member object --- .../UI/Dialogs/WindowMain.xaml.cs | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 466dfe8b..7d0112e7 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -127,7 +127,7 @@ private void CheckForUpdates() { /// The album to download. /// The path where to save the album. private void DownloadAlbum(Album album, String downloadsFolder) { - if (this._userCancelled) { + if (_userCancelled) { // Abort return; } @@ -159,7 +159,7 @@ private void DownloadAlbum(Album album, String downloadsFolder) { // Wait for all tracks to be downloaded before saying the album is downloaded Task.WaitAll(tasks); - if (!this._userCancelled) { + if (!_userCancelled) { // Tasks have not been aborted if (tracksDownloaded.All(x => x == true)) { Log($"Successfully downloaded album \"{album.Title}\"", LogType.Success); @@ -222,7 +222,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac // Update progress bar when downloading webClient.DownloadProgressChanged += (s, e) => { - this._downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived)); + _downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived)); UpdateProgress(); }; @@ -253,7 +253,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac } // Note the file as downloaded - TrackFile currentFile = this._filesDownload.Where(f => f.Url == track.Mp3Url).First(); + TrackFile currentFile = _filesDownload.Where(f => f.Url == track.Mp3Url).First(); currentFile.Downloaded = true; Log($"Downloaded track \"{GetFileName(album, track)}\" from album \"{album.Title}\"", LogType.IntermediateSuccess); } else if (!e.Cancelled && e.Error != null) { @@ -272,20 +272,20 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac doneEvent.Set(); }; - lock (this._pendingDownloads) { - if (this._userCancelled) { + lock (_pendingDownloads) { + if (_userCancelled) { // Abort return false; } // Register current download - this._pendingDownloads.Add(webClient); + _pendingDownloads.Add(webClient); // Start download webClient.DownloadFileAsync(new Uri(track.Mp3Url), trackPath); } // Wait for download to be finished doneEvent.WaitOne(); - lock (this._pendingDownloads) { - this._pendingDownloads.Remove(webClient); + lock (_pendingDownloads) { + _pendingDownloads.Remove(webClient); } } } while (!trackDownloaded && tries < App.UserSettings.DownloadMaxTries); @@ -336,7 +336,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { // Update progress bar when downloading webClient.DownloadProgressChanged += (s, e) => { - this._downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived)); + _downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived)); UpdateProgress(); }; @@ -383,7 +383,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { } // Note the file as downloaded - TrackFile currentFile = this._filesDownload.Where(f => f.Url == album.ArtworkUrl).First(); + TrackFile currentFile = _filesDownload.Where(f => f.Url == album.ArtworkUrl).First(); currentFile.Downloaded = true; Log($"Downloaded artwork for album \"{album.Title}\"", LogType.IntermediateSuccess); } else if (!e.Cancelled && e.Error != null) { @@ -397,21 +397,21 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { doneEvent.Set(); }; - lock (this._pendingDownloads) { - if (this._userCancelled) { + lock (_pendingDownloads) { + if (_userCancelled) { // Abort return null; } // Register current download - this._pendingDownloads.Add(webClient); + _pendingDownloads.Add(webClient); // Start download webClient.DownloadFileAsync(new Uri(album.ArtworkUrl), artworkTempPath); } // Wait for download to be finished doneEvent.WaitOne(); - lock (this._pendingDownloads) { - this._pendingDownloads.Remove(webClient); + lock (_pendingDownloads) { + _pendingDownloads.Remove(webClient); } } } while (!artworkDownloaded && tries < App.UserSettings.DownloadMaxTries); @@ -448,7 +448,7 @@ private List GetAlbums(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this._userCancelled) { + if (_userCancelled) { // Abort return new List(); } @@ -502,7 +502,7 @@ private List GetArtistDiscography(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this._userCancelled) { + if (_userCancelled) { // Abort return new List(); } @@ -541,7 +541,7 @@ private List GetArtistDiscography(List urls) { throw new NotImplementedException(); // Shouldn't happen } - if (this._userCancelled) { + if (_userCancelled) { // Abort return new List(); } @@ -603,7 +603,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC int tries = 0; if (App.UserSettings.RetrieveFilesSize) { do { - if (this._userCancelled) { + if (_userCancelled) { // Abort return new List(); } @@ -636,7 +636,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC // Temporarily save the index or we will have a race condition exception when i hits its maximum value int trackIndex = i; - if (this._userCancelled) { + if (_userCancelled) { // Abort return new List(); } @@ -647,7 +647,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC int tries = 0; if (App.UserSettings.RetrieveFilesSize) { do { - if (this._userCancelled) { + if (_userCancelled) { // Abort break; } @@ -713,7 +713,7 @@ private void Log(String message, LogType logType) { // Log to window if (App.UserSettings.ShowVerboseLog || logType == LogType.Error || logType == LogType.Info || logType == LogType.IntermediateSuccess || logType == LogType.Success) { - this.Dispatcher.Invoke(new Action(() => { + Dispatcher.Invoke(new Action(() => { // Time var textRange = new TextRange(richTextBoxLog.Document.ContentEnd, richTextBoxLog.Document.ContentEnd) { Text = DateTime.Now.ToString("HH:mm:ss") + " " @@ -753,7 +753,7 @@ private String ParseDownloadPath(String downloadPath, Album album) { /// /// True if the download just started, false if it just stopped. private void UpdateControlsState(Boolean downloadStarted) { - this.Dispatcher.Invoke(new Action(() => { + Dispatcher.Invoke(new Action(() => { if (downloadStarted) { // We just started the download buttonBrowse.IsEnabled = false; @@ -792,40 +792,40 @@ private void UpdateControlsState(Boolean downloadStarted) { private void UpdateProgress() { DateTime now = DateTime.Now; - this._downloadProgresses.TryDequeue(out DownloadProgress downloadProgress); + _downloadProgresses.TryDequeue(out DownloadProgress downloadProgress); // Compute new progress values - TrackFile currentFile = this._filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First(); + TrackFile currentFile = _filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First(); currentFile.BytesReceived = downloadProgress.BytesReceived; - long totalReceivedBytes = this._filesDownload.Sum(f => f.BytesReceived); - long bytesToDownload = this._filesDownload.Sum(f => f.Size); - Double downloadedFilesCount = this._filesDownload.Count(f => f.Downloaded); + long totalReceivedBytes = _filesDownload.Sum(f => f.BytesReceived); + long bytesToDownload = _filesDownload.Sum(f => f.Size); + Double downloadedFilesCount = _filesDownload.Count(f => f.Downloaded); Double bytesPerSecond; - if (this._lastTotalReceivedBytes == 0) { + if (_lastTotalReceivedBytes == 0) { // First time we update the progress bytesPerSecond = 0; - this._lastTotalReceivedBytes = totalReceivedBytes; - this._lastDownloadSpeedUpdate = now; - } else if ((now - this._lastDownloadSpeedUpdate).TotalMilliseconds > 500) { + _lastTotalReceivedBytes = totalReceivedBytes; + _lastDownloadSpeedUpdate = now; + } else if ((now - _lastDownloadSpeedUpdate).TotalMilliseconds > 500) { // Last update of progress happened more than 500 milliseconds ago // We only update the download speed every 500+ milliseconds bytesPerSecond = - ((Double) (totalReceivedBytes - this._lastTotalReceivedBytes)) / - (now - this._lastDownloadSpeedUpdate).TotalSeconds; - this._lastTotalReceivedBytes = totalReceivedBytes; - this._lastDownloadSpeedUpdate = now; + ((Double) (totalReceivedBytes - _lastTotalReceivedBytes)) / + (now - _lastDownloadSpeedUpdate).TotalSeconds; + _lastTotalReceivedBytes = totalReceivedBytes; + _lastDownloadSpeedUpdate = now; // Update UI - this.Dispatcher.Invoke(new Action(() => { + Dispatcher.Invoke(new Action(() => { // Update download speed labelDownloadSpeed.Content = (bytesPerSecond / 1024).ToString("0.0") + " kB/s"; })); } // Update UI - this.Dispatcher.Invoke(new Action(() => { - if (!this._userCancelled) { + Dispatcher.Invoke(new Action(() => { + if (!_userCancelled) { // Update progress label labelProgress.Content = ((Double) totalReceivedBytes / (1024 * 1024)).ToString("0.00") + " MB" + @@ -881,12 +881,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { return; } - this._userCancelled = false; + _userCancelled = false; - this._pendingDownloads = new List(); + _pendingDownloads = new List(); // Set controls to "downloading..." state - this._activeDownloads = true; + _activeDownloads = true; UpdateControlsState(true); Log("Starting download...", LogType.Info); @@ -897,7 +897,7 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { var urls = new List(); var albums = new List(); - this._downloadProgresses = new ConcurrentQueue(); + _downloadProgresses = new ConcurrentQueue(); Task.Factory.StartNew(() => { // Get URLs of albums to download @@ -912,17 +912,17 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { albums = GetAlbums(urls); }).ContinueWith(x => { // Save files to download (we'll need the list to update the progressBar) - this._filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder); + _filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder); }).ContinueWith(x => { // Set progressBar max value long maxProgressBarValue; if (App.UserSettings.RetrieveFilesSize) { - maxProgressBarValue = this._filesDownload.Sum(f => f.Size); // Bytes to download + maxProgressBarValue = _filesDownload.Sum(f => f.Size); // Bytes to download } else { - maxProgressBarValue = this._filesDownload.Count; // Number of files to download + maxProgressBarValue = _filesDownload.Count; // Number of files to download } if (maxProgressBarValue > 0) { - this.Dispatcher.Invoke(new Action(() => { + Dispatcher.Invoke(new Action(() => { progressBar.IsIndeterminate = false; progressBar.Maximum = maxProgressBarValue; TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal; @@ -947,12 +947,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { Task.WaitAll(tasks); } }).ContinueWith(x => { - if (this._userCancelled) { + if (_userCancelled) { // Display message if user cancelled Log("Downloads cancelled by user", LogType.Info); } // Set controls to "ready" state - this._activeDownloads = false; + _activeDownloads = false; UpdateControlsState(false); // Play a sound try { @@ -967,12 +967,12 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) { return; } - this._userCancelled = true; + _userCancelled = true; Cursor = Cursors.Wait; Log("Cancelling downloads. Please wait...", LogType.Info); - lock (this._pendingDownloads) { - if (this._pendingDownloads.Count == 0) { + lock (_pendingDownloads) { + if (_pendingDownloads.Count == 0) { // Nothing to cancel Cursor = Cursors.Arrow; return; @@ -985,9 +985,9 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) { TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None; TaskbarItemInfo.ProgressValue = 0; - lock (this._pendingDownloads) { + lock (_pendingDownloads) { // Stop current downloads - foreach (WebClient webClient in this._pendingDownloads) { + foreach (WebClient webClient in _pendingDownloads) { webClient.CancelAsync(); } } @@ -1016,7 +1016,7 @@ private void TextBoxUrls_LostFocus(object sender, RoutedEventArgs e) { } private void WindowMain_Closing(object sender, CancelEventArgs e) { - if (this._activeDownloads) { + if (_activeDownloads) { // There are active downloads, ask for confirmation if (MessageBox.Show("There are currently active downloads. Are you sure you want to close the application and stop all downloads?", "Bandcamp Downloader", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) == MessageBoxResult.Cancel) { // Cancel closing the window From 863700bfba2d3e94058d14bb24531594aec9393d Mon Sep 17 00:00:00 2001 From: Otiel Date: Sun, 16 Dec 2018 22:21:07 +0100 Subject: [PATCH 22/29] refactor: improve debug data --- src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 7d0112e7..6b1b3e93 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -81,7 +81,7 @@ public WindowMain() { } #if DEBUG textBoxUrls.Text = "" - + "https://projectmooncircle.bandcamp.com" /* Lots of albums (124) */ + Environment.NewLine + //+ "https://projectmooncircle.bandcamp.com" /* Lots of albums (124) */ + Environment.NewLine //+ "https://goataholicskjald.bandcamp.com/album/dogma" /* #65 Downloaded size ≠ predicted */ + Environment.NewLine //+ "https://mstrvlk.bandcamp.com/album/-" /* #64 Album with big cover */ + Environment.NewLine //+ "https://mstrvlk.bandcamp.com/track/-" /* #64 Track with big cover */ + Environment.NewLine @@ -90,6 +90,7 @@ public WindowMain() { //+ "https://goataholicskjald.bandcamp.com/track/europa" + Environment.NewLine //+ "https://goataholicskjald.bandcamp.com/track/epilogue" + Environment.NewLine //+ "https://afterdarkrecordings.bandcamp.com/album/adr-unreleased-tracks" /* #69 Album without cover */ + Environment.NewLine + + "https://liluglymane.bandcamp.com/album/study-of-the-hypothesized-removable-and-or-expandable-nature-of-human-capability-and-limitations-primarily-regarding-introductory-experiences-with-new-and-exciting-technologies-by-way-of-motivati-2" /* #54 long path */ + Environment.NewLine ; #endif } From 89a863526e8eadca79091b9d73a51991408285ec Mon Sep 17 00:00:00 2001 From: Otiel Date: Sun, 16 Dec 2018 22:31:01 +0100 Subject: [PATCH 23/29] fix: album paths longer than 247 characters --- src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 6b1b3e93..370dfb4e 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -746,6 +746,12 @@ private String ParseDownloadPath(String downloadPath, Album album) { downloadPath = downloadPath.Replace("{day}", album.ReleaseDate.Day.ToString().ToAllowedFileName()); downloadPath = downloadPath.Replace("{artist}", album.Artist.ToAllowedFileName()); downloadPath = downloadPath.Replace("{album}", album.Title.ToAllowedFileName()); + + if (downloadPath.Length >= 248) { + // Windows doesn't do well with path >= 248 characters (and path + filename >= 260 characters) + downloadPath = downloadPath.Substring(0, 247); + } + return downloadPath; } From 8070644c5df999f7afa3bbbcb3baaa301bcdd311 Mon Sep 17 00:00:00 2001 From: Otiel Date: Sun, 16 Dec 2018 22:31:30 +0100 Subject: [PATCH 24/29] feat: improve paths length management --- .../UI/Dialogs/WindowMain.xaml.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 370dfb4e..df6acd8f 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -182,9 +182,11 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac // Set path to save the file String trackPath = albumDirectoryPath + "\\" + GetFileName(album, track); - if (trackPath.Length > 256) { - // Shorten the path (Windows doesn't support a path > 256 characters) - trackPath = albumDirectoryPath + "\\" + GetFileName(album, track).Substring(0, 3) + Path.GetExtension(trackPath); + if (trackPath.Length >= 260) { + // Windows doesn't do well with path + filename >= 260 characters (and path >= 248 characters) + // Path has been shorten to 247 characters before, so we have 12 characters max left for filename.ext + int fileNameMaxLength = 12 - Path.GetExtension(trackPath).ToString().Length; + trackPath = albumDirectoryPath + "\\" + GetFileName(album, track).Substring(0, fileNameMaxLength) + Path.GetExtension(trackPath); } int tries = 0; Boolean trackDownloaded = false; @@ -303,11 +305,13 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { // Compute paths where to save artwork String artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl); String artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl); - if (artworkTempPath.Length > 256 || artworkFolderPath.Length > 256) { - // Shorten the path (Windows doesn't support a path > 256 characters) - // There may be only one path to shorten, but it's better to use the same file name in both places - artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName().Substring(0, 3) + Path.GetExtension(album.ArtworkUrl); - artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName().Substring(0, 3) + Path.GetExtension(album.ArtworkUrl); + if (artworkTempPath.Length >= 260 || artworkFolderPath.Length >= 260) { + // Windows doesn't do well with path + filename >= 260 characters (and path >= 248 characters) + // Path has been shorten to 247 characters before, so we have 12 characters max left for filename.ext + // There may be only one path needed to shorten, but it's better to use the same file name in both places + int fileNameMaxLength = 12 - Path.GetExtension(album.ArtworkUrl).ToString().Length; + artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName().Substring(0, fileNameMaxLength) + Path.GetExtension(album.ArtworkUrl); + artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName().Substring(0, fileNameMaxLength) + Path.GetExtension(album.ArtworkUrl); } TagLib.Picture artworkInTags = null; From 8bd5844b048b42e7cb4997b6c3d964759a7b24d5 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 17 Dec 2018 19:27:21 +0100 Subject: [PATCH 25/29] fix: race condition on artwork file in %TEMP% Fixes #54 --- src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index df6acd8f..1c7b3cb4 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -54,6 +54,10 @@ public partial class WindowMain: Window { /// private List _pendingDownloads; /// + /// Random class used to create random numbers. + /// + private Random _random = new Random(); + /// /// Used when user clicks on 'Cancel' to manage the cancelation (UI...). /// private Boolean _userCancelled; @@ -305,6 +309,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { // Compute paths where to save artwork String artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl); String artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl); + if (artworkTempPath.Length >= 260 || artworkFolderPath.Length >= 260) { // Windows doesn't do well with path + filename >= 260 characters (and path >= 248 characters) // Path has been shorten to 247 characters before, so we have 12 characters max left for filename.ext @@ -314,6 +319,12 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) { artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName().Substring(0, fileNameMaxLength) + Path.GetExtension(album.ArtworkUrl); } + // In order to prevent #54 (artworkTempPath used at the same time by another downloading thread): + // Change the name of the artwork file: replace the last 3 characters with a random number between 1-999 + String artworkFileWithoutExt = Path.GetFileNameWithoutExtension(artworkTempPath); + artworkFileWithoutExt = artworkFileWithoutExt.Remove(artworkFileWithoutExt.Length - 3, 3) + _random.Next(1, 1000).ToString("00#"); + artworkTempPath = Path.GetDirectoryName(artworkTempPath) + "\\" + artworkFileWithoutExt + Path.GetExtension(artworkTempPath); + TagLib.Picture artworkInTags = null; int tries = 0; From bb47ce9fbbf008697d2dced5b951530859d15e56 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 17 Dec 2018 20:09:04 +0100 Subject: [PATCH 26/29] feat: add option to disable notification sounds --- src/BandcampDownloader/Core/UserSettings.cs | 3 +++ .../Settings/UserControlSettingsGeneral.xaml | 15 +++++++++++++-- .../Settings/UserControlSettingsGeneral.xaml.cs | 1 + .../UI/Dialogs/WindowMain.xaml.cs | 10 ++++++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/BandcampDownloader/Core/UserSettings.cs b/src/BandcampDownloader/Core/UserSettings.cs index bcd63163..95559ac1 100644 --- a/src/BandcampDownloader/Core/UserSettings.cs +++ b/src/BandcampDownloader/Core/UserSettings.cs @@ -72,6 +72,9 @@ public interface IUserSettings { [Option(DefaultValue = "")] String DownloadsPath { get; set; } + [Option(DefaultValue = false)] + Boolean EnableApplicationSounds { get; set; } + [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")] String FileNameFormat { get; set; } diff --git a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml index 214046a5..cb1c6a53 100644 --- a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml +++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml @@ -6,8 +6,8 @@ xmlns:local="clr-namespace:BandcampDownloader" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="userControlSettingsGeneral" - Width="287" - Height="51" + Width="286" + Height="75" KeyboardNavigation.TabNavigation="Local" mc:Ignorable="d"> @@ -57,5 +57,16 @@ VerticalAlignment="Top" Content="(the log file is always verbose)" Foreground="#FF858585" /> + \ No newline at end of file diff --git a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs index ec6b63d8..ac629dec 100644 --- a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs @@ -28,6 +28,7 @@ public void LoadSettings() { /// public void SaveSettings() { checkBoxCheckForUpdates.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); + checkBoxEnableApplicationSounds.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); checkBoxVerboseLog.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); } diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 1c7b3cb4..f544c31e 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -976,10 +976,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { // Set controls to "ready" state _activeDownloads = false; UpdateControlsState(false); - // Play a sound - try { - (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play(); - } catch { + if (App.UserSettings.EnableApplicationSounds) { + // Play a sound + try { + (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play(); + } catch { + } } }); } From 9b136f5cb885e633456d4f98583ad618e41d68f4 Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 17 Dec 2018 20:09:04 +0100 Subject: [PATCH 27/29] feat: add option to disable notification sounds Fixes #71 --- src/BandcampDownloader/Core/UserSettings.cs | 3 +++ .../Settings/UserControlSettingsGeneral.xaml | 15 +++++++++++++-- .../Settings/UserControlSettingsGeneral.xaml.cs | 1 + .../UI/Dialogs/WindowMain.xaml.cs | 10 ++++++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/BandcampDownloader/Core/UserSettings.cs b/src/BandcampDownloader/Core/UserSettings.cs index bcd63163..95559ac1 100644 --- a/src/BandcampDownloader/Core/UserSettings.cs +++ b/src/BandcampDownloader/Core/UserSettings.cs @@ -72,6 +72,9 @@ public interface IUserSettings { [Option(DefaultValue = "")] String DownloadsPath { get; set; } + [Option(DefaultValue = false)] + Boolean EnableApplicationSounds { get; set; } + [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")] String FileNameFormat { get; set; } diff --git a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml index 214046a5..cb1c6a53 100644 --- a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml +++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml @@ -6,8 +6,8 @@ xmlns:local="clr-namespace:BandcampDownloader" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="userControlSettingsGeneral" - Width="287" - Height="51" + Width="286" + Height="75" KeyboardNavigation.TabNavigation="Local" mc:Ignorable="d"> @@ -57,5 +57,16 @@ VerticalAlignment="Top" Content="(the log file is always verbose)" Foreground="#FF858585" /> + \ No newline at end of file diff --git a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs index ec6b63d8..ac629dec 100644 --- a/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs @@ -28,6 +28,7 @@ public void LoadSettings() { /// public void SaveSettings() { checkBoxCheckForUpdates.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); + checkBoxEnableApplicationSounds.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); checkBoxVerboseLog.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource(); } diff --git a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs index 1c7b3cb4..f544c31e 100644 --- a/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs +++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs @@ -976,10 +976,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) { // Set controls to "ready" state _activeDownloads = false; UpdateControlsState(false); - // Play a sound - try { - (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play(); - } catch { + if (App.UserSettings.EnableApplicationSounds) { + // Play a sound + try { + (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play(); + } catch { + } } }); } From 105768726fef577cd525fc7b4a51b06eb42851fe Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 17 Dec 2018 20:19:20 +0100 Subject: [PATCH 28/29] docs: add 0.2.3.0 to CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee519fd7..a0c15cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 0.2.3.0 + +## New features + +* Added an option to disable notifications sound (off by default). [#71](https://github.com/Otiel/BandcampDownloader/issues/71) + +## Bug fixes + +* Fixed race condition [#54](https://github.com/Otiel/BandcampDownloader/issues/54) that would make the program crash when downloading two albums with the same name. +* Fixed issue with albums name too long to be supported by Windows. + # 0.2.2.0 ## New features From ee0174252a24f4428488eeec36de76469197d69c Mon Sep 17 00:00:00 2001 From: Otiel Date: Mon, 17 Dec 2018 20:19:38 +0100 Subject: [PATCH 29/29] chore: bump assembly version to 0.2.3.0 --- src/BandcampDownloader/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BandcampDownloader/Properties/AssemblyInfo.cs b/src/BandcampDownloader/Properties/AssemblyInfo.cs index 24da7999..0655acdc 100644 --- a/src/BandcampDownloader/Properties/AssemblyInfo.cs +++ b/src/BandcampDownloader/Properties/AssemblyInfo.cs @@ -51,6 +51,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.2.2.0")] -[assembly: AssemblyFileVersion("0.2.2.0")] +[assembly: AssemblyVersion("0.2.3.0")] +[assembly: AssemblyFileVersion("0.2.3.0")] [assembly: GuidAttribute("8C171C7F-9BAC-4EC0-A287-59908B48953F")]