public string loaddevices(){ string connectedDevicestring = ""; try { NetworkInfo connectedDevices = new NetworkInfo(); NetworkMap connectedDev = new NetworkMap(); connectedDevices = connectedDev.getNetworkMappingInfo(); connectedDevicestring = JsonConvert.SerializeObject(connectedDevices); } catch (Exception ex) { ErrorTracker.WriteErrorLog("networkmap.cs", "loaddevices", "", ex.Message, ex.StackTrace, "ERROR"); } return connectedDevicestring; }
public NetworkInfo getNetworkMappingInfo() { IPAddress routerIP = GetRouterIP(); NetworkInfo objNetworkInfo = new NetworkInfo(); //var localmachine = NetworkBrowser.getMachineInfo(); //objNetworkInfo.HostName = localmachine.HostName; //objNetworkInfo.IPAddress = localmachine.IPAddress; //objNetworkInfo.MACAddress = localmachine.MACAddress; //objNetworkInfo.MachineName = localmachine.MachineName; //objNetworkInfo.AddressFamily = localmachine.AddressFamily; objNetworkInfo.IPAddress = routerIP.ToString(); objNetworkInfo.MACAddress = NetworkBrowser.GetMacAddress((IPAddress)routerIP).ToString(); objNetworkInfo.Status = "Online"; objNetworkInfo.DeviceList = getNetworkMapping(); return objNetworkInfo; }