private void ConvertMacAddress() { try { MACFormat format = Network.GetMacFormat(txtMacAddress.Text); MACNotation notation = GetMacNotation(); uDebugLogAdd($"Converting MAC address [f]{format.ToString()} [n]{notation.ToString()} [a]{txtMacAddress.Text}"); string macAddr = txtMacAddress.Text.Replace(":", "").Replace("-", "").Replace(".", ""); if (notation == MACNotation.Uppercase) { lblMacAddressDashValue.Text = Network.ConvertMacAddrToDashNotation(macAddr).ToUpper(); lblMacAddressColValue.Text = Network.ConvertMacAddrToColonNotation(macAddr).ToUpper(); lblMacAddressNetValue.Text = Network.ConvertMacAddrToNetNotation(macAddr).ToUpper(); uDebugLogAdd("Set MAC Addresses to Upper"); } else if (notation == MACNotation.Lowercase) { lblMacAddressDashValue.Text = Network.ConvertMacAddrToDashNotation(macAddr).ToLower(); lblMacAddressColValue.Text = Network.ConvertMacAddrToColonNotation(macAddr).ToLower(); lblMacAddressNetValue.Text = Network.ConvertMacAddrToNetNotation(macAddr).ToLower(); uDebugLogAdd("Set MAC Addresses to Lower"); } } catch (Exception ex) { LogException(ex); } }
private MACNotation GetMacNotation() { MACNotation notation = MACNotation.Lowercase; if (togMACCase.IsChecked == true) { notation = MACNotation.Uppercase; } else { notation = MACNotation.Lowercase; } return(notation); }
public MacPopup(string str = null, MACNotation notation = MACNotation.Lowercase) { try { InitializeComponent(); this.txtMacAddress.Text = str != null ? str : "FF:FF:FF:FF:FF:FF"; if (str != null) { ConvertMacAddress(); } } catch (Exception ex) { LogException(ex); } }