DotNetZip 创建权限为 000(不可读取、不可写入、不可执行)的 zip 文件,因此我无法在 Linux 上轻松打开它们(Windows 资源管理器不关心它并正常打开文件)。Windows 上的相同代码生成具有读取权限的文件(在 Linux 上):
using (var fs = new System.IO.FileStream("./test.zip"))
{
using (var archive = new System.IO.Compression.ZipArchive(fs, ZipArchiveMode.Create))
{
var entry = archive.CreateEntry("test.txt");
using (var writer = new System.IO.StreamWriter(entry.Open()))
{
writer.Write("Hello World");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我可以设置权限或模拟System.IO.Compression在 Windows 上运行的程序吗?
我正在尝试使用 WinUI3 进行拖放操作。在 WPF 中,我曾经将AllowDrop和Drop添加到 UI 元素中,并且能够接收已删除文件的文件名。然而,在 WinUI3 中,Drop 方法并未被执行。我究竟做错了什么?
XAML
<Page
x:Class="..."
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="..."
xmlns:helper="..."
xmlns:prop="..."
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<DataTemplate x:Key="Image" x:DataType="helper:ProductImage">
<Border BorderBrush="{x:Bind Path=Color, Mode=OneWay}" BorderThickness="1" Background="Transparent"
AllowDrop="True" Drop="Image_Drop" >
<Grid Width="{Binding ElementName=PIImageSize, Path=Value}"
Height="{Binding ElementName=PIImageSize, Path=Value}" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="2" HorizontalAlignment="Center"
Text="{x:Bind Path=Type, Mode=OneWay}"
Foreground="{x:Bind Path=Color, Mode=OneWay}" />
<Image Grid.Row="1" Stretch="Uniform" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="{x:Bind Path=BitmapImage, Mode=OneWay}"/>
<TextBox Grid.Row="2" …Run Code Online (Sandbox Code Playgroud)