diff --git a/Wintor/WinTorrent.sln b/Wintor/WinTorrent.sln new file mode 100644 index 0000000..a8a57f4 --- /dev/null +++ b/Wintor/WinTorrent.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinTorrent", "WinTorrent\WinTorrent.csproj", "{88F8E34F-0129-4856-A1F7-4A89DA892C9B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM.ActiveCfg = Debug|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM.Build.0 = Debug|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM.Deploy.0 = Debug|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM64.Build.0 = Debug|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x64.ActiveCfg = Debug|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x64.Build.0 = Debug|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x64.Deploy.0 = Debug|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x86.ActiveCfg = Debug|x86 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x86.Build.0 = Debug|x86 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Debug|x86.Deploy.0 = Debug|x86 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM.ActiveCfg = Release|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM.Build.0 = Release|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM.Deploy.0 = Release|ARM + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM64.ActiveCfg = Release|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM64.Build.0 = Release|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|ARM64.Deploy.0 = Release|ARM64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x64.ActiveCfg = Release|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x64.Build.0 = Release|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x64.Deploy.0 = Release|x64 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x86.ActiveCfg = Release|x86 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x86.Build.0 = Release|x86 + {88F8E34F-0129-4856-A1F7-4A89DA892C9B}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E3A42E8C-A604-4B2B-9820-C44F47BB4D17} + EndGlobalSection +EndGlobal diff --git a/Wintor/WinTorrent/App.xaml b/Wintor/WinTorrent/App.xaml new file mode 100644 index 0000000..0f652a6 --- /dev/null +++ b/Wintor/WinTorrent/App.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + DeepSkyBlue + + + + + + + + + + + \ No newline at end of file diff --git a/Wintor/WinTorrent/App.xaml.cs b/Wintor/WinTorrent/App.xaml.cs new file mode 100644 index 0000000..ab38b67 --- /dev/null +++ b/Wintor/WinTorrent/App.xaml.cs @@ -0,0 +1,136 @@ +using System; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.ApplicationModel.Core; +using Windows.UI; +using Windows.UI.ViewManagement; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; +using WinTorrent.Pages; +using WinTorrent.Utils; + +namespace WinTorrent +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + InitializeComponent(); + Suspending += OnSuspending; + } + + public static void UpdateTitleBar(bool isDark) + { + ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; + titleBar.ButtonBackgroundColor = Colors.Transparent; + titleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + titleBar.ButtonInactiveForegroundColor = Colors.Gray; + + if (isDark) + { + titleBar.ButtonForegroundColor = + titleBar.ButtonHoverForegroundColor = + titleBar.ButtonPressedForegroundColor = Colors.White; + titleBar.ButtonHoverBackgroundColor = Color.FromArgb(50, 255, 255, 255); + titleBar.ButtonPressedBackgroundColor = Color.FromArgb(30, 255, 255, 255); + } + else + { + titleBar.ButtonForegroundColor = + titleBar.ButtonHoverForegroundColor = + titleBar.ButtonPressedForegroundColor = Colors.Black; + titleBar.ButtonHoverBackgroundColor = Color.FromArgb(50, 0, 0, 0); + titleBar.ButtonPressedBackgroundColor = Color.FromArgb(70, 0, 0, 0); + } + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; + + if (!(Window.Current.Content is Frame rootFrame)) + { + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + Window.Current.Content = rootFrame; + } + + if (!e.PrelaunchActivated) + { + if (rootFrame.Content == null) + rootFrame.Navigate(typeof(MainPage), e.Arguments); + + Window.Current.Activate(); + } + + rootFrame.RequestedTheme = Settings.Theme switch + { + 0 => ElementTheme.Light, + 1 => ElementTheme.Dark, + _ => RequestedTheme == ApplicationTheme.Dark ? ElementTheme.Dark : ElementTheme.Light + }; + if (rootFrame.RequestedTheme == ElementTheme.Dark) + rootFrame.Background = new AcrylicBrush + { + TintOpacity = .8, + TintColor = Colors.Black, + BackgroundSource = AcrylicBackgroundSource.HostBackdrop, + FallbackColor = Color.FromArgb(255, 31, 31, 31) + }; + else + rootFrame.Background = new AcrylicBrush + { + TintOpacity = .5, + TintColor = Colors.White, + BackgroundSource = AcrylicBackgroundSource.HostBackdrop, + FallbackColor = Color.FromArgb(255, 230, 230, 230) + }; + UpdateTitleBar(rootFrame.RequestedTheme == ElementTheme.Dark); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} diff --git a/Wintor/WinTorrent/Assets/LargeTile.scale-100.png b/Wintor/WinTorrent/Assets/LargeTile.scale-100.png new file mode 100644 index 0000000..f05c9f9 Binary files /dev/null and b/Wintor/WinTorrent/Assets/LargeTile.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/LargeTile.scale-125.png b/Wintor/WinTorrent/Assets/LargeTile.scale-125.png new file mode 100644 index 0000000..76e5d85 Binary files /dev/null and b/Wintor/WinTorrent/Assets/LargeTile.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/LargeTile.scale-150.png b/Wintor/WinTorrent/Assets/LargeTile.scale-150.png new file mode 100644 index 0000000..87b319f Binary files /dev/null and b/Wintor/WinTorrent/Assets/LargeTile.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/LargeTile.scale-200.png b/Wintor/WinTorrent/Assets/LargeTile.scale-200.png new file mode 100644 index 0000000..c31b10c Binary files /dev/null and b/Wintor/WinTorrent/Assets/LargeTile.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/LargeTile.scale-400.png b/Wintor/WinTorrent/Assets/LargeTile.scale-400.png new file mode 100644 index 0000000..1dcd683 Binary files /dev/null and b/Wintor/WinTorrent/Assets/LargeTile.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/LockScreenLogo.scale-200.png b/Wintor/WinTorrent/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..735f57a Binary files /dev/null and b/Wintor/WinTorrent/Assets/LockScreenLogo.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/Ref.png b/Wintor/WinTorrent/Assets/Ref.png new file mode 100644 index 0000000..ce0cf68 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Ref.png differ diff --git a/Wintor/WinTorrent/Assets/SmallTile.scale-100.png b/Wintor/WinTorrent/Assets/SmallTile.scale-100.png new file mode 100644 index 0000000..305a2f5 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SmallTile.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/SmallTile.scale-125.png b/Wintor/WinTorrent/Assets/SmallTile.scale-125.png new file mode 100644 index 0000000..a3431ad Binary files /dev/null and b/Wintor/WinTorrent/Assets/SmallTile.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/SmallTile.scale-150.png b/Wintor/WinTorrent/Assets/SmallTile.scale-150.png new file mode 100644 index 0000000..3cfd2e1 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SmallTile.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/SmallTile.scale-200.png b/Wintor/WinTorrent/Assets/SmallTile.scale-200.png new file mode 100644 index 0000000..09080a4 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SmallTile.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/SmallTile.scale-400.png b/Wintor/WinTorrent/Assets/SmallTile.scale-400.png new file mode 100644 index 0000000..1e4a6f2 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SmallTile.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/SplashScreen.scale-100.png b/Wintor/WinTorrent/Assets/SplashScreen.scale-100.png new file mode 100644 index 0000000..efb658f Binary files /dev/null and b/Wintor/WinTorrent/Assets/SplashScreen.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/SplashScreen.scale-125.png b/Wintor/WinTorrent/Assets/SplashScreen.scale-125.png new file mode 100644 index 0000000..704e52b Binary files /dev/null and b/Wintor/WinTorrent/Assets/SplashScreen.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/SplashScreen.scale-150.png b/Wintor/WinTorrent/Assets/SplashScreen.scale-150.png new file mode 100644 index 0000000..dd9446d Binary files /dev/null and b/Wintor/WinTorrent/Assets/SplashScreen.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/SplashScreen.scale-200.png b/Wintor/WinTorrent/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000..201aab5 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SplashScreen.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/SplashScreen.scale-400.png b/Wintor/WinTorrent/Assets/SplashScreen.scale-400.png new file mode 100644 index 0000000..a1f6478 Binary files /dev/null and b/Wintor/WinTorrent/Assets/SplashScreen.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/Square150x150Logo.scale-100.png b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-100.png new file mode 100644 index 0000000..8b2cded Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/Square150x150Logo.scale-125.png b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-125.png new file mode 100644 index 0000000..6dcb2b1 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/Square150x150Logo.scale-150.png b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-150.png new file mode 100644 index 0000000..da91d79 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/Square150x150Logo.scale-200.png b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..3a795d5 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/Square150x150Logo.scale-400.png b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-400.png new file mode 100644 index 0000000..7a72842 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square150x150Logo.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png new file mode 100644 index 0000000..b7bb2ca Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png new file mode 100644 index 0000000..c16e04b Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png new file mode 100644 index 0000000..a67cac0 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png new file mode 100644 index 0000000..57f4638 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png new file mode 100644 index 0000000..61aafff Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-16.png new file mode 100644 index 0000000..b7bb2ca Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-256.png new file mode 100644 index 0000000..a67cac0 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-32.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-32.png new file mode 100644 index 0000000..57f4638 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-32.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-48.png new file mode 100644 index 0000000..61aafff Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.scale-100.png b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-100.png new file mode 100644 index 0000000..e3eaee1 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.scale-125.png b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-125.png new file mode 100644 index 0000000..f76378b Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.scale-150.png b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-150.png new file mode 100644 index 0000000..6fa05c1 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.scale-200.png b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..3c24051 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.scale-400.png b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-400.png new file mode 100644 index 0000000..3adfea8 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-16.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-16.png new file mode 100644 index 0000000..ca455fe Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-16.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24.png new file mode 100644 index 0000000..a8827b8 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..02683b5 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-256.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-256.png new file mode 100644 index 0000000..eabfdd7 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-256.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-32.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-32.png new file mode 100644 index 0000000..dea2926 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-32.png differ diff --git a/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-48.png b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-48.png new file mode 100644 index 0000000..33acad1 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Square44x44Logo.targetsize-48.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.backup.png b/Wintor/WinTorrent/Assets/StoreLogo.backup.png new file mode 100644 index 0000000..7385b56 Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.backup.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.scale-100.png b/Wintor/WinTorrent/Assets/StoreLogo.scale-100.png new file mode 100644 index 0000000..0a56091 Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.scale-125.png b/Wintor/WinTorrent/Assets/StoreLogo.scale-125.png new file mode 100644 index 0000000..4599f06 Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.scale-150.png b/Wintor/WinTorrent/Assets/StoreLogo.scale-150.png new file mode 100644 index 0000000..289e45b Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.scale-200.png b/Wintor/WinTorrent/Assets/StoreLogo.scale-200.png new file mode 100644 index 0000000..13358ac Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/StoreLogo.scale-400.png b/Wintor/WinTorrent/Assets/StoreLogo.scale-400.png new file mode 100644 index 0000000..4ce93eb Binary files /dev/null and b/Wintor/WinTorrent/Assets/StoreLogo.scale-400.png differ diff --git a/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-100.png b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-100.png new file mode 100644 index 0000000..1be252c Binary files /dev/null and b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-100.png differ diff --git a/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-125.png b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-125.png new file mode 100644 index 0000000..9fd514c Binary files /dev/null and b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-125.png differ diff --git a/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-150.png b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-150.png new file mode 100644 index 0000000..f02eaca Binary files /dev/null and b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-150.png differ diff --git a/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-200.png b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..9497527 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-200.png differ diff --git a/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-400.png b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-400.png new file mode 100644 index 0000000..36b9dd9 Binary files /dev/null and b/Wintor/WinTorrent/Assets/Wide310x150Logo.scale-400.png differ diff --git a/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml b/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml new file mode 100644 index 0000000..3f824bf --- /dev/null +++ b/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml @@ -0,0 +1,17 @@ + + + + + diff --git a/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml.cs b/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml.cs new file mode 100644 index 0000000..ac4f436 --- /dev/null +++ b/Wintor/WinTorrent/Dialogs/AddTorrentDialog.xaml.cs @@ -0,0 +1,35 @@ +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 Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 + +namespace WinTorrent.Dialogs +{ + public sealed partial class AddTorrentDialog : ContentDialog + { + public AddTorrentDialog() + { + this.InitializeComponent(); + } + + private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) + { + } + + private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) + { + } + } +} diff --git a/Wintor/WinTorrent/Models/DataSize.cs b/Wintor/WinTorrent/Models/DataSize.cs new file mode 100644 index 0000000..c741f22 --- /dev/null +++ b/Wintor/WinTorrent/Models/DataSize.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; + +namespace WinTorrent.Models +{ + public struct DataSize : IComparable, IEquatable, IComparer + { + public long ByteSize { get; set; } + + public DataSize(long sizeInBytes) => + ByteSize = sizeInBytes; + + public override string ToString() => + $"{ByteSize} B"; + + public int CompareTo(DataSize other) => + (int)Math.Clamp(ByteSize - other.ByteSize, -1, 1); + + public bool Equals(DataSize other) => + ByteSize == other.ByteSize; + + public int Compare(DataSize x, DataSize y) => + (int)Math.Clamp(x.ByteSize - y.ByteSize, -1, 1); + + public static double operator /(DataSize s1, DataSize s2) => + s1.ByteSize / s2.ByteSize; + public static bool operator ==(DataSize s1, DataSize s2) => + s1.ByteSize == s2.ByteSize; + public static bool operator !=(DataSize s1, DataSize s2) => + s1.ByteSize != s2.ByteSize; + public static bool operator ==(DataSize s1, int s2) => + s1.ByteSize == s2; + public static bool operator !=(DataSize s1, int s2) => + s1.ByteSize != s2; + } + + public struct DownloadSpeed : IComparable, IEquatable, IComparer + { + public long BytesPerSecond { get; set; } + + public DownloadSpeed(long bps) => + BytesPerSecond = bps; + + public override string ToString() => + $"{BytesPerSecond} B/s"; + + public int CompareTo(DownloadSpeed other) => + (int)Math.Clamp(BytesPerSecond - other.BytesPerSecond, -1, 1); + + public bool Equals(DownloadSpeed other) => + BytesPerSecond == other.BytesPerSecond; + + public int Compare(DownloadSpeed x, DownloadSpeed y) => + (int)Math.Clamp(x.BytesPerSecond - y.BytesPerSecond, -1, 1); + + public static double operator /(DownloadSpeed s1, DownloadSpeed s2) => + s1.BytesPerSecond / s2.BytesPerSecond; + public static bool operator ==(DownloadSpeed s1, DownloadSpeed s2) => + s1.BytesPerSecond == s2.BytesPerSecond; + public static bool operator !=(DownloadSpeed s1, DownloadSpeed s2) => + s1.BytesPerSecond != s2.BytesPerSecond; + } +} diff --git a/Wintor/WinTorrent/Models/PointerHoverStateTrigger.cs b/Wintor/WinTorrent/Models/PointerHoverStateTrigger.cs new file mode 100644 index 0000000..cdca01f --- /dev/null +++ b/Wintor/WinTorrent/Models/PointerHoverStateTrigger.cs @@ -0,0 +1,38 @@ +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using WinTorrent.Pages; + +namespace WinTorrent.Models +{ + class PointerHoverStateTrigger : StateTriggerBase + { + public TorrentItem TargetItem + { + get => _targetItem; + set + { + if (_targetItem == value) + return; + + if (_targetElement != null) + { + _targetElement.PointerEntered -= PointerEntered; + _targetElement.PointerExited -= PointerExited; + } + + _targetItem = value; + _targetElement = ((Window.Current.Content as Frame).Content as MainPage).list.ContainerFromItem(_targetItem) as FrameworkElement; + _targetElement.PointerEntered += PointerEntered; + _targetElement.PointerExited += PointerExited; + } + } + private TorrentItem _targetItem; + private FrameworkElement _targetElement; + + private void PointerExited(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) => + SetActive(false); + + private void PointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) => + SetActive(true); + } +} diff --git a/Wintor/WinTorrent/Models/TorrentItem.cs b/Wintor/WinTorrent/Models/TorrentItem.cs new file mode 100644 index 0000000..5bfa2f6 --- /dev/null +++ b/Wintor/WinTorrent/Models/TorrentItem.cs @@ -0,0 +1,133 @@ +using System; +using System.ComponentModel; +using Windows.Storage; +using WinTorrent.Utils; + +namespace WinTorrent.Models +{ + public enum TorrentState + { + Initializing = 0, + Downloading = 1, + Cancelling = 2, + Pausing = 3, + Paused = 4, + Resuming = 5, + Completed = 6, + Seeding = 7, + Error = 8 + } + + public class TorrentItem : INotifyPropertyChanged + { + public event TorrentStateChangedEventHandler StateChanged; + public event PropertyChangedEventHandler PropertyChanged; + + public string Title + { + get => _title; + set + { + if (_title == value) + return; + + _title = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Title))); + } + } + private string _title; + + public TorrentState State + { + get => _state; + set + { + if (_state == value) + return; + + TorrentState previousState = _state; + _state = value; + StateChanged?.Invoke(this, previousState); + TorrentClient.OnItemStateChanged(this, previousState); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(State))); + } + } + private TorrentState _state = TorrentState.Initializing; + + public DownloadSpeed TransmissionSpeed + { + get => _transmissionSpeed; + set + { + if (_transmissionSpeed == value) + return; + + _transmissionSpeed = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TransmissionSpeed))); + } + } + private DownloadSpeed _transmissionSpeed; + + public DataSize Downloaded + { + get => _downloaded; + set + { + if (_downloaded == value) + return; + + _downloaded = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Downloaded))); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Progress))); + } + } + private DataSize _downloaded; + + public DataSize TotalSize + { + get => _totalSize; + set + { + if (_totalSize == value) + return; + + _totalSize = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalSize))); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Progress))); + } + } + private DataSize _totalSize; + + public double Progress => TotalSize != 0 ? ((double)Downloaded.ByteSize / TotalSize.ByteSize) : 0; + + public int SeedCount + { + get => _seedCount; + set + { + if (_seedCount == value) + return; + + _seedCount = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SeedCount))); + } + } + private int _seedCount; + + public TimeSpan RemainingTime + { + get => _remainingTime; + set + { + if (_remainingTime == value) + return; + + _remainingTime = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SeedCount))); + } + } + private TimeSpan _remainingTime; + + public IStorageItem Files { get; set; } + } +} diff --git a/Wintor/WinTorrent/Models/TorrentStateDataTrigger.cs b/Wintor/WinTorrent/Models/TorrentStateDataTrigger.cs new file mode 100644 index 0000000..40f4df8 --- /dev/null +++ b/Wintor/WinTorrent/Models/TorrentStateDataTrigger.cs @@ -0,0 +1,46 @@ +using Windows.UI.Xaml; + +namespace WinTorrent.Models +{ + public class TorrentStateDataTrigger : StateTriggerBase + { + public TorrentState TargetState + { + get => _targetState; + set + { + if (_targetState == value) + return; + + _targetState = value; + UpdateTrigger(); + } + } + private TorrentState _targetState; + + public TorrentItem TargetElement + { + get => _targetElement; + set + { + if (_targetElement == value) + return; + + if (_targetElement != null) + _targetElement.StateChanged -= TargetElementStateChanged; + + _targetElement = value; + _targetElement.StateChanged += TargetElementStateChanged; + + UpdateTrigger(); + } + } + private TorrentItem _targetElement; + + private void UpdateTrigger() => + SetActive(TargetElement?.State == TargetState); + + private void TargetElementStateChanged(TorrentItem sender, TorrentState previousState) => + UpdateTrigger(); + } +} diff --git a/Wintor/WinTorrent/Package.appxmanifest b/Wintor/WinTorrent/Package.appxmanifest new file mode 100644 index 0000000..9b36fa4 --- /dev/null +++ b/Wintor/WinTorrent/Package.appxmanifest @@ -0,0 +1,55 @@ + + + + + + + + + + Wintor + XFox + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wintor/WinTorrent/Pages/MainPage.xaml b/Wintor/WinTorrent/Pages/MainPage.xaml new file mode 100644 index 0000000..5b50e08 --- /dev/null +++ b/Wintor/WinTorrent/Pages/MainPage.xaml @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + of + + + remaining + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wintor/WinTorrent/Pages/MainPage.xaml.cs b/Wintor/WinTorrent/Pages/MainPage.xaml.cs new file mode 100644 index 0000000..49c1221 --- /dev/null +++ b/Wintor/WinTorrent/Pages/MainPage.xaml.cs @@ -0,0 +1,119 @@ +using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media.Animation; +using Windows.UI.Xaml.Navigation; +using WinTorrent.Dialogs; +using WinTorrent.Models; +using WinTorrent.Utils; + +namespace WinTorrent.Pages +{ + public sealed partial class MainPage : Page + { + public MainPage() + { + InitializeComponent(); + + sharedShadow.Receivers.Add(shadowRecieverGrid); + search.Translation += new System.Numerics.Vector3(0, 0, 10); + + navigationList.SelectedIndex = 0; + TorrentClient.TorrentItemStateChanged += (s, e) => NavigationViewList_SelectionChanged(this, null); + } + + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + Window.Current.SetTitleBar(TitleBar); + } + + private void OpenSettings(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) => + Frame.Navigate(typeof(SettingsPage), null, new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromLeft }); + + private async void AddTorrent(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) => + await new AddTorrentDialog().ShowAsync(); + + private void NavigationViewList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + list.ItemsSource = (navigationList.SelectedItem as NavigationViewItem)?.Tag as string switch + { + "downloading" => TorrentClient.Torrents.FindAll(i => i.State.BelongsTo(TorrentState.Downloading, TorrentState.Cancelling, TorrentState.Error, TorrentState.Initializing, TorrentState.Pausing)), + "seeding" => TorrentClient.Torrents.FindAll(i => i.State.BelongsTo(TorrentState.Seeding)), + "completed" => TorrentClient.Torrents.FindAll(i => i.State.BelongsTo(TorrentState.Completed, TorrentState.Seeding)), + "paused" => TorrentClient.Torrents.FindAll(i => i.State.BelongsTo(TorrentState.Paused, TorrentState.Resuming)), + _ => TorrentClient.Torrents + }; + search.ItemsSource = null; + } + + private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) + { + if (args.Reason != AutoSuggestionBoxTextChangeReason.UserInput) + return; + + sender.ItemsSource = null; + navigationList.SelectedIndex = 0; + var result = TorrentClient.Torrents.FindAll(i => + i.Title.ToLowerInvariant().Contains(sender.Text.ToLowerInvariant()) || + (i.Files?.Path.ToLowerInvariant().Contains(sender.Text.ToLowerInvariant()) ?? false) || + i.State.ToString().ToLowerInvariant().Contains(sender.Text.ToLowerInvariant())); + + list.ItemsSource = result; + + if (result.Count < 1) + { + if (sender.Text.ToUri() is Uri magnetUrl && magnetUrl.IsAbsoluteUri) + { + sender.ItemsSource = new[] { $"Add torrent from URL: {magnetUrl.AbsoluteUri}" }; + } + else + { + sender.ItemsSource = new[] { "No results found" }; + } + } + } + + private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) + { + if (args.SelectedItem as string == "No results found") + return; + // TODO: Add torrent from URL + } + + private void PauseItem(object sender, RoutedEventArgs e) + { + + } + + private void list_ItemClick(object sender, ItemClickEventArgs e) => + OpenItem(e.ClickedItem as TorrentItem); + + private void ViewItem(object sender, RoutedEventArgs e) => + OpenItem(list.ItemFromContainer(((sender as FrameworkElement).Parent as FrameworkElement).Parent) as TorrentItem); + + private void OpenItem(TorrentItem item) + { + if (list.ContainerFromItem(item) as ListViewItem != null) + list.PrepareConnectedAnimation("ca1", item, "caTarget"); + + Frame.Navigate(typeof(TorrentDetailsPage), item); + } + + private void SetSeeding(object sender, RoutedEventArgs e) + { + + } + + private void SetPriority(object sender, RoutedEventArgs e) + { + + } + + private void DeleteItem(object sender, RoutedEventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/Wintor/WinTorrent/Pages/SettingsPage.xaml b/Wintor/WinTorrent/Pages/SettingsPage.xaml new file mode 100644 index 0000000..42107aa --- /dev/null +++ b/Wintor/WinTorrent/Pages/SettingsPage.xaml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Wintor/WinTorrent/Pages/TorrentDetailsPage.xaml.cs b/Wintor/WinTorrent/Pages/TorrentDetailsPage.xaml.cs new file mode 100644 index 0000000..4526af9 --- /dev/null +++ b/Wintor/WinTorrent/Pages/TorrentDetailsPage.xaml.cs @@ -0,0 +1,32 @@ +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media.Animation; +using Windows.UI.Xaml.Navigation; +using WinTorrent.Models; + +namespace WinTorrent.Pages +{ + public sealed partial class TorrentDetailsPage : Page + { + public TorrentItem Item { get; private set; } + + public TorrentDetailsPage() + { + InitializeComponent(); + Window.Current.SetTitleBar(TitleBar); + } + + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + Item = e.Parameter as TorrentItem; + + if (ConnectedAnimationService.GetForCurrentView().GetAnimation("ca1") is ConnectedAnimation animation) + animation.TryStart(caTarget); + } + + private void BackRequested(object sender, RoutedEventArgs e) => + Frame.Navigate(typeof(MainPage), null, new DrillInNavigationTransitionInfo()); + } +} diff --git a/Wintor/WinTorrent/Properties/AssemblyInfo.cs b/Wintor/WinTorrent/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..19efec6 --- /dev/null +++ b/Wintor/WinTorrent/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Wintor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Wintor")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Wintor/WinTorrent/Properties/Default.rd.xml b/Wintor/WinTorrent/Properties/Default.rd.xml new file mode 100644 index 0000000..af00722 --- /dev/null +++ b/Wintor/WinTorrent/Properties/Default.rd.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Wintor/WinTorrent/TemplateDictionaries/AutoSuggestBoxTemplateDictionary.xaml b/Wintor/WinTorrent/TemplateDictionaries/AutoSuggestBoxTemplateDictionary.xaml new file mode 100644 index 0000000..5171c0f --- /dev/null +++ b/Wintor/WinTorrent/TemplateDictionaries/AutoSuggestBoxTemplateDictionary.xaml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Visible + + + + + + + + + + + + +