本文整理汇总了C#中Console类的典型用法代码示例。如果您正苦于以下问题:C# Console类的具体用法?C# Console怎么用?C# Console使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Console类属于命名空间,在下文中一共展示了Console类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
private void Awake()
{
Inst = this;
ListCommand = new List<DescriptionConsoleMethod>();
foreach (var item in typeof(Console).GetMethods())
{
if (Attribute.IsDefined(item, typeof(ConsoleMethodAttribute)))
{
var attr = Attribute.GetCustomAttribute(item, typeof(ConsoleMethodAttribute)) as ConsoleMethodAttribute;
var paramList = new List<Tuple<string, string>>();
if (!string.IsNullOrEmpty(attr.Params))
{
paramList.AddRange(attr.Params.Split(';').Select(param => param.Split(',')).Select(mas => new Tuple<string, string>(mas[0], mas[1])));
}
ListCommand.Add(new DescriptionConsoleMethod
{
Name = item.Name,
Description = attr.Name,
Params = paramList
});
}
}
}
开发者ID:PhilipMantrov,项目名称:Jeka3,代码行数:28,代码来源:Console.cs
示例2: Main
public static int Main(string[] args)
{
try
{
var arguments = Args.InvokeAction<Arguments>(args).Args;
IPackageSourceFileFactory packageSourceFileFactory = new PackageSourceFileFactory();
var packageSourceFile = packageSourceFileFactory.CreatePackageSourceFile();
var packageManager = new PackageManagerModule(packageSourceFile);
var packageSource = string.IsNullOrWhiteSpace(arguments.Source)
? packageManager.ActiveSource
: packageManager.GetSource(arguments.Source);
var sourceFactory = new SourcePackageRepositoryFactory(packageSource);
IPackageInstallerFactory factory = new PackageInstallerFactory(
sourceFactory, new SystemConfigurationManager(), new PhysicalDirectorySystem());
var installer = factory.CreatePackageInstaller(arguments.Destination, arguments.Configuration);
var program = new Console(arguments, installer);
return program.Start();
}
catch (Exception)
{
System.Console.WriteLine(ArgUsage.GetUsage<Arguments>());
return 1;
}
}
开发者ID:alexfalkowski,项目名称:NuGet.AdvancedPackagingTool,代码行数:25,代码来源:Program.cs
示例3: FWCAntForm
public FWCAntForm(Console c)
{
InitializeComponent();
console = c;
FWC.GetRX2OK(out rx2_ok);
RX2OK = rx2_ok;
if(RX2OK)
{
uint temp;
FWC.GetRFIORev(out temp);
if((temp&0xFF) < 34)
comboRX2Ant.Items.Remove("ANT 1");
}
// Set mode first
ArrayList a = DB.GetVars("FWCAnt");
a.Sort();
foreach(string s in a)
{
if(s.StartsWith("radModeExpert") && s.IndexOf("True") >= 0)
{
radModeExpert.Checked = true;
break;
}
}
Common.RestoreForm(this, "FWCAnt", false);
if(radModeSimple.Checked)
radModeSimple_CheckedChanged(this, EventArgs.Empty);
}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:32,代码来源:fwcAntForm.cs
示例4: FWCCalForm
public FWCCalForm(Console c)
{
InitializeComponent();
console = c;
switch (console.CurrentModel)
{
case Model.FLEX5000:
if (!FWCEEPROM.RX2OK)
{
grpRX2.Visible = false;
this.Height -= grpRX2.Height;
}
break; // do nothing
case Model.FLEX3000:
this.Text = this.Text.Replace("FLEX-5000", "FLEX-3000");
grpRX2.Visible = false;
this.Height -= grpRX2.Height;
break;
case Model.FLEX1500:
this.Text = this.Text.Replace("FLEX-5000", "FLEX-1500");
grpRX2.Visible = false;
btnResetTRXChecksums.Visible = false;
grpTRX.Height -= btnResetTRXChecksums.Height;
this.Height -= (grpRX2.Height + btnResetTRXChecksums.Height);
break;
}
}
开发者ID:wa1gon,项目名称:PowerSDR,代码行数:27,代码来源:fwcCalForm.cs
示例5: Pack
public static Response Pack(NuGetPackRequest request)
{
var console = new Console();
PackageBuilder builder = new PackageBuilder();
var command = new PackCommand
{
BasePath = PathTools.OptimizePath(request.BaseDirectory),
OutputDirectory = PathTools.OptimizePath(request.OutputDirectory),
Version = request.Version,
Console = console,
Verbosity = Verbosity.Detailed,
Rules = new IPackageRule[0],
};
command.Arguments.Add(request.SpecPath);
try
{
command.Execute();
}
catch (Exception e)
{
console.WriteError(e);
}
return new Response(console.Messages);
}
开发者ID:penartur,项目名称:micro-build-server,代码行数:26,代码来源:NuGetter.cs
示例6: PreSelForm
public PreSelForm(Console c)
{
InitializeComponent();
console = c;
mox = c.MOX;
UpdatePreSel();
}
开发者ID:HosokawaKenchi,项目名称:powersdr-if-stage,代码行数:7,代码来源:PreSelForm.cs
示例7: DebugForm
public DebugForm(Console c, bool enable_debug)
{
try
{
this.AutoScaleMode = AutoScaleMode.Inherit;
InitializeComponent();
float dpi = this.CreateGraphics().DpiX;
float ratio = dpi / 96.0f;
string font_name = this.Font.Name;
float size = (float)(8.25 / ratio);
System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
this.Font = new_font;
this.PerformAutoScale();
this.PerformLayout();
console = c;
if (enable_debug)
{
chkAudio.Checked = true;
chkCAT.Checked = true;
chkConsole.Checked = true;
chkDirectX.Checked = true;
chkEthernet.Checked = true;
chkIRRemote.Checked = true;
chkUSB.Checked = true;
}
}
catch (Exception ex)
{
Debug.Write(ex.ToString());
}
}
开发者ID:Dfinitski,项目名称:genesisradio,代码行数:32,代码来源:DebugForm.cs
示例8: FWCMixForm
public FWCMixForm(Console c)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
console = c;
if(FWCEEPROM.Model == 0)
{
lblIntSpkr.Enabled = false;
tbIntSpkr.Enabled = false;
chkIntSpkrSel.Enabled = false;
}
Common.RestoreForm(this, "FWCMixer", false);
chkMicSel_CheckedChanged(this, EventArgs.Empty);
chkLineInRCASel_CheckedChanged(this, EventArgs.Empty);
chkLineInPhonoSel_CheckedChanged(this, EventArgs.Empty);
chkLineInDB9Sel_CheckedChanged(this, EventArgs.Empty);
chkIntSpkrSel_CheckedChanged(this, EventArgs.Empty);
chkExtSpkrSel_CheckedChanged(this, EventArgs.Empty);
chkHeadphoneSel_CheckedChanged(this, EventArgs.Empty);
chkLineOutRCASel_CheckedChanged(this, EventArgs.Empty);
tbMic_Scroll(this, EventArgs.Empty);
tbLineInRCA_Scroll(this, EventArgs.Empty);
tbLineInPhono_Scroll(this, EventArgs.Empty);
tbLineInDB9_Scroll(this, EventArgs.Empty);
tbIntSpkr_Scroll(this, EventArgs.Empty);
tbExtSpkr_Scroll(this, EventArgs.Empty);
tbHeadphone_Scroll(this, EventArgs.Empty);
tbLineOutRCA_Scroll(this, EventArgs.Empty);
}
开发者ID:wa1gon,项目名称:PowerSDR,代码行数:34,代码来源:fwcmixform.cs
示例9: SIOListenerII
public SIOListenerII(Console c)
{
console = c;
console.Activated += new EventHandler(console_Activated);
console.Closing += new System.ComponentModel.CancelEventHandler(console_Closing);
parser = new CATParser(console);
//event handler for Serial RX Events
SDRSerialPort.serial_rx_event += new SerialRXEventHandler(SerialRXEventHandler);
if ( console.CATEnabled ) // if CAT is on, fire it up
{
try
{
enableCAT();
}
catch ( Exception ex )
{
// fixme??? how cool is to to pop a msg box from an exception handler in a constructor ??
// seems ugly to me (wjt)
console.CATEnabled = false;
if ( console.setupForm != null )
{
console.setupForm.copyCATPropsToDialogVars(); // need to make sure the props on the setup page get reset
}
MessageBox.Show("Could not initialize CAT control. Exception was:\n\n " + ex.Message +
"\n\nCAT control has been disabled.", "Error Initializing CAT control",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
开发者ID:wa1gon,项目名称:PowerSDR,代码行数:31,代码来源:SIOListenerII.cs
示例10: SaveMem
public SaveMem(Console c)
{
InitializeComponent();
console = c;
InitAGCModes();
InitDSPModes();
comboGroup.DataSource = DB.dsMemory.Tables["GroupList"];
comboGroup.ValueMember = "GroupID";
comboGroup.DisplayMember = "GroupName";
comboMode.SelectedIndex = (int)console.RX1DSPMode;
if(console.RX1DSPMode != DSPMode.DRM &&
console.RX1DSPMode != DSPMode.SPEC)
comboFilter.SelectedIndex = (int)console.RX1Filter;
comboStepSize.SelectedIndex = console.StepSize;
comboAGC.SelectedIndex = (int)console.RX1AGCMode;
udSquelch.Value = console.Squelch;
txtFreq.Text = console.VFOAFreq.ToString("f6");
chkScan.Checked = true;
comboGroup.SelectedIndex = 0;
this.ActiveControl = btnOK; // OK has focus initially
}
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:25,代码来源:savemem.cs
示例11: ConsoleCommand
protected ConsoleCommand(Console console, string name, string info = "")
{
Console = console;
Name = name;
Args = "no arguments";
Info = info;
}
开发者ID:nitrocaster,项目名称:xrConsole,代码行数:7,代码来源:ConsoleCommand.cs
示例12: Main
static void Main(string[] args)
{
try {
var help = new Help(System.Console.Out);
if (help.AreHelpArguments(args)) {
help.PrintHelp();
} else {
var masterFiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "*" + Console.MasterConfigExtension);
Console console = new Console();
if (masterFiles.Length > 0) {
foreach (string masterConfigFileName in masterFiles) {
console.BuildConfigFilesFromMaster(masterConfigFileName);
}
} else {
System.Console.WriteLine(String.Format("could not find any files with extension `{0}'", Console.MasterConfigExtension));
}
}
}
catch (ConfgenException e)
{
System.Console.WriteLine(e.Message);
Environment.Exit(1);
}
catch (Exception e)
{
System.Console.WriteLine(e);
Environment.Exit(1);
}
}
开发者ID:refractalize,项目名称:confgen,代码行数:32,代码来源:Program.cs
示例13: FRdialog
public FRdialog(Info info, Console c, mainWindow m)
{
this.info = info;
InitializeComponent();
console = c;
mainWindow = m;
}
开发者ID:Mloc,项目名称:DreamEdit,代码行数:7,代码来源:FRdialog.cs
示例14: CWKeyer2
public CWKeyer2(Console c)
{
console = c;
hw = console.Hdw;
siolisten = console.Siolisten;
Thread.Sleep(50);
DttSP.NewKeyer(600.0f, true, 0.0f, 3.0f, 25.0f, (float)Audio.SampleRate1);
RadioDSP.KeyerIambicMode = 0;
Thread.Sleep(50);
CWTone = new Thread(new ThreadStart(DttSP.KeyerSoundThread));
CWTone.Name = "CW Sound Thread";
CWTone.Priority = ThreadPriority.Highest;
CWTone.IsBackground = true;
CWTone.Start();
Keyer = new Thread(new ThreadStart(KeyThread));
Keyer.Name = "CW KeyThread";
Keyer.Priority = ThreadPriority.Highest;
Keyer.IsBackground = true;
Keyer.Start();
timer = new HiPerfTimer();
}
开发者ID:ae6jl-mdd,项目名称:powersdr-iq,代码行数:25,代码来源:cwkeyer.cs
示例15: ConsoleInput
public ConsoleInput(Console.IViewer viewer)
{
_Viewer = viewer;
_Doskey = new Doskey(10);
_Prompt = ">>";
}
开发者ID:jiowchern,项目名称:Regulus,代码行数:7,代码来源:ConsoleInput.cs
示例16: ShouldCreateConfigFileForNamedEnv
public void ShouldCreateConfigFileForNamedEnv()
{
var masterConfig = new XElement("stuff",
new XAttribute(Console.BuildConfigForAttribute, "dev, systest, uat"),
new XElement("dome", new XAttribute("name", "7")),
new XElement("hill", new XElement("speed", new XAttribute(ConfigurationGenerator.ForEnvironmentsAttribute, "systest"), "some text")),
new XElement("development", new XAttribute(ConfigurationGenerator.ForEnvironmentsAttribute, Console.DefaultEnvironment), 4));
var config = new XElement("stuff",
new XElement("dome", new XAttribute("name", "7")),
new XElement("hill", new XElement("speed", "some text")));
var diskAccessMock = new Mock<IXmlLoaderSaver>();
const string masterFileName = "app.master.config";
diskAccessMock.Setup(ls => ls.Load(masterFileName)).Returns(new XDocument(masterConfig));
XDocument exportedConfig = null;
diskAccessMock.Setup(ls => ls.Save(It.IsAny<XDocument>(), "the.config")).Callback<XDocument, string>((doc, fn) => exportedConfig = doc);
var console = new Console();
console.BuildConfigFilesFromMaster(masterFileName, "the.config", "systest", diskAccessMock.Object);
Assert.That(exportedConfig, Is.Not.Null);
Assert.AreEqual(config.ToString(), exportedConfig.ToString());
}
开发者ID:refractalize,项目名称:confgen,代码行数:26,代码来源:ConsoleTest.cs
示例17: FlexControlBasicForm
public FlexControlBasicForm(Console c)
{
InitializeComponent();
console = c;
// setup the actual FlexControl Interface
fc_interface = new FlexControlInterface2(c);
// populate knob combobox controls
foreach (FlexControlKnobFunction function in Enum.GetValues(typeof(FlexControlKnobFunction)))
{
string s = KnobFunction2String(function);
comboButtonLeft.Items.Add(s);
comboButtonMid.Items.Add(s);
comboButtonRight.Items.Add(s);
comboButtonKnob.Items.Add(s);
}
// setup defaults
comboButtonLeft.Text = "Tune RIT";
comboButtonMid.Text = "Audio Gain";
comboButtonRight.Text = "Tune VFO B";
comboButtonKnob.Text = "Tune VFO A";
// restore any saved configuration
Common.RestoreForm(this, "FlexControlBasicForm", false);
}
开发者ID:wa1gon,项目名称:PowerSDR,代码行数:27,代码来源:FlexControlBasicForm.cs
示例18: SetupConsole
public void SetupConsole()
{
if (Console.instance != null)
return;
Console.instance = this;
this.Text = "";
}
开发者ID:snbolierakis,项目名称:mgrenier,代码行数:8,代码来源:Console.cs
示例19: btnTest_Click
private void btnTest_Click(object sender, EventArgs e)
{
FillServer();
Console con = new Console(m_server);
con.ShowDialog(this);
m_invalid = !con.Passed;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:ServerEditor.cs
示例20: BenchmarkThread
public BenchmarkThread(Console console, BenchmarkArguments args, BenchmarkShared shared, Example example)
{
this.console = console;
this.args = args;
this.shared = shared;
this.example = example;
random = new RandomShift();
}
开发者ID:Caldas,项目名称:aerospike-client-csharp,代码行数:8,代码来源:BenchmarkThread.cs
注:本文中的Console类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论