Seems like I recall another message about the below code not working
because of intpr or something?  Anyway, I need the MACAdress anyone have
any ideas?

 

 

private String getMacAddress()

        {

            String macAddress = String.Empty;

            try

            {

                foreach (System.Net.NetworkInformation.NetworkInterface
networkInterface in
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
)

                {

                    try

                    {

                        if
(!String.IsNullOrEmpty(networkInterface.GetPhysicalAddress().ToString())
&& 

 
!networkInterface.GetPhysicalAddress().ToString().StartsWith("0000"))

                        {

                            macAddress +=
(networkInterface.GetPhysicalAddress().ToString()) + "-";

                        }

                    }

                    catch { }

                }

                if (!String.IsNullOrEmpty(macAddress))

                {

                    if (macAddress.EndsWith("-"))

                    {

                        macAddress = macAddress.Substring(0,
macAddress.Length - 2);

                    }

                }

            }

            catch (Exception ex)

            {

                System.Diagnostics.StackTrace stackTrace = new
System.Diagnostics.StackTrace();

                String method = stackTrace.GetFrame(0).GetMethod().Name;

                log.writeLogInfo("ERROR " + method + ":", ex.Message +
System.Environment.NewLine + ex.StackTrace.ToString());

            }

            if (string.IsNullOrEmpty (macAddress)) 

            {

                macAddress = "none";

            }

            return macAddress;

        }

 

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to