Beispiel #1
0
        // same as ToString, just full primary key and type code
        private string ToStringImpl(bool detailed)
        {
            // TODO Get name of system/target grain + name of the grain type

            var keyString = Key.ToString();
            // this should grab the least-significant half of n1, suffixing it with the key extension.
            string idString = keyString;

            if (!detailed)
            {
                if (keyString.Length >= 48)
                {
                    idString = keyString.Substring(24, 8) + keyString.Substring(48);
                }
                else
                {
                    idString = keyString.Substring(24, 8);
                }
            }

            string fullString = null;

            switch (Category)
            {
            case UniqueKey.Category.Grain:
            case UniqueKey.Category.KeyExtGrain:
                var typeString = TypeCode.ToString("X");
                if (!detailed)
                {
                    typeString = typeString.Substring(Math.Max(0, typeString.Length - 8));
                }
                fullString = $"*grn/{typeString}/{idString}";
                break;

            case UniqueKey.Category.Client:
                fullString = $"*cli/{idString}";
                break;

            case UniqueKey.Category.SystemTarget:
            case UniqueKey.Category.KeyExtSystemTarget:
                fullString = $"*stg/{Key.N1}/{idString}";
                break;

            case UniqueKey.Category.SystemGrain:
                fullString = $"*sgn/{Key.PrimaryKeyToGuid()}/{idString}";
                break;

            default:
                fullString = "???/" + idString;
                break;
            }
            return(detailed ? String.Format("{0}-0x{1, 8:X8}", fullString, GetUniformHashCode()) : fullString);
        }
Beispiel #2
0
 public override string ToString()
 {
     return(Key.ToString());
 }
        public override string ToString()
        {
            string idString = Key.ToString().Substring(24, 8);

            return(String.Format("@{0}{1}", IsSystem ? "S" : "", idString));
        }