public void DoLeave(Conn client, byte[] buffer)
        {
            var simpleInt = NetUtil.ProtobufDeserialize <simpledata.SimpleInt>(buffer);
            int roomid    = simpleInt.simple;

            NiuNiuGame nngame = nnGames[roomid];

            if (nngame.RoomLeave(client))
            {
                nnGames.Remove(roomid);
                LogUtil.LogInfo("******  房间解散 :" + roomid);
            }
        }
Exemple #2
0
        public ref NetSegmentEnd GetEnd(ushort nodeID)
        {
            bool startNode = NetUtil.IsStartNode(segmentId: SegmentID, nodeId: nodeID);

            if (startNode)
            {
                return(ref Start);
            }
            else
            {
                return(ref End);
            }
        }
Exemple #3
0
        void OnDisconnected(IAsyncResult ar)
        {
            var socket = (Socket)ar.AsyncState;

            socket.EndDisconnect(ar);
            socket.Close();

            base.socket = null;

            NetUtil.LogInfo(logTag, "Disconnected.");

            TriggerOnDisconnect();
        }
Exemple #4
0
 public override void Disconnect()
 {
     if (IsConnected)
     {
         NetUtil.LogInfo(logTag, "Disconnecting...");
         IsConnected = false;
         socket.BeginDisconnect(false, OnDisconnected, socket);
     }
     else
     {
         NetUtil.LogWarning(logTag, "Already disconnected.");
     }
 }
Exemple #5
0
        private bool Handle_QueryStacksResponse(eNetCmd cmd, UsCmd c)
        {
            var stackInfo = c.ReadString();

            if (string.IsNullOrEmpty(stackInfo))
            {
                return(false);
            }

            _stackInfoObj.writeStackInfo(stackInfo);
            NetUtil.Log("stack info{0}", stackInfo);
            return(true);
        }
Exemple #6
0
    private void OnSubUserAccountInfo(byte[] data, int size)
    {
        CMD_GP_UserAccountInfo info = NetUtil.BytesToStruct <CMD_GP_UserAccountInfo>(data);

        GlobalDataScript.userInfo.szLogonIP            = info.szLogonIp;
        GlobalDataScript.Instance.weChatInformation.ip = info.szLogonIp;
        CMD_GP_UserInGameServerID kNetInfo = new CMD_GP_UserInGameServerID
        {
            dwUserID = GlobalDataScript.userInfo.dwUserID
        };
        //SocketSendManager.Instance.SendData((int) MAIN_CMD.MDM_GP_USER_SERVICE,
        //    (int) MDM_SERVICE.SUB_GP_QUERY_INGAME_SEVERID, NetUtil.StructToBytes(kNetInfo), Marshal.SizeOf(kNetInfo));
    }
    private void DissolveRoomReply(ClientResponse response)
    {
        DissloveRoomResponseVo req = NetUtil.JsonToObj <DissloveRoomResponseVo>(response.message);

        MyDebug.Log(req.userId + "--------++++++++++++++++++++++++++++++++++++++++++++++++++++--------" + req.result);

        if (req.userId == 0)
        {
            CloseUI();
            return;
        }
        doDissoliveRoomRequest((int)req.userId, req.result);
    }
        private static void SaveLaneData(uint i, Configuration configuration)
        {
            try {
                //NetLane.Flags flags = (NetLane.Flags)lane.m_flags;

                /*if ((flags & NetLane.Flags.LeftForwardRight) == NetLane.Flags.None) // only save lanes with explicit lane arrows
                 *      return;*/
                if (!NetUtil.IsLaneValid(i))
                {
                    return;
                }

                if (Flags.laneConnections[i] != null)
                {
                    for (int nodeArrayIndex = 0; nodeArrayIndex <= 1; ++nodeArrayIndex)
                    {
                        uint[] connectedLaneIds = Flags.laneConnections[i][nodeArrayIndex];
                        bool   startNode        = nodeArrayIndex == 0;
                        if (connectedLaneIds != null)
                        {
                            foreach (uint otherHigherLaneId in connectedLaneIds)
                            {
                                if (otherHigherLaneId <= i)
                                {
                                    continue;
                                }
                                if (!NetUtil.IsLaneValid(otherHigherLaneId))
                                {
                                    continue;
                                }

                                Log._Debug($"Saving lane connection: lane {i} -> {otherHigherLaneId}");
                                configuration.LaneConnections.Add(new Configuration.LaneConnection(i, (uint)otherHigherLaneId, startNode));
                            }
                        }
                    }
                }

                //if (TrafficPriority.PrioritySegments.ContainsKey(laneSegmentId)) {
                Flags.LaneArrows?laneArrows = Flags.getLaneArrowFlags(i);
                if (laneArrows != null)
                {
                    uint laneArrowInt = (uint)laneArrows;
                    Log._Debug($"Saving lane data for lane {i}, setting to {laneArrows.ToString()} ({laneArrowInt})");
                    configuration.LaneFlags += $"{i}:{laneArrowInt},";
                }
                //}
            } catch (Exception e) {
                Log.Error($"Error saving NodeLaneData {e.Message}");
            }
        }
