示例#1
0
 private static bool SearchForFields(Key fieldKey)
 {
     if (_fieldCache.ContainsKey(fieldKey))
     {
         return(true);
     }
     else
     {
         FieldInfo[] fieldInfos = fieldKey.Type.GetFields(BindFlagAll);
         System.Text.StringBuilder printArray = new System.Text.StringBuilder();
         foreach (FieldInfo fi in fieldInfos)
         {
             if (fi.Name == fieldKey.Name)
             {
                 _fieldCache.Add(fieldKey, fi);
                 return(true);
             }
             printArray.Add($"Field Name/ Type: {fi.Name}/ {fi.FieldType}");
         }
         Logger.LogError($"Field Not Found : {fieldKey.Name} on {fieldKey.Type.FullName}");
         Logger.LogDebug($"Get {fieldInfos.Length} Fields.");
         Logger.LogDebug(printArray.ToString());
         return(false);
     }
 }