2024-06-24 09:27:12 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using Common;
|
|
|
|
|
|
|
|
|
|
namespace ServerTest;
|
|
|
|
|
|
|
|
|
|
public class FilesSeed : IDisposable
|
|
|
|
|
{
|
|
|
|
|
public FilesSeed()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("FilesSeed Construct");
|
|
|
|
|
// string TestPath = Path.Combine(Directory.GetCurrentDirectory(), "../../..");
|
|
|
|
|
DateTime NewTime = DateTime.Now.AddSeconds(-99);
|
|
|
|
|
DateTime OldTime = NewTime.AddSeconds(-20);
|
|
|
|
|
NewDir = new Dir(
|
|
|
|
|
TestPath + "/NewDir",
|
|
|
|
|
[
|
|
|
|
|
new Dir($"{TestPath}/NewDir/0"),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/NewDir/1",
|
|
|
|
|
[new Common.File($"{TestPath}/NewDir/1/1.txt", NewTime)]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/NewDir/2",
|
|
|
|
|
[
|
|
|
|
|
new Common.File($"{TestPath}/NewDir/2/2.txt", NewTime),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/NewDir/2/2_1",
|
|
|
|
|
[
|
|
|
|
|
new Common.File($"{TestPath}/NewDir/2/2_1/1.txt", NewTime),
|
|
|
|
|
new Common.File($"{TestPath}/NewDir/2/2_1/2.txt", NewTime),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/NewDir/2/2_2",
|
|
|
|
|
[
|
|
|
|
|
new Common.File($"{TestPath}/NewDir/2/2_2/1.txt", NewTime),
|
|
|
|
|
new Common.File($"{TestPath}/NewDir/2/2_2/2.txt", NewTime),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/NewDir/2/2_2/2_3",
|
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
|
|
|
|
$"{TestPath}/NewDir/2/2_2/2_3/1.txt",
|
|
|
|
|
NewTime
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
DiffDir = new Dir(
|
|
|
|
|
$"{TestPath}/OldDir",
|
|
|
|
|
[
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/1",
|
|
|
|
|
[new Common.File($"{TestPath}/OldDir/1/2_D.txt", NewTime, NextOpType.Del),]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2",
|
|
|
|
|
[
|
|
|
|
|
// 将要添加
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/2/2.txt", NewTime, NextOpType.Add),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_1",
|
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_1/2.txt",
|
|
|
|
|
NewTime,
|
|
|
|
|
NextOpType.Modify
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M",
|
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/1.txt",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
OldTime,
|
|
|
|
|
NextOpType.Del
|
|
|
|
|
),
|
|
|
|
|
new Common.File(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/2.txt",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
OldTime,
|
|
|
|
|
NextOpType.Del
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/2_3",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/2_3/1.txt",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
OldTime,
|
|
|
|
|
NextOpType.Del
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
NextOpType.Del
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
NextOpType.Del
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2",
|
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2/1.txt",
|
|
|
|
|
NewTime,
|
|
|
|
|
NextOpType.Add
|
|
|
|
|
),
|
|
|
|
|
new Common.File(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2/2.txt",
|
|
|
|
|
NewTime,
|
|
|
|
|
NextOpType.Add
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2/2_3",
|
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2/2_3/1.txt",
|
|
|
|
|
NewTime,
|
|
|
|
|
NextOpType.Add
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
NextOpType.Add
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
NextOpType.Add
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
OldDir = new Dir(
|
|
|
|
|
$"{TestPath}/OldDir",
|
|
|
|
|
[
|
|
|
|
|
new Dir($"{TestPath}/OldDir/0"),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/1",
|
|
|
|
|
[
|
|
|
|
|
//不做修改
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/1/1.txt", NewTime),
|
|
|
|
|
//将要删除
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/1/2_D.txt", NewTime),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2",
|
|
|
|
|
[
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_1",
|
|
|
|
|
[
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/2/2_1/1.txt", NewTime),
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/2/2_1/2.txt", OldTime),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
new Dir(
|
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M",
|
|
|
|
|
[
|
2024-07-12 06:15:38 +00:00
|
|
|
|
new Common.File($"{TestPath}/OldDir/2/2_2_M/1.txt", OldTime),
|
|
|
|
|
new Common.File($"{TestPath}/OldDir/2/2_2_M/2.txt", OldTime),
|
2024-06-24 09:27:12 +00:00
|
|
|
|
new Dir(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/2_3",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
[
|
|
|
|
|
new Common.File(
|
2024-07-12 06:15:38 +00:00
|
|
|
|
$"{TestPath}/OldDir/2/2_2_M/2_3/1.txt",
|
2024-06-24 09:27:12 +00:00
|
|
|
|
OldTime
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
);
|
2024-07-26 08:04:00 +00:00
|
|
|
|
fileDirOp = new SimpleFileDirOp();
|
2024-06-24 09:27:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly string TestPath = Path.Combine(Directory.GetCurrentDirectory(), "../../..");
|
|
|
|
|
public Dir NewDir;
|
|
|
|
|
public Dir OldDir;
|
|
|
|
|
public Dir DiffDir;
|
2024-07-26 08:04:00 +00:00
|
|
|
|
public FileDirOpStra fileDirOp;
|
2024-06-24 09:27:12 +00:00
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2024-07-12 06:15:38 +00:00
|
|
|
|
Directory.Delete($"{TestPath}/OldDir", true);
|
|
|
|
|
Directory.Delete($"{TestPath}/NewDir", true);
|
2024-06-24 09:27:12 +00:00
|
|
|
|
Console.WriteLine("FilesSeed Dispose");
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
}
|
|
|
|
|
// ~FilesSeed()
|
|
|
|
|
// {
|
|
|
|
|
// Console.WriteLine("FilesSeed ~");
|
|
|
|
|
// }
|
|
|
|
|
}
|