private static IEnumerable <Tuple <IPAddress, byte[]> > ParseARPOutput(string stdout) { var result = new List <Tuple <IPAddress, byte[]> >(); foreach (var line in stdout.Split('\n').Select(p => p.Trim('\r'))) { if (string.IsNullOrWhiteSpace(line)) { continue; } var cols = line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (cols.Length != 3) { continue; } if (!IPAddress.TryParse(cols[0], out var ipaddr)) { continue; } var macaddr = SCUtil.ParseMacAddress(cols[1], false); if (macaddr == null) { continue; } result.Add(Tuple.Create(ipaddr, macaddr)); } return(result); }
private static string GetTempPath() { var path = Path.Combine(Path.GetTempPath(), @"DamageConfiguration.xml"); SCUtil.SafeDelete(path); return(path); }
public void Spawn(GraphicsDevice gDev, int level) { if (mUfo == null && mTimer > (750 - (level * 5)) && rand.Next(SCUtil.Max(0, 2250 - SCUtil.Min(mTimer, 2249))) < 1) //<-- 1/1000 chance per cycle { sndUFOMoving.Play(); if (rand.Next(10) < 5) { mUfo = new Sprite(mUFOTexture, new Vector2(gDev.Viewport.Width - 200, 20), new Vector2(-1.5f, 0), 1.0f + (float)level / 8.0f); } else { mUfo = new Sprite(mUFOTexture, new Vector2(-68, 20), new Vector2(1.5f, 0), 1.0f + (float)level / 8.0f); } } }
//General methods public void CheckBounds(int lower, int upper) { mPosition.X = SCUtil.Max(0, SCUtil.Min((int)mPosition.X, upper - mImage.Width)); setQAs(); }