Esempio n. 1
0
        public void MapShareFileToLocal(NetAddress gatewayAddress, string shareFilePath, string localFilePath, Action <string, string> callback)
        {
            if (_gatewayAddress != null && _gatewayAddress.Equals(gatewayAddress.Address, gatewayAddress.Port) == false)
            {
                throw new Exception("不能监测不同网关的文件");
            }
            _dict[shareFilePath] = new MapItem {
                LocalPath = localFilePath,
                Callback  = callback
            };

            _gatewayAddress = gatewayAddress;
        }
Esempio n. 2
0
            public Device GetDevice(int netAddress, Network network)
            {
                if (network.CheckOverflow())
                {
                    throw new Exception("Packet konnte nicht zugestellt werden");
                }
                if (!NetAddress.Equals(netAddress))
                {
                    return(this.Succesor.GetDevice(netAddress, network));
                }

                network.RunLength = 0; // reset
                return(this);
            }
Esempio n. 3
0
        public static bool RemoveServerAddress(int KeyIndex, NetAddress netAddress)
        {
            if (!m_ServerAddresses.ContainsKey(KeyIndex))
            {
                return(false);
            }

            NetAddress FindAddress =
                m_ServerAddresses[KeyIndex].Find(adress => adress.Port == netAddress.Port && adress.Address == netAddress.Address);

            if (!FindAddress.Equals(default(NetAddress)))
            {
                m_ServerAddresses[KeyIndex].Remove(FindAddress);
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        private static bool AddServerAddress(int KeyIndex, NetAddress netAddress)
        {
            if (!m_ServerAddresses.ContainsKey(KeyIndex))
            {
                m_ServerAddresses.Add(KeyIndex, new List <NetAddress>());
            }

            NetAddress FindAddress =
                m_ServerAddresses[KeyIndex].Find(adress => adress.Port == netAddress.Port && adress.Address == netAddress.Address);

            // If the address not in the address list, add it
            if (FindAddress.Equals(default(NetAddress)))
            {
                m_ServerAddresses[KeyIndex].Insert(0, netAddress);
                return(true);
            }

            return(false);
        }