Ejemplo n.º 1
0
        private static void AddDummyTestItem()
        {
            DataExchangeLogItem item = new DataExchangeLogItem
            {
                ID        = 0,
                Time      = DateTime.Now,
                IP        = "127.0.0.1",
                Type      = "PUSH",
                Parameter = "123"
            };

            list.Add(item);
        }
Ejemplo n.º 2
0
        private void AddToList(DataExchangeLogItem item)
        {
            lock (list)
            {
                item.ID = Id;
                IDSelfIncrease();
                list.Add(item);

                if (list.Count > 100)
                {
                    list.RemoveAt(0);
                }
            }
        }
Ejemplo n.º 3
0
        internal void LogRequest(HttpListenerRequest httpRequest)
        {
            DataExchangeLogItem item = new DataExchangeLogItem
            {
                Time      = DateTime.Now,
                IP        = httpRequest.RemoteEndPoint.ToString(),
                Type      = "REQUEST",
                Parameter = httpRequest.RawUrl.SubStringAfter("?", 1)
            };

            AddToList(item);

            webSocket.PushMessageAllClinet("NEW_REQUEST");
        }
Ejemplo n.º 4
0
        public void LogRequest(IPAddress ip, Dictionary <string, string> dictionary, string RequestType = "REQUEST")
        {
            var txtparam             = string.Join("&", dictionary.Select(x => x.Key + "=" + x.Value));
            DataExchangeLogItem item = new DataExchangeLogItem
            {
                Time      = DateTime.Now,
                IP        = ip.ToString(),
                Type      = RequestType,
                Parameter = txtparam
            };

            AddToList(item);

            webSocket.PushMessageAllClinet("NEW_REQUEST");
        }
Ejemplo n.º 5
0
        public void LogPush(IPAddress ip, string requestBody, string filePath)
        {
            var length = (requestBody == null) ? 0 : requestBody.Length;

            DataExchangeLogItem item = new DataExchangeLogItem
            {
                Time      = DateTime.Now,
                IP        = ip.ToString(),
                Type      = "PUSH",
                Parameter = length + " bytes received ==> " + filePath
            };

            AddToList(item);

            webSocket.PushMessageAllClinet("NEW_PUSH");
        }