Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTP Support #5627

Merged
merged 37 commits into from
Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c08697
browse
hez2010 Jul 26, 2021
3599015
Merge branch 'main' of github.com:files-community/Files into feature/ftp
hez2010 Jul 29, 2021
f45824b
Merge branch 'main' of github.com:files-community/Files into feature/ftp
hez2010 Jul 30, 2021
fe06a45
Fix navigation for FTP
hez2010 Jul 30, 2021
889f1e3
Implement FtpStorageFile
hez2010 Jul 30, 2021
d37889a
Copy to clipboard support
hez2010 Jul 30, 2021
811011e
WIP: FTP copy support
hez2010 Jul 30, 2021
a7056d6
Ask for network credentials
hez2010 Jul 30, 2021
b7513a0
Fixes to ftp helpers
hez2010 Jul 30, 2021
a7a96ef
cleanup
hez2010 Aug 1, 2021
a115507
Support pasting & uploading
hez2010 Aug 1, 2021
45a607e
Distinguish FtpClient
hez2010 Aug 1, 2021
803e410
Merge branch 'main' of github.com:files-community/Files into feature/ftp
hez2010 Aug 1, 2021
1e70d68
Support delete
hez2010 Aug 1, 2021
1ee4670
Delete and rename
hez2010 Aug 1, 2021
e478550
Implement FtpStorageFolder
hez2010 Aug 1, 2021
f3bc135
Handle ContentDialogResult.None case
hez2010 Aug 1, 2021
0d6d382
Use BoolNegationConverter
hez2010 Aug 1, 2021
81a7386
Fix size and icon display
hez2010 Aug 1, 2021
d5a58d4
Minor fixes and avoid blocking UI while connecting to FTP
hez2010 Aug 1, 2021
b6ac2e9
Minor fixes
hez2010 Aug 2, 2021
275c732
Resolve clipboard issue
hez2010 Aug 3, 2021
4cd832d
Review feedback on permissions
hez2010 Aug 3, 2021
beeea25
Merge branch 'main' of github.com:files-community/Files into feature/ftp
hez2010 Aug 4, 2021
591131c
Conditional flush clipboard, impl GetFile from FtpStorageFolder
hez2010 Aug 4, 2021
3b82337
Merge branch 'feature/ftp' of github.com:hez2010/files-uwp into featu…
hez2010 Aug 4, 2021
9647f42
Implement copy directories to FTP
hez2010 Aug 5, 2021
8802ac9
Use app built-in copy for FTP directories
hez2010 Aug 5, 2021
3a03b7d
Merge branch 'main' of github.com:files-community/Files into feature/ftp
hez2010 Aug 5, 2021
6e8ad2e
Merge branch 'main' of https://github.com/files-community/Files into …
gave92 Aug 14, 2021
6ed26ad
Fix rename and delete operations
gave92 Aug 14, 2021
bbdf939
Enable thumbnails in FTP
gave92 Aug 14, 2021
d682938
Added drag&drop support from FTP
gave92 Aug 15, 2021
99686ab
Fix date display format in FTP
gave92 Aug 15, 2021
25ff516
Hide non-working menu items
gave92 Aug 15, 2021
5c355d3
Add string resources for credentials dialog
gave92 Aug 15, 2021
978a555
Fix dialog resource
gave92 Aug 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Files.Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.17763.0" />
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
</Dependencies>
<Resources>
<Resource Language="x-generate" />
Expand Down
2 changes: 2 additions & 0 deletions Files/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)

ParentShellPageInstance.InstanceViewModel.IsPageTypeRecycleBin = workingDir.StartsWith(App.AppSettings.RecycleBinPath);
ParentShellPageInstance.InstanceViewModel.IsPageTypeMtpDevice = workingDir.StartsWith("\\\\?\\");
ParentShellPageInstance.InstanceViewModel.IsPageTypeFtp = FtpHelpers.IsFtpPath(workingDir);
ParentShellPageInstance.InstanceViewModel.IsPageTypeSearchResults = false;
ParentShellPageInstance.NavToolbarViewModel.PathControlDisplayText = navigationArguments.NavPathParam;
if (!navigationArguments.IsLayoutSwitch)
Expand All @@ -441,6 +442,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
ParentShellPageInstance.NavToolbarViewModel.CanGoBack = true; // Impose no artificial restrictions on back navigation. Even in a search results page.
ParentShellPageInstance.NavToolbarViewModel.CanNavigateToParent = false;
ParentShellPageInstance.InstanceViewModel.IsPageTypeRecycleBin = false;
ParentShellPageInstance.InstanceViewModel.IsPageTypeFtp = false;
ParentShellPageInstance.InstanceViewModel.IsPageTypeMtpDevice = false;
ParentShellPageInstance.InstanceViewModel.IsPageTypeSearchResults = true;
if (!navigationArguments.IsLayoutSwitch)
Expand Down
52 changes: 52 additions & 0 deletions Files/Dialogs/CredentialDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<ContentDialog
x:Class="Files.Dialogs.CredentialDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Name="AskCredentialDialog"
x:Uid="AskCredentialDialog"
Title="Credential Required"
PrimaryButtonText="OK"
SecondaryButtonText="Cancel"
Grid.RowSpan="4"
BorderThickness="0"
CornerRadius="{StaticResource OverlayCornerRadius}"
PrimaryButtonStyle="{StaticResource AccentButtonStyle}"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}"
Style="{StaticResource DefaultContentDialogStyle}"
Closed="AskCredentialDialog_Closed">

<ContentDialog.Resources>
<ResourceDictionary>
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
</ResourceDictionary>
</ContentDialog.Resources>

