public void RouteRemove(IpAddress address, IpAddress mask) { lock (this) { string key = RouteEntry.ToKey(address, mask); if (EntryAdded.ContainsKey(key)) { RouteEntry entry = EntryAdded[key]; entry.RefCount--; if (entry.RefCount > 0) { } else { entry.Remove(); EntryAdded.Remove(key); } } Recovery.Save(); } }
public void RouteAdd(IpAddress address, IpAddress mask, IpAddress gateway, string iface) { lock (this) { string key = RouteEntry.ToKey(address, mask); if (EntryAdded.ContainsKey(key)) { RouteEntry entry = EntryAdded[key]; entry.RefCount++; } else { RouteEntry entry = new RouteEntry(); entry.Address = address; entry.Mask = mask; entry.Gateway = gateway; entry.Interface = iface; EntryAdded[key] = entry; entry.Add(); } Recovery.Save(); } }