Exemple #9
0
        private void OnWeatherAlarmTriggered(object sender, AlarmEventTriggeredEventArgs <WeatherData> e)
        {
            if (string.IsNullOrEmpty(e.Alarm.Webhook))
            {
                return;
            }

            _logger.Info($"Weather Found [Alarm: {e.Alarm.Name}, S2CellId: {e.Data.Id}, Condition={e.Data.GameplayCondition}, Severity={e.Data.Severity}]");

            var weather = e.Data;
            var loc     = GeofenceService.GetGeofence(e.Alarm.GeofenceItems, new Location(weather.Latitude, weather.Longitude));

            if (loc == null)
            {
                //_logger.Warn($"Failed to lookup city from coordinates {pokemon.Latitude},{pokemon.Longitude} {pkmn.Name} {pokemon.IV}, skipping...");
                return;
            }

            if (!_servers.ContainsKey(e.GuildId))
            {
                return;
            }

            if (!_whConfig.Instance.Servers.ContainsKey(e.GuildId))
            {
                return;
            }

            try
            {
                var client    = _servers[e.GuildId];
                var eb        = weather.GenerateWeatherMessage(e.GuildId, client, _whConfig.Instance, e.Alarm, loc?.Name ?? e.Alarm.Name);
                var jsonEmbed = new DiscordWebhookMessage
                {
                    Username  = eb.Username,
                    AvatarUrl = eb.IconUrl,
                    Content   = eb.Description,
                    Embeds    = eb.Embeds
                }.Build();
                NetUtil.SendWebhook(e.Alarm.Webhook, jsonEmbed);

                // Weather changed, set weather in weather cache
                _whm.SetWeather(weather.Id, weather.GameplayCondition);

                Statistics.Instance.WeatherAlarmsSent++;
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }
        }
