internal static void CreateDirRecursiveRemote(MultiThreadedRunner <State> inst, AdlsClient client, string path, int recursLevel, int noDirEntries, int lowFileEntries, int highFileEntries, int lowStringLength, int highStringLength, bool keepBottomLevelFolderEmpty = false, string filePrefix = "", string nonRandomText = "") { client.CreateDirectory(path); if (recursLevel == 0 && keepBottomLevelFolderEmpty) { return; } string[] str = path.Split('/'); char nextLevel = str[str.Length - 1][0]; int noFileEntries = Random.Next(lowFileEntries, highFileEntries); for (int i = 0; i < noFileEntries; i++) { long stringLength = (Random.Next(lowStringLength, highStringLength)); inst.AddToQueue(new State(path + "/" + nextLevel + filePrefix + i + "File.txt", stringLength, false, false, client, nonRandomText)); } if (recursLevel == 0) { return; } nextLevel++; string newPath = path + "/"; for (int i = 0; i < noDirEntries; i++) { CreateDirRecursiveRemote(inst, client, newPath + nextLevel + i, recursLevel - 1, noDirEntries, lowFileEntries, highFileEntries, lowStringLength, highStringLength, keepBottomLevelFolderEmpty, filePrefix); } }
internal static void CreateDirRecursiveLocal(MultiThreadedRunner <State> inst, string path, int recursLevel, int noDirEntries, int lowFileEntries, int highFileEntries, int lowStringLength, int highStringLength, string filePrefix = "", bool writeInNewLines = false) { Directory.CreateDirectory(path); if (recursLevel == 0) { return; } string[] str = path.Split('\\'); char nextLevel = str[str.Length - 1][0]; int noFileEntries = Random.Next(lowFileEntries, highFileEntries); for (int i = 0; i < noFileEntries; i++) { int stringLength = (Random.Next(lowStringLength, highStringLength)); inst.AddToQueue(new State(path + "\\" + nextLevel + filePrefix + i + "File.txt", stringLength, writeInNewLines)); } nextLevel++; string newPath = path + "\\"; for (int i = 0; i < noDirEntries; i++) { CreateDirRecursiveLocal(inst, newPath + nextLevel + i, recursLevel - 1, noDirEntries, lowFileEntries, highFileEntries, lowStringLength, highStringLength, filePrefix, writeInNewLines); } }