V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  xiaoyanbot  ›  全部回复第 8 页 / 共 20 页
回复总数  388
1 ... 4  5  6  7  8  9  10  11  12  13 ... 20  
发现可以通过 wsl -d docker-desktop 进入 docker-desktop 的 WSL 虚拟机
使用 -p 90:90 这样的端口映射,可以正常映射出来
两个容器之间是通的, 即 172.17.0.2 和 172.17.0.3 之间是通的
同问: 有没有一篇预览效果的文章?是在文章尾部贴这个小程序码的吗?
类似 https://www.kancloud.cn/ming5112/dolphinphp/256357 这个, 但是不需要编程, 是直接在 配置文件里修改的 ,指定哪些字段显示(或者 * 全部显示), 指定 哪些资源搜索, 排序 什么的
发现了个 http://www.dbninja.com/ 。 还不是那个 给普通用户用的展示类的那种, 我继续找找
不是 PMA, 是另外一个, 我再想想
https://dadabik.com/ 印度写的找到了; 还有个其他 英语系国家写的 ; 大家有遇到类似的吗?
类似这种的 https://www.phpcrudgenerator.com/ , 但是不是生成的代码。 是配置的, 而且能读取 mysql 的字段注释, 自动变为标题
@geelaw
@Athrob

感谢,感谢。 是因为二次调用,流翻转的原因

一样了:

~~~


// 二次调用,翻转到开头
fileStream.Seek(0, SeekOrigin.Begin);




~~~
@geelaw 感谢
~~~

计算正确:
1b3851736679ffb7eb8b06bb751bc3bf

独特的:
d41d8cd98f00b204e9800998ecf8427e

另外一种用法(计算正确):
1b3851736679ffb7eb8b06bb751bc3bf

~~~
stream 情况下, 又获取了一遍 stream 导致的?
独特的那个,无论换什么文件,都是出来固定的一个字符: D41D8CD98F00B204E9800998ECF8427E

.NET 4.6 (没用 core )
@Athrob


整理了一下, 好像是写法的问题:



~~~


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{

String path = "C:\\Users\\ABC\\Downloads\\DiskGenius.exe";

var md5 = MD5.Create();
var openFile = File.OpenRead(path);


var hash = md5.ComputeHash(openFile);
Console.WriteLine("计算正确:");
Console.WriteLine(BitConverter.ToString(hash).Replace("-", String.Empty).ToLower());


Console.WriteLine();



Console.WriteLine("独特的:");
var stream = new BufferedStream(openFile);
var hash2 = md5.ComputeHash(stream);
Console.WriteLine(BitConverter.ToString(hash2).Replace("-", String.Empty).ToLower());


Console.WriteLine();


Console.WriteLine("另外一种用法(计算正确):");
FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
var bufferedStream3 = new BufferedStream(fileStream, 1024 * 4);
var hash3 = md5.ComputeHash(bufferedStream3);
Console.WriteLine(BitConverter.ToString(hash3).Replace("-", String.Empty).ToLower());


Console.ReadLine();
}
}
}



~~~
使用 BufferedStream 之后, 跟 BUFFER_SIZE 也没关系。 换了文件也是出来这个:

D41D8CD98F00B204E9800998ECF8427E
是因为 private const int BUFFER_SIZE = 1200000 导致的?
会弄了
~~~

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net462</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<Company>Microsoft</Company>
<Authors>Hybrid Application Team</Authors>
<Copyright>Copyright ©2020</Copyright>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="0.9.538-prerelease" />
</ItemGroup>
</Project>


~~~
1 ... 4  5  6  7  8  9  10  11  12  13 ... 20  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3265 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 28ms · UTC 13:39 · PVG 21:39 · LAX 06:39 · JFK 09:39
Developed with CodeLauncher
♥ Do have faith in what you're doing.