/// <summary> /// Sprawdza jakie klasy są w sparsowanych źródłach a następnie wypełnia wstępną informację /// <see cref="ClassTranslations">ClassTranslations</see> dla tych klas /// </summary> /// <param name="knownTypes"></param> public void FillClassTranslations(IEnumerable <Type> knownTypes) { ClassTranslations.Clear(); foreach (var type in knownTypes.Where(i => !i.IsEnum)) { GetOrMakeTranslationInfo(type); // it is created and stored in classTranslations } }
public ClassTranslationInfo GetOrMakeTranslationInfo(Type type) { if ((object)type == null) { throw new ArgumentNullException(nameof(type)); } if (ClassTranslations.TryGetValue(type, out var cti)) { return(cti); } cti = ClassTranslations[type] = new ClassTranslationInfo(type, this); if (OnTranslationInfoCreated != null) { OnTranslationInfoCreated(this, new TranslationInfoCreatedEventArgs { ClassTranslation = cti }); } return(cti); }
public ClassTranslationInfo GetTi(Type type, bool doCheckAccesibility) { if ((object)type == null) { return(null); } if (doCheckAccesibility) { CheckAccesibility(type); } if (type.IsGenericType) { type = type.GetGenericTypeDefinition(); } if (ClassTranslations.TryGetValue(type, out var result)) { return(result); } result = GetOrMakeTranslationInfo(type); return(result); // throw new Exception("Unable to find translation info for type " + type); }
public ClassTranslationInfo FindClassTranslationInfo(Type t) { ClassTranslationInfo info; return(ClassTranslations.TryGetValue(t, out info) ? info : null); }