// Token: 0x0600037B RID: 891 RVA: 0x0001309C File Offset: 0x0001129C
        internal int GetKey(Type type, bool demand, bool getBaseKey)
        {
            int result;

            try
            {
                int num = this.FindOrAddAuto(type, demand, true, false);
                if (num >= 0)
                {
                    MetaType metaType = (MetaType)this.types[num];
                    if (getBaseKey)
                    {
                        metaType = MetaType.GetRootType(metaType);
                        num      = this.FindOrAddAuto(metaType.Type, true, true, false);
                    }
                }
                result = num;
            }
            catch (NotSupportedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf(type.FullName) >= 0)
                {
                    throw;
                }
                throw new ProtoException(ex.Message + " (" + type.FullName + ")", ex);
            }
            return(result);
        }
Ejemplo n.º 2
0
 internal int GetKey(Type type, bool demand, bool getBaseKey)
 {
     Helpers.DebugAssert(type != null);
     try
     {
         int typeIndex = FindOrAddAuto(type, demand, true, false);
         if (typeIndex >= 0)
         {
             MetaType mt = (MetaType)types[typeIndex];
             if (getBaseKey)
             {
                 mt        = MetaType.GetRootType(mt);
                 typeIndex = FindOrAddAuto(mt.Type, true, true, false);
             }
         }
         return(typeIndex);
     }
     catch (NotSupportedException)
     {
         throw; // re-surface "as-is"
     }
     catch (Exception ex)
     {
         if (ex.Message.IndexOf(type.FullName) >= 0)
         {
             throw;                                          // already enough info
         }
         throw new ProtoException(ex.Message + " (" + type.FullName + ")", ex);
     }
 }