Beispiel #1
0
 run(String[] args)
 {
     Ice.Properties properties = communicator().getProperties();
     test(properties.getProperty("Ice.Trace.Network").Equals("1"));
     test(properties.getProperty("Ice.Trace.Protocol").Equals("1"));
     test(properties.getProperty("Config.Path").Equals("./config/中国_client.config"));
     test(properties.getProperty("Ice.ProgramName").Equals("PropertiesClient"));
     test(appName().Equals(properties.getProperty("Ice.ProgramName")));
     return(0);
 }
Beispiel #2
0
    public static int Main(string[] args)
    {
        int status = 0;

        try
        {
            Console.Out.Write("testing load properties from UTF-8 path... ");
            Console.Out.Flush();
            Ice.Properties properties = Ice.Util.createProperties();
            properties.load("./config/中国_client.config");
            test(properties.getProperty("Ice.Trace.Network").Equals("1"));
            test(properties.getProperty("Ice.Trace.Protocol").Equals("1"));
            test(properties.getProperty("Config.Path").Equals("./config/中国_client.config"));
            test(properties.getProperty("Ice.ProgramName").Equals("PropertiesClient"));
            Console.Out.WriteLine("ok");
            Console.Out.Write("testing load properties from UTF-8 path using Ice::Application... ");
            Console.Out.Flush();
            PropertiesClient c = new PropertiesClient();
            c.main(args, "./config/中国_client.config");
            Console.Out.WriteLine("ok");
        }
        catch (System.Exception ex)
        {
            System.Console.Error.WriteLine(ex);
            status = 1;
        }

        //
        // Try to load multiple config files.
        //
        try
        {
            Console.Out.Write("testing using Ice.Config with multiple config files... ");
            Console.Out.Flush();
            string[]       args1      = new string[] { "--Ice.Config=config/config.1, config/config.2, config/config.3" };
            Ice.Properties properties = Ice.Util.createProperties(ref args1);
            test(properties.getProperty("Config1").Equals("Config1"));
            test(properties.getProperty("Config2").Equals("Config2"));
            test(properties.getProperty("Config3").Equals("Config3"));
            Console.Out.WriteLine("ok");
        }
        catch (System.Exception ex)
        {
            System.Console.Error.WriteLine(ex);
            status = 1;
        }
        return(status);
    }
Beispiel #3
0
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                System.Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            Ice.ObjectAdapter adapter    = communicator().createObjectAdapter("Hello");
            Ice.Properties    properties = communicator().getProperties();
            Ice.Identity      id         = communicator().stringToIdentity(properties.getProperty("Identity"));
            adapter.add(new HelloI(properties.getProperty("Ice.ProgramName")), id);
            adapter.activate();
            communicator().waitForShutdown();
            return(0);
        }
Beispiel #4
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.Properties properties = communicator.getProperties();

        int port = 12010;

        try
        {
            port += args.Length == 1 ? Int32.Parse(args[0]) : 0;
        }
        catch (FormatException)
        {
        }
        properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port);
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter");
        adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
        adapter.activate();

        if (port == 12010)
        {
            properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
            Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter");
            adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
            adapter2.activate();
        }

        string endpoint;

        if (properties.getProperty("Ice.IPv6").Equals("1"))
        {
            if (IceInternal.AssemblyUtil.osx_)
            {
                endpoint = "udp -h \"ff15::1:1\" -p 12020 --interface \"::1\"";
            }
            else
            {
                endpoint = "udp -h \"ff15::1:1\" -p 12020";
            }
        }
        else
        {
            endpoint = "udp -h 239.255.1.1 -p 12020";
        }
        properties.setProperty("McastTestAdapter.Endpoints", endpoint);
        Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter");
        mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
        mcastAdapter.activate();

        communicator.waitForShutdown();
        return(0);
    }
