Ejemplo n.º 1
0
 public async void JoinRoom(Friend buddyToJoin)
 {
     var serverProxy = ServerProxy.GetInstance();
     await serverProxy.messageSender.SendMessage(
         PacketType.c_JoinRoom,
         buddyToJoin);
 }
Ejemplo n.º 2
0
        private void Disconnect()
        {
            m_serverProxy = null;

            TRV_Entities.Nodes.Clear();
            LST_Chat_Messages.Items.Clear();
            LST_Chat_ConnectedPlayers.Items.Clear();
            LST_Plugins.Items.Clear();

            m_serverStatusCheckTimer.Stop();
            m_entityTreeRefreshTimer.Stop();
            m_chatViewRefreshTimer.Stop();
            m_pluginManagerRefreshTimer.Stop();

            BTN_StartServer.Enabled    = false;
            BTN_StopServer.Enabled     = false;
            BTN_Connect.Enabled        = true;
            BTN_Chat_Send.Enabled      = false;
            BTN_Plugins_Load.Enabled   = false;
            BTN_Plugins_Unload.Enabled = false;

            TXT_Chat_Message.Enabled = false;

            CMB_Control_AutosaveInterval.Enabled       = false;
            CMB_Control_AutosaveInterval.SelectedIndex = 2;

            CHK_Control_Debugging.Enabled = false;
            CHK_Control_Debugging.Checked = false;
        }
Ejemplo n.º 3
0
        private async void StartGame_OnTapped(object sender, TappedRoutedEventArgs e)
        {
            //
            // Only allow the room host to initiate a game.
            //

            var roomManager = RoomManager.GetInstance();

            if (roomManager.Host.EmailAddress != Settings.EmailAddress)
            {
                return;
            }

            var args = new GameBoardNavigationArgs()
            {
                GameConnectionType = GameConnectionType.Online,
                BotCount           = 0
            };

            var serverProxy = ServerProxy.GetInstance();

            if (serverProxy.messageSender != null)
            {
                await serverProxy.messageSender.SendMessage(PacketType.ClientInitiateGame);
            }

            Frame.Navigate(typeof(GameBoardPrototype), args);
        }
        public void ServerProxy_NoFallbackOnConnectIfNormalException()
        {
            //------------Setup for test--------------------------
            var serverProxy = new ServerProxy(new Uri("http://bob"));
            var serverGuid  = Guid.NewGuid();
            var p           = new Warewolf.Testing.PrivateObject(serverProxy);
            var wrapped     = new Mock <IEnvironmentConnection>();
            var fallback    = new Mock <IEnvironmentConnection>();

            wrapped.Setup(a => a.Connect(It.IsAny <Guid>())).Throws(new Exception());
            p.SetField("_wrappedConnection", wrapped.Object);

            try
            {
                serverProxy.Connect(serverGuid);
            }

            catch

            {
                // ignored
            }

            var con = p.GetField("_wrappedConnection");

            Assert.IsNotNull(con);
        }
Ejemplo n.º 5
0
            public int Run()
            {
                if (_options.ShowConsole)
                {
                    _ = new ConsoleWindow();
                }
                var serverEndpoint        = _options.ServerEndpoint;
                var environmentConnection = new ServerProxy(serverEndpoint);

                Console.Write("connecting to server: " + serverEndpoint + "...");
                environmentConnection.Connect(Guid.Empty);
                Console.WriteLine("done.");
                var resourceCatalogProxy = new ResourceCatalogProxy(environmentConnection);

                var config = new WorkerContext(_options, resourceCatalogProxy, TriggersCatalog.Instance);

                using (var watcher = new FileSystemWatcherWrapper())
                {
                    config.WatchTriggerResource(watcher);
                    watcher.Created += (o, t) => Environment.Exit(1);
                    watcher.Changed += (o, t) => Environment.Exit(0);
                    watcher.Deleted += (o, t) => Environment.Exit(0);
                    watcher.Renamed += (o, t) => Environment.Exit(0);

                    new QueueWorkerImplementation(config).Run();
                }

                return(0);
            }
