cs-codex-dist-tests/Tools/AutoClient/App.cs

41 lines
1.1 KiB
C#
Raw Normal View History

2024-09-12 12:38:15 +00:00
using Logging;
namespace AutoClient
{
public class App
{
public App(Configuration config)
{
Config = config;
Log = new LogSplitter(
new FileLog(Path.Combine(config.LogPath, "autoclient")),
new ConsoleLog()
);
Generator = CreateGenerator();
CidRepo = new CidRepo(config);
Performance = new Performance(new LogSplitter(
new FileLog(Path.Combine(config.LogPath, "performance")),
new ConsoleLog()
));
2024-09-12 12:38:15 +00:00
}
public Configuration Config { get; }
public ILog Log { get; }
public IFileGenerator Generator { get; }
public CancellationTokenSource Cts { get; } = new CancellationTokenSource();
public CidRepo CidRepo { get; }
public Performance Performance { get; }
2024-09-12 12:38:15 +00:00
private IFileGenerator CreateGenerator()
{
if (Config.FileSizeMb > 0)
{
return new RandomFileGenerator(Config, Log);
}
return new ImageGenerator(Log);
}
}
}