//============================================================================================================//
    protected void HandleDisconnect(TcpClient mSocket)
    {
        void HandleEndPoint()
        {
            lock (lockerUDPEndPoints)
            {
                udpEndPoints.RemoveAll(x => x.Equals(mSocket.RemoteEndPoint()));
            }
            lock (lockerUDPEndPointsVoices)
            {
                udpEndPointsVoices.RemoveAll(x => x.Address.Equals(mSocket.RemoteEndPoint().Address));
            }
        }

        if (GetPlayer(mSocket, out Player playerHandled))
        {
            if (RemovePlayer(playerHandled))
            {
                IDS.TryRemove(mSocket, out int value);
                //=====================================\\
                HandleEndPoint();
                HandlePlayerDisconnected(playerHandled);
                //=====================================\\
                onPlayerDisconnected(playerHandled);
            }
            mSocket.Close();
        }
    }
 public GenerateUniqueID(IDS type)
 {
     //lock (auto_id)
     {
         auto_id++;
         p_id = auto_id;
         Calculate(type);
     }
 }
Пример #3
0
 public ID(IDS type)
 {
     //lock (auto_id)
     {
         auto_id++;
         p_id = auto_id;
         Calculate(type);
     }
 }
 public GenerateUniqueID(IDS type)
 {
     //lock (auto_id)
     {
         auto_id++;
         p_id = auto_id;
         Calculate(type);
     }
 }
Пример #5
0
 public ID(IDS type)
 {
     //lock (auto_id)
     {
         auto_id++;
         p_id = auto_id;
         Calculate(type);
     }
 }
Пример #6
0
        static void Main()
        {
            LoadSettings();

            if (_idsMode)
            {
                var ids = new IDS(_trainDataset, _testDir, _fullDataset);
                ids.Run(_catFile);
            }
            else
            {
                var classifier = new GenericClassifier(_dataset);
                var result     = classifier.RunXFoldTest(_xfold);
            }
        }
Пример #7
0
		public void CascadeInsertAssigned()
		{
			IDS _IDS = new IDS();
			_IDS.Identifier = Guid.NewGuid().ToString();
			_IDS.Name = "IDS";
			_IDS.CRSPLUTs = new Dictionary<String, ListOfHLUT>();
			_IDS.CRSPLUTs.Add("a", new ListOfHLUT());


			HLUT _HLUT = new HLUT();
			_HLUT.Identifier = 1123;
			_HLUT.Name = "HLUT";
			_HLUT.Entries = new List<Entry>();
			_HLUT.Entries.Add(new Entry(1.1, .1));
			_HLUT.Entries.Add(new Entry(2.2, .2));

			_IDS.CRSPLUTs["a"].Values.Add(_HLUT);

			using (ISession s = OpenSession())
			{
				ITransaction t = s.BeginTransaction();
				s.Save(_IDS);
				t.Commit();
			}

			using (ISession s = OpenSession())
			{
				ITransaction t = s.BeginTransaction();
				IDS _IDSRead = s.Load<IDS>(_IDS.Identifier);
				
				Assert.IsNotNull(_IDSRead);
				Assert.IsNotNull(_IDSRead.CRSPLUTs);
				Assert.IsNotNull(_IDSRead.CRSPLUTs["a"]);
				Assert.IsNotNull(_IDSRead.CRSPLUTs["a"].Values[0]);
				Assert.IsNotNull(_IDSRead.CRSPLUTs["a"].Values[0].Entries);

				s.Delete(_IDSRead);
				t.Commit();
			}
		}
Пример #8
0
 void Calculate(IDS type)
 {
     if (type == IDS.Object)
     {
         capacity = 10;
         casting  = 8;
         max      = p_id * capacity + 2000000;
         min      = max - (capacity - 1);
     }
     else if (type == IDS.Player)
     {
         capacity = 50;
         casting  = 10;
         max      = p_id * capacity;
         min      = max - (capacity - 1);
     }
     else if (type == IDS.World)
     {
         max = p_id + 4000000;
         min = max - 1;
     }
     List.Add(min + 1);
 }
Пример #9
0
        public void ParseFormBinary(BinaryReader reader)
        {
            ID = reader.ReadInt32();

            int IDS_Len = reader.ReadInt32();

            while (IDS_Len-- > 0)
            {
                var IDS_Temp = new Test();
                IDS_Temp.ParseFormBinary(reader);
                IDS.Add(IDS_Temp);
            }
            ID = reader.ReadInt16();
            var TestID_Temp = new Test();

            TestID_Temp.ParseFormBinary(reader);
            TestID = TestID_Temp;
            int xxLen = reader.ReadInt32();

            Str    = Encoding.UTF8.GetString(reader.ReadBytes(xxLen));
            TestID = new Test();
            TestID.ParseFormBinary(reader);
        }
