private static void EthernetHelp() { foreach (var ethernet in Enum.GetValues(typeof(ProtocolHelper.EthernetType))) { foreach (var frame in Enum.GetValues(typeof(ProtocolHelper.FrameLength))) { ConsoleColorWrite(string.Format( "{0}, {1}: ", (ProtocolHelper.EthernetType)ethernet, frame), ConsoleColor.Green, false); Console.WriteLine(string.Format("{0} frame/sec", ProtocolHelper.GetCapacity((ProtocolHelper.EthernetType)ethernet, (ProtocolHelper.FrameLength)frame))); } Console.WriteLine(); } }
private double ParseEthernet(XElement element) { var ethernetType = (ProtocolHelper.EthernetType)Enum.Parse(typeof(ProtocolHelper.EthernetType), element.Attribute("Type").Value); int frameLength; try { frameLength = int.Parse(element.Attribute("FrameLength").Value); } catch (FormatException) { frameLength = (int)Enum.Parse(typeof(ProtocolHelper.FrameLength), element.Attribute("FrameLength").Value); } return(ProtocolHelper.GetCapacity(ethernetType, frameLength)); }