示例#1
0
        public ActionResult Index()
        {
            UserLogic    gl = new UserLogic();
            RequestLogic rl = new RequestLogic();
            ServerLogic  sl = new ServerLogic();

            //Different models
            RequestDataViewModel rdvm = rl.GetRequestResponseTimeGraphData();
            ServerDataViewModel  sdvm = sl.GetServerData(10);
            SettingLogic         s    = new SettingLogic();
            //events
            EventViewModel evm = new EventViewModel();

            evm.Events            = new EventLogic().GetLastEvents(5);
            evm.NotificationCount = Facade.NotificationDomainController.GetAll().Where(x => x.Seen == false).ToList().Count;

            //MasterViewModel
            DashBoardViewModel dbvm = gl.GetUsersGraphData();

            dbvm.RequestDataViewModel = rdvm;
            dbvm.ServerDataViewModel  = sdvm;
            dbvm.SettingsModel        = s.GetSettings();
            dbvm.EventViewModel       = evm;
            //   DashBoardViewModel dbvm = gl.GetGraphDataOneHourInterval();
            return(View(dbvm));
        }
示例#2
0
 void Start(int port)
 {
     logic     = new ServerLogic(this);
     _listener = TcpListener.Create(port);
     _listener.Start();
     Console.WriteLine("Bound to port {0}", port);
 }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     ServerLogic.somethinghappend += PrintSomething;
     sData.IPofServer              = "127.0.0.1";
     sData.PortofServer            = 60000;
     ServerLogic.ServerOnline(sData);
 }
示例#4
0
        public void Setup()
        {
            inputData = new InputData
            {
                Content = new byte[1]
            };
            new Random().NextBytes(inputData.Content);

            middleInputData = new InputData
            {
                Content = new byte[10 * 1024]
            };
            new Random().NextBytes(middleInputData.Content);

            largeInputData = new InputData
            {
                Content = new byte[100 * 1024]
            };
            new Random().NextBytes(largeInputData.Content);

            messageInputData = new InputData
            {
                Content = new byte[1024]
            };

            new Random().NextBytes(middleInputData.Content);
            expectedReply        = ServerLogic.Convert(inputData);
            middleExpectedReply  = ServerLogic.Convert(middleInputData);
            largeExpectedReply   = ServerLogic.Convert(largeInputData);
            messageExpectedReply = ServerLogic.Convert(messageInputData);

            client = new T();
        }
示例#5
0
 public ServerViewModel()
 {
     Outputs     = new ObservableCollection <string>();
     serverLogic = new ServerLogic(ExternalAddress, Port, "Rice", ClientsConnected, _server, _isRunning, Outputs, Usernames);
     RunCommand  = new RelayCommand((obj) => { serverLogic.Run(_status); });
     StopCommand = new AsyncCommand(serverLogic.Stop);
 }
示例#6
0
        public ServerDataViewModel ServerData(int serverId)
        {
            ServerLogic         sl   = new ServerLogic();
            ServerDataViewModel sdvm = sl.GetServerData(serverId);

            return(sdvm);
        }
示例#7
0
 public virtual void Setup()
 {
     ConfigurationMock = new Mock <IConfiguration>();
     ProcessLogicMock  = new Mock <IProcessWrapper>();
     IPLogicMock       = new Mock <IIPWrapper>();
     LoggerMock        = new Mock <ILogger <ServerLogic> >();
     ServerLogic       = new ServerLogic(ConfigurationMock.Object, ProcessLogicMock.Object, IPLogicMock.Object, LoggerMock.Object);
 }
        public static void Main(string[] args)
        {
            ServerLogic server = new ServerLogic();

            server.Init();
            server.OnServerUpdate    += PrintPlayers;
            server.OnMsgReceivedSize += MsgReceivedSize;
            server.StartServer(8181, 60);
        }
