通常可以在以下位置访问文件:
http://example.com/cats/cat1.zip
我想编码/加密路径名(/cats/cat1.zip),以便链接通常不可访问,但在路径名加密/编码后可访问:
http://example.com/Y2F0cy9jYXQxLnppcAo=
我上面使用base64编码是为了简单,但更喜欢加密.我该怎么做呢?我是否必须编写自定义模块?
P/Invoke声明:
[DllImport("kernel32.dll")]
static extern bool UpdateResource(IntPtr hUpdate, IntPtr lpType, IntPtr lpName, ushort wLanguage, byte[] lpData, uint cbData);
[DllImport("kernel32.dll")]
static extern bool UpdateResource(IntPtr hUpdate, string lpType, int lpName, ushort wLanguage, byte[] lpData, uint cbData);
[DllImport("kernel32.dll")]
static extern IntPtr BeginUpdateResource(string pFileName, bool bDeleteExistingResources);
[DllImport("kernel32.dll")]
static extern bool EndUpdateResource(IntPtr hUpdate, bool fDiscard);
Run Code Online (Sandbox Code Playgroud)
我的代码:
var hUpdate = BeginUpdateResource(FilePath, false);
var BMP = File.ReadAllBytes(BmpPath);
UpdateResource(hUpdate, "2", 123, 1033, BMP, (uint)BMP.Length);
UpdateResource(hUpdate, "#2", 123, 1033, BMP, (uint)BMP.Length);
UpdateResource(hUpdate, "RT_BITMAP", 123, 1033, BMP, (uint)BMP.Length);
UpdateResource(hUpdate, "BITMAP", 123, …Run Code Online (Sandbox Code Playgroud) 在C#中:
0x80000000==2147483648 //outputs True
Run Code Online (Sandbox Code Playgroud)
在VB.NET中:
&H80000000=2147483648 'outputs False
Run Code Online (Sandbox Code Playgroud)
这怎么可能?
我在哪里可以找到/ItemTemplate等控件的默认值?MSDN 中没有关于此的任何内容。ListBoxListView
<ListBox.ItemTemplate>
<DataTemplate>
<!--What's the default value of this?-->
</DataTemplate>
</ListBox.ItemTemplate>
Run Code Online (Sandbox Code Playgroud)