internal static async Task Convert(string filePath, string outputFilePath, string connectionString) { List <Rpc> rpcs = new List <Rpc>(); PreProcessor preProcessor = new PreProcessor(); using (var con = new SqlConnection(connectionString)) { await con.OpenAsync(); using (var reader = new StreamReader(filePath)) { await reader.ReadLineAsync(); //skip header while (!reader.EndOfStream) { string statement = await reader.ReadLineAsync(); Rpc rpc = new Rpc { Statement = statement.TrimStart('"').TrimEnd('"') }; preProcessor.LoadParameters(con, rpc); rpcs.Add(rpc); } } } await File.WriteAllTextAsync(outputFilePath, JsonConvert.SerializeObject(rpcs)); }
internal static async Task Prep(string[] fileNames, string outputPath, int clients, string connectionString, DateTimeOffset?cutoff) { var preProcessor = new PreProcessor(); Run run = await preProcessor.PreProcess(fileNames, connectionString, cutoff); Run[] runs = new Run[clients]; for (var i = 0; i < clients; ++i) { runs[i] = new Run { Sessions = new List <Session>(), ConnectionString = connectionString, EventCaptureOrigin = run.EventCaptureOrigin }; } for (var i = 0; i < run.Sessions.Count; ++i) { var bucket = i % clients; runs[bucket].Sessions.Add(run.Sessions[i]); } var formatter = new BinaryFormatter(); for (var i = 0; i < clients; ++i) { using (var stream = new MemoryStream()) { formatter.Serialize(stream, runs[i]); await File.WriteAllBytesAsync($@"{outputPath}\replay{i}.txt", stream.ToArray()); } } }
internal static async Task Prep(string[] filePaths, string outputDirectory, int clients, string connectionString) { var preProcessor = new PreProcessor(); Run run = await preProcessor.PreProcessAsync(filePaths, connectionString); await ProcessPrep(run, outputDirectory, clients, connectionString); }