本文整理汇总了C#中Console.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# Console.WriteLine方法的具体用法?C# Console.WriteLine怎么用?C# Console.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console.WriteLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button2_Click
private void Button2_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Parts List File (*.list)|*.list";
open.FileName = "";
if (open.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
return;
System.IO.StreamReader read = new System.IO.StreamReader(open.FileName);
open.Dispose();
string str = read.ReadToEnd();
Console c = new Console();
//if (Convert.ToBoolean(Form1.AllocConsole()))
//{
c.WriteLine("Analyzing parts.list file...");
if (Common.CheckPartList(str) == false)
{
return;
}
c.WriteLine("Successful. Importing parts.list...");
Parts.Clear();
Carbon.Properties.Settings.Default.PartList = str;
Carbon.Properties.Settings.Default.Save();
Parts = Common.LoadPartList(Carbon.Properties.Settings.Default.PartList);
PartsListLoaded = true;
c.WriteLine("Successful.");
//Form1.FreeConsole();
MessageBox.Show("Import was successful.");
}
示例2: CheckPartList
//.........这里部分代码省略.........
//Console.WriteLine("Found " + p3[0]);
name = p3[1];
npart.Name = p3[1];
break;
case "RawName":
//Console.WriteLine("Found " + p3[0]);
npart.RawName = p3[1];
break;
case "Thrust":
//Console.WriteLine("Found " + p3[0]);
npart.Thrust = Convert.ToDouble(p3[1]);
break;
case "ISP":
//Console.WriteLine("Found " + p3[0]);
npart.ISP = Convert.ToInt32(p3[1]);
break;
case "LiquidFuel":
//Console.WriteLine("Found " + p3[0]);
npart.LiquidFuel = Convert.ToDouble(p3[1]);
break;
case "SolidFuel":
//Console.WriteLine("Found " + p3[0]);
break;
case "XenonGas":
//Console.WriteLine("Found " + p3[0]);
break;
case "Oxidizer":
//Console.WriteLine("Found " + p3[0]);
npart.Oxidizer = Convert.ToDouble(p3[1]);
break;
case "MonoPropellant":
//Console.WriteLine("Found " + p3[0]);
npart.MonoPropellant = Convert.ToDouble(p3[1]);
break;
case "ElectricCharge":
//Console.WriteLine("Found " + p3[0]);
npart.Electricity = Convert.ToDouble(p3[1]);
break;
case "IntakeAir":
//Console.WriteLine("Found " + p3[0]);
break;
case "Mass":
//Console.WriteLine("Found " + p3[0]);
npart.Mass = Convert.ToDouble(p3[1]);
break;
case "DryMass":
//Console.WriteLine("Found " + p3[0]);
npart.DryMass = Convert.ToDouble(p3[1]);
break;
case "Cost":
//Console.WriteLine("Found " + p3[0]);
npart.Cost = Convert.ToInt32(p3[1]);
break;
case "IsEngine":
//Console.WriteLine("Found " + p3[0]);
npart.IsEngine = Convert.ToBoolean(p3[1]);
break;
case "IsAirEngine":
//Console.WriteLine("Found " + p3[0]);
npart.IsAirEngine = Convert.ToBoolean(p3[1]);
break;
case "IsIntake":
//Console.WriteLine("Found " + p3[0]);
npart.IsIntake = Convert.ToBoolean(p3[1]);
break;
case "IsDrainingElectricity":
//Console.WriteLine("Found " + p3[0]);
npart.IsDrainingElectricity = Convert.ToBoolean(p3[1]);
break;
case "ElectricityDrainRate":
//Console.WriteLine("Found " + p3[0]);
npart.ElectricityDrainRate = Convert.ToSingle(p3[1]);
break;
default:
if (ignorelist.Contains(p3[0]))
continue;
Console.WriteLine("Found unknown string/value: " + p3[0]);
/*Console.WriteLine("Allow? (y/n)");
if (Console.ReadKey().KeyChar.ToString() == "y" | Console.ReadKey().KeyChar.ToString() == "Y")
{*/
ignorelist = ignorelist + p3[0];
/*
}
else
{
throw new Exception("Found unknown string/value");
} */
break;
}
}
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Found Error: " + ex.Message + Environment.NewLine + "part.list file import failed");
success = false;
}
Console.Hide();
return success;
}