-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
60 lines (52 loc) · 2.13 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using client_generator.App;
using client_generator.App.Commands;
using client_generator.App.Windows;
using client_generator.Deserializer;
using client_generator.Generators;
using client_generator.Templates;
using client_generator.Templates.Clients;
using client_generator.Templates.Endpoints;
using client_generator.Templates.Parameters;
using client_generator.Templates.Requests;
using client_generator.Templates.Responses;
using client_generator.Templates.Schemes;
using logger;
using logger.LogStrategies;
using Terminal.Gui;
namespace client_generator
{
internal static class Program
{
private static void Main()
{
var generator = SetUpGenerator();
var logger = SetUpLogger();
VersionedDeserializers.RegisterFromAssembly(typeof(Program).Assembly);
Application.Init();
var commandProvider = new CommandsProvider(AppController.Instance(), logger);
var menu = new MenuWindow(commandProvider);
AppController.Instance().StartWindow(menu, generator, logger);
}
private static GeneratorTemplate SetUpGenerator()
{
var templateFactory = new TemplatesFactory.TemplateFactoryBuilder()
.SetClientTemplateFactory(new ClientTemplateFactory())
.SetParameterTemplateFactory(new ParameterTemplateFactory())
.SetRequestTemplateFactory(new RequestTemplateFactory())
.SetResponseTemplateFactory(new ResponseTemplateFactory())
.SetEndpointTemplateFactory(new EndpointTemplateFactory())
.SetClassSchemaTemplateFactory(new ClassSchemaTemplateFactory())
.Build();
var context = new GeneratorContext(templateFactory);
return new Generator(context);
}
private static ILogger SetUpLogger()
{
return new LoggerFacade<RawLogger>(new LoggerSettings
{
LogLevel = LogLevel.Debug | LogLevel.Info | LogLevel.Warn | LogLevel.Error | LogLevel.Fatal,
DefaultLogStrategy = new FileLogStrategy("logs.log")
});
}
}
}