Exemple #10
0
        private async void OnPokemonAlarmTriggered(object sender, AlarmEventTriggeredEventArgs <PokemonData> e)
        {
            if (string.IsNullOrEmpty(e.Alarm.Webhook))
            {
                return;
            }

            _logger.Info($"Pokemon Found [Alarm: {e.Alarm.Name}, Pokemon: {e.Data.Id}, Despawn: {e.Data.DespawnTime}]");

            var pokemon = e.Data;
            var pkmn    = Database.Instance.Pokemon[pokemon.Id];
            var loc     = _whm.GeofenceService.GetGeofence(e.Alarm.Geofences, new Location(pokemon.Latitude, pokemon.Longitude));

            if (loc == null)
            {
                //_logger.Warn($"[POKEMON] Failed to lookup city from coordinates {pokemon.Latitude},{pokemon.Longitude} {pkmn.Name} {pokemon.IV}, skipping...");
                return;
            }

            try
            {
                var form = pokemon.Id.GetPokemonForm(pokemon.FormId.ToString());
                //var costume = e.Pokemon.Id.GetCostume(e.Pokemon.Costume.ToString());
                //var costumeFormatted = (string.IsNullOrEmpty(costume) ? "" : " " + costume);
                var pkmnImage = pokemon.Id.GetPokemonImage(_whConfig.Urls.PokemonImage, pokemon.Gender, pokemon.FormId, pokemon.Costume);
                var eb        = await pokemon.GeneratePokemonMessage(_client, _whConfig, pokemon, e.Alarm, loc.Name, pkmnImage);

                var name      = $"{pkmn.Name}{pokemon.Gender.GetPokemonGenderIconValue()}{form}";
                var jsonEmbed = new DiscordWebhookMessage
                {
                    Username  = name,
                    AvatarUrl = pkmnImage,
                    Embeds    = new List <DiscordEmbed> {
                        eb
                    }
                }.Build();
                NetUtil.SendWebhook(e.Alarm.Webhook, jsonEmbed);

                Statistics.Instance.PokemonSent++;
                Statistics.Instance.IncrementPokemonStats(pokemon.Id);

                if (pokemon.IV == "100%")
                {
                    Statistics.Instance.Add100Percent(pokemon);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }
        }
Exemple #11
0
    //麻将
    public void SendStandUpPacket(int wTableID, int wChairID, byte cbForceLeave = 0)
    {
        CMD_GR_UserStandUp UserStandUp = new CMD_GR_UserStandUp
        {
            //构造数据
            wTableID     = (ushort)wTableID,
            wChairID     = (ushort)wChairID,
            cbForceLeave = cbForceLeave
        };

        //发送数据
        SendData((int)GameServer.MDM_GR_USER, (int)MDM_GR_USER.SUB_GR_USER_STANDUP,
                 NetUtil.StructToBytes(UserStandUp), Marshal.SizeOf(UserStandUp));
    }
Exemple #12
0
    public void GetGameOption()
    {
        CMD_GF_GameOption GameOption = new CMD_GF_GameOption();

        ;
        //构造数据
        GameOption.dwFrameVersion  = 9; //LoginData.DwProcessVersion;
        GameOption.cbAllowLookon   = 0;
        GameOption.dwClientVersion = 9; // LoginData.DwProcessVersion;
        byte[] temp = NetUtil.StructToBytes(GameOption);
        //发送数据
        //Instance.SendData((int) GameServer.MDM_GF_FRAME, (int) MDM_GF_FRAME.SUB_GF_GAME_OPTION, temp,
        //    Marshal.SizeOf(GameOption));
    }
Exemple #13
0
        public static QRDecodeResult GetQRData(string address, out byte[] result)
        {
            result = Array.Empty <byte>();
            // Fetch data from QR code...

            if (!address.StartsWith("http"))
            {
                return(QRDecodeResult.BadPath);
            }

            string url = DecodeAPI + WebUtility.UrlEncode(address);
            string data;

            try
            {
                var str = NetUtil.GetStringFromURL(url);
                if (str is null)
                {
                    return(QRDecodeResult.BadConnection);
                }

                data = str;
                if (data.Contains("could not find"))
                {
                    return(QRDecodeResult.BadImage);
                }

                if (data.Contains("filetype not supported"))
                {
                    return(QRDecodeResult.BadType);
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch { return(QRDecodeResult.BadConnection); }
#pragma warning restore CA1031 // Do not catch general exception types

            // Quickly convert the json response to a data string
            try
            {
                result = DecodeQRJson(data);
                return(QRDecodeResult.Success);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                Debug.WriteLine(e.Message);
                return(QRDecodeResult.BadConversion);
            }
        }
        /// <summary>
        /// 授权设备
        /// </summary>
        /// <param name="configModel">设备授权信息</param>
        /// <returns></returns>
        public AuthDeviceRetViewModel CallAuthDeviceAPI(ConfigDeviceViewModel configModel)
        {
            var    obj         = new AuthDeviceRetViewModel();
            string weiXinToken = WeChatService.GetWeiXinToken(EnumWeChatType.Client.GetHashCode());
            var    url         = string.Format(WeChatConsts.IOT_AUTH_DEVICE, weiXinToken);

            if (configModel != null)
            {
                var parms  = JsonConvert.SerializeObject(configModel);
                var result = NetUtil.WechatSendPostRequest(url, parms);
                obj = JsonConvert.DeserializeObject <AuthDeviceRetViewModel>(result.Trim());
            }
            return(obj);
        }
Exemple #15
0
 public void UpdateFlags()
 {
     if (JRMan != null)
     {
         bool keepClearAll = true;
         foreach (var segmentID in NetUtil.IterateNodeSegments(NodeID))
         {
             bool startNode = NetUtil.IsStartNode(segmentId: segmentID, nodeId: NodeID);
             bool keppClear = JRMan.IsEnteringBlockedJunctionAllowed(segmentID, startNode);
             keepClearAll &= keppClear;
         }
         m_flags = m_flags.SetFlags(Flags.KeepClearAll, keepClearAll);
     }
 }
        /// <summary>
        /// scenario 1: no change - returns the input node.
        /// scenario 2: move node : segment is released and a smaller segment is created - returns the moved node.
        /// scenario 3: merge node: segment is released and the other node is returned.
        ///
        /// How to handle:
        /// 1: skip (DONE)
        /// 2: copy segment end for the node that didn't move (moved node cannot have customisations) (DONE)
        /// 3: when split-segment creates a new segment, that copy segment end to it.
        /// </summary>
        /// <param name="node">input node</param>


        public static void Prefix(ref ushort node) // TODO remove ref when in lates harmony.
        {
            if (!InSimulationThread())
            {
                return;
            }
            NodeID = node;
            AssertEqual(NodeID.ToNode().CountSegments(), 1, "CountSegments");
            ushort segmentID = NetUtil.GetFirstSegment(NodeID);

            Log.Info($"MoveMiddleNode.Prefix() node:{NodeID} segment:{segmentID}" /*+"\n" + Environment.StackTrace*/, true);
            SegmentData = MoveItIntegration.CopySegment(segmentID);
            NodeID2     = segmentID.ToSegment().GetOtherNode(NodeID);
        }
 protected override void OnResume()
 {
     base.OnResume();
     if (!NetUtil.CheckNetWork(CurrActivity))
     {
         ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
         return;
     }
     else
     {
         LoadingDialogUtil.ShowLoadingDialog(CurrActivity, "获取数据中...");
         GetTeacherListByScope();
     }
 }
        /// <summary>
        /// 删除教师信息
        /// </summary>
        private void DoDelete()
        {
            try
            {
                if (!NetUtil.CheckNetWork(CurrActivity))
                {
                    ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
                    return;
                }


                LoadingDialogUtil.ShowLoadingDialog(this, "删除中...");

                new Thread(new ThreadStart(() =>
                {
                    var schoolId = CurrUserInfo.SchoolId;
                    var type     = 1;                                         //type = 1 助教相关身份 type = 2 教师相关身份
                    var keyword  = currAssistant.Mobile;
                    var modifier = CurrUserInfo.Name;
                    var rd       = _meService.DeleteManagerUser(schoolId, type.ToString(), keyword, modifier);

                    RunOnUiThread(() =>
                    {
                        LoadingDialogUtil.DismissLoadingDialog();
                        if (rd.State == 0)
                        {
                            ToastUtil.ShowErrorToast(this, (string.IsNullOrEmpty(rd.Error) ? "操作失败" : rd.Error));
                        }
                        else
                        {
                            ToastUtil.ShowSuccessToast(this, "操作成功");
                            new Handler().PostDelayed(() =>
                            {
                                Finish();
                                OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out);
                            }, 1000);
                        }
                    });
                })).Start();
            }
            catch (Exception ex)
            {
                var msg = ex.Message.ToString();
                ToastUtil.ShowErrorToast(this, "操作失败");
            }
            finally
            {
                LoadingDialogUtil.DismissLoadingDialog();
            }
        }
        public void RefreshElevation()
        {
            int elevation = NetUtil.GetElevation();

            if (FreeCursorTool.Instance.AbsoluteElevation)
            {
                int terrainY = (int)FreeCursorTool.Instance.HoverPosition.y;
                UIWindow.instance.P_FreeToolPanel.ElevationField.Value = terrainY + elevation;
            }
            else
            {
                UIWindow.instance.P_FreeToolPanel.ElevationField.Value = elevation;
            }
        }
        /// <summary>
        /// 下载目录或文件,返回本地路径。如果重复下载,则直接返回。
        /// </summary>
        /// <param name="ftpFolderOrFilePath">路径,含IP地址和端口,若是目录,请以"/"结尾</param>
        /// <param name="extension">若是目录,则设置,可以以分号分隔多个匹配类型</param>
        /// <param name="isDownAll">是否下载所有的文件,如果不是,则成成功一个后就停止下载。</param>
        /// <param name="localFolder"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="throwException"></param>
        /// <returns></returns>
        protected List <string> DownloadFtpDirecotryOrFile(string ftpFolderOrFilePath, string extension = "*.*", string localFolder = @"C:\GnsserTemp\", string userName = "******", string password = "******", bool IsOverwrite = false, bool throwException = false)
        {
            List <string> localFilePathes = new List <string>();
            List <string> fileUrlPathes   = NetUtil.GetFtpFileUrls(ftpFolderOrFilePath, extension, userName, password);

            foreach (var url in fileUrlPathes)
            {
                var localPath = Path.Combine(localFolder, Path.GetFileName(url));
                log.Info("正在尝试下载 " + url);

                TryDownloadOne(localFilePathes, url, localPath, userName, password, IsOverwrite, throwException);
            }
            return(localFilePathes);
        }
        /// <summary>
        /// 校验accessToken是否过期
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static bool CheckTokenIsExpired(string accessToken)
        {
            string jsonStr = NetUtil.ResponseByGet(string.Format(WeChatConsts.WECHAT_TOKEN_ISEXPIRED, accessToken), null);
            Dictionary <string, object> dicWechat = JsonUtil.Deserialize <Dictionary <string, object> >(jsonStr);

            if (dicWechat != null && dicWechat.ContainsKey("errcode"))
            {
                return(dicWechat["errcode"].ToString().Length > 0);
            }
            else
            {
                return(false);
            }
        }
Exemple #22
0
    private bool OnSocketSubPrivateCreateSuceess(byte[] data, int dataSize)
    {
        if (dataSize != Marshal.SizeOf(typeof(CMD_GF_Create_Private_Sucess)))
        {
            return(false);
        }
        var pNetInfo = NetUtil.BytesToStruct <CMD_GF_Create_Private_Sucess>(data);

        MyDebug.Log("房间号:" + pNetInfo.dwRoomNum);
        GlobalDataScript.roomVo.roomId = (int)pNetInfo.dwRoomNum;
        MyDebug.Log("OnSocketSubPrivateCreateSuceess  To Game");
        MySceneManager.instance.SceneToMaJiang();
        return(true);
    }
Exemple #23
0
    //十三水
    public void SendCancelRoomPacket(int wTableID, int wChairID, int dwUserID)
    {
        CMD_GR_CancelRequest UserStandUp = new CMD_GR_CancelRequest
        {
            //构造数据
            dwTableID = (uint)wTableID,
            dwChairID = (uint)wChairID,
            dwUserID  = (uint)dwUserID,
        };

        //发送数据
        SendData((int)GameServer.MDM_GR_USER, (int)MDM_GR_PRIVATE.SUB_GR_CANCEL_REQUEST,
                 NetUtil.StructToBytes(UserStandUp), Marshal.SizeOf(UserStandUp));
    }
Exemple #24
0
        public static ServiceRouteDescriptor CreateLocalRouteDescriptor(this ServiceEntry serviceEntry)
        {
            if (!serviceEntry.IsLocal)
            {
                throw new LmsException("只允许本地服务条目生成路由描述符");
            }

            return(new ServiceRouteDescriptor()
            {
                ServiceDescriptor = serviceEntry.ServiceDescriptor,
                AddressDescriptors = new[]
                { NetUtil.GetRpcAddressModel().Descriptor },
            });
        }
Exemple #25
0
    //语音聊天消息
    public void ChewTheRag(byte[] buffer)
    {
        CMD_GF_C_UserVoice userVoice = new CMD_GF_C_UserVoice();

        userVoice.dwTargetUserID = 0;
        userVoice.dwVoiceLength  = (uint)buffer.Length;
        byte[] buffer1 = NetUtil.StructToBytes(userVoice);
        MyDebug.TestLog("buffer.Length==" + buffer.Length);
        sendData = new byte[8 + buffer.Length];
        Array.Copy(buffer1, sendData, buffer1.Length);
        Array.Copy(buffer, 0, sendData, buffer1.Length, buffer.Length);
        SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GF_FRAME, (int)SUB_GF_GAME_STATUS.SUB_GF_USER_VOICE, sendData,
                                             sendData.Length);
    }
Exemple #26
0
    public void Disconnect()
    {
        if (_tcpClient != null)
        {
            _tcpClient.Close();
            _tcpClient = null;

            _host = "";
            _port = 0;

            NetUtil.Log("connection closed.");
            SysPost.InvokeMulticast(this, Disconnected);
        }
    }
Exemple #27
0
    //游戏配置
    private void Cmd_Gf_GameOption(byte[] tmpBuf)
    {
        CMD_GF_GameOption gameOption = NetUtil.BytesToStruct <CMD_GF_GameOption>(tmpBuf);

        if (GlobalDataScript.Instance.roomInfo == null)
        {
            GlobalDataScript.Instance.roomInfo = new GameRoomInfo();
        }

        GlobalDataScript.Instance.roomInfo.playerNum = gameOption.cb_game_rule[2];
        GlobalDataScript.Instance.roomInfo.payType   = (int)gameOption.cb_game_rule[4];
        GlobalDataScript.Instance.roomInfo.gameMode  = (int)gameOption.cb_game_rule[1];
        // GlobalDataScript.Instance.roomInfo.maPaiId = NetUtil.PuCardChange((PU_KE)gameOption.cb_game_rule[5]);
    }
Exemple #28
0
        private void getMoreNetworkInformation(List <DeviceModel.UserInfo> totalUsers)
        {
            if (_lastInfoTime == null || DateTime.Now - _lastInfoTime.Value > Config.Instance.PingEntireSubnetInterval)
            {
                _lastInfoTime = DateTime.Now;
                var tasks = new List <Task>();
                var range = NetUtil.GetIpRange();
                foreach (var address in range)
                {
                    tasks.Add(PingWrapper.GetInstance().SendPingAsync(address.ToString(), TimeSpan.FromSeconds(1)));
                    var running = tasks.Where(t => t.Status == TaskStatus.Running).ToArray();
                    if (running.Length > 5)
                    {
                        Task.WaitAny(running);
                    }
                }
                Task.WaitAll(tasks.ToArray());
            }
            var devicesOnLan = NetUtil.GetAllDevicesOnLAN();

            foreach (var user in totalUsers)
            {
                if (!string.IsNullOrWhiteSpace(user.MacAddress) /*&& string.IsNullOrWhiteSpace(user.Ip)*/)
                {
                    var mac = System.Net.NetworkInformation.PhysicalAddress.Parse(user.MacAddress);
                    var ips = devicesOnLan.Where(p => p.Value.ToString() == mac.ToString()).Select(p => p.Key).ToList();
                    foreach (var ip in ips)
                    {
                        user.Ip = ip.ToString();
                        var local = user;

                        /*var ping = new MillenniumTools.Common.Ping();
                         * ping.SendPingAsync(user.Ip, 1000).ContinueWith(t =>
                         * {
                         *  if (t.Result.Status == System.Net.NetworkInformation.IPStatus.Success)
                         *  {*/
                        System.Net.Dns.GetHostEntryAsync(ip).ContinueWith(t2 =>
                        {
                            if (!t2.IsFaulted && !string.IsNullOrWhiteSpace(t2.Result.HostName))
                            {
                                local.Name = t2.Result.HostName;
                            }
                        });

                        /*}
                         * });*/
                    }
                }
            }
        }
Exemple #29
0
        /// <summary>
        /// 下拉刷新
        /// </summary>
        public void OnRefresh()
        {
            if (!NetUtil.CheckNetWork(CurrActivity))
            {
                ToastUtil.ShowWarningToast(CurrActivity, "网络未连接!");
            }
            else
            {
                pageIndex = 1;

                //mSwipeRefreshLayout.Refreshing = true;
                GetTeacherListByScope();
            }
        }
 public bool SetUturnAllowed(ushort segmentId, bool startNode, bool value)
 {
     if (!NetUtil.IsSegmentValid(segmentId))
     {
         return(false);
     }
     if (!value && LaneConnectionManager.Instance.HasUturnConnections(segmentId, startNode))
     {
         return(false);
     }
     Flags.setUTurnAllowed(segmentId, startNode, value);
     SubscribeToSegmentGeometry(segmentId);
     return(true);
 }