public void NotifyPing(ClientInfo client, Vector2 pos, int targetNetId, Pings type) { var ping = new AttentionPingRequest(pos.X, pos.Y, targetNetId, type); var response = new AttentionPingResponse(client, ping); _packetHandlerManager.BroadcastPacketTeam(client.Team, response, Channel.CHL_S2C); }
public void AddPing(PingReplyWrapper reply, PingInfo info = null) { var result = reply != null && reply.Status == System.Net.NetworkInformation.IPStatus.Success ? reply.RoundtripTime : (long?)null; IsNetworkAccessible = result != null; if (info == null) { info = new PingInfo { Time = DateTime.Now }; } lock (Pings.GetLock()) { Pings.Add(info); } info.Roundtrip = result; List <PingInfo> lastPings; lock (Pings.GetLock()) { lastPings = Pings.Where(p => p.Time > DateTime.Now - Config.Instance.PingGraphTimeSize).ToList(); } var lastPingsSuccess = lastPings.Where(p => p.Roundtrip != null).ToList(); NetworkAvailability = 100.0 * lastPingsSuccess.Count / lastPings.Count; NetworkAvgRoundtrip = lastPingsSuccess.Count == 0 ? 0 : (long)lastPingsSuccess.Average(p => p.Roundtrip.Value); }
public PingViewModel(NavigationViewModel navigationViewModel, Pings _pings = null) { _navigationViewModel = navigationViewModel; AddPingCommand = new MyICommand(OnAddPingCommand); ShowGraphViewCommand = new MyICommand(OnShowGraphViewCommand); ClosePingGroupCommand = new MyICommand(OnClosePingGroupCommand); MainQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(10)); NavigationViewModel spgn = new NavigationViewModel(); SelectedPingGroupNavigation = spgn; SelectedPingGroupNavigation.SelectedViewModel = new NoSelectionViewModel(SelectedPingGroupNavigation); if (_pings != null) { pings = _pings; } else { InitPings(); } pings.SelectedIndexChanged += GroupIndexChanged; if (pings.LastSelectedIndex != -1) { pings.SelectedIndex = pings.LastSelectedIndex; } }
public AddPingDialog(Pings pings) { InitializeComponent(); AddPingEnterKeyCommand = new MyICommand(OnAddPingEnterKeyCommand); NotificationQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(5)); _pings = pings; }
public AttentionPingRequest(float x, float y, int netId, Pings type) { X = x; Y = y; TargetNetId = netId; Type = type; }
public PingResponse(ClientInfo client, Vector2 pos, IAttackableUnit target, Pings type) { Client = client; Position = pos; Target = target; PingType = type; }
public AttentionPingRequest(float x, float y, int netId, Pings type) { this.x = x; this.y = y; this.targetNetId = netId; this.type = type; }
public virtual void StopSW() { _stopWatch.Stop(); if (_stopWatch.ElapsedMilliseconds > 0) { Pings.Add(_stopWatch.ElapsedMilliseconds); } _stopWatch.Reset(); }
public void InitPings() { Pings tempPings = new Pings(); tempPings.SelectedIndex = -1; tempPings.LastSelectedIndex = -1; pings = tempPings; }
public PingControlVM() { sendRequestCommand = new RelayCommand(SendRequest); stopSendingRequestsCommand = new RelayCommand(StopSendingRequests); requests = new ObservableCollection <RequestItem> { }; pingRequests = new Pings(); PingRequests.RequestCompleted += RequestCompleted; PingRequests.AllRequestsCompleted += AllRequestsCompleted; }
public void ProcessParser(IServerQueryParser parser) { if (Pings.Count == 0) { Pings.Add(Common.MagicPingValue); } Result = parser.ParsePackets(this); ReceivedPackets = null; Succeed(); }
private void InitPingStorage() { Pings.EnsureIndex("Guild"); Links.EnsureIndex("PingId"); Links.EnsureIndex("Guild"); Links.EnsureIndex("User"); Actions.EnsureIndex("PingId"); Actions.EnsureIndex("LinkId"); Actions.EnsureIndex("Guild"); Actions.EnsureIndex("User"); }
public AttentionPingRequest(byte[] data) { var reader = new BinaryReader(new MemoryStream(data)); cmd = reader.ReadByte(); unk1 = reader.ReadInt32(); x = reader.ReadSingle(); y = reader.ReadSingle(); targetNetId = reader.ReadInt32(); type = (Pings)reader.ReadByte(); }
public AttentionPingRequest(byte[] data) { using (var reader = new BinaryReader(new MemoryStream(data))) { Cmd = reader.ReadByte(); Unk1 = reader.ReadInt32(); X = reader.ReadSingle(); Y = reader.ReadSingle(); TargetNetId = reader.ReadInt32(); Type = (Pings)reader.ReadByte(); } }
public GraphViewModel(NavigationViewModel navigationViewModel, Pings pings) { _navigationViewModel = navigationViewModel; BackCommand = new MyICommand(OnBackCommand); CloseGraphCommand = new MyICommand(OnCloseGraphCommand); CompressionValueBoxEnter = new MyICommand(OnCompressionValueBoxEnter); ToggleDisplayTypeCommand = new AwaitableDelegateCommand(OnToggleDisplayTypeCommand); OpenDataFolderCommand = new MyICommand(OnOpenDataFolderCommand); _pings = pings; InitGraph(); graphHelper = new GraphHelper(); }
public void Decode(NetIncomingMessage im) { var count = im.ReadInt32(); for (var i = 0; i < count; i++) { var guid = Guid.Parse(im.ReadString()); var ping = im.ReadInt32(); Pings.Add(guid, ping); } }
public int CreatePing(string guild, string author, string text, IEnumerable <string> users) { int pingId = Pings.Insert(new Ping() { Guild = guild, Author = author, Created = DateTime.Now, Text = text }); var links = users.Select(user => new Link() { PingId = pingId, Guild = guild, User = user }); Links.InsertBulk(links); _db.Checkpoint(); return(pingId); }
public Ping[] GetPings(HashSet <string> guilds = null) { if (guilds != null && guilds.Any()) { var arr = new BsonArray(); foreach (string guild in guilds) { arr.Add(guild); } return(Pings .Find(Query.In("Guild", arr)) .OrderByDescending(p => p.Id) .ToArray()); } else { return(Pings .FindAll() .OrderByDescending(p => p.Id) .ToArray()); } }
public AttentionPing(byte[] data) { var reader = new BinaryReader(new MemoryStream(data)); cmd = reader.ReadByte(); unk1 = reader.ReadInt32(); x = reader.ReadSingle(); y = reader.ReadSingle(); targetNetId = reader.ReadInt32(); type = (Pings)reader.ReadByte(); }
public Ping GetPing(int pingId) { return(Pings.FindById(pingId)); }
public List <Ping> GetPings() { return(Pings.Where(p => p.Accuracy < (AccuracyCutoff ?? 100)).OrderBy(p => p.Time).ToList()); }