Beispiel #1
0
 public VRCommand(Enums.ControlMessage controlMessage, TileConfig tileConfig)
 {
     ControlMessage = controlMessage;
     TileConfig     = tileConfig;
 }
        private void ClientSetAllTileConfig(ConnectionInfo connectionInfo, bool withImage = false)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString();

                InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault();

                VRClient vrc = m.VRClients.Where(x => x.IPAddress == ipAdd && !x.IsDeleted).FirstOrDefault();

                if (vrc != null)
                {
                    List <VRTileconfig> lvrt0 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID == 0 && !x.IsDeleted).ToList(); // root level

                    if (lvrt0 != null)
                    {
                        VRGameSelectorDTO.TileConfig tc = new VRGameSelectorDTO.TileConfig();

                        foreach (VRTileconfig vrt in lvrt0)                                                  // first process root level
                        {
                            string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end

                            if (withImage)
                            {
                                GetType();
                            }

                            VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage);

                            Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL);

                            tc.MainScreenTiles.Add(t);
                        }

                        List <VRTileconfig> lvrt1 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID != 0 && !x.IsDeleted).ToList(); // sub level

                        if (lvrt1 != null)
                        {
                            foreach (VRTileconfig vrt in lvrt1)
                            {
                                Tile targetVrt = tc.MainScreenTiles.Where(x => x.TileID == vrt.VRTileconfigID.ToString()).FirstOrDefault();

                                if (targetVrt != null)
                                {
                                    string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end

                                    VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage);


                                    Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL);

                                    targetVrt.ChildTiles.Add(t);
                                }
                            }
                        }



                        VRCommand vcs = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_TILE_CONFIG, tc);

                        SendCommandToPeer(connectionInfo, vcs);

                        if (iClientStatus != null)
                        {
                            iClientStatus.LastTileConfigDownloadTimestamp = DateTime.Now;
                        }
                    }
                }
            }
        }
Beispiel #3
0
 public VRCommand(TileConfig tileConfig)
 {
     ControlMessage = Enums.ControlMessage.LOAD_CONFIG;
     TileConfig     = tileConfig;
 }