Beispiel #5
0
    public override int run(string[] args)
    {
        Ice.Properties properties = communicator().getProperties();

        int num = 0;

        try
        {
            num = args.Length == 1 ? Int32.Parse(args[0]) : 0;
        }
        catch (FormatException)
        {
        }
        properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp"));
        Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
        adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
        adapter.activate();

        if (num == 0)
        {
            properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp"));
            Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter");
            adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
            adapter2.activate();
        }

        StringBuilder endpoint = new StringBuilder();

        if (properties.getProperty("Ice.IPv6").Equals("1"))
        {
            endpoint.Append("udp -h \"ff15::1:1\" -p ");
        }
        else
        {
            endpoint.Append("udp -h 239.255.1.1 -p ");
        }
        endpoint.Append(getTestPort(properties, 10));
        properties.setProperty("McastTestAdapter.Endpoints", endpoint.ToString());
        Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
        mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
        mcastAdapter.activate();

        communicator().waitForShutdown();
        return(0);
    }
Beispiel #6
0
        public LookupI(LocatorRegistryI registry, LookupPrx lookup, Ice.Properties properties)
        {
            _registry          = registry;
            _lookup            = lookup;
            _timeout           = properties.getPropertyAsIntWithDefault("IceDiscovery.Timeout", 300);
            _retryCount        = properties.getPropertyAsIntWithDefault("IceDiscovery.RetryCount", 3);
            _latencyMultiplier = properties.getPropertyAsIntWithDefault("IceDiscovery.LatencyMultiplier", 1);
            _domainId          = properties.getProperty("IceDiscovery.DomainId");
            _timer             = lookup.Communicator.timer();

            //
            // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast
            // datagram on each endpoint.
            //
            var single = new Ice.Endpoint[1];

            foreach (var endpt in lookup.Endpoints)
            {
                single[0] = endpt;
                _lookups[lookup.Clone(endpoints: single)] = null;
            }
            Debug.Assert(_lookups.Count > 0);
        }
Beispiel #7
0
    public override void run(string[] args)
    {
        {
            Console.Out.Write("testing load properties from UTF-8 path... ");
            Console.Out.Flush();
            Ice.Properties properties = Ice.Util.createProperties();
            properties.load("./config/中国_client.config");
            test(properties.getProperty("Ice.Trace.Network").Equals("1"));
            test(properties.getProperty("Ice.Trace.Protocol").Equals("1"));
            test(properties.getProperty("Config.Path").Equals("./config/中国_client.config"));
            test(properties.getProperty("Ice.ProgramName").Equals("PropertiesClient"));
            Console.Out.WriteLine("ok");
            Console.Out.Write("testing load properties from UTF-8 path using Ice::Application... ");
            Console.Out.Flush();
            PropertiesClient c = new PropertiesClient();
            c.main(args, "./config/中国_client.config");
            Console.Out.WriteLine("ok");
        }

        //
        // Try to load multiple config files.
        //
        {
            Console.Out.Write("testing using Ice.Config with multiple config files... ");
            Console.Out.Flush();
            string[]       args1      = new string[] { "--Ice.Config=config/config.1, config/config.2, config/config.3" };
            Ice.Properties properties = Ice.Util.createProperties(ref args1);
            test(properties.getProperty("Config1").Equals("Config1"));
            test(properties.getProperty("Config2").Equals("Config2"));
            test(properties.getProperty("Config3").Equals("Config3"));
            Console.Out.WriteLine("ok");
        }

        {
            Console.Out.Write("testing configuration file escapes... ");
            Console.Out.Flush();
            string[]       args1      = new string[] { "--Ice.Config=config/escapes.cfg" };
            Ice.Properties properties = Ice.Util.createProperties(ref args1);

            string[] props = new string[] { "Foo\tBar", "3",
                                            "Foo\\tBar", "4",
                                            "Escape\\ Space", "2",
                                            "Prop1", "1",
                                            "Prop2", "2",
                                            "Prop3", "3",
                                            "My Prop1", "1",
                                            "My Prop2", "2",
                                            "My.Prop1", "a property",
                                            "My.Prop2", "a     property",
                                            "My.Prop3", "  a     property  ",
                                            "My.Prop4", "  a     property  ",
                                            "My.Prop5", "a \\ property",
                                            "foo=bar", "1",
                                            "foo#bar", "2",
                                            "foo bar", "3",
                                            "A", "1",
                                            "B", "2 3 4",
                                            "C", "5=#6",
                                            "AServer", "\\\\server\\dir",
                                            "BServer", "\\server\\dir",
                                            "" };

            for (int i = 0; props[i].Length > 0; i += 2)
            {
                test(properties.getProperty(props[i]).Equals(props[i + 1]));
            }
            Console.Out.WriteLine("ok");
        }
    }
