Inheritance: global::System.IDisposable
        private void Awake()
        {
            Instance = this;

            this.logWriter = new ConsoleLogWriter();

            ClientConfig config = new ClientConfig(this.ClientRole);
            config.SetIsAudioEndpoint(this.IsAudioEndpoint);
            config.SetLogWriter(this.logWriter);
            config.SetServerAddress(this.ServerAddress);
            config.SetServerPort(this.ServerPort);
            config.SetProfilerEnabled(false);

            this.sharingMgr = SharingManager.Create(config);
        }
Exemple #2
0
        public XToolsApp(string[] args = null)
        {
            parsedArguments = ParseCommandLine(args);
            this.logWriter = new ConsoleLogWriter();

            ClientConfig config = new ClientConfig(ClientRole.Primary);
            config.SetServerAddress(GetArgumentOrDefault("sessionserver", "localhost"));
            config.SetLogWriter(this.logWriter);

            this.Manager = SharingManager.Create(config);
            this.syncListener = new ConsoleSyncReporter();

            this.viewerConnection = this.Manager.GetPairedConnection();
            this.serverConnection = this.Manager.GetServerConnection();
            this.SessionManager = this.Manager.GetSessionManager();

            BeginPairing();

            ViewerListener = new NetworkConnectionAdapter();
            ViewerListener.ConnectedCallback += this.OnViewerConnected;
            ViewerListener.ConnectionFailedCallback += this.OnViewerConnectionFailed;
            ViewerListener.DisconnectedCallback += this.OnViewerDisconnected;
            viewerConnection.AddListener((byte)MessageID.StatusOnly, ViewerListener);

            ServerListener = new NetworkConnectionAdapter();
            ServerListener.ConnectedCallback += this.OnSessionConnected;
            ServerListener.ConnectionFailedCallback += this.OnSessionConnectionFailed;
            ServerListener.DisconnectedCallback += this.OnSessionDisconnected;
            serverConnection.AddListener((byte)MessageID.StatusOnly, ServerListener);

            this.rootObject = this.Manager.GetRootSyncObject();
            this.rootObject.AddListener(this.syncListener);

            // Listen for new sessions
            SessionManagerListener = new XToolsSessionManagerListener();
            this.SessionManager.AddListener(SessionManagerListener);
        }
Exemple #3
0
        public void Connect(string server, string userName = "******", int port = 20602, ClientRole clientRole = ClientRole.Primary)
        {
            ClientConfig config = new ClientConfig(clientRole);
            config.SetServerAddress(server);
            config.SetServerPort(port);
            config.SetLogWriter(LogWriter);

            this.SharingManager = SharingManager.Create(config);
            this.SharingManager.SetUserName(userName);
            
            this.viewerConnection = this.SharingManager.GetPairedConnection();
            this.serverConnection = this.SharingManager.GetServerConnection();
            this.SessionManager = this.SharingManager.GetSessionManager();
            
            BeginPairing();

            ViewerListener = new NetworkConnectionAdapter();
            ViewerListener.ConnectedCallback += this.OnViewerConnected;
            ViewerListener.ConnectionFailedCallback += this.OnViewerConnectionFailed;
            ViewerListener.DisconnectedCallback += this.OnViewerDisconnected;
            viewerConnection.AddListener((byte)MessageID.StatusOnly, ViewerListener);

            ServerListener = new NetworkConnectionAdapter();
            ServerListener.ConnectedCallback += this.OnSessionConnected;
            ServerListener.ConnectionFailedCallback += this.OnSessionConnectionFailed;
            ServerListener.DisconnectedCallback += this.OnSessionDisconnected;
            serverConnection.AddListener((byte)MessageID.StatusOnly, ServerListener);

            this.syncListener = new ConsoleSyncReporter();
            this.rootObject = this.SharingManager.GetRootSyncObject();
            this.rootObject.AddListener(this.syncListener);

            SessionManagerListener = new XToolsSessionManagerListener(this.LogWriter);
            this.SessionManager.AddListener(SessionManagerListener);
            networkMessageLoop = new Timer(new TimerCallback((a) => Update()), null, 0, 1000);
        }