示例#1
0
        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();
            }
        }
示例#2
0
        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();
            }
        }