예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckInputParameters();

            var ctrlMessageList = (ListActivityMessageView)LoadControl("ListActivityMessageView.ascx");

            ctrlMessageList.MessageList = GetUserActivity();
            LoadedMessageCount          = ctrlMessageList.MessageList.Count;

            CommonContainerHolder.Controls.Add(ctrlMessageList);

            _ctrlMessageCount.SelectedValue = MessageCount.ToString();

            if (ThrownExceptions.Count > 0 && _socialNetworks.Count == 1)
            {
                _ctrlErrorDescription.InnerText = GetErrorDescription(_thrownExceptions[0]);
                _ctrlErrorDescriptionContainer.Style.Add(HtmlTextWriterStyle.Display, "block");
                _ctrlMessageNumberContainer.Visible = false;
            }

            /*if (ThrownExceptions.Count > 0 && _socialNetworks.Count > 1)
             * {
             *  _ctrlErrorDescription.InnerText = GetErrorDescription(_thrownExceptions[0]);
             *  _ctrlErrorDescriptionContainer.Style.Add(HtmlTextWriterStyle.Display, "block");
             * }*/
        }
예제 #2
0
 public void Print()
 {
     Console.WriteLine("{0} ({1}): {2} Connected, {3} Received, {4},  Avg latency {5} ms",
                       TestPhase,
                       Elapsed.ToString(),
                       ClientsConnected.ToString(),
                       MessageCount.ToString(),
                       BytesAsString(),
                       AvgRoundLatencyMs);
 }
        private void SetMessageCount()
        {
            int messageCountFromCookie;

            if (HttpContext.Current.Request.Cookies[MessageCountCookieName] != null && Int32.TryParse(HttpContext.Current.Request.Cookies[MessageCountCookieName].Value, out messageCountFromCookie))
            {
                MessageCount = messageCountFromCookie;
            }

            _ctrlMessageCount.SelectedValue = MessageCount.ToString();
        }
예제 #4
0
    //	public void OnSubmitText ()
    //	{
    //		if (string.IsNullOrEmpty (Inputfield.text)) {
    //			SendMessageButton.interactable = false;
    //		} else {
    //			SendMessageButton.interactable = true;
    //		}
    //	}

    public void GenerateMessageInCoOp(string message, string sender)
    {
        GameObject obj = null;

        if (sender == PlayerManager.Instance.playerInfo.Username)
        {
            obj = (GameObject)Instantiate(players_message);
        }
        else
        {
            obj = (GameObject)Instantiate(other_message);
        }

        obj.transform.SetParent(message_panelForCoOp, false);
        obj.transform.localScale = Vector3.one;

        // get messages from others and apply here....
        obj.transform.FindChild("Message").GetComponent <Text> ().text = message;
        //		obj.transform.FindChild ("Image").GetComponent<Image> ().sprite = PlayerImages [UnityEngine.Random.Range (0, PlayerImages.Length)];
        obj.transform.FindChild("UserName").GetComponent <Text> ().text  = sender;
        obj.transform.FindChild("Time Text").GetComponent <Text> ().text = DateTime.Now.ToString("hh:mm tt");

        Invoke("scrollValueinCoOp", 0.1f);

        if (!ScreenAndPopupCall.Instance.ChatInCoopIsShown)
        {
            CoOpEventController.Instance.ChatBagdeCountText.gameObject.SetActive(true);
            MessageCount++;
        }
        else
        {
            MessageCount = 0;
            CoOpEventController.Instance.ChatBagdeCountText.gameObject.SetActive(false);
        }
        CoOpEventController.Instance.ChatBagdeCountText.text = MessageCount.ToString();
    }
        private void OnTimingFrame(MessageFrame frame)
        {
            var data = Encoding.ASCII.GetString(frame.PayloadBuffer.Array, frame.PayloadBuffer.Offset,
                                                frame.PayloadBuffer.Count);

            var parts = data.Split(';');

            if (data == "completed")
            {
                var clockSyncAndNetworkDelay = TimeSpan.FromMilliseconds(_timings.Average());
                var elapsedTime = DateTime.UtcNow.Subtract(Started).Subtract(clockSyncAndNetworkDelay);
                var mbits       = (MessageCount * MessageSize * 8L / elapsedTime.TotalSeconds) / 1000000;
                Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " completed.");
                Console.WriteLine("Duration:      {0} ms", elapsedTime.TotalMilliseconds);
                Console.WriteLine("Message Size:  {0} bytes", MessageSize.ToString("N0"));
                Console.WriteLine("Message Count: {0}", MessageCount.ToString("N0"));
                Console.WriteLine("Total size:    {0} bytes", (MessageSize * MessageCount).ToString("N0"));
                Console.WriteLine("Msgs/sec:      {0}", (MessageCount / elapsedTime.TotalSeconds).ToString("N0"));
                Console.WriteLine("Throughput:    {0} Mbit/s", mbits.ToString("N1"));

                if (!File.Exists("result.csv"))
                {
                    File.AppendAllText("result.csv", "sep=,\r\n");
                    File.AppendAllText("result.csv", @"""Message size (bytes)"",""Message count"",""Transfer size (bytes)"",""Msgs/Ack"",""Duration (ms)"",""Msgs/sec"",""Troughput (Mbit/s)""" + "\r\n");
                }

                File.AppendAllText(@"result.csv",
                                   string.Format("{0},{1},{2},{3},{4},{5},{6}\r\n",
                                                 MessageSize.ToString(CultureInfo.InvariantCulture),
                                                 MessageCount.ToString(CultureInfo.InvariantCulture),
                                                 (MessageSize * MessageCount).ToString(CultureInfo.InvariantCulture),
                                                 MessagesPerAck,
                                                 ((long)elapsedTime.TotalMilliseconds).ToString(CultureInfo.InvariantCulture),
                                                 ((long)(MessageCount / elapsedTime.TotalSeconds)).ToString(CultureInfo.InvariantCulture),
                                                 mbits.ToString(CultureInfo.InvariantCulture)));
                _completedEvent.Set();

                return;
            }

            var timing = int.Parse(parts[0]);

            _timings.Add(timing);
            var date       = DateTime.Parse(parts[1], CultureInfo.InvariantCulture);
            var difference = DateTime.UtcNow.Subtract(date).TotalMilliseconds;

            _timings.Add((int)difference);

            if (_timings.Count == 10)
            {
                var buffer = Encoding.ASCII.GetBytes(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.ffff") + ";end");
                _client.Send(new MessageFrame(buffer));
            }
            else if (_timings.Count == 12)
            {
                Started = DateTime.UtcNow;
                Benchmark(_client);
            }
            else
            {
                var buffer = Encoding.ASCII.GetBytes(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.ffff"));
                _client.Send(new MessageFrame(buffer));
            }
        }