示例#1
0
        private static string GenerateName(MinMessage message)
        {
            var sb = new StringBuilder();

            var from = message.Payload.Headers.FirstOrDefault(t => t.Name.Equals("From", StringComparison.CurrentCultureIgnoreCase));

            if (from != null)
            {
                var m = _mailHeaderFromRegex.Match(from.Value);
                if (!m.Success)
                {
                    sb.Append("_" + from.Value.Trim(20));
                }
                else
                {
                    sb.Append("_" + (string.IsNullOrWhiteSpace(m.Groups[1].Value) ? m.Groups[2].Value : m.Groups[1].Value).Trim(20));
                }
            }

            var subj = message.Payload.Headers.FirstOrDefault(t => t.Name.Equals("Subject", StringComparison.CurrentCultureIgnoreCase));

            if (subj != null)
            {
                sb.Append("_" + subj.Value.Trim(20));
            }

            return(_fileNameRegex.Replace(sb.ToString(), ""));
        }
示例#2
0
        // Update is called once per frame
        void Update()
        {
            if (messages == null)
            {
                messages = new System.Collections.Generic.List <MinMessage>();
            }
            for (int i = 0; i < VRDebug.logs.Count; i++)
            {
                if (VRDebug.logs[i].id > lastRecordedMessage)
                {
                    MinMessage newMessage = new MinMessage();
                    newMessage.message    = VRDebug.logs[i].message;
                    newMessage.deleteTime = Time.time + retentionTime;
                    messages.Add(newMessage);

                    lastRecordedMessage = VRDebug.logs[i].id;
                }
            }


            string correctString = "";

            for (int i = 0; i < messages.Count; i++)
            {
                float timeRemaining = messages[i].deleteTime - Time.time;
                if (timeRemaining <= 1f)
                {
                    correctString = "<color=" + getHexCol((int)Mathf.Lerp(222f, 0f, timeRemaining)) + ">" + messages[i].message + "</color>\n\n" + correctString;
                }
                else
                {
                    correctString = messages[i].message + "\n\n" + correctString;
                }
            }

            mainText.text = correctString;

            for (int i = 0; i < messages.Count; i++)
            {
                if (messages[i].deleteTime < Time.time)
                {
                    messages.RemoveAt(i);
                }
            }
        }