Beispiel #1
0
        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 "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 "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;

                            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}");
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            try
            {
                if (args.Length == 2)
                {
                    if (Text.IsBase64String(args[1]))
                    {
                        switch (args[0].ToLower())
                        {
                        case "test":
                            // Begin timing
                            dynamic       global_data   = JsonConvert.DeserializeObject <dynamic>(Text.Base64Decode(args[1]));
                            GlobalTest    global_test   = new GlobalTest(global_data);
                            List <string> global_result = global_test.Send();
                            // Stop timing
                            stopwatch.Stop();
                            Console.Write(string.Join("<br>", global_result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
                            break;

                        case "ctest":
                            dynamic       campaing_test_data = JsonConvert.DeserializeObject <dynamic>(Text.Base64Decode(args[1]));
                            Ctest         campaign_test      = new Ctest(campaing_test_data);
                            List <string> test_result        = campaign_test.Send();
                            // Stop timing
                            stopwatch.Stop();
                            Console.Write(string.Join("<br>", test_result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
                            break;

                        case "delay":
                            dynamic       dalay_data   = JsonConvert.DeserializeObject <dynamic>(Text.Base64Decode(args[1]));
                            Xdelay        delay_send   = new Xdelay(dalay_data);
                            List <string> delay_result = delay_send.Send();
                            stopwatch.Stop();
                            Console.Write(string.Join("<br>", delay_result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
                            break;

                        case "normal":
                            dynamic       normal_data   = JsonConvert.DeserializeObject <dynamic>(Text.Base64Decode(args[1]));
                            NormalM       normal_send   = new NormalM(normal_data);
                            List <string> normal_result = normal_send.Send();
                            stopwatch.Stop();
                            Console.Write(string.Join("<br>", normal_result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
                            Console.ReadLine();
                            break;

                        //case "bulk":
                        //    dynamic bulk_data = JsonConvert.DeserializeObject<dynamic>(Text.Base64Decode(args[1]));
                        //    BulkM bulk_send = new BulkM(bulk_data);
                        //    List<string> bulk_result = bulk_send.Send();
                        //    stopwatch.Stop();
                        //    Console.Write(string.Join("<br>", bulk_result) + "<br>TOOK : " + stopwatch.Elapsed.ToString());
                        //    Console.ReadLine();
                        //    break;
                        default:
                            Console.Write("UNKNOW ACTION");
                            break;
                        }
                    }
                    else
                    {
                        Console.Write("TEST, INVALID DATA");
                        logger.Warn("TEST, INVALID DATA B64");
                    }
                }
                else
                {
                    Console.Write("BAD ARGUMENTS");
                    logger.Warn("BAD ARGUMENTS PASSED");
                }
            }
            catch (Exception ex)
            {
                Console.Write("EXEPTION " + ex.Message);
                logger.Error($"{ex.Message}_{ex.StackTrace}");
            }
        }