コード例 #1
0
ファイル: OneDasProject.cs プロジェクト: tomyqg/OneDAS-Core
        private ChannelHubBase CreateChannelHub(ChannelHubSettings channelHubSettings)
        {
            Type type;

            type = typeof(ChannelHub <>).MakeGenericType(new Type[] { OneDasUtilities.GetTypeFromOneDasDataType(channelHubSettings.DataType) });

            return((ChannelHubBase)Activator.CreateInstance(type, channelHubSettings));
        }
コード例 #2
0
        public DataGatewaySampleGateway(DataGatewaySampleSettings settings) : base(settings)
        {
            Random random;

            random    = new Random();
            _settings = settings;

            _numberGeneratorSet = this.DataPortSet.Where(dataPort => dataPort.DataDirection == DataDirection.Input).ToList().Select(dataPort =>
            {
                Type type;

                type = typeof(DataGatewaySampleNumberGenerator <>).MakeGenericType(OneDasUtilities.GetTypeFromOneDasDataType(dataPort.DataType));

                return((DataGatewaySampleNumberGeneratorBase)Activator.CreateInstance(type, dataPort, random));
            }).ToList();
        }