internal AbstractNetworkOutlet(DataManagement.IDataStore <string> dataManager)
 {
     this.DataManager = dataManager;
 }
        static void StartAll(string[] args)
        {
            // veriables
            INetworkObject inlet  = null;
            INetworkObject outlet = null;

            DataManagement.IDataStore <string> dataStore = null;

            string[] options = args;

            int cindex = 2;

            // determine the inlet
            if (IsFrameWork(options[cindex]))
            {
                switch (options[cindex])
                {
                case "lsl":
                    // run LSL
                    try
                    {
                        // get the new input
                        inlet = new LSLInputConsoleWalkthough(
                            options[++cindex], options[++cindex], int.Parse(options[++cindex]),
                            options[++cindex].Equals("-D"), true);

                        if (inlet == null)
                        {
                            return;
                        }
                        else
                        {
                            dataStore = ((LSLInputConsoleWalkthough)inlet).DataManager;
                        }
                        break;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                        return;
                    }

                case "udp":
                    //TODO run UDP listener
                    break;
                }
            }

            // the the current C index equals the d move forward one to get to the next marker
            if (options[cindex].ToLower().Equals("-d"))
            {
                cindex++;
            }

            // work out the outlet details
            switch (options[cindex].ToLower())
            {
            case "lsl":
            //TODO run LSL

            case "udp":
                // Run UDP client
                try
                {
                    outlet = new UDPOutlet(int.Parse(options[++cindex]), options[++cindex], dataStore);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    return;
                }

                break;
            }

            if (outlet != null && inlet != null)
            {
                inlet.Start();

                outlet.Start();

                Console.ReadKey();

                inlet.Stop();

                outlet.Stop();
                outlet.Stop();
            }

            return;
        }
Пример #3
0
 public UDPOutlet(int portNumber, string hostName, DataManagement.IDataStore <string> dataStore) : base(dataStore)
 {
     Outlet = new UDPClient(portNumber, hostName);
 }