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);
|
2024-09-12 13:03:06 +00:00
|
|
|
|
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; }
|
2024-09-12 13:03:06 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|