public int Next(int min, int max) { int value = random.Next(min, max); if (value == 0) { value = random.Next(min, max); if (value == 0) { random = new Random(); value = random.Next(1, max); if (value == 0) { Logger.ShowDebug("Random function returning 0 for three times!", null); } } } return(value); }
private void ProcessPacket(Packet p) { if (commandTable.ContainsKey(p.ID)) { Packet p1 = commandTable[p.ID].New(); p1.data = p.data; p1.size = (ushort)(p.data.Length); ClientManager.EnterCriticalArea(); try { p1.Parse(this.client); } catch (Exception ex) { Logger.ShowError(ex); } ClientManager.LeaveCriticalArea(); } else { if (commandTable.ContainsKey(0xFFFF)) { Packet p1 = commandTable[0xFFFF].New(); p1.data = p.data; p1.size = (ushort)(p.data.Length); ClientManager.EnterCriticalArea(); try { p1.Parse(this.client); } catch (Exception ex) { Logger.ShowError(ex); } ClientManager.LeaveCriticalArea(); } else { Logger.ShowDebug(string.Format("Unknown Packet:0x{0:X4}\r\n Data:{1}", p.ID, DumpData(p)), Logger.CurrentLogger); } } }