-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
114 lines (112 loc) · 5.1 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using Newtonsoft.Json;
using NLog;
using Send.helpers;
using Send.modes;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace Send
{
class Program
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
static void Log(bool status, string message)
{
Dictionary<string, object> response = new Dictionary<string, object>
{
{ "status", status },
{ "response", message },
};
Console.Write(JsonConvert.SerializeObject(response));
}
static void Main(string[] args)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
try
{
if (args.Length == 2)
{
if (File.Exists(args[1]))
{
string data = File.ReadAllText(args[1]);
List<string> result = null;
if (Text.IsBase64String(data))
{
dynamic file_data = JsonConvert.DeserializeObject<dynamic>(Text.Base64Decode(data));
switch (args[0].ToLower())
{
case "test":
GlobalTest global_test = new GlobalTest(file_data);
result = global_test.Send();
break;
case "warmup":
Warmup warmup_send = new Warmup(file_data);
result = warmup_send.Send();
break;
case "warmupm":
WarmupM warmupm_send = new WarmupM(file_data);
result = warmupm_send.Send();
break;
case "ctest":
Ctest campaign_test = new Ctest(file_data);
result = campaign_test.Send();
break;
case "delay":
Xdelay delay_send = new Xdelay(file_data);
result = delay_send.Send();
break;
case "delay_reply":
XdelayReply xdelay_reply_send = new XdelayReply(file_data);
result = xdelay_reply_send.Send();
break;
case "delay_smtp":
XdelaySmtp xdelay_smtp = new XdelaySmtp(file_data);
result = xdelay_smtp.Send();
break;
case "normal":
NormalM normal_send = new NormalM(file_data);
result = normal_send.Send();
break;
case "bulk":
BulkM bulk_send = new BulkM(file_data);
result = bulk_send.Send();
break;
case "smtp_test":
SmtpTest smtp_test = new SmtpTest(file_data);
result = smtp_test.Send();
break;
default:
Console.Write("UNKNOW ACTION");
break;
}
stopwatch.Stop();
Console.Write(string.Join("<br>", result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
}
else
{
Console.Write("INVALID DATA CONFIG");
logger.Warn("TEST, INVALID DATA B64");
}
}
else
{
Console.Write("DROP SETTINGS NOT FOUND");
logger.Warn("DROP SETTINGS NOT FOUND "+ args[1]);
}
}
else
{
Console.Write("BAD ARGUMENTS");
logger.Warn("BAD ARGUMENTS PASSED");
}
}
catch (Exception ex)
{
Console.Write("EXEPTION " + ex.Message);
logger.Error($"{ex.Message}_{ex.StackTrace}");
}
}
}
}