diff --git "a/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.csproj" "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.csproj" new file mode 100644 index 0000000..2150e37 --- /dev/null +++ "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.csproj" @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git "a/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.sln" "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.sln" new file mode 100644 index 0000000..96c74dd --- /dev/null +++ "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/BoomDisk.sln" @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BoomDisk", "BoomDisk.csproj", "{B676A30D-1E67-406C-95D1-CB77D49505D4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B676A30D-1E67-406C-95D1-CB77D49505D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B676A30D-1E67-406C-95D1-CB77D49505D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B676A30D-1E67-406C-95D1-CB77D49505D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B676A30D-1E67-406C-95D1-CB77D49505D4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git "a/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/Program.cs" "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/Program.cs" new file mode 100644 index 0000000..95c7ce0 --- /dev/null +++ "b/app/Tool/\345\220\221\347\243\201\347\233\230\345\241\253\345\205\205\345\236\203\345\234\276\346\226\207\344\273\266\345\267\245\345\205\267/BoomDisk/Program.cs" @@ -0,0 +1,74 @@ +// See https://aka.ms/new-console-template for more information + +using System.Buffers; + +var folder = @"D:\lindexi\laji"; +var currentFolder = folder; + +for (int i = 0; i < int.MaxValue / 2; i++) +{ + try + { + if (Random.Shared.Next(10) > 7) + { + var next = Random.Shared.Next(3); + var folderName = GetRandomName(); + + if (next == 0) + { + currentFolder = Path.Join(currentFolder, folderName); + Directory.CreateDirectory(currentFolder); + } + else if (next == 1) + { + if (currentFolder.Length <= folder.Length + 1) + { + currentFolder = folder; + continue; + } + + currentFolder = Path.Join(Path.GetDirectoryName(currentFolder), folderName); + } + else + { + currentFolder = Path.GetDirectoryName(currentFolder) ?? folder; + if (currentFolder.Length <= folder.Length + 1) + { + currentFolder = folder; + } + } + } + else + { + var fileName = GetRandomName(); + Directory.CreateDirectory(currentFolder); + var file = Path.Join(currentFolder, fileName); + WriteRandomFile(file); + } + } + catch (Exception e) + { + Console.WriteLine(e); + } +} + +string GetRandomName() => Path.GetRandomFileName(); + +void WriteRandomFile(string file) +{ + var length = Random.Shared.Next(1024 * 1024 * 10); + var buffer = ArrayPool.Shared.Rent(length); + Span span = buffer.AsSpan(0, length); + try + { + Random.Shared.NextBytes(span); + using var fileStream = File.OpenWrite(file); + fileStream.Write(span); + } + finally + { + ArrayPool.Shared.Return(buffer); + } +} + +Console.WriteLine("Hello, World!");