本文整理汇总了C#中Interface.GetByteTab方法的典型用法代码示例。如果您正苦于以下问题:C# Interface.GetByteTab方法的具体用法?C# Interface.GetByteTab怎么用?C# Interface.GetByteTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interface
的用法示例。
在下文中一共展示了Interface.GetByteTab方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConfiguration
/// <summary>
/// Get the configuration from interface
/// </summary>
/// <returns>True if it successfull or false otherwise</returns>
public override bool GetConfiguration(Options options, Interface inter)
{
bool res = true;
try
{
inter.WriteMessage("\n*** Ethernet configuration ***\n");
if (options.Mac == null)
struc.Mac = inter.GetByteTab("Enter the mac address of Rpleth", 6, ':', 16, false);
else
{
try
{
struc.Mac = StringHelper.StringToByteTab(options.Mac, 6, ':', 16);
}
catch (Exception)
{
struc.Mac = inter.GetByteTab("Enter the mac address of Rpleth", 6, ':', 16, false);
}
}
if (options.Dhcp == -1)
struc.Dhcp = inter.GetByte("Disable the dhcp ?\nEnter 0 to disable or 1 to enable.", false);
else
struc.Dhcp = Convert.ToByte(options.Dhcp);
if (struc.Dhcp == 0)
{
if (options.Ip == null)
struc.Ip = inter.GetByteTab("Enter the ip address of Rpleth", 4, '.', false);
else
{
try
{
struc.Ip = StringHelper.StringToByteTab(options.Ip, 4, '.');
}
catch (Exception)
{
struc.Ip = inter.GetByteTab("Enter the ip address of Rpleth", 4, '.', false);
}
}
if (options.Subnet == null)
struc.Subnet = inter.GetByteTab("Enter the subnet address for Rpleth", 4, '.', false);
else
{
try
{
struc.Subnet = StringHelper.StringToByteTab(options.Subnet, 4, '.');
}
catch (Exception)
{
struc.Subnet = inter.GetByteTab("Enter the subnet address for Rpleth", 4, '.', false);
}
}
if (options.Gateway == null)
struc.Gateway = inter.GetByteTab("Enter the gateway address for Rpleth", 4, '.', false);
else
{
try
{
struc.Gateway = StringHelper.StringToByteTab(options.Gateway, 4, '.');
}
catch (Exception)
{
struc.Gateway = inter.GetByteTab("Enter the gateway address for Rpleth", 4, '.', false);
}
}
}
if (options.Port == -1)
struc.Port = Convert.ToUInt16(inter.GetUint("Enter the port number that listen Rpleth", false));
else
struc.Port = Convert.ToUInt16(options.Port);
inter.WriteMessage("\n*** Rpleth configuration ***\n");
if (options.Welcome == null)
struc.Message = inter.GetMessage("Enter the welcome message of Rpleth", false);
else
struc.Message = options.Welcome;
}
catch (Exception)
{
res = false;
}
return res;
}
示例2: GetConfiguration
/// <summary>
/// Get the configuration from interface
/// </summary>
/// <returns>True if it successfull or false otherwise</returns>
public override bool GetConfiguration(Options options, Interface inter)
{
bool res = true;
try
{
inter.WriteMessage("\n*** Rpleth Target Information ***\n");
while (struc.TargetIp == null)
{
try
{
if (options.TargetIp == null)
struc.TargetIp = inter.GetByteTab("Enter the ip address of Rpleth", 4, '.', false, ref TargetIp);
else
{
struc.TargetIp = StringHelper.StringToByteTab(options.TargetIp, 4, '.');
options.TargetIp = null;
}
}
catch (Exception)
{ }
}
while (struc.TargetPort == 0)
{
try
{
if (options.TargetPort == -1)
struc.TargetPort = Convert.ToUInt16(inter.GetUint("Enter the port number that listen the Target Rpleth", false));
else
{
struc.TargetPort = Convert.ToUInt16(options.TargetPort);
options.TargetPort = -1;
}
}
catch (Exception)
{ }
options.TargetPort = struc.TargetPort;
}
inter.WriteMessage("\n*** Rpleth configuration ***\n");
if (options.Mac == null)
struc.Mac = inter.GetByteTab("Enter the mac address of Rpleth", 6, ':', 16, true);
else
{
try
{
struc.Mac = StringHelper.StringToByteTab(options.Mac, 6, ':', 16);
}
catch (Exception)
{
struc.Mac = inter.GetByteTab("Enter the mac address of Rpleth", 6, ':', 16, true);
}
}
if (options.Dhcp == -1)
struc.Dhcp = inter.GetByte("Disable the dhcp ?\nEnter 0 to disable or 1 to enable", true);
else
struc.Dhcp = Convert.ToByte(options.Dhcp);
if (options.Ip == null)
struc.Ip = inter.GetByteTab("Enter the ip address of Rpleth", 4, '.', true);
else
{
try
{
struc.Ip = StringHelper.StringToByteTab(options.Ip, 4, '.');
}
catch (Exception)
{
struc.Ip = inter.GetByteTab("Enter the ip address of Rpleth", 4, '.', true);
}
}
if (options.Subnet == null)
struc.Subnet = inter.GetByteTab("Enter the subnet address for Rpleth", 4, '.', true);
else
{
try
{
struc.Subnet = StringHelper.StringToByteTab(options.Subnet, 4, '.');
}
catch (Exception)
{
struc.Subnet = inter.GetByteTab("Enter the subnet address for Rpleth", 4, '.', true);
}
}
if (options.Gateway == null)
struc.Gateway = inter.GetByteTab("Enter the gateway address for Rpleth", 4, '.', true);
else
{
//.........这里部分代码省略.........