Ejemplo n.º 6
0
        public MyApplicationContext()
        {
            //If WinForms exposed a global event that fires whenever a new Form is created,
            //we could use that event to register for the form's `FormClosed` event.
            //Without such a global event, we have to register each Form when it is created
            //This means that any forms created outside of the ApplicationContext will not prevent the
            //application close.
            var server = new ServerProxy("127.0.0.1", 8081);
            var forms  = new List <Form>()
            {
                new Login(server),
                new Login(server)
            };

            foreach (var form in forms)
            {
                form.FormClosed += onFormClosed;
            }

            //to show all the forms on start
            //can be included in the previous foreach
            foreach (var form in forms)
            {
                form.Show();
            }

            //to show only the first form on start
            //forms[0].Show();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 直接提供webApi本地直接处理请求,不转发到后端rpcServer
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static string SendHttp(HttpContext context)
        {
            var           content  = GetRequestValue(context.Request);
            Args <object> a        = JsonConvert.DeserializeObject <Args <object> >(content);
            var           jSetting = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            };

            a.Headers = GetRequestIp(context);
            if (string.IsNullOrEmpty(a.rid))
            {
                // 提前端产生一个rid
                a.rid = Guid.NewGuid().ToString("N");
            }
            string[] motheds = context.Request.Path.ToString().Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (motheds == null || motheds.Length < 2)
            {
                Result <object> rr = new Result <object>();
                rr.msg = "Uri Error rid=" + a.rid;
                rr.c   = 503;
                rr.v   = default(object);
                return(JsonConvert.SerializeObject(rr, jSetting));
            }
            else
            {
                a.m = motheds[motheds.Length - 1];
                jSetting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
                return(ServerProxy.HttpSend(JsonConvert.SerializeObject(a, jSetting), a.Headers));
            }
        }
Ejemplo n.º 8
0
        public void DeleteWorkflowSuccessCantDeleteDeletedWorkflow()
        {
            //---------Setup-------------------------------
            IEnvironmentConnection connection = new ServerProxy(new Uri(_webserverUri));

            connection.Connect(Guid.Empty);
            const string ServiceName  = "DeleteWorkflowTest2";
            const string ResourceType = "WorkflowService";
            //----------Execute-----------------------------

            var coms = new CommunicationController {
                ServiceName = "DeleteResourceService"
            };

            coms.AddPayloadArgument("ResourceName", ServiceName);
            coms.AddPayloadArgument("ResourceType", ResourceType);
            coms.AddPayloadArgument("ResourceID", "f2b78836-91dd-44f0-a43f-b3ecf4c53cd5");

            // Execute
            var result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty);

            // Assert
            Assert.IsTrue(result.Message.Contains("Success"), "Got [ " + result.Message + " ]");

            result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty);
            StringAssert.Contains(result.Message.ToString(), "WorkflowService 'f2b78836-91dd-44f0-a43f-b3ecf4c53cd5' was not found.");
        }
