コード例 #1
0
ファイル: TranslationInfo.cs プロジェクト: isukces/cs2python
 /// <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
     }
 }
コード例 #2
0
ファイル: TranslationInfo.cs プロジェクト: isukces/cs2python
 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);
 }
コード例 #3
0
ファイル: TranslationInfo.cs プロジェクト: isukces/cs2python
 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);
 }
コード例 #4
0
ファイル: TranslationInfo.cs プロジェクト: isukces/cs2python
        public ClassTranslationInfo FindClassTranslationInfo(Type t)
        {
            ClassTranslationInfo info;

            return(ClassTranslations.TryGetValue(t, out info) ? info : null);
        }