Skip to content

Commit 768f6b7

Browse files
authored
Add support for Recycle Bin (#840)
* Add support for Recycle Bin
1 parent 746cc25 commit 768f6b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1909
-241
lines changed

Common/Common.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
</Project>

Common/Extensions.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace Files.Common
5+
{
6+
public static class Extensions
7+
{
8+
public static TOut Get<TOut, TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TOut defaultValue = default(TOut))
9+
{
10+
// If setting doesn't exist, create it.
11+
if (!dictionary.ContainsKey(key))
12+
dictionary[key] = (TValue)(object)defaultValue;
13+
14+
return (TOut)(object)dictionary[key];
15+
}
16+
17+
public static DateTime ToDateTime(this System.Runtime.InteropServices.ComTypes.FILETIME time)
18+
{
19+
ulong high = (ulong)time.dwHighDateTime;
20+
uint low = (uint)time.dwLowDateTime;
21+
long fileTime = (long)((high << 32) + low);
22+
try
23+
{
24+
return DateTime.FromFileTimeUtc(fileTime);
25+
}
26+
catch
27+
{
28+
return DateTime.FromFileTimeUtc(0xFFFFFFFF);
29+
}
30+
}
31+
}
32+
}

Common/ShellFileItem.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Runtime.Serialization;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Files.Common
9+
{
10+
public class ShellFileItem
11+
{
12+
public bool IsFolder;
13+
public string RecyclePath;
14+
public string FileName;
15+
public string FilePath;
16+
public DateTime RecycleDate;
17+
public string FileSize;
18+
public ulong FileSizeBytes;
19+
public string FileType;
20+
21+
public ShellFileItem()
22+
{
23+
24+
}
25+
26+
public ShellFileItem(bool isFolder, string recyclePath, string fileName, string filePath, DateTime recycleDate, string fileSize, ulong fileSizeBytes, string fileType)
27+
{
28+
this.IsFolder = isFolder;
29+
this.RecyclePath = recyclePath;
30+
this.FileName = fileName;
31+
this.FilePath = filePath;
32+
this.RecycleDate = recycleDate;
33+
this.FileSize = fileSize;
34+
this.FileSizeBytes = fileSizeBytes;
35+
this.FileType = fileType;
36+
}
37+
}
38+
}

Files.Launcher/Files.Launcher.csproj

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{533F9E86-EE0A-4FCB-B70C-F29532C1B787}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
9-
<RootNamespace>ProcessLauncher</RootNamespace>
10-
<AssemblyName>ProcessLauncher</AssemblyName>
9+
<RootNamespace>FilesFullTrust</RootNamespace>
10+
<AssemblyName>FilesFullTrust</AssemblyName>
1111
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -26,6 +26,7 @@
2626
<ErrorReport>prompt</ErrorReport>
2727
<WarningLevel>4</WarningLevel>
2828
<LangVersion>8.0</LangVersion>
29+
<UseVSHostingProcess>false</UseVSHostingProcess>
2930
</PropertyGroup>
3031
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3132
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -104,9 +105,44 @@
104105
<Compile Include="Program.cs" />
105106
<Compile Include="Properties\AssemblyInfo.cs" />
106107
<Compile Include="QuickLook.cs" />
108+
<Compile Include="Win32API.cs" />
107109
</ItemGroup>
108110
<ItemGroup>
109111
<None Include="app.config" />
112+
<Content Include="NLog.config">
113+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
114+
</Content>
115+
</ItemGroup>
116+
<ItemGroup>
117+
<PackageReference Include="Microsoft.Net.Compilers">
118+
<Version>3.3.1</Version>
119+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
120+
<PrivateAssets>all</PrivateAssets>
121+
</PackageReference>
122+
<PackageReference Include="Microsoft.Windows.SDK.Contracts">
123+
<Version>10.0.19041.1</Version>
124+
</PackageReference>
125+
<PackageReference Include="Newtonsoft.Json">
126+
<Version>12.0.3</Version>
127+
</PackageReference>
128+
<PackageReference Include="NLog">
129+
<Version>4.7.0</Version>
130+
</PackageReference>
131+
<PackageReference Include="System.Runtime.WindowsRuntime">
132+
<Version>4.6.0</Version>
133+
</PackageReference>
134+
<PackageReference Include="System.Runtime.WindowsRuntime.UI.Xaml">
135+
<Version>4.6.0</Version>
136+
</PackageReference>
137+
<PackageReference Include="Vanara.Windows.Shell">
138+
<Version>3.2.7</Version>
139+
</PackageReference>
140+
</ItemGroup>
141+
<ItemGroup>
142+
<ProjectReference Include="..\Common\Common.csproj">
143+
<Project>{0533133f-2559-4b53-a0fd-0970bc0e312e}</Project>
144+
<Name>Common</Name>
145+
</ProjectReference>
110146
</ItemGroup>
111147
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
112148
</Project>

Files.Launcher/NLog.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
5+
<targets>
6+
<target name="logfile" xsi:type="File" fileName="${var:LogPath}\debug_fulltrust.txt" concurrentWrites="true"
7+
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=tostring}"/>
8+
<target name="logconsole" xsi:type="Console" />
9+
</targets>
10+
11+
<rules>
12+
<logger name="*" minlevel="Debug" writeTo="logconsole" />
13+
<logger name="*" minlevel="Debug" writeTo="logfile" />
14+
</rules>
15+
</nlog>

0 commit comments

Comments
 (0)