//other constructor, used exclusively for editing in forge mode //sets the console up for forge world use public ConsoleForm() { InitializeComponent(); this.ConsoleType = ConsoleApp.ForgeMode; this.Opacity = 0.93; this.WindowState = FormWindowState.Maximized; this.TopMost = true; UpdatePrompts(); }
public ConsoleForm(ConsoleApp TypeArg) { InitializeComponent(); //beeps when created Console.Beep(); ConsoleType = TypeArg; //works backwords from the executable to find the directory of the exectuables (found with the other content) ContentDirectory = Directory.GetParent(Directory.GetParent(Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()).ToString()).ToString()).ToString(); UpdatePrompts(); }
/// <summary> /// Run ping.exe asynchronously and return roundtrip times back to the caller in a callback /// </summary> /// <param name="url"></param> /// <param name="replyHandler"></param> public static void PingUrl(string url, Action<string> replyHandler) { var regex = new Regex("(time=|Average = )(?<time>.*?ms)", RegexOptions.Compiled); var app = new ConsoleApp("ping", url); app.ConsoleOutput += (o, args) => { var match = regex.Match(args.Line); if (match.Success) { var roundtripTime = match.Groups["time"].Value; replyHandler(roundtripTime); } }; app.Run(); }
public static void Run(ConsoleApp app, WinFormsTestConsole console, Action input) { var form = new Form(); form.BackColor = Color.Black; form.Width = console.Width; form.Height = console.Height; var oldProvider = ConsoleProvider.Current; form.Controls.Add(console); app.Stopped.SubscribeForLifetime(() => { Application.Exit(); }, app.LifetimeManager); var task = app.Start(); Task.Factory.StartNew(input); Application.Run(form); }
private static int Main(string[] args) { ConsoleApp consoleApp = new ConsoleApp(args); return(consoleApp.Process()); }
public void Main() { var items = new List <Item>(); for (var i = 0; i < 100; i++) { items.Add(new Item() { Bar = "Bar" + i, Foo = "Foo" + i, }); } var app = new ConsoleApp(); var dataGrid = new ListGrid <Item>(new ListGridOptions <Item>() { SelectionMode = DataGridSelectionMode.Cell, DataSource = new SlowList(items), Columns = new List <ListGridColumnDefinition <Item> >() { new ListGridColumnDefinition <Item>() { Header = "Foo".ToGreen(), Width = .25, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Foo.ToConsoleString() } }, new ListGridColumnDefinition <Item>() { Header = "Bar".ToRed(), Width = .25, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Bar.ToConsoleString() } }, new ListGridColumnDefinition <Item>() { Header = "Foo2".ToGreen(), Width = .15, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Foo.ToConsoleString() } }, new ListGridColumnDefinition <Item>() { Header = "Bar2".ToRed(), Width = .15, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Bar.ToConsoleString() } }, new ListGridColumnDefinition <Item>() { Header = "Foo3".ToGreen(), Width = .15, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Foo.ToConsoleString() } }, new ListGridColumnDefinition <Item>() { Header = "Bar3".ToRed(), Width = .15, Type = GridValueType.Percentage, Formatter = (item) => new Label() { Text = item.Bar.ToConsoleString() } } } }); app.LayoutRoot.Add(dataGrid).Fill(); app.Start().Wait(); return; var winSound = new WindowsSoundProvider.SoundProvider(); Sound.Provider = winSound; winSound.StartPromise.Wait(); new DemoMultiPlayerGameApp().Start().Wait(); Sound.Dispose(); }
public static IConsoleAppBuilder <Application> ConsoleAppBuilder(string[] args) => ConsoleApp.DefaultBuilder <Application>(args);
public void Afficher() { ConsoleApp.WriteLine("nom: " + nom + ", prénom: " + prenom); }
/// <summary> /// Run simplest shell command and return its output. /// </summary> /// <returns></returns> public static string GetWindowsVersion() { return(ConsoleApp.Run("cmd", "/c ver").Output.Trim()); }
public void PositionWindow(Demo2Input input) { Console.SetWindowSize(45, 20); Console.SetBufferSize(45, 20); ConsoleApp.MoveWindow(25, 100); }
public static void Main() { ConsoleApp app = new ConsoleApp(); app.Run(); }
public static async Task Main(string[] args) { var configuration = GetServiceImplementation <IConfig>(); await ConsoleApp.Present(configuration); }
//method for all the end code for any console app private void EndApp() { Console.Beep(); this.ProgramOutput(Environment.NewLine + "Good-Bye!"); this.ConsoleType = ConsoleApp.MainMenu; Thread.Sleep(500); UpdatePrompts(); }
//default method/menu to run all other apps public void MainMenuSys() { //clear last output after the next bit was entered this.textBox2.Clear(); String ReadLine = this.textBox1.Text; //waits for user input //this.ProgramPrompt("Console_Input: "); //ReadLine = this.ReadLine(); //checks the command, then does appropriate code if (ReadLine == ProjectKeywords.GuitarApp + ProjectKeywords.Executable) { this.RunExecutable(@"GuitarAppDestribution\" + ProjectKeywords.GuitarExe + ProjectKeywords.Executable); //reset console when this process is dead EndApp(); } if (ReadLine == ProjectKeywords.GLaDOSSings + ProjectKeywords.Executable) { this.RunExecutable(ProjectKeywords.GLaDOSExe + ProjectKeywords.Executable); //reset console when this process is dead EndApp(); } if (ReadLine == ProjectKeywords.TemperatureConverter + ProjectKeywords.Executable) { this.RunExecutable(ProjectKeywords.TemperatureConverterExe + ProjectKeywords.Executable); EndApp(); } if (ReadLine == ProjectKeywords.PortalCardGame + ProjectKeywords.Executable) { this.RunExecutable(@"MyCardGame\GameFiles\" + ProjectKeywords.PortalCardGameExe + ProjectKeywords.Executable); EndApp(); } if (ReadLine == ProjectKeywords.MathTrivia + ProjectKeywords.Executable) { this.RunExecutable(ProjectKeywords.MathTriviaExe + ProjectKeywords.Executable); EndApp(); } if (ReadLine == ProjectKeywords.Calculator + ProjectKeywords.Executable) { this.RunExecutable(ProjectKeywords.CalculatorExe + ProjectKeywords.Executable); EndApp(); } if (ReadLine == ProjectKeywords.GreatGatsby + ProjectKeywords.Executable) { this.RunExecutable(ProjectKeywords.GreatGatsbyExe + ProjectKeywords.Executable); EndApp(); } //simple math functions..homage to our first/earliest programs if (ReadLine == ProjectKeywords.RandomNums + ProjectKeywords.MathExe) { this.ConsoleType = ConsoleApp.RanNum; this.UpdatePrompts(); } if (ReadLine == ProjectKeywords.RanProbability + ProjectKeywords.MathExe) { //creates a new Console window over the main menu this.ConsoleType = ConsoleApp.RanProb; this.UpdatePrompts(); } if (ReadLine == ProjectKeywords.Binary + ProjectKeywords.MathExe) { this.ConsoleType = ConsoleApp.RanBinary; this.UpdatePrompts(); } if (ReadLine == ProjectKeywords.FibonacciSeq + ProjectKeywords.MathExe) { this.ConsoleType = ConsoleApp.Fibinacci; this.UpdatePrompts(); } //help menu/exit stuff if(ReadLine == "Help") { this.ProgramOutput("Type 'Exit' to leave any console application."); this.ProgramOutput(Environment.NewLine+"Otherwise: Please contact our benefactor, the network administrator."); } if(ReadLine == "Exit") { Console.Beep(); this.ProgramOutput(Environment.NewLine+"Good-Bye!"); Thread.Sleep(500); this.Dispose(); //Environment.Exit(0); } //clear for the next entry this.textBox1.Clear(); }
/// <summary> /// Get Windows firewall rule /// </summary> /// <param name="ruleName"></param> /// <returns></returns> public static string GetFirewallRule(string ruleName) { var cmdLine = string.Format("advfirewall firewall show rule \"{0}\" verbose", ruleName); return(ConsoleApp.Run("netsh", cmdLine).Output.Trim()); }
public void FingerTemplatesUpdate() { try { //if (Util.IsOnline==false )return; ConsoleApp.WriteLine(Application.ProductName, "Start uploading data to server."); DateTime _ProfileLastUpdate; _dcProfile_OleDb = new dcProfile_OleDb(); _dcProfile_OleDb.DBConn.Open(); OleDbCommand _cmd2 = new OleDbCommand("select * from updatelog", _dcProfile_OleDb.DBConn); OleDbDataReader _dr2 = _cmd2.ExecuteReader(CommandBehavior.CloseConnection); Trans = _dcProfile_OleDb.DBConn.BeginTransaction(); if (_dr2.HasRows == false) { this.SelectParameters.Add("p_ClientId", ClientSettings.ClientWorkStationInfo.ClientId); this.SelectParameters.Add("p_ApplicationId", ClientSettings.ClientWorkStationInfo.ApplicationId); this.CountParameters.Add("p_ClientId", ClientSettings.ClientWorkStationInfo.ClientId); this.CountParameters.Add("p_ApplicationId", ClientSettings.ClientWorkStationInfo.ApplicationId); this.CountParameters.Add("p_RecordCount", SqlDbType.Int, ParameterDirection.Output); this.CountParameters.Add("p_IsCount", true); this.DataRowPosition.TotalRecords = this.GetRecordCount("p_RecordCount"); this.GetDataSource(); ConsoleApp.WriteLine(Application.ProductName, "Get new records from the live server"); this.InsertNewDataLocalDB(this.List); UpdateLastUpdate(); } else { _dr2.Read(); _ProfileLastUpdate = Convert.ToDateTime(_dr2["ProfileLastUpdate"]); ConsoleApp.WriteLine(Application.ProductName, "Get newest created and updated records from the live server"); List <Profile> _NewList = this.GetNewDataFromServer(_ProfileLastUpdate); List <Profile> _UpdatedList = this.GetUpdatedDataFromServer(_ProfileLastUpdate); this.InsertNewDataLocalDB(_NewList); this.UpdateLocalDB(_UpdatedList); if (_NewList.Count > 0 || _UpdatedList.Count > 0) { UpdateLastUpdate(); } } Trans.Commit(); _dcProfile_OleDb.DBConn.Close(); ConsoleApp.WriteLine(Application.ProductName, "Migrating finger templates has been done."); } catch (Exception ex) { try { Trans.Rollback(); } catch {} ConsoleApp.WriteLine(Application.ProductName, "[Error]," + ex.ToString()); zsi.PhotoFingCapture.Util.LogError(ex.ToString()); } }
static void Main() { ConsoleApp consoleApp = new ConsoleApp(); consoleApp.Process(); }
public string LaunchProcess(string parameters) { return(ConsoleApp.Run(pathToExeFile, parameters).Output.Trim()); }
private static void Main(string[] args) { ConsoleApp consoleApp = new ConsoleApp(args); consoleApp.Parse(); consoleApp.Process(); }
public void Init() { console = new CliUnitTestConsole(); ConsoleProvider.Current = console; app = new ConsoleApp(0, 0, 80, 80); }
public void PositionWindow() { Console.SetWindowSize(45, 20); Console.SetBufferSize(45, 20); ConsoleApp.MoveWindow(450, 100); }
static void Main(string[] args) { var consoleApp = new ConsoleApp(); consoleApp.Run(args); }