예제 #1
0
 public static string DisplayValue(DisplayKey key)
 {
     if (displayNames == null)
     {
         displayNames = new Dictionary <DisplayKey, string>();
         foreach (var keyvalue in (DisplayKey[])System.Enum.GetValues(typeof(DisplayKey)))
         {
             displayNames.Add(keyvalue, "");
         }
         var ta    = Resources.Load <TextAsset>("DisplayNames");
         var lines = ta.text.Split('\n');
         foreach (var line in lines)
         {
             if (line.Length == 0)
             {
                 continue;
             }
             if (line.StartsWith("//"))
             {
                 continue;
             }
             string replacement = System.Text.RegularExpressions.Regex.Replace(line, @"\t|\n|\r", "");
             var    split       = replacement.Split('|');
             foreach (var keyvalue in (DisplayKey[])System.Enum.GetValues(typeof(DisplayKey)))
             {
                 if (keyvalue.ToString().ToUpper() == split[0].ToUpper())
                 {
                     displayNames[keyvalue] = split[1];
                     break;
                 }
             }
         }
     }
     return(displayNames[key]);
 }
예제 #2
0
        public override int GetHashCode()
        {
            var hashCode = -2141251448;

            hashCode = hashCode * -1521134295 + DisplayID.GetHashCode();
            hashCode = hashCode * -1521134295 + DisplayKey.GetHashCode();
            hashCode = hashCode * -1521134295 + DisplayCreator.GetHashCode();

            return(hashCode);
        }
예제 #3
0
 public string this[DisplayKey key]
 {
     get {
         string code = key.ToCode();
         if ( code.HasValue() ) {
             return SelectNodeKeyText( code, LdmlAttribute.Type, "localeDisplayNames", "keys" );
         }
         return null;
     }
 }
예제 #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Code != 0)
            {
                hash ^= Code.GetHashCode();
            }
            if (DisplayKey.Length != 0)
            {
                hash ^= DisplayKey.GetHashCode();
            }
            if (OrderNo != 0)
            {
                hash ^= OrderNo.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #5
0
 public static string ToCode(this DisplayKey key)
 {
     return(_displayKeyMap[(int)key]);
 }