Пример #10
0
    public IEnumerator Login(Player mSocket, string username, string password)
    {
        WWWForm formData = new WWWForm();

        { formData.AddField(@USER, username); formData.AddField(@PASS, password); };

        using (UnityWebRequest request = UnityWebRequest.Post(NeutronServerConstants.URL_LOGIN, formData))
        {
            yield return(request.SendWebRequest());

            //================================================//
            string response = request.downloadHandler.text;
            //================================================//
            try
            {
                int ID = int.Parse(response);
                if (ID != 0)
                {
                    if (!IDS.ContainsKey(mSocket.tcpClient))
                    {
                        if (IDS.TryAdd(mSocket.tcpClient, ID))
                        {
                            Response(mSocket, Packet.Login, SendTo.Only, new object[] { 1, ID }); // Correct user and pass is 1;
                        }
                    }
                }
                else if (ID == 0)
                {
                    Response(mSocket, Packet.Login, SendTo.Only, new object[] { 0, ID });               // Wrong User And Pass is 0
                }
            }
            catch
            {
                Response(mSocket, Packet.Login, SendTo.Only, new object[] { 0, 0 });
            }
        }
    }
Пример #11
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            FIO.Clear(); Group.Clear(); Datar.Clear();
            IDS.Clear(); DataS.Clear(); ZadS.Clear(); OtsenkaS.Clear();

            string        connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=dnevnik;Integrated Security=True";
            SqlConnection conn             = new SqlConnection(connectionString);                      // Подключение к БД

            conn.Open();                                                                               // Открытие Соединения

            string ssql1 = $"SELECT TOP (1000) [name],[groupp],[data] FROM [dnevnik].[dbo].[student]"; //Зaпрос таблицы Student

            SqlCommand    command = new SqlCommand(ssql1, conn);                                       // Объект вывода запросов
            SqlDataReader reader  = command.ExecuteReader();                                           // Выполнение запроса вывод информации

            while (reader.Read())                                                                      //В цикле вывести всю информацию из таблици
            {
                FIO.Text   += (reader[0].ToString() + "\n");
                Group.Text += (reader[1].ToString() + "\n");
                Datar.Text += (reader[2].ToString() + "\n");
            }
            reader.Close();                                                                                             // Закрываем "чтение" первой таблицы

            string        sql2     = $"SELECT TOP (1000) [id],[data],[zadanie],[otsenka]FROM[dnevnik].[dbo].[dnevnik]"; // Запрос таблицы Dnevnik
            SqlCommand    command2 = new SqlCommand(sql2, conn);
            SqlDataReader reader2  = command2.ExecuteReader();

            while (reader2.Read())
            {
                IDS.Text      += (reader2[0].ToString() + "\n");
                DataS.Text    += (reader2[1].ToString() + "\n");
                ZadS.Text     += (reader2[2].ToString() + "\n");
                OtsenkaS.Text += (reader2[3].ToString() + "\n");
            }

            reader2.Close(); // Закрываем чтение второй таблицы
        }
Пример #12
0
        public DataSet GetOrderDetails(int PONum)
        {
            string IDS;

            string        queryStr = "SELECT ListOfProductID FROM PurchaseOrderItems WHERE PoID=@ID";
            SqlConnection conn     = new SqlConnection(connStr);
            SqlCommand    cmd      = new SqlCommand(queryStr, conn);

            cmd.Parameters.AddWithValue("@ID", PONum);
            conn.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            //Continue to read the resultsets row by row if not the end
            dr.Read();
            IDS = dr["ListOfProductID"].ToString();
            conn.Close();
            List <int> idlist = new List <int>();

            foreach (var item in IDS.Split(','))
            {
                idlist.Add(int.Parse(item));
            }
            return(GetProductUsingID(idlist.ToArray()));
        }
Пример #13
0
 private void StartAlgorithem()
 {
     if (Data.StartHome == null)
     {
         MessageBox.Show("Start home not selected!");
     }
     else if (Data.DestinationHome == null)
     {
         MessageBox.Show("Destination home not selected!");
     }
     else
     {
         IDS ids = new IDS();
         ids.Start();
         if (ids.Answer == null)
         {
             MessageBox.Show("There is no answer for this solution!");
         }
         else
         {
             ShowPath(ids.Answer);
         }
     }
 }
			public static bool CanReplace(IDS mapItem, IDS newItem)
			{
				return AllBlueprints[mapItem].CanPlaceHere ||
					(SelectiveReplacements.ContainsKey(mapItem) && SelectiveReplacements[mapItem].Contains(newItem));
			}
Пример #15
0
        public JsonResult My_Order_Otclick([FromBody] IDS i)
        {
            IEnumerable <OtClick> otcl = db.OtClicks.Where(p => p.UserOrderId == i.id);

            return(Json(otcl));
        }
 public GenerateUniqueID(int id, IDS type)
 {
     p_id = id;
     Calculate(type);
 }
 protected bool isLoggedin(TcpClient mSocket)
 {
     return(IDS.ContainsKey(mSocket));
 }
Пример #18
0
 public ID(int id, IDS type)
 {
     p_id = id;
     Calculate(type);
 }
Пример #19
0
 public ID(int id, IDS type)
 {
     p_id = id;
     Calculate(type);
 }
 void Calculate(IDS type)
 {
     if (type == IDS.Object)
     {
         capacity = 10;
         casting = 8;
         max = p_id * capacity + 2000000;
         min = max - (capacity - 1);
     }
     else if (type == IDS.Player)
     {
         capacity = 50;
         casting = 10;
         max = p_id * capacity;
         min = max - (capacity - 1);
     }
     else if (type == IDS.World)
     {
         max = p_id + 4000000;
         min = max - 1;
     }
     List.Add(min + 1);
 }
 public GenerateUniqueID(int id, IDS type)
 {
     p_id = id;
     Calculate(type);
 }