Exemplo n.º 1
0
            public GridRow(ConnectorInfo info, IMessageAdapter adapter /*, IMessageAdapter innerAdapter*/)
            {
                if (info == null)
                {
                    throw new ArgumentNullException(nameof(info));
                }

                if (adapter == null)
                {
                    throw new ArgumentNullException(nameof(adapter));
                }

                //if (innerAdapter == null)
                //	throw new ArgumentNullException("innerAdapter");

                Info    = info;
                Adapter = adapter;
                //InnerAdapter = innerAdapter;
                SupportedMessages = adapter.GetType().CreateInstance <IMessageAdapter>(adapter.TransactionIdGenerator).SupportedMessages.Select(m => new SupportedMessage(adapter, m)).ToArray();
                SupportedMessages.ForEach(m => m.SelectedChanged += () =>
                {
                    NotifyChanged("IsTransactionEnabled");
                    NotifyChanged("IsMarketDataEnabled");
                });
                Icon = adapter.GetType().GetIconUrl();
            }
Exemplo n.º 2
0
        BEncodedDictionary Create()
        {
            var mainDict     = new BEncodedDictionary();
            var supportsDict = new BEncodedDictionary();

            mainDict.Add(MaxRequestKey, (BEncodedNumber)MaxRequests);
            mainDict.Add(VersionKey, (BEncodedString)Version);
            mainDict.Add(PortKey, (BEncodedNumber)LocalPort);

            SupportedMessages.ForEach(delegate(ExtensionSupport s) { supportsDict.Add(s.Name, (BEncodedNumber)s.MessageId); });
            mainDict.Add(SupportsKey, supportsDict);

            if (MetadataSize.HasValue)
            {
                mainDict.Add(MetadataSizeKey, (BEncodedNumber)MetadataSize);
            }

            return(mainDict);
        }
Exemplo n.º 3
0
        private BEncodedDictionary Create()
        {
            if (!ClientEngine.SupportsExtended)
            {
                throw new MessageException("Libtorrent extension messages not supported");
            }

            BEncodedDictionary mainDict     = new BEncodedDictionary();
            BEncodedDictionary supportsDict = new BEncodedDictionary();

            mainDict.Add(MaxRequestKey, (BEncodedNumber)maxRequests);
            mainDict.Add(VersionKey, (BEncodedString)Version);
            mainDict.Add(PortKey, (BEncodedNumber)LocalPort);

            SupportedMessages.ForEach(delegate(ExtensionSupport s) { supportsDict.Add(s.Name, (BEncodedNumber)s.MessageId); });
            mainDict.Add(SupportsKey, supportsDict);

            mainDict.Add(MetadataSizeKey, (BEncodedNumber)metadataSize);

            return(mainDict);
        }