Skip to content

Commit 2493ba4

Browse files
committed
Added ArchiveStorable
1 parent 67980b5 commit 2493ba4

File tree

11 files changed

+84
-38
lines changed

11 files changed

+84
-38
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Storage.Storables
5+
{
6+
/// <summary>
7+
/// Represents a file that is powered by SevenZipSharp and 7zip.
8+
/// </summary>
9+
public class ArchiveFile : ArchiveStorable/*, IFile*/
10+
{
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Storage.Storables
5+
{
6+
/// <summary>
7+
/// Represents a folder that is powered by SevenZipSharp and 7zip.
8+
/// </summary>
9+
public class ArchiveFolder : ArchiveStorable/*, IFolder*/
10+
{
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Storage.Storables
5+
{
6+
/// <summary>
7+
/// Represents a folder view that is powered by SevenZipSharp and 7zip.
8+
/// </summary>
9+
public class ArchiveFolderView : IFolderView
10+
{
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
using System.Runtime.InteropServices;
5+
using Windows.Win32;
6+
using Windows.Win32.Foundation;
7+
using Windows.Win32.System.Com;
8+
using Windows.Win32.UI.Shell;
9+
10+
namespace Files.App.Storage.Storables
11+
{
12+
/// <inheritdoc cref="IArchiveStorable"/>
13+
public abstract class ArchiveStorable : IArchiveStorable
14+
{
15+
/// <inheritdoc/>
16+
public string Path { get; protected set; }
17+
18+
/// <inheritdoc/>
19+
public string Name { get; protected set; }
20+
21+
/// <inheritdoc/>
22+
public string Id { get; protected set; }
23+
}
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Storage.Storables
5+
{
6+
/// <summary>
7+
/// Represents a storable that is powered by SevenZipSharp and 7zip.
8+
/// </summary>
9+
public interface IArchiveStorable : IStorable
10+
{
11+
}
12+
}

src/Files.App.Storage/Storables/Native/INativeStorable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
namespace Files.App.Storage.Storables
55
{
66
/// <summary>
7-
/// Represents a file object that is natively supported by Windows Shell API.
7+
/// Represents a storable that is natively supported by Windows Shell API.
88
/// </summary>
9-
public interface INativeStorable
9+
public interface INativeStorable : IStorable
1010
{
1111
public string GetPropertyAsync(string id);
1212
}

src/Files.App.Storage/Storables/Native/NativeFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Files.App.Storage.Storables
55
{
66
/// <summary>
7-
/// Represents a file object that is natively supported by Windows Shell API.
7+
/// Represents a file that is natively supported by Windows Shell API.
88
/// </summary>
99
public class NativeFile : NativeStorable/*, IFile*/
1010
{

src/Files.App.Storage/Storables/Native/NativeFolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Files.App.Storage.Storables
55
{
66
/// <summary>
7-
/// Represents a folder object that is natively supported by Windows Shell API.
7+
/// Represents a folder that is natively supported by Windows Shell API.
88
/// </summary>
99
public class NativeFolder : NativeStorable/*, IFolder*/
1010
{

src/Files.App.Storage/Storables/Native/NativeFolderView.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,9 @@
44
namespace Files.App.Storage.Storables
55
{
66
/// <summary>
7-
/// Represents a folder object that is natively supported by Windows Shell API.
7+
/// Represents a folder view that is natively supported by Windows Shell API.
88
/// </summary>
99
public class NativeFolderView : IFolderView
1010
{
11-
public int GetSpacing()
12-
{
13-
return 0;
14-
}
15-
16-
public int GetThumbnailSize()
17-
{
18-
return 0;
19-
}
20-
21-
public FolderViewMode GetViewMode()
22-
{
23-
return 0;
24-
}
25-
26-
public uint GetItemsCount()
27-
{
28-
return 0;
29-
}
3011
}
3112
}

src/Files.App.Storage/Storables/Native/NativeStorable.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public abstract class NativeStorable : INativeStorable
3535
/// Initializes an instance of <see cref="NativeStorable"/> class.
3636
/// </summary>
3737
/// <param name="path">Win32 file namespace, shell namespace, or UNC path.</param>
38-
public unsafe NativeFile(string path)
38+
public unsafe NativeStorable(string path)
3939
{
4040
HRESULT hr = PInvoke.SHCreateItemFromParsingName(
4141
path,
@@ -53,7 +53,7 @@ public unsafe NativeStorable(Guid shellGuid)
5353
HRESULT hr = default;
5454

5555
// For known folders
56-
fixed (Guid* pFolderId = shellGuid)
56+
fixed (Guid* pFolderId = &shellGuid)
5757
{
5858
hr = PInvoke.SHGetKnownFolderItem(
5959
pFolderId,
@@ -96,12 +96,12 @@ public string GetPropertyAsync(string id)
9696
id,
9797
out var propertyKey);
9898

99-
using ComHeapPtr<LPWSTR> pPropertyValue;
100-
hr = pShellItem2.Get()->GetString(
101-
&propertyKey,
102-
pPropertyValue.GetAddressOf());
99+
using ComHeapPtr<LPWSTR> pszPropertyValue = default;
100+
//hr = pShellItem2.Get()->GetString(
101+
// &propertyKey,
102+
// pszPropertyValue.GetAddressOf());
103103

104-
return szPropertyValue.Get()->ToString();
104+
return pszPropertyValue.Get()->ToString();
105105
}
106106
}
107107
}

0 commit comments

Comments
 (0)