Ejemplo n.º 9
0
        public void ServerProxy_NoFallbackOnConnectIfNormalException()
        {
            //------------Setup for test--------------------------
            var           serverProxy = new ServerProxy(new Uri("http://bob"));
            var           serverGuid  = Guid.NewGuid();
            PrivateObject p           = new PrivateObject(serverProxy);
            var           wrapped     = new Mock <IEnvironmentConnection>();
            var           fallback    = new Mock <IEnvironmentConnection>();

            wrapped.Setup(a => a.Connect(It.IsAny <Guid>())).Throws(new Exception());
            p.SetField("_wrappedConnection", wrapped.Object);

            try
            {
                serverProxy.Connect(serverGuid);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
            var con = p.GetField("_wrappedConnection");

            Assert.IsNotNull(con);
        }
Ejemplo n.º 10
0
        public static string ExecuteServiceOnLocalhostUsingProxy(string serviceName, Dictionary <string, string> payloadArguments)
        {
            CommunicationControllerFactory fact = new CommunicationControllerFactory();
            var comm = fact.CreateController(serviceName);
            var prx  = new ServerProxy("http://localhost:3142", CredentialCache.DefaultNetworkCredentials, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object);

            prx.Connect(Guid.NewGuid());
            foreach (var payloadArgument in payloadArguments)
            {
                comm.AddPayloadArgument(payloadArgument.Key, payloadArgument.Value);
            }
            if (comm != null)
            {
                var messageToExecute = comm.ExecuteCommand <ExecuteMessage>(prx, Guid.Empty);
                if (messageToExecute != null)
                {
                    var responseMessage = messageToExecute.Message;
                    if (responseMessage != null)
                    {
                        var actual = responseMessage.ToString();
                        return(actual);
                    }
                    return("Error: response message empty!");
                }
                return("Error: message to send to localhost server could not be generated.");
            }
            return("Error: localhost server controller could not be created.");
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This method is invoked whenever someone from the server performs a
        /// dump action.
        /// </summary>
        /// <param name="actionSender">The person who performed the dump action</param>
        /// <param name="returnedTile"></param>
        public async Task <List <Tile> > PerformDumpAction(string actionSender, Tile returnedTile)
        {
            var tiles = _tileManager.PerformDumpAction(returnedTile);


            //
            // If the dump failed, return an empty tile list
            //

            if (tiles == null)
            {
                return(new List <Tile>());
            }

            var viewModel = GameBoardViewModel.GetInstance();

            _gameDataLogger.LogMove(actionSender, viewModel.GameTime, MoveType.Dump);

            viewModel.TilePileCount -= 2;

            var serverProxy = ServerProxy.GetInstance();

            if (serverProxy.messageSender != null)
            {
                // ToDo: Send the actionsender name here instead of the client name in case it's a bot that's dumping.
                await serverProxy.messageSender.SendMessage(PacketType.c_Dump);
            }

            return(tiles);
        }
Ejemplo n.º 12
0
        protected override void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dgv.SelectedRows.Count < 1)
            {
                MessageBox.Show("请右键选中记录.");
                return;
            }
            int row = dgv.SelectedRows[0].Index;

            if (MessageBox.Show("是否删除当前记录?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                var id  = dgv["ID", row].Value.ToString();
                var sql = string.Format("sp_del_T_BA_Client {0},{1}", id, -1);
                try
                {
                    #region 更新数据
                    bool succeed = ServerProxy.UpdateProc(sql);
                    if (succeed)
                    {
                        OnDataSaved();
                        MessageBox.Show("保存成功.");
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    //LogTextHelper.Error(ex);
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 13
0
        static IServer CreateEnvironmentModel(Connection connection)
        {
            var         resourceId = connection.ResourceID;
            ServerProxy connectionProxy;

            if (connection.AuthenticationType == AuthenticationType.Windows || connection.AuthenticationType == AuthenticationType.Anonymous)
            {
                connectionProxy = new ServerProxy(new Uri(connection.WebAddress));
            }
            else
            {
                var userName = connection.UserName;
                var password = connection.Password;
                if (connection.AuthenticationType == AuthenticationType.Public)
                {
                    userName = "******";
                    password = "";
                }

                connectionProxy = new ServerProxy(connection.WebAddress, userName, password);
            }
            return(new Server(resourceId, connectionProxy)
            {
                Name = connection.ResourceName
            });
        }
Ejemplo n.º 14
0
        public void ServerProxy_HandleItemAdded()
        {
            //------------Setup for test--------------------------
            var serverProxy = new ServerProxy(new Uri("http://bob"));
            var serverGuid  = Guid.NewGuid();
            var ItemGuid    = Guid.Empty;

            try
            {
                serverProxy.Connect(serverGuid);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
            //------------Execute Test---------------------------
            ServerExplorerItem item = new ServerExplorerItem("bob", Guid.Empty, ResourceType.DbService, null, Permissions.Administrator, "bob");

            serverProxy.ItemAddedMessageAction += explorerItem => { ItemGuid = explorerItem.ServerId; };
            Dev2JsonSerializer dev = new Dev2JsonSerializer();
            var           output   = dev.SerializeToBuilder(item);
            PrivateObject p        = new PrivateObject(serverProxy);

            p.Invoke("OnItemAddedMessageReceived", new object[] { output.ToString() });
            Assert.AreEqual(ItemGuid, serverGuid);
            //------------Assert Results-------------------------
            var subscription = serverProxy.EsbProxy.Subscribe("SendDebugState");

            Assert.IsNotNull(subscription);
        }
Ejemplo n.º 15
0
        public void SendNullParam()
        {
            string returnValue = ServerProxy.ServerMethodD(null);

            Assert.IsNull(returnValue);
            Assert.IsNull(Server.MethodCalls[0].Args[0]);
        }
Ejemplo n.º 16
0
        public void ServerProxy_FallbackOnConnect()
        {
            //------------Setup for test--------------------------
            var           serverProxy = new ServerProxy(new Uri("http://bob"));
            var           serverGuid  = Guid.NewGuid();
            PrivateObject p           = new PrivateObject(serverProxy);
            var           wrapped     = new Mock <IEnvironmentConnection>();

            wrapped.Setup(a => a.DisplayName).Returns("moo");
            wrapped.Setup(a => a.Connect(It.IsAny <Guid>())).Throws(new FallbackException());
            wrapped.Setup(a => a.WebServerUri).Returns(new Uri("http://bob"));
            p.SetField("_wrappedConnection", wrapped.Object);

            try
            {
                serverProxy.Connect(serverGuid);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch (Exception err)
            {
                Assert.IsNotNull(err);
            }
            var con = p.GetField("_wrappedConnection") as IEnvironmentConnection;

            Assert.IsNotNull(con);
            Assert.AreNotEqual(con, wrapped.Object);
            Assert.AreEqual("moo", con.DisplayName);
        }
Ejemplo n.º 17
0
        public void DeleteWorkflowSuccessCantCallDeletedWorkflow()
        {
            //---------Setup-------------------------------
            IEnvironmentConnection connection = new ServerProxy(new Uri(_webserverUri));

            connection.Connect(Guid.Empty);
            const string ServiceName  = "DeleteWorkflowTest3";
            const string ResourceType = "WorkflowService";
            //----------Execute-----------------------------

            var coms = new CommunicationController {
                ServiceName = "DeleteResourceService"
            };

            coms.AddPayloadArgument("ResourceName", ServiceName);
            coms.AddPayloadArgument("ResourceType", ResourceType);

            var result = coms.ExecuteCommand <ExecuteMessage>(connection, Guid.Empty);

            //---------Call Workflow Failure-------
// ReSharper disable InconsistentNaming
            const string serviceName = "DeleteWorkflowTest3";
// ReSharper restore InconsistentNaming
            var servicecall = String.Format("{0}{1}", ServerSettings.WebserverURI, serviceName);
            var result2     = TestHelper.PostDataToWebserver(servicecall);

            Assert.IsTrue(result2.Contains("Service [ DeleteWorkflowTest3 ] not found."), "Got [ " + result + " ]");
        }
Ejemplo n.º 18
0
        private async void OnPlayAgainClicked(object sender, RoutedEventArgs e)
        {
            switch (_navigationArgs.GameMode)
            {
            case GameMode.Friendly:
                Frame.Navigate(typeof(MainPage));     //ToDo: Navigate to the Lobby pane of the Main Page
                break;

            case GameMode.Matchmaking:
                var serverProxy = ServerProxy.GetInstance();

                if (serverProxy.messageSender != null)
                {
                    await serverProxy.messageSender.SendMessage(PacketType.ClientStartingMatchmaking);

                    Frame.Navigate(typeof(MainPage));     //ToDo: Navigate to the Matchmaking pane of the Main Page
                }
                else
                {
                    var args = new GameBoardNavigationArgs
                    {
                        GameConnectionType = GameConnectionType.Local,
                        BotCount           = 1
                    };

                    Frame.Navigate(typeof(GameBoardPrototype), args);
                }

                break;

            default:
                Frame.Navigate(typeof(MainPage));
                break;
            }
        }
Ejemplo n.º 19
0
        public KService( int port )
        {
            Log = new UnityLogger();
            WebServer = new HttpServer();
            jsonrpc = new ServerProxy();
            Service = new KRPCService();
            if (!IsMono)
            {
                WebServer.Localhostonly = true;
            }

            jsonrpc.AddHandlers((IKRPCService)Service);
            Service.Service = this;

            WebServer.Port = port;

            WebServer.UriRequested += WebServer_UriRequested;
            WebServer.UriRequested += WebServer_Json;
            WebServer.UriRequested += WebServer_FileServer;
            WebServer.UriRequested += WebServer_FileIndex;
            WebServer.UriRequested += WebServer_FileNotFound;

            pageModels.Add(new KIWebContext(this) { PagePath = "/index.html", Title = "KInstruments Home" });
            pageModels.Add(new KIWebContext(this) { PagePath = "/radalt.html", Title = "Altitude (RADAR)" });
            pageModels.Add(new KIWebContext(this) { PagePath = "/analogalt.html", Title = "Altitude (MSL)" });
            pageModels.Add(new KIWebContext(this) { PagePath = "/navball.html", Title = "Nav Ball" });
            pageModels.Add(new KIWebContext(this) { PagePath = "/hframe_nav_rad.html", Title = "Nav Ball + Radar Alt" });
            pageModels.Add(new KIWebContext(this) { PagePath = "/gear_stage.html", Title = "Gear / Stage" });
        }
Ejemplo n.º 20
0
        private static void Main(string[] args)
        {
            string        uri                   = "http://*****:*****@"C:\temp\networkSpeedTo{0}.csv", uri.Replace(':', '-').Replace('/', '_'));

            // header
            timings.Add(string.Format("URI:, '{0}'", uri));
            timings.Add(string.Format("Max message size:, {0}, Initial block size:, {1}, Incrementing factor:, {2}, Rounds per packet size:, {3}", maxMessageSize, numberOfGuidsPerChunk, incrementingFactor, roundsPerPacketStep));

            using (var serverProxy = new ServerProxy(new Uri(uri)))
            {
                serverProxy.Connect(Guid.NewGuid());
                CommunicationControllerFactory cf = new CommunicationControllerFactory();
                while (sb.Length < maxMessageSize)
                {
                    timingsPerRound.Clear();
                    for (int i = 0; i < roundsPerPacketStep; i++)
                    {
                        var controller = cf.CreateController("TestNetworkService");
                        controller.AddPayloadArgument("payload", sb);
                        DateTime start = DateTime.Now;
                        // send very large message
                        var svc = controller.ExecuteCommand <ExecuteMessage>(serverProxy, Guid.NewGuid());

                        TimeSpan elapsed = DateTime.Now - start;
                        timingsPerRound.Add(elapsed.TotalMilliseconds);

                        // give the server time to clear it's queue
                        Thread.Sleep((int)Math.Round(elapsed.TotalMilliseconds) * 2);
                    }
                    string toAdd = string.Format("{0}, {1}", sb.Length, timingsPerRound.Sum() / roundsPerPacketStep);
                    Console.WriteLine(toAdd);
                    timings.Add(toAdd);
                    // build new packet that is incrementingFactor bigger than previous
                    StringBuilder tmpSb = new StringBuilder();
                    tmpSb.Append(sb);
                    Enumerable.Range(1, (int)Math.Ceiling(incrementingFactor)).ToList().ForEach(x =>
                                                                                                tmpSb.Append(tmpSb.ToString()));
                    sb.Append(tmpSb.ToString().Substring(0,
                                                         (int)((tmpSb.Length - sb.Length) * (incrementingFactor - 1))));
                }
            }
            File.WriteAllLines(outFileName, timings.ToArray());
            //Console.ReadKey();
        }
Ejemplo n.º 21
0
        public static void MUFRTime()
        {
            if (ServerProxy.Running())
            {
                if (AntiCheat.SpeedTicket == 0)
                {
                    AntiCheat.SpeedTicket++;
                    AntiCheat.IAmSpeed = 1000;
                }
                else if (AntiCheat.SpeedTicket == 1)
                {
                    AntiCheat.SpeedTicket++;
                    AntiCheat.IAmSpeed = 500;
                }

                int TimeSeconds = InformationCache.RestartTimer;

                if (TimeSeconds >= 2592000)
                {
                    InformationCache.RestartTimer = TimeSeconds - 2592000;
                }
                else if (TimeSeconds >= 86400)
                {
                    InformationCache.RestartTimer = TimeSeconds - 86400;
                }
                else if (TimeSeconds >= 3600)
                {
                    InformationCache.RestartTimer = TimeSeconds - 3600;
                }
                else if (TimeSeconds >= 1800)
                {
                    InformationCache.RestartTimer = TimeSeconds - 1800;
                }
                else if (TimeSeconds >= 900)
                {
                    InformationCache.RestartTimer = TimeSeconds - 900;
                }
                else if (TimeSeconds >= 600)
                {
                    InformationCache.RestartTimer = TimeSeconds - 600;
                }
                else if (TimeSeconds >= 300)
                {
                    InformationCache.RestartTimer = TimeSeconds - 300;
                }
                else if (TimeSeconds >= 60)
                {
                    InformationCache.RestartTimer = TimeSeconds - 60;
                }
                else
                {
                    InformationCache.RestartTimer = 0;
                }
            }
            else
            {
                InformationCache.RestartTimer = 0;
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 所有的客户端提前异常退出、正常退出都走此方法
 /// </summary>
 /// <param name="clientProxy"></param>
 private void ClientProxyClose(ServerProxy clientProxy)
 {
     SGMM.OnClientCancelMatch(clientProxy);
     SGMM.RemoveGame(clientProxy);
     clientProxy.OnClose();
     ClientsDict.Remove(clientProxy.ClientID);
     UserDatabase.Instance.RemoveLoginUser(clientProxy.ClientID);
 }
Ejemplo n.º 23
0
        static void Main()
        {
            IService service = new ServerProxy("127.0.0.1", 55555);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormLogin(service));
        }
Ejemplo n.º 24
0
 public FilesysEventHandlerBase(ServerProxy serverProxy, FilesysManager 
     fileManager, PathFactory pathFactory, FilesysContext filesysContext)
 {
     _serverProxy = serverProxy;
       _fileManager = fileManager;
       _pathFactory = pathFactory;
       _filesysContext = filesysContext;
 }
Ejemplo n.º 25
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var server = new ServerProxy("127.0.0.1", 8081);

            Application.Run(new Login(server));
        }
 public FilesysEventHandlerBase(ServerProxy serverProxy, FilesysManager
                                fileManager, PathFactory pathFactory, FilesysContext filesysContext)
 {
     _serverProxy    = serverProxy;
     _fileManager    = fileManager;
     _pathFactory    = pathFactory;
     _filesysContext = filesysContext;
 }
Ejemplo n.º 27
0
        public void SendServerMessageA()
        {
            var result = ServerProxy.ServerMethodA();

            Assert.AreEqual(10, result);
            Assert.IsTrue(Server.MethodCalls.Any());
            Assert.AreEqual(Server.MethodCalls[0].MethodName, nameof(ServerMock.ServerMethodA));
        }
Ejemplo n.º 28
0
        string _last_sql = string.Empty;//最后执行的sql,用于刷新界面
        /// <summary>
        /// 绑定列表数据
        /// </summary>
        private void BindData()
        {
            var dt = ServerProxy.GetTable(_last_sql);

            dgv.DataSource                  = dt;
            dgv.Columns["Id"].Visible       = false;
            dgv.Columns["CreateAt"].Visible = false;
            dgv.Columns["statu"].Visible    = false;
        }
Ejemplo n.º 29
0
    public void OnClientCancelMatch(ServerProxy clientProxy)
    {
        if (matchingClients.Contains(clientProxy))
        {
            matchingClients.Remove(clientProxy);

            ServerLog.Instance.PrintServerStates("Player " + clientProxy.ClientID + " cancels matching. Currently " + clientBattleMapping.Count + " people are in games," + matchingClients.Count + " people are matching");
        }
    }
Ejemplo n.º 30
0
        private IOperation BuildServerOperation()
        {
            var server    = new ServerProxy(context.AppConfig, ModuleLogger(nameof(ServerProxy)), powerSupply, wirelessAdapter);
            var operation = new ServerOperation(actionCenter, context, logger, server, taskbar);

            context.Server = server;

            return(operation);
        }
Ejemplo n.º 31
0
        static IServer CreateEnvironmentModel(Guid id, Uri applicationServerUri, string alias)
        {
            var environmentConnection = new ServerProxy(applicationServerUri);

            return(new Server(id, environmentConnection)
            {
                Name = alias
            });
        }
Ejemplo n.º 32
0
        public void SendServerMessageC()
        {
            ServerProxy.ServerMethodC(new List <byte>()
            {
                0, 1, 2
            }, new [] { 0, 1, 2 });

            Assert.IsTrue(Server.MethodCalls.Any());
            Assert.AreEqual(Server.MethodCalls[0].MethodName, nameof(ServerMock.ServerMethodC));
        }
Ejemplo n.º 33
0
 public BigTableDictionary(string domain, int port, string user, string secret,
     string table)
 {
     _domain = domain;
       _port = port;
       _user = user;
       _secret = secret;
       _table = table;
       _serverProxy = new ServerProxy(BaseUrl);
 }
Ejemplo n.º 34
0
        private static void Start(params string[] args)
        {
            foreach (var arg in args)
            {
                if (arg.StartsWith("-enableconsole"))
                    ConsoleManager.Start();
            }

            Proxy = new ServerProxy("127.0.0.1");
            Proxy.Start();

            Update();
        }
Ejemplo n.º 35
0
        public void MissingMethod()
        {
            string str = "{\"method\": \"notamethod\",      \"params\": [\"fred\"],              \"id\": null}";

            var p = new ServerProxy();

            p.AddHandlers(this);

            var m = p.ReadMethod(str);

            var res = p.RunMethod(m);
            Assert.IsNotNull(res.error);
            Console.WriteLine(res.error);
        }
Ejemplo n.º 36
0
        public void GoodMethod()
        {
            string str = "{\"method\": \"TestHello\",      \"params\": [\"fred\"],              \"id\": null}";

            var p = new ServerProxy();

            p.AddHandlers(this);

            var m = p.ReadMethod(str);

            var res = p.RunMethod(m);
            Assert.IsNull(res.error);
            Assert.IsTrue(res.result.Equals(TestHello("fred")));
        }
Ejemplo n.º 37
0
 public FilesysManager(PathFactory pathFactory, 
     ServerProxy serverProxy)
 {
     _pathFactory = pathFactory;
       _serverProxy = serverProxy;
 }
Ejemplo n.º 38
0
        // -- Debug -- //
#endif


        public P3DPlayer(ITCPClient client, ServerProxy proxy)
        {
            Client = client;
            Stream = new P3DStream(Client);
            _proxy = proxy;
        }
Ejemplo n.º 39
0
        // -- Debug -- //
#endif

        public ProtobufPlayer(ITCPClient client, ServerProxy proxy)
        {
            Client = client;
            Stream = new ProtobufOriginStream(Client);
            _proxy = proxy;
        }
 public BitTorrentFilesysEventHandler(ServerProxy serverProxy,
     FilesysManager fileManager, PathFactory pathFactory,
     FilesysContext filesysContext)
     : base(serverProxy, fileManager, pathFactory, filesysContext)
 {
 }
Ejemplo n.º 41
0
        void init()
        {
            RpcCommunicator.instance().logger.addLogHandler("stdout", new RpcLogHandlerStdout());
            RpcCommunicator.instance().initialize("server1");
            //RpcCommunicator.instance().settings.callwait = 1000*1000;

            RpcAdapter adapter = RpcCommunicator.instance().createAdapter("adapter1");
            prx = ServerProxy.create("192.168.199.235", 16005, false);
            TerminalImpl impl = new TerminalImpl();
            adapter.attachConnection(prx.conn);
            adapter.addServant(impl);
        }
Ejemplo n.º 42
0
 SimpleStorageDictionary(string domain, int port)
 {
     _domain = domain;
       _port = port;
       _serverProxy = new ServerProxy(BaseUrl);
 }
Ejemplo n.º 43
0
        public static int Main(string[] args)
        {
            if (Platform.IsUnix) {
                uint uid = Syscall.geteuid ();
                uint gid = Syscall.getegid ();
                Platform.SetIdentity (uid, gid);
            }

            var configurationManager = new ConfigurationManager ("fastcgi-mono-server");
            if (!configurationManager.LoadCommandLineArgs (args))
                return 1;

            // Show the help and exit.
            if (configurationManager.Help) {
                configurationManager.PrintHelp ();
            #if DEBUG
                Console.WriteLine ("Press any key...");
                Console.ReadKey ();
            #endif
                return 0;
            }

            // Show the version and exit.
            if (configurationManager.Version) {
                Version.Show ();
                return 0;
            }

            if (!configurationManager.LoadConfigFile ())
                return 1;

            configurationManager.SetupLogger ();

            #if DEBUG
            // Log everything while debugging
            Logger.Level = LogLevel.All;
            #endif

            Logger.Write (LogLevel.Debug, Assembly.GetExecutingAssembly ().GetName ().Name);
            Platform.LogIdentity ();

            string root_dir;
            if (!TryGetRootDirectory (configurationManager, out root_dir))
                return 1;

            CreateAppServer (configurationManager, root_dir);

            if (!TryLoadApplicationsConfig (configurationManager))
                return 1;

            IServer server;

            if (configurationManager.OnDemand) {
                Socket socket;
                Uri uri;
                if (!TryCreateOnDemandSocket (configurationManager.OnDemandSock, out socket, out uri))
                    return 1;
                server = CreateOnDemandServer (configurationManager, socket);
                CreateWatchdog (configurationManager, server);
            } else {
                Socket socket;
                if (!TryCreateSocket (configurationManager, out socket))
                    return 1;
                server = new ServerProxy (CreateServer (configurationManager, socket));
            }

            var stoppable = configurationManager.Stoppable;
            if (!server.Start (stoppable, (int)configurationManager.Backlog)) {
                Logger.Write (LogLevel.Error, "Failed to start server!");
                return 1;
            }

            if (stoppable) {
                Console.WriteLine (
                    "Hit Return to stop the server.");
                Console.ReadLine ();
                server.Stop ();
            }

            return 0;
        }