예제 #1
0
        /**
         * Returns the display name for a property or link.
         */

        public string GetPropDisplayName(int propId)
        {
            bool reverse      = false;
            bool directedLink = false;

            PropTypeItem ptItem = (PropTypeItem)this [propId];

            if (ptItem.DataType == PropDataType.Link && ptItem.HasFlag(PropTypeFlags.DirectedLink))
            {
                directedLink = true;
                if (propId < 0)
                {
                    propId  = -propId;
                    reverse = true;
                }
            }

            string result;

            if (reverse)
            {
                result = ptItem.ReverseDisplayName;
                if (result == null)
                {
                    result = ptItem.Name + " Target";
                }
            }
            else
            {
                result = ptItem.DisplayName;
                if (result == null)
                {
                    if (directedLink)
                    {
                        result = ptItem.Name + " Source";
                    }
                    else
                    {
                        result = ptItem.Name;
                    }
                }
            }
            return(result);
        }
예제 #2
0
        public IPropType this [int propID]
        {
            get
            {
                if (propID < 0)
                {
                    PropTypeItem revItem = FindPropTypeItem(-propID);
                    if (revItem.HasFlag(PropTypeFlags.DirectedLink))
                    {
                        return(revItem);
                    }
                    throw new StorageException("Invalid property type ID " + propID);
                }
                if (propID >= ResourceProps.Id)
                {
                    return(_pseudoProps [propID - ResourceProps.Id]);
                }

                return(FindPropTypeItem(propID));
            }
        }