<Grid RowSpacing="25">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="SubtitleArea">
<TextBlock
x:Name="Description"
x:Uid="CredentialDialogDescription"
Text="Provide your credential:" />
</Grid>
<StackPanel
x:Name="SelectionListContent"
Grid.Row="1"
HorizontalAlignment="Stretch">
<TextBox x:Name="UserName" Margin="4" PlaceholderText="UserName" IsEnabled="{x:Bind Anonymous.IsChecked, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
<PasswordBox x:Name="Password" Margin="4" PlaceholderText="Password" IsEnabled="{x:Bind Anonymous.IsChecked, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
<CheckBox x:Name="Anonymous" Margin="4" Content="Anonymous" />
</StackPanel>
</Grid>
</ContentDialog>
52 changes: 52 additions & 0 deletions Files/Dialogs/CredentialDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
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;

// コンテンツ ダイアログの項目テンプレートについては、https://go.microsoft.com/fwlink/?LinkId=234238 を参照してください

namespace Files.Dialogs
{
public sealed partial class CredentialDialog : ContentDialog
{
private readonly TaskCompletionSource<(string UserName, string Password, bool Anonymous)> _taskCompletionSource;
public Task<(string UserName, string Password, bool Anonymous)> Result { get; }

public CredentialDialog()
{
_taskCompletionSource = new();
Result = _taskCompletionSource.Task;
this.InitializeComponent();
}

private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
_taskCompletionSource.SetResult((UserName.Text, Password.Password, Anonymous.IsChecked ?? false));
hez2010 marked this conversation as resolved.
Show resolved Hide resolved
}

private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
_taskCompletionSource.SetResult((null, null, true));
}

private void AskCredentialDialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
if (args.Result == ContentDialogResult.None)
{
_taskCompletionSource.SetResult((null, null, true));
}
}
}
}
73 changes: 27 additions & 46 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="16.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -15,7 +15,7 @@
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>16</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
Expand All @@ -26,9 +26,11 @@
<GenerateTestArtifacts>False</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<DisableXbfLineInfo>False</DisableXbfLineInfo>
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
<AppxBundlePlatforms>x86|x64|arm64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<Win32Resource>Resources\MiddleClickScrolling-CursorType.res</Win32Resource>
<LangVersion>9.0</LangVersion>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -39,7 +41,6 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<UseAppLocalCoreFramework>true</UseAppLocalCoreFramework>
Expand All @@ -54,33 +55,6 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseAppLocalCoreFramework>true</UseAppLocalCoreFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;DISABLE_XAML_GENERATED_MAIN</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
Expand All @@ -91,9 +65,8 @@
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>9.0</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseAppLocalCoreFramework>true</UseAppLocalCoreFramework>
</PropertyGroup>
Expand All @@ -105,9 +78,8 @@
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<Prefer32Bit>false</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
Expand All @@ -118,8 +90,8 @@
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<LangVersion>9.0</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseAppLocalCoreFramework>true</UseAppLocalCoreFramework>
</PropertyGroup>
Expand All @@ -131,14 +103,10 @@
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<Prefer32Bit>false</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<LangVersion>9.0</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Label="MultilingualAppToolkit">
<MultilingualAppToolkitVersion>4.0</MultilingualAppToolkitVersion>
<MultilingualFallbackLanguage>en-US</MultilingualFallbackLanguage>
Expand Down Expand Up @@ -204,11 +172,15 @@
<Compile Include="Extensions\KeyboardAcceleratorExtensions.cs" />
<Compile Include="Extensions\TaskExtensions.cs" />
<Compile Include="Filesystem\FilesystemOperations\ShellFilesystemOperations.cs" />
<Compile Include="Filesystem\FtpManager.cs" />
<Compile Include="Filesystem\Permissions\FilePermissionsManager.cs" />
<Compile Include="Filesystem\Permissions\FileSystemAccessRule.cs" />
<Compile Include="Filesystem\Permissions\FileSystemAccessRuleForUI.cs" />
<Compile Include="Filesystem\Permissions\RulesForUser.cs" />
<Compile Include="Filesystem\Permissions\UserGroup.cs" />
<Compile Include="Filesystem\StorageItems\FtpStorageFile.cs" />
<Compile Include="Filesystem\StorageItems\FtpStorageFolder.cs" />
<Compile Include="Helpers\FtpHelpers.cs" />
<Compile Include="Helpers\ItemListDisplayHelpers\GroupedCollection.cs" />
<Compile Include="Helpers\ItemListDisplayHelpers\GroupingHelper.cs" />
<Compile Include="Helpers\UniversalLogWriter.cs" />
Expand Down Expand Up @@ -580,6 +552,9 @@
<Compile Include="Dialogs\SettingsDialog.xaml.cs">
<DependentUpon>SettingsDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\CredentialDialog.xaml.cs">
<DependentUpon>CredentialDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPages\About.xaml.cs">
<DependentUpon>About.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -1347,6 +1322,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Dialogs\CredentialDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsPages\About.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -1392,6 +1371,9 @@
<PackageReference Include="ByteSize">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="FluentFTP">
<Version>34.0.1</Version>
</PackageReference>
<PackageReference Include="ini-parser-netstandard">
<Version>2.5.2</Version>
</PackageReference>
Expand Down Expand Up @@ -1485,14 +1467,13 @@
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<SDKReference Include="WindowsDesktop, Version=10.0.19041.0">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '16.0' ">
<VisualStudioVersion>16.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.PriResources.targets" Label="MultilingualAppToolkit" Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\v$(MultilingualAppToolkitVersion)\Microsoft.Multilingual.PriResources.targets')" />
Expand Down
Loading