diff --git a/VDownload/Core/Enums/AudioFileExtension.cs b/VDownload.Core/Enums/AudioFileExtension.cs similarity index 100% rename from VDownload/Core/Enums/AudioFileExtension.cs rename to VDownload.Core/Enums/AudioFileExtension.cs diff --git a/VDownload/Core/Enums/MediaFileExtension.cs b/VDownload.Core/Enums/MediaFileExtension.cs similarity index 100% rename from VDownload/Core/Enums/MediaFileExtension.cs rename to VDownload.Core/Enums/MediaFileExtension.cs diff --git a/VDownload/Core/Enums/MediaType.cs b/VDownload.Core/Enums/MediaType.cs similarity index 100% rename from VDownload/Core/Enums/MediaType.cs rename to VDownload.Core/Enums/MediaType.cs diff --git a/VDownload/Core/Enums/StreamType.cs b/VDownload.Core/Enums/StreamType.cs similarity index 100% rename from VDownload/Core/Enums/StreamType.cs rename to VDownload.Core/Enums/StreamType.cs diff --git a/VDownload/Core/Enums/VideoFileExtension.cs b/VDownload.Core/Enums/VideoFileExtension.cs similarity index 100% rename from VDownload/Core/Enums/VideoFileExtension.cs rename to VDownload.Core/Enums/VideoFileExtension.cs diff --git a/VDownload.Core/EventArgsObjects/PlaylistSearchEventArgs.cs b/VDownload.Core/EventArgsObjects/PlaylistSearchEventArgs.cs new file mode 100644 index 0000000..9a2e598 --- /dev/null +++ b/VDownload.Core/EventArgsObjects/PlaylistSearchEventArgs.cs @@ -0,0 +1,10 @@ +using System; + +namespace VDownload.Core.EventArgsObjects +{ + public class PlaylistSearchEventArgs : EventArgs + { + public string Phrase { get; set; } + public int Count { get; set; } + } +} diff --git a/VDownload.Core/EventArgsObjects/VideoSearchEventArgs.cs b/VDownload.Core/EventArgsObjects/VideoSearchEventArgs.cs new file mode 100644 index 0000000..c0d47e4 --- /dev/null +++ b/VDownload.Core/EventArgsObjects/VideoSearchEventArgs.cs @@ -0,0 +1,9 @@ +using System; + +namespace VDownload.Core.EventArgsObjects +{ + public class VideoSearchEventArgs : EventArgs + { + public string Phrase { get; set; } + } +} diff --git a/VDownload/Core/Exceptions/TwitchAccessTokenNotFoundException.cs b/VDownload.Core/Exceptions/TwitchAccessTokenNotFoundException.cs similarity index 100% rename from VDownload/Core/Exceptions/TwitchAccessTokenNotFoundException.cs rename to VDownload.Core/Exceptions/TwitchAccessTokenNotFoundException.cs diff --git a/VDownload/Core/Exceptions/TwitchAccessTokenNotValidException.cs b/VDownload.Core/Exceptions/TwitchAccessTokenNotValidException.cs similarity index 100% rename from VDownload/Core/Exceptions/TwitchAccessTokenNotValidException.cs rename to VDownload.Core/Exceptions/TwitchAccessTokenNotValidException.cs diff --git a/VDownload/Core/Interfaces/IAStream.cs b/VDownload.Core/Interfaces/IAStream.cs similarity index 70% rename from VDownload/Core/Interfaces/IAStream.cs rename to VDownload.Core/Interfaces/IAStream.cs index ef404b5..fc8a86f 100644 --- a/VDownload/Core/Interfaces/IAStream.cs +++ b/VDownload.Core/Interfaces/IAStream.cs @@ -1,15 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using VDownload.Core.Enums; namespace VDownload.Core.Interfaces { public interface IAStream { - #region PARAMETERS + #region PROPERTIES Uri Url { get; } bool IsChunked { get; } diff --git a/VDownload/Core/Interfaces/IPlaylistService.cs b/VDownload.Core/Interfaces/IPlaylistService.cs similarity index 67% rename from VDownload/Core/Interfaces/IPlaylistService.cs rename to VDownload.Core/Interfaces/IPlaylistService.cs index 0d43580..76ab2bd 100644 --- a/VDownload/Core/Interfaces/IPlaylistService.cs +++ b/VDownload.Core/Interfaces/IPlaylistService.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace VDownload.Core.Interfaces { internal interface IPlaylistService { - #region PARAMETERS + #region PROPERTIES string ID { get; } string Name { get; } diff --git a/VDownload/Core/Interfaces/IVStream.cs b/VDownload.Core/Interfaces/IVStream.cs similarity index 93% rename from VDownload/Core/Interfaces/IVStream.cs rename to VDownload.Core/Interfaces/IVStream.cs index 5e1c344..d35b57b 100644 --- a/VDownload/Core/Interfaces/IVStream.cs +++ b/VDownload.Core/Interfaces/IVStream.cs @@ -5,7 +5,7 @@ namespace VDownload.Core.Interfaces { public interface IVStream { - #region PARAMETERS + #region PROPERTIES Uri Url { get; } bool IsChunked { get; } diff --git a/VDownload/Core/Interfaces/IVideoService.cs b/VDownload.Core/Interfaces/IVideoService.cs similarity index 97% rename from VDownload/Core/Interfaces/IVideoService.cs rename to VDownload.Core/Interfaces/IVideoService.cs index 9c007e4..19a1735 100644 --- a/VDownload/Core/Interfaces/IVideoService.cs +++ b/VDownload.Core/Interfaces/IVideoService.cs @@ -3,14 +3,14 @@ using System.ComponentModel; using System.Threading; using System.Threading.Tasks; using VDownload.Core.Enums; -using VDownload.Core.Models; +using VDownload.Core.Objects; using Windows.Storage; namespace VDownload.Core.Interfaces { public interface IVideoService { - #region PARAMETERS + #region PROPERTIES string ID { get; } string Title { get; } @@ -49,15 +49,10 @@ namespace VDownload.Core.Interfaces #region EVENT HANDLERS event EventHandler DownloadingStarted; - event EventHandler DownloadingProgressChanged; - event EventHandler DownloadingCompleted; - event EventHandler ProcessingStarted; - event EventHandler ProcessingProgressChanged; - event EventHandler ProcessingCompleted; #endregion diff --git a/VDownload/Core/Models/Stream.cs b/VDownload.Core/Objects/Stream.cs similarity index 93% rename from VDownload/Core/Models/Stream.cs rename to VDownload.Core/Objects/Stream.cs index a4dca63..3bb97d0 100644 --- a/VDownload/Core/Models/Stream.cs +++ b/VDownload.Core/Objects/Stream.cs @@ -2,11 +2,24 @@ using VDownload.Core.Enums; using VDownload.Core.Interfaces; -namespace VDownload.Core.Models +namespace VDownload.Core.Objects { public class Stream : IVStream, IAStream { - #region PARAMETERS + #region CONSTRUCTORS + + public Stream(Uri url, bool isChunked, StreamType streamType) + { + Url = url; + IsChunked = isChunked; + StreamType = streamType; + } + + #endregion + + + + #region PROPERTIES public Uri Url { get; private set; } public bool IsChunked { get; private set; } @@ -19,18 +32,5 @@ namespace VDownload.Core.Models public string AudioCodec { get; set; } #endregion - - - - #region CONSTRUCTORS - - public Stream(Uri url, bool isChunked, StreamType streamType) - { - Url = url; - IsChunked = isChunked; - StreamType = streamType; - } - - #endregion } } diff --git a/VDownload/Core/Services/Config.cs b/VDownload.Core/Services/Config.cs similarity index 91% rename from VDownload/Core/Services/Config.cs rename to VDownload.Core/Services/Config.cs index 61d8341..2a0e20b 100644 --- a/VDownload/Core/Services/Config.cs +++ b/VDownload.Core/Services/Config.cs @@ -1,14 +1,11 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.Media.Editing; using Windows.Storage; namespace VDownload.Core.Services { - internal class Config + public class Config { #region CONSTANTS @@ -25,7 +22,8 @@ namespace VDownload.Core.Services { "twitch_vod_downloading_chunk_retries_delay", 5000 }, { "media_transcoding_use_hardware_acceleration", true }, { "media_transcoding_use_mrfcrf444_algorithm", true }, - { "media_editing_algorithm", MediaTrimmingPreference.Fast } + { "media_editing_algorithm", (int)MediaTrimmingPreference.Fast }, + { "default_max_playlist_videos", 0 }, }; #endregion diff --git a/VDownload/Core/Services/MediaProcessor.cs b/VDownload.Core/Services/MediaProcessor.cs similarity index 99% rename from VDownload/Core/Services/MediaProcessor.cs rename to VDownload.Core/Services/MediaProcessor.cs index 0fadcc4..9a6cdc2 100644 --- a/VDownload/Core/Services/MediaProcessor.cs +++ b/VDownload.Core/Services/MediaProcessor.cs @@ -15,16 +15,6 @@ namespace VDownload.Core.Services { public class MediaProcessor { - #region PARAMETERS - - public StorageFile OutputFile { get; private set; } - public TimeSpan TrimStart { get; private set; } - public TimeSpan TrimEnd { get; private set; } - - #endregion - - - #region CONSTRUCTOR public MediaProcessor(StorageFile outputFile, TimeSpan trimStart, TimeSpan trimEnd) @@ -38,6 +28,16 @@ namespace VDownload.Core.Services + #region PROPERTIES + + public StorageFile OutputFile { get; private set; } + public TimeSpan TrimStart { get; private set; } + public TimeSpan TrimEnd { get; private set; } + + #endregion + + + #region STANDARD METHODS public async Task Run(StorageFile audioVideoInputFile, MediaFileExtension extension, MediaType mediaType, CancellationToken cancellationToken = default) diff --git a/VDownload/Core/Services/Sources/Twitch/Auth.cs b/VDownload.Core/Services/Sources/Twitch/Auth.cs similarity index 99% rename from VDownload/Core/Services/Sources/Twitch/Auth.cs rename to VDownload.Core/Services/Sources/Twitch/Auth.cs index 59671de..5c3c03d 100644 --- a/VDownload/Core/Services/Sources/Twitch/Auth.cs +++ b/VDownload.Core/Services/Sources/Twitch/Auth.cs @@ -14,7 +14,6 @@ namespace VDownload.Core.Services.Sources.Twitch { public class Auth { - #region CONSTANTS // CLIENT ID diff --git a/VDownload/Core/Services/Sources/Twitch/Channel.cs b/VDownload.Core/Services/Sources/Twitch/Channel.cs similarity index 99% rename from VDownload/Core/Services/Sources/Twitch/Channel.cs rename to VDownload.Core/Services/Sources/Twitch/Channel.cs index 3e21bb2..e435e40 100644 --- a/VDownload/Core/Services/Sources/Twitch/Channel.cs +++ b/VDownload.Core/Services/Sources/Twitch/Channel.cs @@ -24,7 +24,7 @@ namespace VDownload.Core.Services.Sources.Twitch - #region PARAMETERS + #region PROPERTIES public string ID { get; private set; } public string Name { get; private set; } diff --git a/VDownload/Core/Services/Sources/Twitch/Clip.cs b/VDownload.Core/Services/Sources/Twitch/Clip.cs similarity index 99% rename from VDownload/Core/Services/Sources/Twitch/Clip.cs rename to VDownload.Core/Services/Sources/Twitch/Clip.cs index 739da9c..71511a1 100644 --- a/VDownload/Core/Services/Sources/Twitch/Clip.cs +++ b/VDownload.Core/Services/Sources/Twitch/Clip.cs @@ -12,7 +12,7 @@ using System.Web; using VDownload.Core.Enums; using VDownload.Core.Exceptions; using VDownload.Core.Interfaces; -using VDownload.Core.Models; +using VDownload.Core.Objects; using Windows.Storage; namespace VDownload.Core.Services.Sources.Twitch @@ -38,7 +38,7 @@ namespace VDownload.Core.Services.Sources.Twitch - #region PARAMETERS + #region PROPERTIES public string ID { get; private set; } public string Title { get; private set; } diff --git a/VDownload/Core/Services/Sources/Twitch/Vod.cs b/VDownload.Core/Services/Sources/Twitch/Vod.cs similarity index 95% rename from VDownload/Core/Services/Sources/Twitch/Vod.cs rename to VDownload.Core/Services/Sources/Twitch/Vod.cs index a734f08..8a98905 100644 --- a/VDownload/Core/Services/Sources/Twitch/Vod.cs +++ b/VDownload.Core/Services/Sources/Twitch/Vod.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using VDownload.Core.Enums; using VDownload.Core.Exceptions; using VDownload.Core.Interfaces; -using VDownload.Core.Models; +using VDownload.Core.Objects; using Windows.Storage; namespace VDownload.Core.Services.Sources.Twitch @@ -49,7 +49,7 @@ namespace VDownload.Core.Services.Sources.Twitch - #region PARAMETERS + #region PROPERTIES public string ID { get; private set; } public string Title { get; private set; } @@ -87,14 +87,9 @@ namespace VDownload.Core.Services.Sources.Twitch JToken response = JObject.Parse(await client.DownloadStringTaskAsync("https://api.twitch.tv/helix/videos")).GetValue("data")[0]; // Set parameters - Title = ((string)response["title"]).Replace("\n", ""); - Author = (string)response["user_name"]; - Date = Convert.ToDateTime(response["created_at"]); - Duration = TimeSpan.ParseExact((string)response["duration"], TimeFormats, null); - Views = (long)response["view_count"]; - Thumbnail = (string)response["thumbnail_url"] == string.Empty ? Globals.Assets.UnknownThumbnailImage : new Uri((string)response["thumbnail_url"]); + GetMetadataAsync(response); } - public void GetMetadataAsync(JToken response) + internal void GetMetadataAsync(JToken response) { // Set parameters Title = ((string)response["title"]).Replace("\n", ""); @@ -102,7 +97,7 @@ namespace VDownload.Core.Services.Sources.Twitch Date = Convert.ToDateTime(response["created_at"]); Duration = TimeSpan.ParseExact((string)response["duration"], TimeFormats, null); Views = (long)response["view_count"]; - Thumbnail = (string)response["thumbnail_url"] == string.Empty ? Globals.Assets.UnknownThumbnailImage : new Uri((string)response["thumbnail_url"]); + Thumbnail = (string)response["thumbnail_url"] == string.Empty ? null : new Uri((string)response["thumbnail_url"]); } // GET VOD STREAMS diff --git a/VDownload.Core/VDownload.Core.csproj b/VDownload.Core/VDownload.Core.csproj new file mode 100644 index 0000000..4196b29 --- /dev/null +++ b/VDownload.Core/VDownload.Core.csproj @@ -0,0 +1,169 @@ + + + + + Debug + AnyCPU + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8} + Library + Properties + VDownload.Core + VDownload.Core + en-US + UAP + 10.0.22000.0 + 10.0.18362.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM64 + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM64 + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + PackageReference + + + + + + + + + + + + + + + + + + + + + + + + + + 6.2.13 + + + 13.0.1 + + + 4.5.0 + + + + + + + 14.0 + + + + \ No newline at end of file diff --git a/VDownload.sln b/VDownload.sln index 66d5080..152e090 100644 --- a/VDownload.sln +++ b/VDownload.sln @@ -10,18 +10,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VDownload.Core", "VDownload.Core\VDownload.Core.csproj", "{65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|Any CPU.Build.0 = Debug|Any CPU + {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|ARM.ActiveCfg = Debug|ARM {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|ARM.Build.0 = Debug|ARM {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|ARM.Deploy.0 = Debug|ARM @@ -34,6 +41,9 @@ Global {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|x86.ActiveCfg = Debug|x86 {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|x86.Build.0 = Debug|x86 {324AB81A-F68D-424D-B90E-5402F5E44240}.Debug|x86.Deploy.0 = Debug|x86 + {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|Any CPU.ActiveCfg = Release|Any CPU + {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|Any CPU.Build.0 = Release|Any CPU + {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|Any CPU.Deploy.0 = Release|Any CPU {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|ARM.ActiveCfg = Release|ARM {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|ARM.Build.0 = Release|ARM {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|ARM.Deploy.0 = Release|ARM @@ -46,6 +56,26 @@ Global {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|x86.ActiveCfg = Release|x86 {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|x86.Build.0 = Release|x86 {324AB81A-F68D-424D-B90E-5402F5E44240}.Release|x86.Deploy.0 = Release|x86 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|ARM.ActiveCfg = Debug|ARM + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|ARM.Build.0 = Debug|ARM + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|ARM64.Build.0 = Debug|ARM64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|x64.ActiveCfg = Debug|x64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|x64.Build.0 = Debug|x64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|x86.ActiveCfg = Debug|x86 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Debug|x86.Build.0 = Debug|x86 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|Any CPU.Build.0 = Release|Any CPU + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|ARM.ActiveCfg = Release|ARM + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|ARM.Build.0 = Release|ARM + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|ARM64.ActiveCfg = Release|ARM64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|ARM64.Build.0 = Release|ARM64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|x64.ActiveCfg = Release|x64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|x64.Build.0 = Release|x64 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|x86.ActiveCfg = Release|x86 + {65C44D96-9C6C-47AD-A1F5-86BFAF2B15B8}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VDownload/App.xaml.cs b/VDownload/App.xaml.cs index 19bb81a..53fdb16 100644 --- a/VDownload/App.xaml.cs +++ b/VDownload/App.xaml.cs @@ -25,30 +25,16 @@ namespace VDownload protected override async void OnLaunched(LaunchActivatedEventArgs e) { - Log.AddHeader("APP LAUNCHED"); - Log.Break(); - // Rebuild configuration file - Log.AddHeader("REBUILDING CONFIGURATION FILE"); - Config.Rebuild(); - Log.Add("Configuration file rebuilded successfully"); - Log.Break(); - - // Delete temp on start - // TODO - Debug.WriteLine(Config.GetValue("delete_temp_on_start")); if ((bool)Config.GetValue("delete_temp_on_start")) { - Log.AddHeader("DELETING TEMPORARY FILES"); IReadOnlyList tempItems = await ApplicationData.Current.TemporaryFolder.GetItemsAsync(); List tasks = new List(); foreach (IStorageItem item in tempItems) tasks.Add(item.DeleteAsync().AsTask()); await Task.WhenAll(tasks); - Log.Add("Temporary files deleted successfully"); - Log.Break(); } // Do not repeat app initialization when the Window already has content, @@ -70,7 +56,7 @@ namespace VDownload // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter - rootFrame.Navigate(typeof(GUI.Views.MainPage), e.Arguments); + rootFrame.Navigate(typeof(Views.MainPage), e.Arguments); } // Ensure the current window is active diff --git a/VDownload/Assets/Icons/MainPage/About.png b/VDownload/Assets/Icons/MainPage/About.png new file mode 100644 index 0000000..dceb015 Binary files /dev/null and b/VDownload/Assets/Icons/MainPage/About.png differ diff --git a/VDownload/GUI/Controls/SettingControl.xaml b/VDownload/Controls/SettingControl.xaml similarity index 77% rename from VDownload/GUI/Controls/SettingControl.xaml rename to VDownload/Controls/SettingControl.xaml index e071e9d..750b959 100644 --- a/VDownload/GUI/Controls/SettingControl.xaml +++ b/VDownload/Controls/SettingControl.xaml @@ -1,13 +1,15 @@  + + @@ -15,11 +17,13 @@ - + + + @@ -28,21 +32,21 @@ - + - - - + + + - + - - + + diff --git a/VDownload/GUI/Controls/SettingControl.xaml.cs b/VDownload/Controls/SettingControl.xaml.cs similarity index 58% rename from VDownload/GUI/Controls/SettingControl.xaml.cs rename to VDownload/Controls/SettingControl.xaml.cs index 4c951ab..74b2ac0 100644 --- a/VDownload/GUI/Controls/SettingControl.xaml.cs +++ b/VDownload/Controls/SettingControl.xaml.cs @@ -1,34 +1,24 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI; +using Windows.UI; using Windows.UI.Xaml; -using Windows.UI.Xaml.Automation; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - -namespace VDownload.GUI.Controls +namespace VDownload.Controls { public sealed partial class SettingControl : UserControl { - // INIT + #region CONSTRUCTORS + public SettingControl() { this.InitializeComponent(); } - // SETTING CONTENT - public FrameworkElement SettingContent { get; set; } + #endregion + + + + #region PROPERTIES // ICON public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(IconElement), typeof(SettingControl), new PropertyMetadata(null)); @@ -54,12 +44,9 @@ namespace VDownload.GUI.Controls set => SetValue(DescriptionProperty, value); } - // DESCRIPTION COLOR - public static readonly DependencyProperty DescriptionColorProperty = DependencyProperty.Register("DescriptionColor", typeof(Brush), typeof(SettingControl), new PropertyMetadata(new SolidColorBrush((Color)Application.Current.Resources["SystemBaseMediumColor"]))); - public Brush DescriptionColor - { - get => (Brush)GetValue(DescriptionColorProperty); - set => SetValue(DescriptionColorProperty, value); - } + // SETTING CONTENT + public FrameworkElement SettingContent { get; set; } + + #endregion } } diff --git a/VDownload/Core/Enums/LogMessageType.cs b/VDownload/Core/Enums/LogMessageType.cs deleted file mode 100644 index a7b1d24..0000000 --- a/VDownload/Core/Enums/LogMessageType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace VDownload.Core.Enums -{ - public enum LogMessageType - { - Header, - Normal, - Break, - } -} diff --git a/VDownload/Core/Globals/Assets.cs b/VDownload/Core/Globals/Assets.cs deleted file mode 100644 index f47277a..0000000 --- a/VDownload/Core/Globals/Assets.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VDownload.Core.Globals -{ - public static class Assets - { - public static readonly Uri UnknownThumbnailImage = new Uri("ms-appx:///Assets/Other/UnknownThumbnail.png"); - } -} diff --git a/VDownload/Core/Services/Log.cs b/VDownload/Core/Services/Log.cs deleted file mode 100644 index e1b8a1a..0000000 --- a/VDownload/Core/Services/Log.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using VDownload.Core.Enums; - -namespace VDownload.Core.Services -{ - public class Log - { - private static List<(DateTime? Time, string Message, LogMessageType MessageType)> MessageList = new List<(DateTime? Time, string Message, LogMessageType MessageType)>(); - - public static void AddHeader(string message) - { - MessageList.Add((DateTime.Now, message, LogMessageType.Header)); - Debug.WriteLine(message); - } - - public static void Add(string message) - { - MessageList.Add((DateTime.Now, message, LogMessageType.Normal)); - Debug.WriteLine(message); - } - - public static void Break() - { - MessageList.Add((null, string.Empty, LogMessageType.Break)); - } - - - public static void Clear() - { - MessageList.Clear(); - } - } -} diff --git a/VDownload/GUI/Controls/MainPageLayoutControl.xaml b/VDownload/GUI/Controls/MainPageLayoutControl.xaml deleted file mode 100644 index df95278..0000000 --- a/VDownload/GUI/Controls/MainPageLayoutControl.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - diff --git a/VDownload/GUI/Controls/MainPageLayoutControl.xaml.cs b/VDownload/GUI/Controls/MainPageLayoutControl.xaml.cs deleted file mode 100644 index 9d63ccc..0000000 --- a/VDownload/GUI/Controls/MainPageLayoutControl.xaml.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - -namespace VDownload.GUI.Controls -{ - public sealed partial class MainPageLayoutControl : UserControl - { - // INIT - public MainPageLayoutControl() - { - this.InitializeComponent(); - } - - // PAGE CONTENT - public FrameworkElement PageContent { get; set; } - - // TITLE - public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(MainPageLayoutControl), new PropertyMetadata(string.Empty)); - public string Title - { - get => (string)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - } -} diff --git a/VDownload/GUI/Views/Home/HomeMain.xaml.cs b/VDownload/GUI/Views/Home/HomeMain.xaml.cs deleted file mode 100644 index a34cd91..0000000 --- a/VDownload/GUI/Views/Home/HomeMain.xaml.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using VDownload.Core.Enums; -using VDownload.Core.Interfaces; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.Storage; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace VDownload.GUI.Views.Home -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class HomeMain : Page - { - public HomeMain() - { - this.InitializeComponent(); - } - - private async void Button_Click(object sender, RoutedEventArgs e) - { - IPlaylistService videoServices = new Core.Services.Sources.Twitch.Channel("jacexdowozwideo"); - await videoServices.GetMetadataAsync(); - Stopwatch sw = Stopwatch.StartNew(); - await videoServices.GetVideosAsync(500); - sw.Stop(); - Debug.WriteLine(((Core.Services.Sources.Twitch.Channel)videoServices).Videos.Length); - Debug.WriteLine(sw.Elapsed.TotalSeconds); - - } - } -} diff --git a/VDownload/GUI/Views/Sources/SourcesMain.xaml b/VDownload/GUI/Views/Sources/SourcesMain.xaml deleted file mode 100644 index 7a4cfbb..0000000 --- a/VDownload/GUI/Views/Sources/SourcesMain.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - + + diff --git a/VDownload/Views/Home/HomeOptionsBarAddPlaylistControl.xaml.cs b/VDownload/Views/Home/HomeOptionsBarAddPlaylistControl.xaml.cs new file mode 100644 index 0000000..7503ee9 --- /dev/null +++ b/VDownload/Views/Home/HomeOptionsBarAddPlaylistControl.xaml.cs @@ -0,0 +1,60 @@ +using System; +using VDownload.Core.EventArgsObjects; +using VDownload.Core.Services; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace VDownload.Views.Home +{ + public sealed partial class HomeOptionsBarAddPlaylistControl : UserControl + { + #region CONSTRUCTORS + + public HomeOptionsBarAddPlaylistControl() + { + this.InitializeComponent(); + } + + #endregion + + + + #region PROPERTIES + + // MAX VIDEOS NUMBERBOX DEFAULT VALUE + public int DefaultMaxPlaylistVideos = (int)Config.GetValue("default_max_playlist_videos"); + + // SEARCH BUTTON EVENT HANDLER + public event EventHandler SearchButtonClicked; + + #endregion + + + + #region EVENT HANDLERS + + // SEARCH BUTTON CLICKED + private void HomeOptionsBarAddPlaylistControlSearchButton_Click(object sender, RoutedEventArgs e) + { + // Close info box + HomeOptionsBarAddPlaylistControlInfoBox.IsOpen = false; + + // Invoke search button event handlers + PlaylistSearchEventArgs args = new PlaylistSearchEventArgs + { + Phrase = HomeOptionsBarAddPlaylistControlUrlTextBox.Text, + Count = int.Parse(HomeOptionsBarAddPlaylistControlMaxVideosNumberBox.Text), + }; + SearchButtonClicked?.Invoke(this, args); + } + + // HELP BUTTON CLICKED + private void HomeOptionsBarAddPlaylistControlHelpButton_Click(object sender, RoutedEventArgs e) + { + // Switch info box + HomeOptionsBarAddPlaylistControlInfoBox.IsOpen = !HomeOptionsBarAddPlaylistControlInfoBox.IsOpen; + } + + #endregion + } +} diff --git a/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml b/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml new file mode 100644 index 0000000..4051cc5 --- /dev/null +++ b/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + diff --git a/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml.cs b/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml.cs new file mode 100644 index 0000000..a99852a --- /dev/null +++ b/VDownload/Views/Home/HomeOptionsBarAddVideoControl.xaml.cs @@ -0,0 +1,55 @@ +using System; +using VDownload.Core.EventArgsObjects; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace VDownload.Views.Home +{ + public sealed partial class HomeOptionsBarAddVideoControl : UserControl + { + #region CONSTRUCTORS + + public HomeOptionsBarAddVideoControl() + { + this.InitializeComponent(); + } + + #endregion + + + + #region PROPERTIES + + // SEARCH BUTTON EVENT HANDLER + public event EventHandler SearchButtonClicked; + + #endregion + + + + #region EVENT HANDLERS + + // SEARCH BUTTON CLICKED + private void HomeOptionsBarAddVideoControlSearchButton_Click(object sender, RoutedEventArgs e) + { + // Close info box + HomeOptionsBarAddVideoControlInfoBox.IsOpen = false; + + // Invoke search button event handlers + VideoSearchEventArgs args = new VideoSearchEventArgs + { + Phrase = HomeOptionsBarAddVideoControlUrlTextBox.Text + }; + SearchButtonClicked?.Invoke(this, args); + } + + // HELP BUTTON CLICKED + private void HomeOptionsBarAddVideoControlHelpButton_Click(object sender, RoutedEventArgs e) + { + // Switch info box + HomeOptionsBarAddVideoControlInfoBox.IsOpen = !HomeOptionsBarAddVideoControlInfoBox.IsOpen; + } + + #endregion + } +} diff --git a/VDownload/GUI/Views/MainPage.xaml b/VDownload/Views/MainPage.xaml similarity index 85% rename from VDownload/GUI/Views/MainPage.xaml rename to VDownload/Views/MainPage.xaml index 644d461..4fa71b4 100644 --- a/VDownload/GUI/Views/MainPage.xaml +++ b/VDownload/Views/MainPage.xaml @@ -1,5 +1,5 @@  + + 0,48,0,0 0 + + - + - + @@ -44,6 +48,11 @@ + + + + + diff --git a/VDownload/GUI/Views/MainPage.xaml.cs b/VDownload/Views/MainPage.xaml.cs similarity index 76% rename from VDownload/GUI/Views/MainPage.xaml.cs rename to VDownload/Views/MainPage.xaml.cs index 5c2e4e4..a748f69 100644 --- a/VDownload/GUI/Views/MainPage.xaml.cs +++ b/VDownload/Views/MainPage.xaml.cs @@ -1,28 +1,20 @@ -// Internal - -// System -using System; +using System; +using System.Collections.Generic; using Windows.ApplicationModel.Core; -using Windows.UI; -using Windows.UI.ViewManagement; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.Foundation; -using System.Collections.Generic; -namespace VDownload.GUI.Views +namespace VDownload.Views { public sealed partial class MainPage : Page { - #region INIT + #region CONSTRUCTORS - // CONSTRUCTOR public MainPage() { - InitializeComponent(); + this.InitializeComponent(); // Hide default title bar. - ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; Window.Current.SetTitleBar(AppTitleBar); @@ -39,12 +31,13 @@ namespace VDownload.GUI.Views #region NAVIGATION PANEL // PAGES DICTIONARY - private Dictionary Pages = new Dictionary() + private readonly Dictionary Pages = new Dictionary() { {"home", typeof(Home.HomeMain)}, {"subscriptions", typeof(Subscriptions.SubscriptionsMain)}, + {"about", typeof(About.AboutMain)}, {"sources", typeof(Sources.SourcesMain)}, - {"settings", typeof(Settings.SettingsMain)} + {"settings", typeof(Settings.SettingsMain)}, }; // ON ITEM INVOKED diff --git a/VDownload/GUI/Views/Settings/SettingsMain.xaml b/VDownload/Views/Settings/SettingsMain.xaml similarity index 88% rename from VDownload/GUI/Views/Settings/SettingsMain.xaml rename to VDownload/Views/Settings/SettingsMain.xaml index 2749213..9a1c1f3 100644 --- a/VDownload/GUI/Views/Settings/SettingsMain.xaml +++ b/VDownload/Views/Settings/SettingsMain.xaml @@ -1,5 +1,5 @@  /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/VDownload/Views/Sources/SourcesMain.xaml b/VDownload/Views/Sources/SourcesMain.xaml new file mode 100644 index 0000000..0a38443 --- /dev/null +++ b/VDownload/Views/Sources/SourcesMain.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + +