Пример #1
0
        public Beacon Parse(string line)
        {
            try
            {
                var result      = new Beacon();
                var information = line.Split('|');

                var routePair = ParsePair(information, routeIndex);
                result.Route = OctRoute.Parse(routePair.Value);

                var macAddressPair = ParsePair(information, macAddressIndex);
                if (macAddressPair.Key == "BM")
                {
                    result.MacAddress = macAddressPair.Value;
                }

                var gatewayPair = ParsePair(information, gatewayIndex);
                result.Gateway = gatewayPair.Value;
                return(result);
            }
            catch (InvalidOperationException)
            {
                return(Beacon.InvalidBeacon);
            }
            catch (IndexOutOfRangeException)
            {
                return(Beacon.InvalidBeacon);
            }
        }
        private static TreeNode CreateRoot(string gateway)
        {
            var beacond = new Beacon
            {
                Route      = OctRoute.Parse("FFFFFFFFFFF8"),
                MacAddress = gateway,
                Gateway    = gateway
            };
            var result = new TreeNode(beacond);

            return(result);
        }
Пример #3
0
        private static OctRoute CreateRoute(string hexRoute)
        {
            var result = OctRoute.Parse(hexRoute);

            return(result);
        }