Beispiel #8
0
        //
        // Only for use by ObjectAdapterFactory
        //
        public ObjectAdapterI(Instance instance, Communicator communicator,
                              ObjectAdapterFactory objectAdapterFactory, string name,
                              RouterPrx router, bool noConfig)
        {
            instance_             = instance;
            _communicator         = communicator;
            _objectAdapterFactory = objectAdapterFactory;
            _servantManager       = new ServantManager(instance, name);
            _name = name;
            _incomingConnectionFactories = new List <IncomingConnectionFactory>();
            _publishedEndpoints          = new List <EndpointI>();
            _routerEndpoints             = new List <EndpointI>();
            _routerInfo  = null;
            _directCount = 0;
            _noConfig    = noConfig;

            if (_noConfig)
            {
                _id             = "";
                _replicaGroupId = "";
                _reference      = instance_.referenceFactory().create("dummy -t", "");
                _acm            = instance_.serverACM();
                return;
            }

            Properties    properties   = instance_.initializationData().properties;
            List <string> unknownProps = new List <string>();
            bool          noProps      = filterProperties(unknownProps);

            //
            // Warn about unknown object adapter properties.
            //
            if (unknownProps.Count != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
            {
                StringBuilder message = new StringBuilder("found unknown properties for object adapter `");
                message.Append(_name);
                message.Append("':");
                foreach (string s in unknownProps)
                {
                    message.Append("\n    ");
                    message.Append(s);
                }
                instance_.initializationData().logger.warning(message.ToString());
            }

            //
            // Make sure named adapter has configuration.
            //
            if (router == null && noProps)
            {
                //
                // These need to be set to prevent warnings/asserts in the destructor.
                //
                state_    = StateDestroyed;
                instance_ = null;
                _incomingConnectionFactories = null;

                InitializationException ex = new InitializationException();
                ex.reason = "object adapter `" + _name + "' requires configuration";
                throw ex;
            }

            _id             = properties.getProperty(_name + ".AdapterId");
            _replicaGroupId = properties.getProperty(_name + ".ReplicaGroupId");

            //
            // Setup a reference to be used to get the default proxy options
            // when creating new proxies. By default, create twoway proxies.
            //
            string proxyOptions = properties.getPropertyWithDefault(_name + ".ProxyOptions", "-t");

            try
            {
                _reference = instance_.referenceFactory().create("dummy " + proxyOptions, "");
            }
            catch (ProxyParseException)
            {
                InitializationException ex = new InitializationException();
                ex.reason = "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'";
                throw ex;
            }

            _acm = new ACMConfig(properties, communicator.getLogger(), _name + ".ACM", instance_.serverACM());

            {
                int defaultMessageSizeMax = instance.messageSizeMax() / 1024;
                int num = properties.getPropertyAsIntWithDefault(_name + ".MessageSizeMax", defaultMessageSizeMax);
                if (num < 1 || num > 0x7fffffff / 1024)
                {
                    _messageSizeMax = 0x7fffffff;
                }
                else
                {
                    _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
                }
            }

            try
            {
                int threadPoolSize    = properties.getPropertyAsInt(_name + ".ThreadPool.Size");
                int threadPoolSizeMax = properties.getPropertyAsInt(_name + ".ThreadPool.SizeMax");
                if (threadPoolSize > 0 || threadPoolSizeMax > 0)
                {
                    _threadPool = new ThreadPool(instance_, _name + ".ThreadPool", 0);
                }

                if (router == null)
                {
                    router = RouterPrxHelper.uncheckedCast(
                        instance_.proxyFactory().propertyToProxy(_name + ".Router"));
                }
                if (router != null)
                {
                    _routerInfo = instance_.routerManager().get(router);
                    if (_routerInfo != null)
                    {
                        //
                        // Make sure this router is not already registered with another adapter.
                        //
                        if (_routerInfo.getAdapter() != null)
                        {
                            Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException();
                            ex.kindOfObject = "object adapter with router";
                            ex.id           = Ice.Util.identityToString(router.ice_getIdentity());
                            throw ex;
                        }

                        //
                        // Add the router's server proxy endpoints to this object
                        // adapter.
                        //
                        EndpointI[] endpoints = _routerInfo.getServerEndpoints();
                        for (int i = 0; i < endpoints.Length; ++i)
                        {
                            _routerEndpoints.Add(endpoints[i]);
                        }
                        _routerEndpoints.Sort(); // Must be sorted.

                        //
                        // Remove duplicate endpoints, so we have a list of unique endpoints.
                        //
                        for (int i = 0; i < _routerEndpoints.Count - 1;)
                        {
                            EndpointI e1 = _routerEndpoints[i];
                            EndpointI e2 = _routerEndpoints[i + 1];
                            if (e1.Equals(e2))
                            {
                                _routerEndpoints.RemoveAt(i);
                            }
                            else
                            {
                                ++i;
                            }
                        }

                        //
                        // Associate this object adapter with the router. This way,
                        // new outgoing connections to the router's client proxy will
                        // use this object adapter for callbacks.
                        //
                        _routerInfo.setAdapter(this);

                        //
                        // Also modify all existing outgoing connections to the
                        // router's client proxy to use this object adapter for
                        // callbacks.
                        //
                        instance_.outgoingConnectionFactory().setRouterInfo(_routerInfo);
                    }
                }
                else
                {
                    //
                    // Parse the endpoints, but don't store them in the adapter. The connection
                    // factory might change it, for example, to fill in the real port number.
                    //
                    List <EndpointI> endpoints = parseEndpoints(properties.getProperty(_name + ".Endpoints"), true);
                    foreach (EndpointI endp in endpoints)
                    {
                        IncomingConnectionFactory factory = new IncomingConnectionFactory(instance, endp, this);
                        _incomingConnectionFactories.Add(factory);
                    }
                    if (endpoints.Count == 0)
                    {
                        TraceLevels tl = instance_.traceLevels();
                        if (tl.network >= 2)
                        {
                            instance_.initializationData().logger.trace(tl.networkCat, "created adapter `" + _name +
                                                                        "' without endpoints");
                        }
                    }

                    //
                    // Parse published endpoints.
                    //
                    _publishedEndpoints = parsePublishedEndpoints();
                }

                if (properties.getProperty(_name + ".Locator").Length > 0)
                {
                    setLocator(LocatorPrxHelper.uncheckedCast(
                                   instance_.proxyFactory().propertyToProxy(_name + ".Locator")));
                }
                else
                {
                    setLocator(instance_.referenceFactory().getDefaultLocator());
                }
            }
            catch (LocalException)
            {
                destroy();
                throw;
            }
        }
Beispiel #9
0
        public void initialize()
        {
            Ice.Properties properties = _communicator.getProperties();

            bool   ipv4       = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
            bool   preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
            string address;

            if (ipv4 && !preferIPv6)
            {
                address = properties.getPropertyWithDefault("IceDiscovery.Address", "239.255.0.1");
            }
            else
            {
                address = properties.getPropertyWithDefault("IceDiscovery.Address", "ff15::1");
            }
            int    port = properties.getPropertyAsIntWithDefault("IceDiscovery.Port", 4061);
            string intf = properties.getProperty("IceDiscovery.Interface");

            if (properties.getProperty("IceDiscovery.Multicast.Endpoints").Length == 0)
            {
                StringBuilder s = new StringBuilder();
                s.Append("udp -h \"").Append(address).Append("\" -p ").Append(port);
                if (intf.Length != 0)
                {
                    s.Append(" --interface \"").Append(intf).Append("\"");
                }
                properties.setProperty("IceDiscovery.Multicast.Endpoints", s.ToString());
            }

            string lookupEndpoints = properties.getProperty("IceDiscovery.Lookup");

            if (lookupEndpoints.Length == 0)
            {
                int protocol   = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6;
                var interfaces = IceInternal.Network.getInterfacesForMulticast(intf, protocol);
                foreach (string p in interfaces)
                {
                    if (p != interfaces[0])
                    {
                        lookupEndpoints += ":";
                    }
                    lookupEndpoints += "udp -h \"" + address + "\" -p " + port + " --interface \"" + p + "\"";
                }
            }

            if (properties.getProperty("IceDiscovery.Reply.Endpoints").Length == 0)
            {
                properties.setProperty("IceDiscovery.Reply.Endpoints",
                                       "udp -h " + (intf.Length == 0 ? "*" : "\"" + intf + "\""));
            }

            if (properties.getProperty("IceDiscovery.Locator.Endpoints").Length == 0)
            {
                properties.setProperty("IceDiscovery.Locator.AdapterId", Guid.NewGuid().ToString());
            }

            _multicastAdapter = _communicator.createObjectAdapter("IceDiscovery.Multicast");
            _replyAdapter     = _communicator.createObjectAdapter("IceDiscovery.Reply");
            _locatorAdapter   = _communicator.createObjectAdapter("IceDiscovery.Locator");

            //
            // Setup locatory registry.
            //
            LocatorRegistryI   locatorRegistry    = new LocatorRegistryI(_communicator);
            LocatorRegistryPrx locatorRegistryPrx = _locatorAdapter.Add(locatorRegistry);

            LookupPrx lookupPrx = LookupPrx.Parse("IceDiscovery/Lookup -d:" + lookupEndpoints, _communicator).Clone(
                clearRouter: true, collocationOptimized: false); // No colloc optimization or router for the multicast proxy!

            //
            // Add lookup and lookup reply Ice objects
            //
            LookupI lookup = new LookupI(locatorRegistry, lookupPrx, properties);

            _multicastAdapter.Add(lookup, "IceDiscovery/Lookup");

            LookupReplyTraits lookupT     = default;
            LookupReplyI      lookupReply = new LookupReplyI(lookup);

            _replyAdapter.AddDefaultServant(
                (current, incoming) => lookupT.Dispatch(lookupReply, current, incoming), "");
            lookup.setLookupReply(LookupReplyPrx.UncheckedCast(_replyAdapter.CreateProxy("dummy")).Clone(invocationMode: InvocationMode.Datagram));

            //
            // Setup locator on the communicator.
            //
            _locator        = _locatorAdapter.Add(new LocatorI(lookup, locatorRegistryPrx));
            _defaultLocator = _communicator.getDefaultLocator();
            _communicator.setDefaultLocator(_locator);

            _multicastAdapter.Activate();
            _replyAdapter.Activate();
            _locatorAdapter.Activate();
        }
Beispiel #10
0
        initialize()
        {
            Ice.Properties properties = _communicator.Properties;

            bool   ipv4       = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
            bool   preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
            string address;

            if (ipv4 && !preferIPv6)
            {
                address = properties.getPropertyWithDefault(_name + ".Address", "239.255.0.1");
            }
            else
            {
                address = properties.getPropertyWithDefault(_name + ".Address", "ff15::1");
            }
            int    port = properties.getPropertyAsIntWithDefault(_name + ".Port", 4061);
            string intf = properties.getProperty(_name + ".Interface");

            string lookupEndpoints = properties.getProperty(_name + ".Lookup");

            if (lookupEndpoints.Length == 0)
            {
                int protocol   = ipv4 && !preferIPv6 ? IceInternal.Network.EnableIPv4 : IceInternal.Network.EnableIPv6;
                var interfaces = IceInternal.Network.getInterfacesForMulticast(intf, protocol);
                foreach (string p in interfaces)
                {
                    if (p != interfaces[0])
                    {
                        lookupEndpoints += ":";
                    }
                    lookupEndpoints += "udp -h \"" + address + "\" -p " + port + " --interface \"" + p + "\"";
                }
            }

            if (properties.getProperty(_name + ".Reply.Endpoints").Length == 0)
            {
                properties.setProperty(_name + ".Reply.Endpoints",
                                       "udp -h " + (intf.Length == 0 ? "*" : "\"" + intf + "\""));
            }

            if (properties.getProperty(_name + ".Locator.Endpoints").Length == 0)
            {
                properties.setProperty(_name + ".Locator.AdapterId", Guid.NewGuid().ToString());
            }

            _replyAdapter   = _communicator.createObjectAdapter(_name + ".Reply");
            _locatorAdapter = _communicator.createObjectAdapter(_name + ".Locator");

            // We don't want those adapters to be registered with the locator so clear their locator.
            _replyAdapter.SetLocator(null);
            _locatorAdapter.SetLocator(null);

            var lookupPrx = LookupPrx.Parse($"IceLocatorDiscovery/Lookup -d:{lookupEndpoints}", _communicator);

            // No colloc optimization or router for the multicast proxy!
            lookupPrx = lookupPrx.Clone(clearRouter: false, collocationOptimized: false);

            LocatorPrx voidLo = _locatorAdapter.Add(new VoidLocatorI());

            string instanceName = properties.getProperty(_name + ".InstanceName");
            var    id           = new Identity("Locator", instanceName.Length > 0 ? instanceName : Guid.NewGuid().ToString());

            _defaultLocator = _communicator.getDefaultLocator();
            _locator        = new LocatorI(_name, lookupPrx, properties, instanceName, voidLo);
            _locatorPrx     = LocatorPrx.UncheckedCast(
                _locatorAdapter.Add((current, incoming) => _locator.Dispatch(current, incoming)));
            _communicator.setDefaultLocator(_locatorPrx);

            LookupReply lookupReplyI = new LookupReplyI(_locator);

            _locator.setLookupReply(_replyAdapter.Add(lookupReplyI).Clone(invocationMode: InvocationMode.Datagram));

            _replyAdapter.Activate();
            _locatorAdapter.Activate();
        }
Beispiel #11
0
        public override int run(string[] args)
        {
            try
            {
                if (args.Length != 0)
                {
                    throw new ApplicationException("starting: too many arguments in application call.");
                }

                Log.APPNAME = Midax.Properties.Settings.Default.APP_NAME;

                Dictionary <string, string> dicSettings = new Dictionary <string, string>();
                List <string> stockList = new List <string>();
                foreach (SettingsPropertyValue prop in Midax.Properties.Settings.Default.PropertyValues)
                {
                    if (prop.Name == "STOCKS")
                    {
                        string[] stockArray = new string[100];
                        ((StringCollection)prop.PropertyValue).CopyTo(stockArray, 0);
                        foreach (string stock in stockArray)
                        {
                            if (stock != null && stock != "")
                            {
                                stockList.Add(stock);
                            }
                        }
                    }
                    else
                    {
                        dicSettings.Add(prop.Name, (string)prop.PropertyValue);
                    }
                }
                Config.Settings = dicSettings;

                Ice.ObjectAdapter adapter    = communicator().createObjectAdapter("MidaxIce");
                Ice.Properties    properties = communicator().getProperties();
                Ice.Identity      id         = communicator().stringToIdentity(properties.getProperty("Identity"));

                //Thread.Sleep(10000);

                /*
                 * List<string> rsiRefMappingGBP = new List<string> { dicSettings["FX_GBPEUR"], dicSettings["FX_GBPUSD"] };
                 * List<string> rsiRefMappingUSD = new List<string> { dicSettings["FX_USDJPY"], dicSettings["FX_EURUSD"] };
                 * List<decimal> volcoeffsGBP = new List<decimal> { 1m, 0.8m };
                 * List<decimal> volcoeffsUSD = new List<decimal> { 0.75m, 0.7m };*/

                var index  = IceStreamingMarketData.Instance;
                var dax    = new MarketData(dicSettings["INDEX_DAX"]);
                var dow    = new MarketData(dicSettings["INDEX_DOW"]);
                var cac    = new MarketData(dicSettings["INDEX_CAC"]);
                var ftse   = new MarketData(dicSettings["INDEX_FTSE"]);
                var icedow = new MarketData(dicSettings["INDEX_ICEDOW"]);
                var gbpusd = new MarketData(dicSettings["FX_GBPUSD"]);
                var eurusd = new MarketData(dicSettings["FX_EURUSD"]);
                var btcusd = new MarketData(dicSettings["FX_BTCUSD"]);
                var silver = new MarketData(dicSettings["COM_SILVER"]);

                /*
                 * List<MarketData> otherIndices = new List<MarketData>();
                 * otherIndices.Add(new MarketData(dicSettings["INDEX_CAC"]));
                 * otherIndices.Add(icedow);
                 * otherIndices.Add(gbpusd);
                 * otherIndices.Add(eurusd);
                 * otherIndices.Add(silver);*/
                var models = new List <Model>();
                //var macD_10_30_90_dax = new ModelMacD(dax, 10, 30, 90);
                var robinhood_eurusd = new ModelRobinHood(eurusd);
                var robinhood_gbpusd = new ModelRobinHood(gbpusd);
                //var robinhood_btcusd = new ModelRobinHood(btcusd);
                var robinhood_silver = new ModelRobinHood(silver);
                var robinhood_dax    = new ModelRobinHood(dax);
                //var robinhood_cac = new ModelRobinHood(cac);
                var robinhood_ftse = new ModelRobinHood(ftse);
                var robinhood_dow  = new ModelRobinHood(dow, 60, 48, 0, 20, 15, new IndicatorVolume(icedow, 60));
                //models.Add(macD_10_30_90_dax);
                models.Add(robinhood_eurusd);
                models.Add(robinhood_gbpusd);
                //models.Add(robinhood_btcusd);
                //models.Add(robinhood_silver);
                models.Add(robinhood_dax);
                //models.Add(robinhood_cac);
                //models.Add(robinhood_dow);
                //models.Add(robinhood_ftse);
                //models.Add(new ModelANN("WMA_5_2", macD_10_30_90_dax, null, null, otherIndices));
                _trader = new Trader(models, communicator().shutdown);
                _trader.Init(Config.GetNow);

                adapter.add(new MidaxIceI(_trader, properties.getProperty("Ice.ProgramName")), id);
                adapter.activate();
                communicator().waitForShutdown();
            }
            catch (SEHException exc)
            {
                Log.Instance.WriteEntry("Midax server interop error: " + exc.ToString() + ", Error code: " + exc.ErrorCode, EventLogEntryType.Error);
            }
            catch (Exception exc)
            {
                Log.Instance.WriteEntry("Midax server error: " + exc.ToString(), EventLogEntryType.Error);
            }

            return(0);
        }