示例#9
0
        public ReplyData GetReply(InputData data)
        {
            var inputBuf = ByteArray.CreateFrom(data);
            var input    = inputBuf.ConvertTo <InputData>();
            var reply    = ServerLogic.Convert(input);
            var replyBuf = ByteArray.CreateFrom(reply);

            return(replyBuf.ConvertTo <ReplyData>());
        }
示例#10
0
        public async Task <JsonResult> AddServerWorker(Server[] swarmNodes)
        {
            try
            {
                await ServerLogic.Init(swarmNodes.ToList());

                await ServerLogic.JoinAllWorkersAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(new JsonResult("Выполнилось"));
        }
        public Server(HostOptions options)
        {
            _options = options;

            ServerLogic server = new ServerLogic();

            _logic = server;

            server.OnClientConnected    += OnClientConnected;
            server.OnClientDisconnected += OnClientDisconnected;
            server.OnTick    += OnTick;
            server.OnMessage += OnMessage;

            server.Start(_options.Port);
        }
示例#12
0
文件: Listener.cs 项目: zervnet/pest
        public void run(ServerLogic logic)
        {
            Console.WriteLine("Creating Listener...");
            TcpListener listener = new TcpListener(System.Net.IPAddress.Parse("127.0.0.1"), 8800);
            listener.Start();
            Console.WriteLine("Listener started, waiting for connections");
            while (true)
            {
                TcpClient client = listener.AcceptTcpClient();
                Console.WriteLine("Connection established with {0}. Creating Thread...", ((IPEndPoint)client.Client.RemoteEndPoint).Address);
                CommunicationThread newThread = new CommunicationThread(logic, client);

                new Thread(new ThreadStart(newThread.run)).Start();
                Console.WriteLine("Thread created.");
            }
        }
示例#13
0
        private void StartServerButton_Click(object sender, EventArgs e)
        {
            ServerConnection Sr = new ServerConnection(sData);

            Sr.ShowDialog();
            RedLightPanel.Visible   = false;
            GreenLightPanel.Visible = true;


            //ServerData.CommonSd = sData;

            ServerLogic.ServerOnline(sData);

            //ServerisOnline += ServerLogic.StartListening(sData);

            //////ServerisOnline(this, sData);
        }
示例#14
0
    private void CheckFieldChanges()
    {
        var listOfFields = GetType().GetFields();
        List <InspectorTypes.FieldValue> fieldsForRemove = null;
        List <InspectorTypes.FieldValue> fieldsForAdd    = null;

        foreach (var newField in listOfFields)
        {
            foreach (var oldField in Fields)
            {
                if (newField.Name.Equals(oldField.Field))
                {
                    string newValue = newField.GetValue(this).ToString();
                    if (!newField.GetValue(this).ToString().Equals(oldField.Value))
                    {
                        // DebugCheckFieldChanges(newField, oldField, newValue);
                        if (fieldsForAdd == null)
                        {
                            fieldsForAdd    = new List <InspectorTypes.FieldValue>();
                            fieldsForRemove = new List <InspectorTypes.FieldValue>();
                        }
                        fieldsForAdd.Add(new InspectorTypes.FieldValue(newField.Name, newValue));
                        fieldsForRemove.Add(oldField);
                    }
                }
            }
        }

        if (fieldsForAdd == null)
        {
            return;
        }
        foreach (var fieldValue in fieldsForRemove)
        {
            Fields.Remove(fieldValue);
        }
        foreach (var field in fieldsForAdd)
        {
            Fields.Add(field);
            ServerLogic.AddChanges(field);
        }
    }
示例#15
0
        public async Task <JsonResult> JoinSwarmNode([FromBody] SwarmManagerNode ManagerInfo)
        {
            Logger.Success("Request to join swarm node!");
            ServerLogic.InitSwarmManagerNode(ManagerInfo);
            try
            {
                bool isSuccess = await ServerLogic.JoinToSwarmAsync();

                if (isSuccess)
                {
                    Logger.Success("Successfuly joined to swarm!");
                }
                else
                {
                    Logger.Fail("Cant join to swarm!");
                }
                return(new JsonResult(await ServerLogic.GetSwarmInfoAsync()));
            }
            catch (Exception e)
            {
                Logger.Fail($"Cant join to swarm: {e.Message}");
                return(new JsonResult(e.Message));
            }
        }
示例#16
0
 private void StopServerButton_Click(object sender, EventArgs e)
 {
     ServerLogic.StopListening();
 }
示例#17
0
        static void Main(string[] args)
        {
            ServerLogic server = new ServerLogic();

            server.Start();
        }
示例#18
0
 void exec(ServerLogic server, object client)
 {
     PrivateUtilities.callPrivateMethod(server, "SendClientToCurrentLevel", client);
 }
示例#19
0
 protected override void Initialize()
 {
     base.Initialize();
     this.SetWorldSize(worldSize);
     serverLogic = new ServerLogic(this, lobby, worldSize);
 }
示例#20
0
 void Awake()
 {
     server    = GameObject.FindWithTag("Server").GetComponent <ServerLogic>();
     slingshot = GetComponentInChildren <SlingshotCreator>();
 }
示例#21
0
 void Awake()
 {
     current = this;
 }
示例#22
0
 public CommunicationThread(ServerLogic logic, TcpClient client)
 {
     Client = client;
     Logic = logic;
 }
示例#23
0
 public async Task <JsonResult> GetSwarmNodeInfo()
 {
     return(new JsonResult(await ServerLogic.GetSwarmInfoAsync()));
 }
示例#24
0
文件: UHost.cs 项目: lfwelove/lbp
 void OnLevelWasLoaded(int level)
 {
     if (serverLogic == null &&
         string.Compare(Application.loadedLevelName, Scenes.Main) == 0)
     {
         serverLogic = GameObject.Find("ServerLogic").GetComponent<ServerLogic>();
     }
     else if (backLogic == null &&
              string.Compare(Application.loadedLevelName, Scenes.Backend) == 0)
     {
         backLogic = GameObject.Find("BackendLogic").GetComponent<BackendLogic>();
     }
 }
    void Start()
    {
        ServerLogic = GameObject.Find("Game").GetComponent<ServerLogic>();
        ServerLogic.RegisterPlayer(this);

        HUDInstance = Instantiate(HUD);

        if (!isLocalPlayer)
        {
            foreach (Behaviour comp in ComponentsToDisable) {
                comp.enabled = false;
            }

            setPlayerTag();
            HUDInstance.SetActive(false);
        }
        else
        {
            this.Revealed = true; // Make sure the player does not 'reveal' itself as a team member

            SceneCamera = Camera.main;
            if (SceneCamera != null)
            {
                SceneCamera.gameObject.SetActive(false);
            }
            ServerLogic.ScoreBoardInstance = Instantiate(ScoreBoard);
        }
    }
 void Awake()
 {
     motor = GetComponent<PlayerMotor>();
     state = GetComponent<PlayerState>();
     serverLogic = GameObject.Find("Game").GetComponent<ServerLogic>();
 }
示例#27
0
 public ReplyData GetReply(InputData data)
 {
     return(ServerLogic.Convert(data));
 }
 void Awake()
 {
     server = GameObject.FindWithTag("Server").GetComponent<ServerLogic>();
     slingshot = GetComponentInChildren<SlingshotCreator>();
 }
示例#29
0
 void exec(ServerLogic server, object client)
 {
     server.GetType().GetMethod("SendClientToCurrentLevel", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(server, new object[] { client });
 }
 public void MakeTurn(int x, int y, int id, bool num, int victim_id, int witns_id)
 {
     Debug.Log("In PUN");
     ServerLogic.SetTurn(new Turn(x, y, id, victim_id, witns_id), num);
 }
示例#31
0
 public Logic()
 {
     serverLogic = new ServerLogic();
 }
示例#32
0
 void Awake()
 {
     instance    = this;
     values      = new int[] { life, speed, rifleAmountStart, grenadeAmountStart, boxAmountStart, largeBoxAmountStart };
     _mysqlLogic = GameObject.Find("MysqlLogic");
 }