Exemple #1
0
        public async Task <echoResponse> Echo(AcquirerType acquirerType)
        {
            var echotype = new EchoType();

            echotype.Acquirer = acquirerType;
            return(await client.EchoAsync(echotype));
        }
        public void _00_EchoTest()
        {
            EchoType echoRequest = new EchoType();
            echoRequest.version = 1.0M;
            echoRequest.echoRequest = "ping";

            EchoResponseType echoRequestResponse = _serviceProxy.Echo(echoRequest);

            Assert.That(echoRequestResponse.echoResponse.Equals("ping"));
        }
    public static string ToPacket <T>(T data, EchoType type = EchoType.Self, string sendTo = "") where T : PacketModelBase
    {
        var json = JsonUtility.ToJson(data);

        return(JsonUtility.ToJson(new PacketProtocolModel()
        {
            PacketType = typeof(T).GetPacketType(),
            EchoType = type,
            Data = json,
            SendToId = sendTo
        }));
    }
        public void _00_EchoTest()
        {
            var echo = new EchoType()
            {
                version = 1.1M,
                echoRequest = "ping"
            };

            var echoResponse = _serviceProxy.Echo(echo);

            Assert.That(echoResponse.echoResponse == "ping");
        }
Exemple #5
0
        private static void Echo(object message, EchoType echoType)
        {
#if UNITY_EDITOR
            if (echoType == EchoType.Debug)
            {
                UnityEngine.Debug.Log(message);
            }
            else if (echoType == EchoType.Warning)
            {
                UnityEngine.Debug.LogWarning(message);
            }
            else if (echoType == EchoType.Error)
            {
                UnityEngine.Debug.LogError(message);
            }
            else if (echoType == EchoType.Exception)
            {
                UnityEngine.Debug.LogException(message is string
                                               ?new Exception(message.ToString())
                                                   : (Exception)message);
            }
            else if (echoType == EchoType.WTF)
            {
                UnityEngine.Debug.Log(message);
                UnityEngine.Debug.LogWarning(message);
                UnityEngine.Debug.LogError(message);
            }
#else
            if (echoType == EchoType.Debug)
            {
                System.Diagnostics.Debug.WriteLine("DEBUG: " + message);
            }
            else if (echoType == EchoType.Warning)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: " + message);
            }
            else if (echoType == EchoType.Error)
            {
                System.Diagnostics.Debug.WriteLine("ERROR: " + message);
            }
            else if (echoType == EchoType.Exception)
            {
                System.Diagnostics.Debug.WriteLine(message);
            }
            else if (echoType == EchoType.WTF)
            {
                System.Diagnostics.Debug.WriteLine(">>>WTF!!!<<<: " + message);
                System.Diagnostics.Debug.WriteLine(">>>WTF!!!<<<: " + message);
                System.Diagnostics.Debug.WriteLine(">>>WTF!!!<<<: " + message);
            }
#endif
        }
Exemple #6
0
        /// <summary>
        /// 输出控制台字符
        /// </summary>
        /// <param name="str"></param>
        /// <param name="i"></param>
        public static void Echo(string str, string title, EchoType echo)
        {
            string strall = str;

            str   = HttpUtility.UrlDecode(str);
            title = HttpUtility.UrlDecode(title);

            lock ("我锁") {
                switch (echo)
                {
                case EchoType.普通信息: {
                    str = StringHelper.SubString(str.Replace("\n", ""), 0, 80).Replace("【", "[").Replace("】", "]");
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write(DateTime.Now.ToString("MM-dd HH:mm:ss") + "|");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Write("【" + str + "】" + Environment.NewLine);
                    LogHelper.CreateLog("普通信息", title + " " + strall, EchoType.普通信息);
                    break;
                }

                case EchoType.任务信息: {
                    str = StringHelper.SubString(str.Replace("\n", ""), 0, 80).Replace("【", "[").Replace("】", "]");
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.Write(DateTime.Now.ToString("MM-dd HH:mm:ss") + "|");
                    Console.Write(string.Format("【{0}】:{1}", title, str + Environment.NewLine));
                    LogHelper.CreateLog("任务信息", title + " " + strall, EchoType.任务信息);
                    break;
                }

                case EchoType.错误信息: {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write(DateTime.Now.ToString("MM-dd HH:mm:ss") + "|");
                    Console.Write(string.Format("【{0}】:{1}", title, str + Environment.NewLine));
                    LogHelper.CreateLog("错误信息", title + " " + strall, EchoType.错误信息);
                    break;
                }

                case EchoType.异常信息: {
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.Write(DateTime.Now.ToString("MM-dd HH:mm:ss") + "|");
                    Console.Write(string.Format("【{0}】:{1}", title, str + Environment.NewLine));
                    LogHelper.CreateLog("异常信息", title + " " + strall, EchoType.异常信息);
                    break;
                }
                }
            }
        }
Exemple #7
0
        static void Main(string[] args)
        {
            try
            {
                InitializeComponents();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException?.Message ?? ex.Message);
                return;
            }

            if (args.Length != 0)
            {
                CommandsBuilder.RunCommands(args);
                return;
            }

            var runningType = SolutionConfiguration.RunningType;

            Console.WriteLine($"Try to running {runningType}");

            IRunningType command;

            switch (runningType)
            {
                case "Webhook":
                    command = new WebhookType();
                    break;
                case "Echo":
                    command = new EchoType();
                    break;
                default:
                    throw new Exception($"Invalid type {runningType}");
            }

            command.Run();
        }
Exemple #8
0
 public EchoClass(EchoType t = EchoType.String, object p = null)
 {
     type  = t;
     param = p;
 }
 /// <summary>
 /// Used to check the availability of the Earthport system, and to provide a simple service
 /// for help with integration.
 /// 
 /// This service simple responds with the exact same data as sent in the request.
 /// </summary>
 /// <param name="echoData">An Echo request</param>
 /// <returns>A response of type EchoResponseType</returns>
 public EchoResponseType Echo(EchoType echoData)
 {
     return (EchoResponseType)InvokeService(
         echoData,
         typeof(EchoResponseType)
         );
 }