You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Apewer.Run
|
|
{
|
|
|
|
class HashComputer
|
|
{
|
|
|
|
public HashComputer()
|
|
{
|
|
var path = @"Y:\telecast\新白娘子传奇";
|
|
var subs = StorageUtility.GetSubFiles(path, true);
|
|
subs.Sort();
|
|
var array = Json.NewArray();
|
|
foreach (var sub in subs)
|
|
{
|
|
var md5 = "";
|
|
using (var file = StorageUtility.OpenFile(sub))
|
|
{
|
|
var info = new FileInfo(sub);
|
|
var length = info.Length;
|
|
md5 = BinaryUtility.MD5(file, (p) =>
|
|
{
|
|
Console.WriteLine($"{sub} total={length} progress={p}");
|
|
}).ToX2();
|
|
}
|
|
|
|
Console.WriteLine($"{sub} md5={md5}");
|
|
|
|
var item = Json.NewObject();
|
|
item["path"] = sub;
|
|
item["md5"] = md5;
|
|
array.AddItem(item);
|
|
}
|
|
|
|
StorageUtility.WriteFile(path + ".json", array.ToString(true).ToBinary());
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|