Example #1
0
 public void AddConvertor(IPlatformTypesConvertor convertor)
 {
     lock (_lockObj)
     {
         if (_context.IsInitialized)
         {
             _context.AddConvertor(convertor);
         }
         else
         {
             _deferredPlatformTypesConvertor = convertor;
         }
     }
 }
        /// <inheritdoc/>
        public void AddConvertor(IPlatformTypesConvertor convertor)
        {
            lock (_lockObj)
            {
#if DEBUG
                //Log($"convertor = {convertor}");
#endif

                Dictionary <Type, IPlatformTypesConvertor> targetDict = null;

                if (convertor.CanConvertToCoreType)
                {
                    if (_convertorsDict.ContainsKey(convertor.PlatformType))
                    {
                        targetDict = _convertorsDict[convertor.PlatformType];
                    }
                    else
                    {
                        targetDict = new Dictionary <Type, IPlatformTypesConvertor>();
                        _convertorsDict[convertor.PlatformType] = targetDict;
                    }

                    targetDict[convertor.CoreType] = convertor;
                }

                if (convertor.CanConvertToPlatformType)
                {
                    if (_convertorsDict.ContainsKey(convertor.CoreType))
                    {
                        targetDict = _convertorsDict[convertor.CoreType];
                    }
                    else
                    {
                        targetDict = new Dictionary <Type, IPlatformTypesConvertor>();
                        _convertorsDict[convertor.CoreType] = targetDict;
                    }

                    targetDict[convertor.PlatformType] = convertor;
                }
            }
        }
Example #3
0
 public void AddConvertor(IPlatformTypesConvertor convertor)
 {
     PlatformTypesConvertorsRegistry.AddConvertor(convertor);
 }