Beispiel #1
0
        public void SetDisplayName()
        {
            if (string.IsNullOrEmpty(RemarkName) == true)
            {
                if (string.IsNullOrEmpty(NickName) == true)
                {
                    if (string.IsNullOrEmpty(DisplayName) == true)
                    {
                        DisplayName = UserName;
                    }
                }
                else
                {
                    DisplayName = NickName;
                }
            }
            else
            {
                DisplayName = RemarkName;
            }

            var startPos = DisplayName.IndexOf("<span", StringComparison.Ordinal);

            while (startPos > -1)
            {
                var    endPos = DisplayName.IndexOf("</span>", StringComparison.Ordinal);
                string emjio  = DisplayName.Substring(startPos, endPos - startPos + 7);
                DisplayName = DisplayName.Replace(emjio, "[]");
                startPos    = DisplayName.IndexOf("<span", StringComparison.Ordinal);
            }
        }
Beispiel #2
0
 public int CollectionIndex()
 {
     if (IsCollection())
     {
         return(int.Parse(DisplayName.Substring(5, DisplayName.Length - 6)));
     }
     return(-1);
 }
        public string GetDisplayNameFormated()
        {
            if (DisplayName.Length > 9)
            {
                return($"{DisplayName.Substring(0, 9)}...");
            }

            return(DisplayName);
        }
Beispiel #4
0
        /// <summary>
        /// Construct a constraint with optional arguments
        /// </summary>
        /// <param name="args">Arguments to be saved</param>
        protected Constraint(params object[] args)
        {
            Arguments = args;

            DisplayName = this.GetType().Name;
            if (DisplayName.EndsWith("`1") || DisplayName.EndsWith("`2"))
            {
                DisplayName = DisplayName.Substring(0, DisplayName.Length - 2);
            }
            if (DisplayName.EndsWith("Constraint"))
            {
                DisplayName = DisplayName.Substring(0, DisplayName.Length - 10);
            }
        }
Beispiel #5
0
            public InternalEntry(int body, int itemID, string name)
            {
                Body   = body;
                ItemID = itemID;
                Name   = name;

                DisplayName = name.ToLower();

                for (var i = 0; i < m_GroupNames.Length; ++i)
                {
                    if (DisplayName.StartsWithOrdinal(m_GroupNames[i]))
                    {
                        DisplayName = DisplayName.Substring(m_GroupNames[i].Length);
                        break;
                    }
                }

                DisplayName = DisplayName.Replace('_', ' ');
            }
Beispiel #6
0
        public void BuildName(ECMAStore store)
        {
            DisplayName = ItemType == ItemType.Constructor ? Parent.Name : Name;
            if (DisplayName.StartsWith("op_"))
            {
                DisplayName = DisplayName.Substring("op_".Length);
            }
            var displayNameWithoutEII = DisplayName;

            if (IsEII)
            {
                var typeStr   = DisplayName.Substring(0, DisplayName.LastIndexOf('.'));
                var memberStr = DisplayName.Substring(DisplayName.LastIndexOf('.') + 1);
                DisplayName = typeStr.ToDisplayName() + '.' + memberStr;
            }

            string paramPart = null;

            if (Parameters?.Count > 0)
            {
                if (Name == "op_Explicit" || Name == "op_Implicit")
                {
                    var rtype = ReturnValueType.VersionedTypes.First().Value.ToDisplayName();

                    paramPart = string.Format("({0} to {1})", Parameters.First().Type.ToDisplayName(), rtype);
                }
                else if (IsIndexer)
                {
                    paramPart = string.Format("[{0}]", string.Join(", ", Parameters.Select(p => p.Type.ToDisplayName())));
                }
                else
                {
                    paramPart = string.Format("({0})", string.Join(", ", Parameters.Select(p => p.Type.ToDisplayName())));
                }
            }
            else if (ItemType == ItemType.Method || ItemType == ItemType.Constructor)
            {
                paramPart = "()";
            }
            DisplayName    += paramPart;
            FullDisplayName = ((Type)Parent).FullName + "." + displayNameWithoutEII + paramPart;
        }
Beispiel #7
0
        }                                     // Added with LE v1.7 API


        public string GetValidFullName()
        {
            if (!string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName))
            {
                return($"{FirstName} {LastName}");
            }

            // NOTE we expect "FirstName LastName" formar
            // But customer has "LastName, FirstName"
            int index = DisplayName.IndexOf(", ");

            if (index >= 0)
            {
                string lastName  = DisplayName.Substring(0, index);
                string firstName = DisplayName.Substring(index + 2);
                return($"{firstName} {lastName}");
            }

            return(DisplayName);
        }
Beispiel #8
0
        private void Parse(string rawAddress)
        {
            if (rawAddress == null)
            {
                throw new ArgumentNullException("rawAddress");
            }

            rawAddress = rawAddress.Trim();

            var extendedPartIndex = rawAddress.IndexOf("|", StringComparison.InvariantCultureIgnoreCase);

            if (extendedPartIndex > -1)
            {
                var extendedPart = rawAddress.Substring(extendedPartIndex);
                var parts        = extendedPart.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length > 0)
                {
                    AvatarUrl = parts[0];
                }

                if (parts.Length > 1)
                {
                    ChannelName = parts[1];
                }

                // Remove extended part from rawAddress and continue parsing
                rawAddress = rawAddress.Substring(0, extendedPartIndex);
            }

            if (rawAddress.Contains("<") && rawAddress.Contains(">"))
            {
                string[] parts = rawAddress.Split(new[] { '<', '>' }, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length == 1)
                {
                    this.Address     = parts[0];
                    this.DisplayName = parts[0];

                    // See if the displayname is quoted, if so, remove the quotes
                    if (DisplayName.StartsWith("\"") && DisplayName.EndsWith("\""))
                    {
                        DisplayName = DisplayName.Substring(1, DisplayName.Length - 2);
                    }
                }
                if (parts.Length == 2)
                {
                    this.DisplayName = parts[0].Trim();
                    this.Address     = parts[1].Trim();

                    // Can happen when you receive addresses like " <*****@*****.**>" (space in the beginning)
                    if (String.IsNullOrEmpty(this.DisplayName))
                    {
                        this.DisplayName = this.Address;
                    }

                    // See if the displayname is quoted, if so, remove the quotes
                    if (DisplayName.StartsWith("\"") && DisplayName.EndsWith("\""))
                    {
                        DisplayName = DisplayName.Substring(1, DisplayName.Length - 2);
                    }

                    return;
                }
            }
            else
            {
                this.DisplayName = rawAddress;
                this.Address     = rawAddress;
            }

            if (String.IsNullOrEmpty(Address))
            {
                this.Address = rawAddress;
            }
        }