示例#1
0
        protected virtual int ResolvePid(Type type)
        {
            if (!PidCache.TryGetValue(type, out int pid))
            {
                pid = AddToPidCache(type);
            }

            return(pid);
        }
示例#2
0
        protected virtual byte ResolvePid <T>()
            where T : class, IOBDData, new()
        {
            if (!PidCache.TryGetValue(typeof(T), out byte pid))
            {
                pid = AddToPidCache <T>();
            }

            return(pid);
        }
示例#3
0
        protected virtual byte ResolvePid <T>()
            where T : class, IOBDData, new()
        {
            byte pid;

            if (!PidCache.TryGetValue(typeof(T), out pid))
            {
                T data = Activator.CreateInstance <T>();
                pid = data.PID;
                PidCache.Add(typeof(T), pid);
                DataTypeCache.Add(pid, typeof(T));
            }

            return(pid);
        }