public override TreeNode GetAstCodeGenerator(SymbolTable t) { switch (op) { case "<": var less = new Lt((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line); SetGeneratorType(less); return(less); case "<=": var lesseq = new Leq((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line); SetGeneratorType(lesseq); return(lesseq); case "=": var eq = new Eq((MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), Line); SetGeneratorType(eq); return(eq); case ">": var greater = new Lt((MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), Line); SetGeneratorType(greater); return(greater); case ">=": var greaterEq = new Leq((MIPSCodeGenerator.Expression)Rigth.GetAstCodeGenerator(t), (MIPSCodeGenerator.Expression)Left.GetAstCodeGenerator(t), Line); SetGeneratorType(greaterEq); return(greaterEq); default: throw new InvalidOperationException(); } }
public LogItem[] GetItems( NpgsqlConnection connection, CriteriaType criteriaType, DateTime criteria, int maxCount, bool includeBytes) { IWhereOp whereOp; bool asc; switch (criteriaType) { case CriteriaType.DownFromInfinity: whereOp = null; asc = false; break; case CriteriaType.DownFrom: whereOp = new Lt(DbStr.Time, criteria.Ticks); asc = false; break; case CriteriaType.DownFromOrEqual: whereOp = new Le(DbStr.Time, criteria.Ticks); asc = false; break; case CriteriaType.UpFromInfinity: whereOp = null; asc = true; break; case CriteriaType.UpFrom: whereOp = new Gt(DbStr.Time, criteria.Ticks); asc = true; break; case CriteriaType.UpFromOrEqual: whereOp = new Ge(DbStr.Time, criteria.Ticks); asc = true; break; default: throw new NotSupportedException("CriteriaType " + criteriaType); } var columns = includeBytes ? _columns : _columnsWithoutBytes; var query = _npgQueryHelper.Select( _tableName, columns, whereOp, new[] { DbStr.Time }, asc, Math.Min(maxCount, MaxItemsToRetrieve)); var alarms = _npgHelper.ExecuteReader(connection, query, reader => { var i = new LogItem { Time = reader.GetDateTimeFormTicks(0), Text = reader.GetNullableString(1) }; if (includeBytes) { i.Bytes = reader.GetByteArray(2); } return(i); }); return(asc ? alarms.Reverse().ToArray() : alarms); }
public static void Log(string text, Lt l) { switch (l) { case Lt.CONNEXION: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + text + " viens de se connecter", Console.ForegroundColor = ConsoleColor.Green); break; case Lt.BAN: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + "Un joueur banni (" + text + ") essaye de se connecter", Console.ForegroundColor = ConsoleColor.DarkYellow); break; case Lt.DECONNEXION: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + text + " viens de se déconnecter", Console.ForegroundColor = ConsoleColor.Magenta); break; case Lt.ERREUR: Console.WriteLine("----------------------------------", Console.ForegroundColor = ConsoleColor.Red); Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + text, Console.ForegroundColor = ConsoleColor.Red); Console.WriteLine("----------------------------------", Console.ForegroundColor = ConsoleColor.Red); break; case Lt.INSCRIPTION: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + "Le gamer " + text + " viens de s'inscrire", Console.ForegroundColor = ConsoleColor.Yellow); break; case Lt.OUVERTURE: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + text, Console.ForegroundColor = ConsoleColor.Cyan); break; case Lt.SERVEUR: Console.WriteLine("[" + DateTime.Now.ToString() + "] - " + text, Console.ForegroundColor = ConsoleColor.Gray); break; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Water != null) { hashCode = hashCode * 59 + Water.GetHashCode(); } if (Lt != null) { hashCode = hashCode * 59 + Lt.GetHashCode(); } if (Wind != null) { hashCode = hashCode * 59 + Wind.GetHashCode(); } if (Freeze != null) { hashCode = hashCode * 59 + Freeze.GetHashCode(); } if (Ht != null) { hashCode = hashCode * 59 + Ht.GetHashCode(); } if (Burn != null) { hashCode = hashCode * 59 + Burn.GetHashCode(); } return(hashCode); } }
public void WhereWithEqualWithParameterName() { var expected = new Query <NonRelationEntity>(where : new EqualOperator(new Property <NonRelationEntity>(nameof(NonRelationEntity.Id)), new Parameter("Id"))); var actual = Lt.Query <NonRelationEntity>().Where(_ => _.Id == Lt.Arg <int>("Id")).ToImmutable(); Assert.Equal(expected, actual); }
public void OrderBy() { var expected = new Query <NonRelationEntity>(orderBy: new OrderBy <NonRelationEntity>(new Property <NonRelationEntity>("Id"))); var actual = Lt.Query <NonRelationEntity>().OrderBy(_ => _.Id).ToImmutable(); Assert.Equal(expected, actual); }
public void ThenByDescending() { var expected = new Query <NonRelationEntity>(orderBy: new OrderBy <NonRelationEntity>(new Property <NonRelationEntity>("Id"), then: new OrderBy <NonRelationEntity>(new Property <NonRelationEntity>("Code"), OrderDirect.Desc))); var actual = Lt.Query <NonRelationEntity>().OrderBy(_ => _.Id).ThenByDescending(_ => _.Code).ToImmutable(); Assert.Equal(expected, actual); }
public void ThenByDescendingWithoutOrderBy() { try { var actual = Lt.Query <NonRelationEntity>().OrderBy(_ => _.Id).ThenByDescending(_ => _.Code).ToImmutable(); throw new Exception(); } catch { } }
/// <summary> /// Add a <Lt>-Tag /// </summary> /// <returns><see cref="BaseCoreComparingGroupElement{T}"/></returns> public static T Lt <T>(this T parent, Action <Lt> action) where T : BaseCoreComparingGroupElement <T> { var lt = new Lt(); action(lt); parent.Childs.Add(lt); return(parent); }
static IValidator Lt(object pValue, object pMax, string pFieldName, string pErrorMsg) { IValidator validator = new Lt() { Value = pValue, Max = pMax, FieldName = pFieldName }; return(validator); }
public string Visit(Lt node) { var st = ""; var labelOne = GenerateLabel(); var labelTwo = GenerateLabel(); st += VisitChildren(node); st += tab(2) + "bge.un " + labelOne + "\n"; st += tab(2) + "ldc.i4.0\n"; st += tab(2) + "br " + labelTwo + "\n"; st += tab(1) + labelOne + ":\n"; st += tab(2) + "ldc.i4 42\n"; st += tab(1) + labelTwo + ":\n"; return(st); }
/// <summary> /// Returns true if DisasterInfo instances are equal /// </summary> /// <param name="other">Instance of DisasterInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(DisasterInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Date == other.Date || Date != null && Date.Equals(other.Date) ) && ( Water == other.Water || Water != null && Water.Equals(other.Water) ) && ( Lt == other.Lt || Lt != null && Lt.Equals(other.Lt) ) && ( Wind == other.Wind || Wind != null && Wind.Equals(other.Wind) ) && ( Freeze == other.Freeze || Freeze != null && Freeze.Equals(other.Freeze) ) && ( Ht == other.Ht || Ht != null && Ht.Equals(other.Ht) ) && ( Burn == other.Burn || Burn != null && Burn.Equals(other.Burn) )); }
public User[] Get(NpgsqlConnection connection, CriteriaType criteriaType, string name, int count) { IWhereOp whereOp; bool asc; switch (criteriaType) { case CriteriaType.DownFromInfinity: whereOp = null; asc = true; break; case CriteriaType.DownFrom: whereOp = new Gt(DbStr.Name, name); asc = true; break; case CriteriaType.DownFromOrEqual: whereOp = new Ge(DbStr.Name, name); asc = true; break; case CriteriaType.UpFromInfinity: whereOp = null; asc = false; break; case CriteriaType.UpFrom: whereOp = new Lt(DbStr.Name, name); asc = false; break; case CriteriaType.UpFromOrEqual: whereOp = new Le(DbStr.Name, name); asc = false; break; default: throw new NotSupportedException("CriteriaType " + criteriaType); } int limit = Math.Min(count, MaxUsersToRetrieve); NpgQuery query = _npgQueryHelper.Select( DbStr.Users, _userColumns, whereOp, new[] { DbStr.Name }, asc, limit); var users = _npgHelper.ExecuteReader(connection, query, GetUser); return(asc ? users : users.Reverse().ToArray()); }
private static void UpdateFromTap(Lt Lt, RnGroup group, RnTerminal tap) { Lt.RnStatus = true; Lt.AutorizeDate = tap.AuthorizationDate; Lt.ValidFrom = tap.AuthorizationDate; Lt.AGN = group.Agn; Lt.GRP = group.Grp; var RnTap = Lt.RnTaps.SingleOrDefault(); if (RnTap == null) { RnTap = new RnOffc(); Lt.RnTaps.Add(RnTap); } RnTap.Offc = tap.Tap; }
public int CompareTo(object obj) { Edge other = (Edge)obj; int c1 = Lt.CompareTo(other.Lt); int c2 = Rt.CompareTo(other.Rt); if (c1 != 0) { return(c1); } if (c2 != 0) { return(c2); } return(Wt - other.Wt); }
/// <summary> /// Returns true if DisasterGuidelines instances are equal /// </summary> /// <param name="other">Instance of DisasterGuidelines to be compared</param> /// <returns>Boolean</returns> public bool Equals(DisasterGuidelines other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Water == other.Water || Water != null && Water.SequenceEqual(other.Water) ) && ( Lt == other.Lt || Lt != null && Lt.SequenceEqual(other.Lt) ) && ( Wind == other.Wind || Wind != null && Wind.SequenceEqual(other.Wind) ) && ( Freeze == other.Freeze || Freeze != null && Freeze.SequenceEqual(other.Freeze) ) && ( Ht == other.Ht || Ht != null && Ht.SequenceEqual(other.Ht) ) && ( Burn == other.Burn || Burn != null && Burn.SequenceEqual(other.Burn) )); }
public override Vector3D AreaLightShade(ref ShadeRec SR) { Vector3D Wo = -SR.Ray.Direction; Vector3D RHO = AmbientBRDF.RHO(ref SR, ref Wo); Vector3D LtFac = SR.World.AmbientLight.L(ref SR); Vector3D L = new Vector3D(RHO.X * LtFac.X, RHO.Y * LtFac.Y, RHO.Z * LtFac.Z); if ((L.X + L.Y + L.Z) <= 0.001f) { return(L); } foreach (Light Lt in SR.World.Lights) { Vector3D Wi = Lt.GetDirection(ref SR).Normalize().ToVector3D(); double NDotWi = SR.Normal.DotProduct(Wi); if (NDotWi > 0.0) { bool bInShadow = false; if (Lt.EnableCastShadow()) { ShadowRay.Origin = SR.HitPoint; ShadowRay.Direction = Wi; bInShadow = Lt.CheckInShadow(ref ShadowRay, ref SR); } if (!bInShadow) { RHO = DiffuseBRDF.Factor(ref SR, ref Wo, ref Wi) + SpecularBRDF.Factor(ref SR, ref Wo, ref Wi); LtFac = Lt.L(ref SR); float G = Lt.GeoTerms(ref SR) / Lt.PDF(ref SR); L += new Vector3D(RHO.X * LtFac.X * NDotWi * G, RHO.Y * LtFac.Y * NDotWi * G, RHO.Z * LtFac.Z * NDotWi * G); } } } return(L); }
public void Setup() { _container = new Container(); _dbConnection = new SqlConnectionFactory().Create(); new global::LtQuery.ORM.DryIoc.Module().Register(_container); var tableRegistrator = _container.Resolve <global::LtQuery.ORM.ITableDefinitionRegistrator>(); tableRegistrator.Register(() => new Tables.TestEntityDefinition()); var resolver = _container.Resolve <global::LtQuery.ORM.ITableDefinitionResolver>(); var sqlBuilder = new SqlServerSqlBuilder(resolver); _connection = new LtConnection(resolver, sqlBuilder, _dbConnection); _query = Lt.Query <TestEntity>().ToImmutable(); _singleQuery = Lt.Query <TestEntity>().Where(_ => _.Id == Lt.Arg <int>()).ToImmutable(); _connection.Select(_query); _connection.Single(_singleQuery, new { Id = 1 }); }
public int LtQuery() { var accum = 0; using (var container = new Container()) { new global::LtQuery.ORM.DryIoc.Module().Register(container); var tableRegistrator = container.Resolve <global::LtQuery.ORM.ITableDefinitionRegistrator>(); tableRegistrator.Register(() => new LtQuery.Tables.TestEntityDefinition()); var tableResolver = container.Resolve <global::LtQuery.ORM.ITableDefinitionResolver>(); var sqlBuilder = new SqlServerSqlBuilder(tableResolver); using (var dbConnection = new SqlConnectionFactory().Create()) using (var connection = new LtConnection(tableResolver, sqlBuilder, dbConnection)) { var singleQuery = Lt.Query <TestEntity>().Where(_ => _.Id == Lt.Arg <int>()).ToImmutable(); var entity = connection.Single(singleQuery, new { Id = 1 }); AddHashCode(ref accum, entity.Id); } return(accum); } }
public void Visit(Lt node) { VisitChildren(node); }
public Tuple <DateTime, double?[]>[] GetPage(int[] trendTagIds, CriteriaType criteriaType, DateTime criteria, int maxCount) { IWhereOp whereOp; bool asc; switch (criteriaType) { case CriteriaType.DownFromInfinity: whereOp = null; asc = false; break; case CriteriaType.DownFrom: whereOp = new Lt(DbStr.Time, criteria.Ticks); asc = false; break; case CriteriaType.DownFromOrEqual: whereOp = new Le(DbStr.Time, criteria.Ticks); asc = false; break; case CriteriaType.UpFromInfinity: whereOp = null; asc = true; break; case CriteriaType.UpFrom: whereOp = new Gt(DbStr.Time, criteria.Ticks); asc = true; break; case CriteriaType.UpFromOrEqual: whereOp = new Ge(DbStr.Time, criteria.Ticks); asc = true; break; default: throw new NotSupportedException("CriteriaType " + criteriaType); } var columns = new List <string>(trendTagIds.Length + 1) { DbStr.Time }; columns.AddRange(trendTagIds.Select(GetColumnName)); var columnsArr = columns.ToArray(); int limit = Math.Min(maxCount, MaxSamplesToRetrieve); var parameters = new List <NpgsqlParameter>(); var queryTexts = new List <string>(); for (var i = 0; i < TrendTableSelector.TablesCount; i++) { string queryText = _npgQueryHelper.Select( parameters, _tableName + "_" + i, columnsArr, whereOp, ColumnsOfTime, asc, limit); queryTexts.Add(queryText); } NpgQuery query = _npgQueryHelper.Union(parameters, queryTexts, ColumnsOfTime, asc, limit); var result = _npgHelper.ExecuteReader(_connection, query, reader => { DateTime time = reader.GetDateTimeFormTicks(0); var values = new double?[columns.Count - 1]; for (var j = 1; j < columns.Count; j++) { values[j - 1] = reader.GetNullableDouble(j); } return(new Tuple <DateTime, double?[]>(time, values)); }); return(asc ? result.Reverse().ToArray() : result); }
private static void UpdateFromPlace(Lt Lt, EntityPlace Place) { Lt.PlaceId = Place.Pcc; Lt.AutorizeDate = Place.AuthorizationDate; Lt.ValidFrom = Place.AuthorizationDate; }
//Listen incoming connections. private void listenThread() { Socket serverSock = null; try { int recvNum; byte[] data = new byte[10240]; IPEndPoint localIp = null; foreach (IPAddress ipa in IpEntry.AddressList) { if (ipa.AddressFamily == AddressFamily.InterNetwork) { localIp = new IPEndPoint(ipa, bindPort); break; } } IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(serverIP), serverPort); if (MainWindow.activicePort.Contains(bindPort)) { MessageBox.Show("Port has been used."); throw new Exception(); } serverSock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); serverSock.Bind(localIp); Success = true; MainWindow.activicePort.Add(bindPort); sockets.Add(serverSock); EndPoint server = serverEndPoint; EndPoint remote = new IPEndPoint(IPAddress.Any, 0); int port = 23000; while (true) { ArrayList denies = dt.read(); if (port > 23500) { port = 23000; } recvNum = serverSock.ReceiveFrom(data, ref remote); Lt.write("********************************"); Lt.write("Time: " + DateTime.Now.ToString()); Lt.write("Connect IP: " + (remote as IPEndPoint).Address.ToString()); Lt.write("Connect port: " + (remote as IPEndPoint).Port.ToString()); Lt.write("Destination Port: " + bindPort); Lt.write("Protocol: UDP"); if (denies.Contains((remote as IPEndPoint).Address.ToString())) { Lt.write("Operation: Reject"); Lt.write("********************************"); Console.WriteLine("Message received from " + remote.ToString() + "\t reject."); continue; } Lt.write("Operation: Accept"); Lt.write("********************************"); if (!remote.ToString().Equals(server.ToString())) { while (proxyTable.ContainsKey(port)) { port++; } IPEndPoint IPRemote = remote as IPEndPoint; string ip = IPRemote.Address.ToString(); int tarPort = IPRemote.Port; proxyTable.Add(port, IPRemote); Thread proxy = new Thread(proxyThread); object[] param = new object[5] { port, data, server, tarPort, recvNum }; port++; proxy.Start(param); } } } catch (Exception ex) { } finally { if (serverSock != null) { serverSock.Close(); } Success = false; MainWindow.activicePort.Remove(bindPort); stop(); } }
//Finalval is the result of the look up of Lambda and Beta in the CP map. //The function uses a bilinear interpolation method, and has been developed //to replace interpn in an embedded matlab environment public void Interpolate(double Beta, double Lambda, ILArray <double> table2, ILArray <double> Betavec2, ILArray <double> Lambdavec2, out double Finalval) { ILArray <int> Bt; int B1; int B2; ILArray <int> Lt; int L1; int L2; ILArray <double> Yvals; ILArray <double> Yintervals; //Setting up persistent variables //Function initialization //The first time the function is run, it stores supplied map as a persistent //variable. if (_persistentCt == null)// Is only run once { _persistentCt = new PersistentVariables(); _persistentCt.Table = table2.C; _persistentCt.Betavec = Betavec2.C; _persistentCt.Lambdavec = Lambdavec2.C; } //Step 1, finding two adjecent indexes of the BetaVec, which contain the //supplied beta value Bt = ILMath.empty <int>(); ILMath.min(ILMath.abs(_persistentCt.Betavec - Beta), Bt); //Finding index 1 B1 = Bt.GetValue(0); //Necessary specification in embedded //matlab if (Beta > _persistentCt.Betavec.GetValue(B1)) //Finding index 2 { if (B1 == (_persistentCt.Betavec.Length - 1)) //testing if endpoint-extrapolation { B2 = B1; //should be used B1 = B1 - 1; } else { B2 = B1 + 1; } } else { if (B1 == 0) { B1 = 1; B2 = 0; } else { B2 = B1 - 1; } } //Step 2, finding two adjecent indexes of the LambdaVec, which contain the //supplied Lambda value Lt = ILMath.empty <int>(); ILMath.min(ILMath.abs(_persistentCt.Lambdavec - Lambda), Lt); L1 = Lt.GetValue(0); if (Lambda > _persistentCt.Lambdavec.GetValue(L1)) //Need to work out of indexes { if (L1 == (_persistentCt.Lambdavec.Length - 1)) { L2 = L1; L1 = L1 - 1; } else { L2 = L1 + 1; } } else { if (L1 == 0) { L1 = 1; L2 = 0; } else { L2 = L1 - 1; } } //Step 3 //Finding the four indexed values by means of the indexes Yvals = new double[, ] { { _persistentCt.Table.GetValue(B1, L1), _persistentCt.Table.GetValue(B2, L1) }, { _persistentCt.Table.GetValue(B1, L2), _persistentCt.Table.GetValue(B2, L2) } }; //Step 4 //Making two sets of linear interpolations by using the different lambda values Yintervals = ILMath.array(new double[] { ((Yvals.GetValue(0, 1) - Yvals.GetValue(0, 0)) / (_persistentCt.Lambdavec.GetValue(L2) - _persistentCt.Lambdavec.GetValue(L1)) * (Lambda - _persistentCt.Lambdavec.GetValue(L1)) + Yvals.GetValue(0, 0)), ((Yvals.GetValue(1, 1) - Yvals.GetValue(1, 0)) / (_persistentCt.Lambdavec.GetValue(L2) - _persistentCt.Lambdavec.GetValue(L1)) * (Lambda - _persistentCt.Lambdavec.GetValue(L1)) + Yvals.GetValue(1, 0)) }, 2, 1); //Step 5 //Making the final linear interpolation on the results obtained in //stepp 4 Finalval = ((Yintervals.GetValue(1) - Yintervals.GetValue(0)) / (_persistentCt.Betavec.GetValue(B2) - _persistentCt.Betavec.GetValue(B1))) * (Beta - _persistentCt.Betavec.GetValue(B1)) + Yintervals.GetValue(0); }
//Listen incoming connections. private void listenThread() { Socket clientSocket = null; string clientAddrStr = null; try { if (MainWindow.activicePort.Contains(bindingPort)) { MessageBox.Show("Port has been used."); throw new Exception(); } Socket hostSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); foreach (IPAddress ipa in IpEntry.AddressList) { if (ipa.AddressFamily == AddressFamily.InterNetwork) { IPEndPoint ipe = new IPEndPoint(ipa, bindingPort); hostSocket.Bind(ipe); break; } } hostSocket.Listen(10); sockets.Add(hostSocket); Success = true; MainWindow.activicePort.Add(bindingPort); while (true) { clientSocket = hostSocket.Accept(); ArrayList denies = Dt.read(); IPEndPoint clientEnd = clientSocket.RemoteEndPoint as IPEndPoint; Lt.write("********************************"); Lt.write("Time: " + DateTime.Now.ToString()); Lt.write("Connect IP: " + clientEnd.Address.ToString()); Lt.write("Connect port: " + clientEnd.Port.ToString()); Lt.write("Destination Port: " + bindingPort); Lt.write("Protocol: TCP"); if (denies.Contains(clientEnd.Address.ToString())) { clientSocket.Close(); Lt.write("Operation: Reject"); Lt.write("********************************"); continue; } Lt.write("Operation: Accept"); Lt.write("********************************"); sockets.Add(clientSocket); Count++; IPAddress ip = IPAddress.Parse(ServerIP); Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); serverSocket.Connect(new IPEndPoint(ip, ServerPort)); //配置服务器IP与端口 sockets.Add(serverSocket); clientSocket.SendTimeout = 5000; serverSocket.ReceiveTimeout = 5000; Socket[] socketPair = { clientSocket, serverSocket }; clientAddrStr = clientEnd.Address + ": " + clientEnd.Port; try { if (!MainWindow.connectStatuses.ContainsKey(clientAddrStr)) { MainWindow.connectStatuses.Add(clientAddrStr, "0"); } } catch (IndexOutOfRangeException indexEx) { } Thread receiveThread = new Thread(receiveMessage); Thread sendThread = new Thread(sendMessage); receiveThread.Start(socketPair); receiveThread.Name = "receive:" + clientEnd.Port; sendThread.Start(socketPair); sendThread.Name = "send:" + clientEnd.Port; } } catch (Exception ex) { //MessageBox.Show("Proxy falied!"); Count--; if (MainWindow.connectStatuses.ContainsKey(clientAddrStr)) { MainWindow.connectStatuses.Remove(clientAddrStr); } if (clientSocket != null && clientSocket.Connected) { clientSocket.Shutdown(SocketShutdown.Both); clientSocket.Close(); } } finally { Success = false; MainWindow.activicePort.Remove(bindingPort); stop(); } }