public WatchListAutoCompleteCell() { InitializeComponent(); console = new ConsoleControl(); console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered); console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown); console.LostFocus += new RoutedEventHandler(console_LostFocus); console.HideScrollBar(); ConsolePanel.Content = console; // get language if (ProjectService.CurrentProject == null) language = "C#"; else language = ProjectService.CurrentProject.Language; resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); // FIXME set language if (language == "VB" || language == "VBNet") { console.SetHighlighting("VBNET"); } else { console.SetHighlighting("C#"); } }
public WatchListAutoCompleteCell() { InitializeComponent(); console = new ConsoleControl(); console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered); console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown); console.LostFocus += new RoutedEventHandler(console_LostFocus); console.HideScrollBar(); ConsolePanel.Content = console; // get language if (ProjectService.CurrentProject == null) language = "C#"; else language = ProjectService.CurrentProject.Language; resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); // FIXME set language if (language == "VB" || language == "VBNet") { console.SetHighlighting("VBNET"); } else { console.SetHighlighting("C#"); } // get process WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { this.Process = e.Process; }; this.Process = debugger.DebuggedProcess; }
/// <summary> /// Обновляет все игровые объекты. /// </summary> private void UpdateGameObjects(List <GameObject> gameObjects) { foreach (var gameObject in gameObjects) { gameObject.Update(); } ConsoleControl.Update(); consoleListener.Update(); sceneLoader.Update(); }
public override int LengthInBufferCells(string s, int offset) { if (s != null) { return(ConsoleControl.LengthInBufferCells(s, offset)); } else { throw PSTraceSource.NewArgumentNullException("str"); } }
internal static int Start(RunspaceConfiguration configuration, string bannerText, string helpText, string preStartWarning, string[] args) { if (args != null) { ConsoleControl.UpdateLocaleSpecificFont(); return(ConsoleHost.Start(configuration, bannerText, helpText, preStartWarning, args)); } else { throw PSTraceSource.NewArgumentNullException("args"); } }
public override void SetBufferContents(Coordinates origin, BufferCell[,] contents) { ConsoleControl.CONSOLE_SCREEN_BUFFER_INFO cONSOLESCREENBUFFERINFO; if (contents == null) { PSTraceSource.NewArgumentNullException("contents"); } SafeFileHandle bufferInfo = ConsoleHostRawUserInterface.GetBufferInfo(out cONSOLESCREENBUFFERINFO); ConsoleHostRawUserInterface.CheckCoordinateWithinBuffer(ref origin, ref cONSOLESCREENBUFFERINFO, "origin"); ConsoleControl.WriteConsoleOutput(bufferInfo, origin, contents); }
private void RaiseKeyDownEvent(ref ConsoleControl console) { console.TextBoxInput.RaiseEvent( new KeyEventArgs( Keyboard.PrimaryDevice, new HwndSource(0, 0, 0, 0, 0, "", IntPtr.Zero), 0, Key.Down) { RoutedEvent = UIElement.PreviewKeyDownEvent } ); }
private ConsoleControl FindControlByAddress(string address) { ConsoleControl control = null; foreach (var channel in Channel) { control = channel.FindControlByAddress(address); if (control != null) { break; } } return(control); }
public HaShell(MainForm mainForm, ConsoleControl.ConsoleControl console) { this.console = console; this.mainForm = mainForm; this.console.OnConsoleInput += Console_OnConsoleInput; console.ClearOutput(); console.IsInputEnabled = true; if (console.IsHandleCreated) Console_HandleCreated(null, null); else console.HandleCreated += Console_HandleCreated; }
public static OSCPacket ControlToOSCPacket(ConsoleControl control, string address, int value) { OSCPacket packet = new OSCPacket(); char[] d = { '/' }; packet.Address = address; packet.Nodes = control.Address.Split(d); packet.ArgList = ",i"; OSCIntArg intArg = new OSCIntArg(); intArg.value = value; packet.Arguments.Add(intArg); return(packet); }
public static OSCPacket ControlToOSCPacket(ConsoleControl control, string value) { OSCPacket packet = new OSCPacket(); char[] d = { '/' }; packet.Address = control.Address; packet.Nodes = control.Address.Split(d); packet.ArgList = ",s"; OSCStringArg stringArg = new OSCStringArg(); stringArg.value = value; packet.Arguments.Add(stringArg); return(packet); }
public static OSCPacket ControlToOSCPacket(ConsoleControl control, float value) { OSCPacket packet = new OSCPacket(); char[] d = { '/' }; packet.Address = control.Address; packet.Nodes = control.Address.Split(d); packet.ArgList = ",f"; OSCFloatArg floatArg = new OSCFloatArg(); floatArg.value = value; packet.Arguments.Add(floatArg); return(packet); }
private void ThemeThisControl(ConsoleControl obj) { if (obj is ThemeAwareSpacialElementRenderer == false) { return; } if (themeProcessors.TryGetValue(obj.GetType(), out List <Action <ThemeAwareSpacialElementRenderer> > processors)) { foreach (var processor in processors) { processor((ThemeAwareSpacialElementRenderer)obj); } } }
public override void OnAdd(ConsoleControl parent) { base.OnAdd(parent); if (Width == 0) { Width = parent.Width; } if (Height == 0) { Height = parent.Height; } // start monitoring CPU and memory when added Task.Factory.StartNew(() => { WatchCPUAndMemory(); }); }
public override BufferCell[,] GetBufferContents(Rectangle region) { ConsoleControl.CONSOLE_SCREEN_BUFFER_INFO cONSOLESCREENBUFFERINFO; if (region.Right >= region.Left) { if (region.Bottom >= region.Top) { SafeFileHandle bufferInfo = ConsoleHostRawUserInterface.GetBufferInfo(out cONSOLESCREENBUFFERINFO); int x = cONSOLESCREENBUFFERINFO.BufferSize.X; int y = cONSOLESCREENBUFFERINFO.BufferSize.Y; if (region.Left >= x || region.Top >= y || region.Right < 0 || region.Bottom < 0) { ConsoleHostRawUserInterface.tracer.WriteLine("region outside boundaries", new object[0]); return(new BufferCell[0, 0]); } else { int num = Math.Max(0, region.Left); int num1 = Math.Min(x - 1, region.Right); int num2 = Math.Max(0, region.Top); int num3 = Math.Min(y - 1, region.Bottom); Coordinates coordinate = new Coordinates(num, num2); Rectangle left = new Rectangle(); left.Left = Math.Max(0, -region.Left); left.Top = Math.Max(0, -region.Top); left.Right = left.Left + num1 - num; left.Bottom = left.Top + num3 - num2; BufferCell[,] bufferCellArray = new BufferCell[region.Bottom - region.Top + 1, region.Right - region.Left + 1]; ConsoleControl.ReadConsoleOutput(bufferInfo, coordinate, left, ref bufferCellArray); return(bufferCellArray); } } else { object[] objArray = new object[2]; objArray[0] = "region.Bottom"; objArray[1] = "region.Top"; throw PSTraceSource.NewArgumentException("region", "ConsoleHostRawUserInterfaceStrings", "InvalidRegionErrorTemplate", objArray); } } else { object[] objArray1 = new object[2]; objArray1[0] = "region.Right"; objArray1[1] = "region.Left"; throw PSTraceSource.NewArgumentException("region", "ConsoleHostRawUserInterfaceStrings", "InvalidRegionErrorTemplate", objArray1); } }
private void RunDebug() { ConsoleControl.SetHandler((ConsoleControl.Handler)(ctrl => { if (ctrl != CtrlType.CTRL_C_EVENT) { return(false); } this.mStateMachine.RequestTermination(); return(true); })); this.OnStart(); Logger.Info("Waiting for signal from user"); this.mStateMachine.WaitForTermination(); this.OnStop(); }
public SpaceUpdater(ISceneProcesser sceneProcesser, ISceneLoader sceneLoader) { this.sceneLoader = sceneLoader; this.sceneProcesser = sceneProcesser; consoleListener = new ConsoleListener(c => { if (c == "end") { ConsoleControl.HideWindow(); } else { sceneProcesser.Process(c); } }); }
public PrimeForm() { _domInspectorForm = new Lazy <Form>(() => { _devToolControl = new DevToolControl(_browserControl.GetRect) { Engine = _browserControl.Engine }; _domTreeControl.NodeSelected += _domTreeControl_NodeSelected; var frm = _devToolControl.PopupForm(); frm.FormClosing += (sender, args) => { args.Cancel = true; frm.Hide(); }; return(frm); }); _consoleForm = new Lazy <Form>(() => { var consoleControl = new ConsoleControl(_browserControl.Engine); var frm = consoleControl.PopupForm(); frm.FormClosing += (sender, args) => { args.Cancel = true; frm.Hide(); }; return(frm); }); InitializeComponent(); _browserControl.Browser.OnAuthorize += Browser_OnAuthorize; _browserControl.KeyDown += PrimeForm_KeyDown; _textBoxUrl.KeyDown += PrimeForm_KeyDown; toolStripStatusLabel1.Click += (sender, args) => { if (_browserControl.State == BrowserStates.Error) { MessageBox.Show(_browserControl.Exception.ToString()); } }; }
// Use this for initialization void Start () { instance = this; consoleAllowed = Application.platform == RuntimePlatform.WindowsEditor; if (consoleAllowed){ //float thebeforetime = Time.realtimeSinceStartup; //log = new List<string>(); command = ""; relativeLine = 0; availableVars = new Dictionary<string, Variable>(); allowAllInAssembly(); //Debug.Log("Startup time: " + (Time.realtimeSinceStartup - thebeforetime) + "s"); } }
public static void TestMain() { ColorConsole.ClearScreen(); ColorConsole.Title = "My Custom Console Title"; ColorConsole.WriteLine("(ConsoleColor.BackgroundRed | ConsoleColor.BackgroundIntensity | ConsoleColor.ForegroundGreen)", (ConsoleColor.BackgroundRed | ConsoleColor.ForegroundGreen | ConsoleColor.BackgroundIntensity)); ColorConsole.WriteLine("(ConsoleColor.ForegroundYellow | ConsoleColor.BackgroundBlue | ConsoleColor.BackgroundGreen)", (ConsoleColor.ForegroundYellow | ConsoleColor.BackgroundBlue | ConsoleColor.BackgroundGreen)); ColorConsole.WriteLine("(ConsoleColor.ForegroundGreen)", (ConsoleColor.ForegroundGreen)); ColorConsole.WriteLine("(ConsoleColor.ForegroundBlue)", (ConsoleColor.ForegroundBlue)); ColorConsole.WriteLine("(ConsoleColor.ForegroundBlue | ConsoleColor.ForegroundGreen)", (ConsoleColor.ForegroundBlue | ConsoleColor.ForegroundGreen)); ColorConsole.WriteLine("(ConsoleColor.ForegroundBlue | ConsoleColor.ForegroundYellow)", (ConsoleColor.ForegroundBlue | ConsoleColor.ForegroundYellow)); ColorConsole.ErrorWriteLine("ErrorWriteLine: ERROR!!!!"); //Test MakeSound ColorConsole.MakeSound(); for (int i = 40; i > 0; i--) { ColorConsole.MakeSound((int)Math.Pow(i, 2), 100); } //Test GetChar() Console.WriteLine("Press any key, and it responds without user hitting return."); char input = ColorConsole.GetChar(); Console.WriteLine("You just pressed " + input.ToString() + ". \nPress c to continue."); while (ColorConsole.GetChar() != 'c') { ; } //Test event firing and handling capability ConsoleControl objConsoleControl = new ConsoleControl(); objConsoleControl.ControlEvent += new ConsoleControl.ControlEventHandler(ConsoleEventHandler.MyEventHandler); Console.WriteLine("Enter 'E' to exit, or Ctrl+C, Ctrl+break, ... to fire events."); // while (true) // { // if (Console.ReadLine() == "E") // break; // } while (Console.ReadLine() != "E") { ; //same as commented code } }
public void Init(ConsoleControl _console) { console = _console; coverObj = transform.GetChild(0); switchObj = transform.GetChild(1); BoxCollider coverCol = coverObj.gameObject.AddComponent <BoxCollider>(); coverCol.size *= 1.5f; switchObj.gameObject.AddComponent <BoxCollider>(); EventTrigger coverTrigger = coverObj.gameObject.AddComponent <EventTrigger>( ); EventTrigger.Entry coverEnterEvent = new EventTrigger.Entry( ); coverEnterEvent.eventID = EventTriggerType.PointerEnter; coverEnterEvent.callback.AddListener((data) => { CoverHover(true); }); coverTrigger.triggers.Add(coverEnterEvent); EventTrigger.Entry coverExitEvent = new EventTrigger.Entry( ); coverExitEvent.eventID = EventTriggerType.PointerExit; coverExitEvent.callback.AddListener((data) => { CoverHover(false); }); coverTrigger.triggers.Add(coverExitEvent); EventTrigger.Entry coverClickEvent = new EventTrigger.Entry( ); coverClickEvent.eventID = EventTriggerType.PointerClick; coverClickEvent.callback.AddListener((data) => { CoverClick(); }); coverTrigger.triggers.Add(coverClickEvent); EventTrigger switchTrigger = switchObj.gameObject.AddComponent <EventTrigger>( ); EventTrigger.Entry switchEnterEvent = new EventTrigger.Entry( ); switchEnterEvent.eventID = EventTriggerType.PointerEnter; switchEnterEvent.callback.AddListener((data) => { SwitchHover(true); }); switchTrigger.triggers.Add(switchEnterEvent); EventTrigger.Entry switchExitEvent = new EventTrigger.Entry( ); switchExitEvent.eventID = EventTriggerType.PointerExit; switchExitEvent.callback.AddListener((data) => { SwitchHover(false); }); switchTrigger.triggers.Add(switchExitEvent); EventTrigger.Entry switchClickEvent = new EventTrigger.Entry( ); switchClickEvent.eventID = EventTriggerType.PointerClick; switchClickEvent.callback.AddListener((data) => { SwitchClick(); }); switchTrigger.triggers.Add(switchClickEvent); }
public static IEnumerator updateMarkerSave() { ConsoleControl.Log("updateMarkerSave Called"); string url = "http://marshlandgames.com/HospitalProject/Client/MarkerPlacement/show_formatted_markers.php"; //byte[] postData = new byte[1]; //Dictionary<string, string> headers = new Dictionary<string, string>(); //headers["Username"] = "******"; //headers["Password"] = "******"; WWW www = new WWW(url); yield return(www); //Debug.Log(www.text); string[] piecesArr = www.text.Split(new string[] { "<br />" }, System.StringSplitOptions.RemoveEmptyEntries); string newSaveString = ""; for (int i = 0; i < piecesArr.Length; i++) { newSaveString += piecesArr[i] + "\n"; } //save what the new save is PlayerPrefs.SetString("MarkerSave", newSaveString); //reload the markers //you have to clear the existing ones first though if (mainParent == null) { mainParent = new GameObject("Labels"); mainParent.transform.position = Vector3.zero; } for (int i = 0; i < mainParent.transform.childCount; i++) { GameObject.Destroy(mainParent.transform.GetChild(i).gameObject); } loadMarkers(); //Debug.Log(PlayerPrefs.GetString("MarkerSave")); Debug.Log("Updated markers"); }
public BaseWatchBox() { console = new ConsoleControl(); this.console.editor.TextArea.TextEntered += new TextCompositionEventHandler(AbstractConsolePadTextEntered); this.console.editor.TextArea.PreviewKeyDown += (sender, e) => { e.Handled = e.Key == Key.Return; if (e.Handled) { DialogResult = true; this.Close(); } }; // hide scroll bar this.console.editor.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; this.console.editor.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; this.Loaded += delegate { this.console.editor.TextArea.Focus(); }; }
/** * @brief Initialise the console. */ private void Awake() { //DECLARE AS SINGLETON... //Code to make the Game Manager a singleton. if (!CONSOLE) { //If the game manager does not yet exist, //assign it to this instance. DontDestroyOnLoad(gameObject); CONSOLE = this; } else if (CONSOLE != this) { Destroy(gameObject); } //Create the list of text items. textItems = new List <GameObject>(); }
// Use this for initialization void Start() { instance = this; consoleAllowed = Application.platform == RuntimePlatform.WindowsEditor; if (consoleAllowed) { //float thebeforetime = Time.realtimeSinceStartup; //log = new List<string>(); command = ""; relativeLine = 0; availableVars = new Dictionary <string, Variable>(); allowAllInAssembly(); //Debug.Log("Startup time: " + (Time.realtimeSinceStartup - thebeforetime) + "s"); } }
protected override void Initialize() { width = GraphicsDevice.Viewport.Width; height = GraphicsDevice.Viewport.Height; GameContainer gc = new GameContainer(GraphicsDevice, null); phaseManager = new PhaseManager(new GamePhase(gc)); gameContent = new RenderTarget2D(GraphicsDevice, width, height); render = new Rectangle(0, 0, width, height); recorder = new Recorder(); FontManager.Initialize(Content); Control.Initialize(width, height); updateContainer = new UpdateContainer(); debugKeyboardManager = new KeyboardManager(); counter = new FPSCounter(this); DebugRenderer.AddDebugObjectScreen(new DebugFPS(counter)); GameConsole.Init(); consoleControl = new ConsoleControl(null); StdConsoleCommands.Init(); Parser p = new Parser(); var res5 = p.Parse(@".\Content\stdCommands.cmds", typeof(StdConsoleCommands)); var res6 = p.Parse(@".\Content\commands.cmds", typeof(ConsoleCommands)); GameConsole.Add(res5); GameConsole.Add(res6); StdConsoleCommands.ExitCalled += () => Exit(); StdConsoleCommands.ClassTree.Root = new ClassTreeItem(this, "game1"); base.Initialize(); }
public WatchListAutoCompleteCell() { InitializeComponent(); console = new ConsoleControl(); console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered); console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown); console.LostFocus += new RoutedEventHandler(console_LostFocus); console.HideScrollBar(); ConsolePanel.Content = console; // get language if (ProjectService.CurrentProject == null) { language = "C#"; } else { language = ProjectService.CurrentProject.Language; } resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); // FIXME set language if (language == "VB" || language == "VBNet") { console.SetHighlighting("VBNET"); } else { console.SetHighlighting("C#"); } // get process WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { this.Process = e.Process; }; this.Process = debugger.DebuggedProcess; }
public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill) { ConsoleControl.SMALL_RECT left; left.Left = (short)source.Left; left.Right = (short)source.Right; left.Top = (short)source.Top; left.Bottom = (short)source.Bottom; ConsoleControl.SMALL_RECT right; right.Left = (short)clip.Left; right.Right = (short)clip.Right; right.Top = (short)clip.Top; right.Bottom = (short)clip.Bottom; ConsoleControl.COORD x; x.X = (short)destination.X; x.Y = (short)destination.Y; ConsoleControl.CHAR_INFO character; character.UnicodeChar = fill.Character; character.Attributes = ConsoleControl.ColorToWORD(fill.ForegroundColor, fill.BackgroundColor); SafeFileHandle activeScreenBufferHandle = ConsoleControl.GetActiveScreenBufferHandle(); ConsoleControl.ScrollConsoleScreenBuffer(activeScreenBufferHandle, left, right, x, character); }
public void Init() { var console = new ConsoleControl(); typeof(MainWindow).GetProperty("Console")?.SetValue(null, console); App.Console = console; File.Create(Filename1).Close(); switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: _filename2 = Filename2Win; break; case PlatformID.MacOSX: case PlatformID.Unix: _filename2 = Filename2Unix; break; default: Assert.Fail($"Why the f**k are you running this on {Enum.GetName(typeof(PlatformID), Environment.OSVersion.Platform)}?"); break; } }
Start(RunspaceConfiguration configuration, string bannerText, string helpText, string preStartWarning, string[] args) { if (args == null) { throw PSTraceSource.NewArgumentNullException("args"); } // The default font face used for Powershell Console is Lucida Console. // However certain CJK locales dont support Lucida Console font. Hence for such // locales the console font is updated to Raster dynamically. // For NanoServer: // 1. There is no GetCurrentConsoleFontEx / SetCurrentConsoleFontEx on NanoServer; // 2. We don't handle CJK locales on NanoServer due to lack of win32 API supports on NanoServer. #if !CORECLR ConsoleControl.UpdateLocaleSpecificFont(); #endif return(ConsoleHost.Start(configuration, bannerText, helpText, preStartWarning, args)); }
// Use this for initialization void Start() { instance = this; ConsoleControl.Log("Start called"); float theBeforeTime = Time.realtimeSinceStartup; /*for (int i = 0; i < floors.Length; i++){ * floors[i].Id = i+1; * //floors[i].make(); * }*/ line = this.GetComponent <LineRenderer>(); //get a reference to the line seeker = GetComponent <Seeker>(); //astarPath = GetComponent<AstarPath>(); //logs["Getting components"] = Time.realtimeSinceStartup - theBeforeTime; //logs["Set active floor"] = Time.realtimeSinceStartup - theBeforeTime; //add the waypoints to the graph //float thebeforetime = Time.realtimeSinceStartup; PlayerPrefs.SetString("MarkerSave", ""); MapLabel.loadMarkers(); //logs["Initial marker load"] = Time.realtimeSinceStartup - theBeforeTime; if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { startMarkerUpdate(); } //logs["Start update of markers"] = Time.realtimeSinceStartup - theBeforeTime; logs["Startup time"] = Time.realtimeSinceStartup - theBeforeTime; setLogs(); }
public override void SetBufferContents(Rectangle region, BufferCell fill) { ConsoleControl.CONSOLE_SCREEN_BUFFER_INFO cONSOLESCREENBUFFERINFO; uint num = 0; if (region.Right >= region.Left) { if (region.Bottom >= region.Top) { SafeFileHandle bufferInfo = ConsoleHostRawUserInterface.GetBufferInfo(out cONSOLESCREENBUFFERINFO); int x = cONSOLESCREENBUFFERINFO.BufferSize.X; int y = cONSOLESCREENBUFFERINFO.BufferSize.Y; ushort wORD = ConsoleControl.ColorToWORD(fill.ForegroundColor, fill.BackgroundColor); Coordinates coordinate = new Coordinates(0, 0); if (region.Left != -1 || region.Right != -1 || region.Top != -1 || region.Bottom != -1) { if (region.Left >= x || region.Top >= y || region.Right < 0 || region.Bottom < 0) { ConsoleHostRawUserInterface.tracer.WriteLine("region outside boundaries", new object[0]); return; } else { int num1 = Math.Max(0, region.Left); int num2 = Math.Min(x - 1, region.Right); int num3 = num2 - num1 + 1; coordinate.X = num1; int num4 = Math.Max(0, region.Top); int num5 = Math.Min(y - 1, region.Bottom); coordinate.Y = num4; if (ConsoleControl.IsCJKOutputCodePage(out num)) { Rectangle rectangle = new Rectangle(0, 0, 1, num5 - num4); int num6 = this.LengthInBufferCells(fill.Character); if (coordinate.X > 0) { BufferCell[,] bufferCellArray = new BufferCell[rectangle.Bottom + 1, 2]; ConsoleControl.ReadConsoleOutputCJK(bufferInfo, num, new Coordinates(coordinate.X - 1, coordinate.Y), rectangle, ref bufferCellArray); int num7 = 0; while (num7 <= rectangle.Bottom) { if (bufferCellArray[num7, 0].BufferCellType != BufferCellType.Leading) { num7++; } else { throw PSTraceSource.NewArgumentException("fill"); } } } if (num2 != x - 1) { BufferCell[,] bufferCellArray1 = new BufferCell[rectangle.Bottom + 1, 2]; ConsoleControl.ReadConsoleOutputCJK(bufferInfo, num, new Coordinates(num2, coordinate.Y), rectangle, ref bufferCellArray1); if (num3 % 2 != 0) { int num8 = 0; while (num8 <= rectangle.Bottom) { if (!(bufferCellArray1[num8, 0].BufferCellType == BufferCellType.Leading ^ num6 == 2)) { num8++; } else { throw PSTraceSource.NewArgumentException("fill"); } } } else { int num9 = 0; while (num9 <= rectangle.Bottom) { if (bufferCellArray1[num9, 0].BufferCellType != BufferCellType.Leading) { num9++; } else { throw PSTraceSource.NewArgumentException("fill"); } } } } else { if (num6 == 2) { throw PSTraceSource.NewArgumentException("fill"); } } if (num3 % 2 == 1) { num3++; } } for (int i = num4; i <= num5; i++) { coordinate.Y = i; ConsoleControl.FillConsoleOutputCharacter(bufferInfo, fill.Character, num3, coordinate); ConsoleControl.FillConsoleOutputAttribute(bufferInfo, wORD, num3, coordinate); } return; } } else { if (x % 2 != 1 || !ConsoleControl.IsCJKOutputCodePage(out num) || this.LengthInBufferCells(fill.Character) != 2) { int num10 = x * y; ConsoleControl.FillConsoleOutputCharacter(bufferInfo, fill.Character, num10, coordinate); ConsoleControl.FillConsoleOutputAttribute(bufferInfo, wORD, num10, coordinate); return; } else { throw PSTraceSource.NewArgumentException("fill"); } } } else { object[] objArray = new object[2]; objArray[0] = "region.Bottom"; objArray[1] = "region.Top"; throw PSTraceSource.NewArgumentException("region", "ConsoleHostRawUserInterfaceStrings", "InvalidRegionErrorTemplate", objArray); } } else { object[] objArray1 = new object[2]; objArray1[0] = "region.Right"; objArray1[1] = "region.Left"; throw PSTraceSource.NewArgumentException("region", "ConsoleHostRawUserInterfaceStrings", "InvalidRegionErrorTemplate", objArray1); } }
private void Console_OnConsoleInput(object sender, ConsoleControl.ConsoleEventArgs args) { try { string[] cmd = CommandLineToArgs(args.Content); if (cmd.Length < 0) goto ret; string command = cmd[0]; cmd = Enumerable.Skip(cmd, 1).ToArray(); MethodInfo mi = null; if (command == "help") { ConsoleWriteLines(new List<string> { string.Format("HaShell [Version {0}]", ServerDataSource.LocalVersion), "", "\thelp - show this help", "\tclients - print all clients", "\tkick [--ban] <ip> - disconnect client, optionally banning it", "\tunban <ip> - unban client", "\tbanlist - print banlist", "\ttail [n] - print last n lines from the log, default 10", "\tflush [path] - force DataSource flush, optionally into a specific path", "\tload [path] - load DataSource, optionally from a specific path", "\texit - exit server" }); goto ret; } try { mi = GetType().GetMethod("command_" + command); } catch { } if (mi == null) { ConsoleWriteLine(string.Format("Couldn't find command {0}, try `help`", command)); goto ret; } mi.Invoke(this, new object[] { cmd }); } catch (Exception e) { if (e is TargetInvocationException) e = e.InnerException; ConsoleWriteLine("Unhandled exception occurred: " + e.Message + "\r\n" + e.StackTrace); } ret: ConsoleWrite("# "); }
public override KeyInfo ReadKey(ReadKeyOptions options) { KeyInfo keyInfo; if ((options & (ReadKeyOptions.IncludeKeyDown | ReadKeyOptions.IncludeKeyUp)) != 0) { if (this.cachedKeyEvent.RepeatCount > 0) { if ((options & ReadKeyOptions.AllowCtrlC) != 0 || this.cachedKeyEvent.UnicodeChar != '\u0003') { if ((options & ReadKeyOptions.IncludeKeyUp) == 0 && !this.cachedKeyEvent.KeyDown || (options & ReadKeyOptions.IncludeKeyDown) == 0 && this.cachedKeyEvent.KeyDown) { this.cachedKeyEvent.RepeatCount = 0; } } else { ConsoleControl.KEY_EVENT_RECORD kEYEVENTRECORDPointer = this.cachedKeyEvent; this.cachedKeyEvent.RepeatCount = (ushort)(this.cachedKeyEvent.RepeatCount - 1); throw this.NewPipelineStoppedException(); } } if (this.cachedKeyEvent.RepeatCount <= 0) { SafeFileHandle inputHandle = ConsoleControl.GetInputHandle(); ConsoleControl.INPUT_RECORD[] nPUTRECORDArray = new ConsoleControl.INPUT_RECORD[1]; ConsoleControl.ConsoleModes mode = ConsoleControl.GetMode(inputHandle); ConsoleControl.ConsoleModes consoleMode = mode & (ConsoleControl.ConsoleModes.ProcessedInput | ConsoleControl.ConsoleModes.LineInput | ConsoleControl.ConsoleModes.EchoInput | ConsoleControl.ConsoleModes.MouseInput | ConsoleControl.ConsoleModes.Insert | ConsoleControl.ConsoleModes.QuickEdit | ConsoleControl.ConsoleModes.Extended | ConsoleControl.ConsoleModes.AutoPosition | ConsoleControl.ConsoleModes.ProcessedOutput | ConsoleControl.ConsoleModes.WrapEndOfLine) & (ConsoleControl.ConsoleModes.ProcessedInput | ConsoleControl.ConsoleModes.LineInput | ConsoleControl.ConsoleModes.EchoInput | ConsoleControl.ConsoleModes.WindowInput | ConsoleControl.ConsoleModes.Insert | ConsoleControl.ConsoleModes.QuickEdit | ConsoleControl.ConsoleModes.Extended | ConsoleControl.ConsoleModes.AutoPosition | ConsoleControl.ConsoleModes.ProcessedOutput | ConsoleControl.ConsoleModes.WrapEndOfLine) & (ConsoleControl.ConsoleModes.LineInput | ConsoleControl.ConsoleModes.EchoInput | ConsoleControl.ConsoleModes.WindowInput | ConsoleControl.ConsoleModes.MouseInput | ConsoleControl.ConsoleModes.Insert | ConsoleControl.ConsoleModes.QuickEdit | ConsoleControl.ConsoleModes.Extended | ConsoleControl.ConsoleModes.AutoPosition | ConsoleControl.ConsoleModes.WrapEndOfLine); try { ConsoleControl.SetMode(inputHandle, consoleMode); do { Label0: int num = ConsoleControl.ReadConsoleInput(inputHandle, ref nPUTRECORDArray); if (num == 1 && nPUTRECORDArray[0].EventType == 1 && nPUTRECORDArray[0].KeyEvent.RepeatCount != 0) { if ((options & ReadKeyOptions.AllowCtrlC) != 0 || nPUTRECORDArray[0].KeyEvent.UnicodeChar != '\u0003') { continue; } ConsoleHostRawUserInterface.CacheKeyEvent(nPUTRECORDArray[0].KeyEvent, ref this.cachedKeyEvent); throw this.NewPipelineStoppedException(); } else { goto Label0; } }while (((options & ReadKeyOptions.IncludeKeyDown) == 0 || !nPUTRECORDArray[0].KeyEvent.KeyDown) && ((options & ReadKeyOptions.IncludeKeyUp) == 0 || nPUTRECORDArray[0].KeyEvent.KeyDown)); ConsoleHostRawUserInterface.CacheKeyEvent(nPUTRECORDArray[0].KeyEvent, ref this.cachedKeyEvent); ConsoleHostRawUserInterface.KEY_EVENT_RECORDToKeyInfo(nPUTRECORDArray[0].KeyEvent, out keyInfo); } finally { ConsoleControl.SetMode(inputHandle, mode); } } else { ConsoleHostRawUserInterface.KEY_EVENT_RECORDToKeyInfo(this.cachedKeyEvent, out keyInfo); this.cachedKeyEvent.RepeatCount = (ushort)(this.cachedKeyEvent.RepeatCount - 1); } if ((options & ReadKeyOptions.NoEcho) == 0) { char character = keyInfo.Character; this.parent.WriteToConsole(character.ToString(CultureInfo.CurrentCulture), true); } return(keyInfo); } else { throw PSTraceSource.NewArgumentException("options", "ConsoleHostRawUserInterfaceStrings", "InvalidReadKeyOptionsError", new object[0]); } }
private void consoleControl1_OnConsoleOutput(object sender, ConsoleControl.ConsoleEventArgs args) { ((ConsoleControl.ConsoleControl)sender).InternalRichTextBox.ScrollToCaret(); }
private void terminal_OnConsoleOutput(object sender, ConsoleControl.ConsoleEventArgs args) { if (!terminal.IsProcessRunning) { bamStatus.Text = "Completed!"; executeBtn.Text = "ANALYZE"; utilityBtn.Enabled = true; terminal.WriteInput(Environment.NewLine + "Analysis has completed.", Color.White, true); if(sampleList.Items.Count > 0) { foreach (string path in sampleList.Items) { string bamstatout = Path.GetDirectoryName(path) + @"\bamstats\"; string bamstatFN = bamstatout + Path.GetFileName(path) + "_bamster.csv"; if (File.Exists(bamstatFN) && !resultList.Items.Contains(bamstatFN)) { resultList.Items.Add(bamstatFN); } } tabControl.SelectedTab = resultTab; this.resultList.HorizontalExtent = 999; sampleList.Items.Clear(); executeBtn.Enabled = false; msgLabel.Visible = true; } } }
private void ParseHelper(string[] args) { Dbg.Assert(args != null, "Argument 'args' to ParseHelper should never be null"); bool noexitSeen = false; for (int i = 0; i < args.Length; ++i) { (string SwitchKey, bool ShouldBreak)switchKeyResults = GetSwitchKey(args, ref i, this, ref noexitSeen); if (switchKeyResults.ShouldBreak) { break; } string switchKey = switchKeyResults.SwitchKey; // If version is in the commandline, don't continue to look at any other parameters if (MatchSwitch(switchKey, "version", "v")) { _showVersion = true; _showBanner = false; _noInteractive = true; _skipUserInit = true; _noExit = false; break; } if (MatchSwitch(switchKey, "help", "h") || MatchSwitch(switchKey, "?", "?")) { _showHelp = true; _showExtendedHelp = true; _abortStartup = true; } else if (MatchSwitch(switchKey, "login", "l")) { // This handles -Login on Windows only, where it does nothing. // On *nix, -Login is handled much earlier to improve startup performance. } else if (MatchSwitch(switchKey, "noexit", "noe")) { _noExit = true; noexitSeen = true; } else if (MatchSwitch(switchKey, "noprofile", "nop")) { _skipUserInit = true; } else if (MatchSwitch(switchKey, "nologo", "nol")) { _showBanner = false; } else if (MatchSwitch(switchKey, "noninteractive", "noni")) { _noInteractive = true; } else if (MatchSwitch(switchKey, "socketservermode", "so")) { _socketServerMode = true; } else if (MatchSwitch(switchKey, "servermode", "s")) { _serverMode = true; } else if (MatchSwitch(switchKey, "namedpipeservermode", "nam")) { _namedPipeServerMode = true; } else if (MatchSwitch(switchKey, "sshservermode", "sshs")) { _sshServerMode = true; } else if (MatchSwitch(switchKey, "interactive", "i")) { _noInteractive = false; } else if (MatchSwitch(switchKey, "configurationname", "config")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingConfigurationNameArgument); break; } _configurationName = args[i]; } else if (MatchSwitch(switchKey, "custompipename", "cus")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingCustomPipeNameArgument); break; } if (!Platform.IsWindows) { int maxNameLength = (Platform.IsLinux ? MaxPipePathLengthLinux : MaxPipePathLengthMacOS) - Path.GetTempPath().Length; if (args[i].Length > maxNameLength) { WriteCommandLineError( string.Format( CommandLineParameterParserStrings.CustomPipeNameTooLong, maxNameLength, args[i], args[i].Length)); break; } } _customPipeName = args[i]; } else if (MatchSwitch(switchKey, "command", "c")) { if (!ParseCommand(args, ref i, noexitSeen, false)) { break; } } else if (MatchSwitch(switchKey, "windowstyle", "w")) { #if UNIX WriteCommandLineError( CommandLineParameterParserStrings.WindowStyleArgumentNotImplemented); break; #else ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingWindowStyleArgument); break; } try { ProcessWindowStyle style = (ProcessWindowStyle)LanguagePrimitives.ConvertTo( args[i], typeof(ProcessWindowStyle), CultureInfo.InvariantCulture); ConsoleControl.SetConsoleMode(style); } catch (PSInvalidCastException e) { WriteCommandLineError( string.Format(CultureInfo.CurrentCulture, CommandLineParameterParserStrings.InvalidWindowStyleArgument, args[i], e.Message)); break; } #endif } else if (MatchSwitch(switchKey, "file", "f")) { if (!ParseFile(args, ref i, noexitSeen)) { break; } } #if DEBUG // this option is useful when debugging ConsoleHost remotely using VS remote debugging, as you can only // attach to an already running process with that debugger. else if (MatchSwitch(switchKey, "wait", "w")) { // This does not need to be localized: its chk only ((ConsoleHostUserInterface)_hostUI).WriteToConsole("Waiting - type enter to continue:", false); _hostUI.ReadLine(); } // this option is useful for testing the initial InitialSessionState experience else if (MatchSwitch(switchKey, "iss", "iss")) { // Just toss this option, it was processed earlier... } // this option is useful for testing the initial InitialSessionState experience // this is independent of the normal wait switch because configuration processing // happens so early in the cycle... else if (MatchSwitch(switchKey, "isswait", "isswait")) { // Just toss this option, it was processed earlier... } else if (MatchSwitch(switchKey, "modules", "mod")) { if (ConsoleHost.DefaultInitialSessionState == null) { WriteCommandLineError( "The -module option can only be specified with the -iss option.", showHelp: true, showBanner: false); break; } ++i; int moduleCount = 0; // Accumulate the arguments to this script... while (i < args.Length) { string arg = args[i]; if (!string.IsNullOrEmpty(arg) && CharExtensions.IsDash(arg[0])) { break; } else { ConsoleHost.DefaultInitialSessionState.ImportPSModule(new string[] { arg }); moduleCount++; } ++i; } if (moduleCount < 1) { _hostUI.WriteErrorLine("No modules specified for -module option"); } } #endif else if (MatchSwitch(switchKey, "outputformat", "o") || MatchSwitch(switchKey, "of", "o")) { ParseFormat(args, ref i, ref _outFormat, CommandLineParameterParserStrings.MissingOutputFormatParameter); _outputFormatSpecified = true; } else if (MatchSwitch(switchKey, "inputformat", "in") || MatchSwitch(switchKey, "if", "if")) { ParseFormat(args, ref i, ref _inFormat, CommandLineParameterParserStrings.MissingInputFormatParameter); } else if (MatchSwitch(switchKey, "executionpolicy", "ex") || MatchSwitch(switchKey, "ep", "ep")) { ParseExecutionPolicy(args, ref i, ref _executionPolicy, CommandLineParameterParserStrings.MissingExecutionPolicyParameter); } else if (MatchSwitch(switchKey, "encodedcommand", "e") || MatchSwitch(switchKey, "ec", "e")) { _wasCommandEncoded = true; if (!ParseCommand(args, ref i, noexitSeen, true)) { break; } } else if (MatchSwitch(switchKey, "encodedarguments", "encodeda") || MatchSwitch(switchKey, "ea", "ea")) { if (!CollectArgs(args, ref i)) { break; } } else if (MatchSwitch(switchKey, "settingsfile", "settings")) { // Parse setting file arg and write error if (!TryParseSettingFileHelper(args, ++i, this)) { break; } } else if (MatchSwitch(switchKey, "sta", "s")) { if (!Platform.IsWindowsDesktop) { WriteCommandLineError( CommandLineParameterParserStrings.STANotImplemented); break; } if (_staMode.HasValue) { // -sta and -mta are mutually exclusive. WriteCommandLineError( CommandLineParameterParserStrings.MtaStaMutuallyExclusive); break; } _staMode = true; } else if (MatchSwitch(switchKey, "mta", "mta")) { if (!Platform.IsWindowsDesktop) { WriteCommandLineError( CommandLineParameterParserStrings.MTANotImplemented); break; } if (_staMode.HasValue) { // -sta and -mta are mutually exclusive. WriteCommandLineError( CommandLineParameterParserStrings.MtaStaMutuallyExclusive); break; } _staMode = false; } else if (MatchSwitch(switchKey, "workingdirectory", "wo") || MatchSwitch(switchKey, "wd", "wd")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingWorkingDirectoryArgument); break; } _workingDirectory = args[i]; } #if !UNIX else if (MatchSwitch(switchKey, "removeworkingdirectorytrailingcharacter", "removeworkingdirectorytrailingcharacter")) { _removeWorkingDirectoryTrailingCharacter = true; } #endif else { // The first parameter we fail to recognize marks the beginning of the file string. --i; if (!ParseFile(args, ref i, noexitSeen)) { break; } } } if (_showHelp) { ShowHelp(); } if (_showBanner && !_showHelp) { DisplayBanner(); if (UpdatesNotification.CanNotifyUpdates) { UpdatesNotification.ShowUpdateNotification(_hostUI); } } Dbg.Assert( ((_exitCode == ConsoleHost.ExitCodeBadCommandLineParameter) && _abortStartup) || (_exitCode == ConsoleHost.ExitCodeSuccess), "if exit code is failure, then abortstartup should be true"); }
private void ParseHelper(string[] args) { Dbg.Assert(args != null, "Argument 'args' to ParseHelper should never be null"); bool noexitSeen = false; for (int i = 0; i < args.Length; ++i) { // Invariant culture used because command-line parameters are not localized. string switchKey = args[i].Trim().ToLowerInvariant(); if (String.IsNullOrEmpty(switchKey)) { continue; } if (!SpecialCharacters.IsDash(switchKey[0]) && switchKey[0] != '/') { // then its a file --i; ParseFile(args, ref i, noexitSeen); break; } // chop off the first character so that we're agnostic wrt specifying / or - // in front of the switch name. switchKey = switchKey.Substring(1); // chop off the second dash so we're agnostic wrt specifying - or -- if (!String.IsNullOrEmpty(switchKey) && SpecialCharacters.IsDash(switchKey[0])) { switchKey = switchKey.Substring(1); } // If version is in the commandline, don't continue to look at any other parameters if (MatchSwitch(switchKey, "version", "v")) { _showVersion = true; _showBanner = false; _noInteractive = true; _skipUserInit = true; _noExit = false; break; } else if (MatchSwitch(switchKey, "help", "h") || MatchSwitch(switchKey, "?", "?")) { _showHelp = true; _showExtendedHelp = true; _abortStartup = true; } else if (MatchSwitch(switchKey, "noexit", "noe")) { _noExit = true; noexitSeen = true; } else if (MatchSwitch(switchKey, "noprofile", "nop")) { _skipUserInit = true; } else if (MatchSwitch(switchKey, "nologo", "nol")) { _showBanner = false; } else if (MatchSwitch(switchKey, "noninteractive", "noni")) { _noInteractive = true; } else if (MatchSwitch(switchKey, "socketservermode", "so")) { _socketServerMode = true; } else if (MatchSwitch(switchKey, "servermode", "s")) { _serverMode = true; } else if (MatchSwitch(switchKey, "namedpipeservermode", "nam")) { _namedPipeServerMode = true; } else if (MatchSwitch(switchKey, "sshservermode", "sshs")) { _sshServerMode = true; } else if (MatchSwitch(switchKey, "interactive", "i")) { _noInteractive = false; } else if (MatchSwitch(switchKey, "configurationname", "config")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingConfigurationNameArgument); break; } _configurationName = args[i]; } else if (MatchSwitch(switchKey, "command", "c")) { if (!ParseCommand(args, ref i, noexitSeen, false)) { break; } } else if (MatchSwitch(switchKey, "windowstyle", "w")) { #if UNIX WriteCommandLineError( CommandLineParameterParserStrings.WindowStyleArgumentNotImplemented); break; #else ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingWindowStyleArgument); break; } try { ProcessWindowStyle style = (ProcessWindowStyle)LanguagePrimitives.ConvertTo( args[i], typeof(ProcessWindowStyle), CultureInfo.InvariantCulture); ConsoleControl.SetConsoleMode(style); } catch (PSInvalidCastException e) { WriteCommandLineError( string.Format(CultureInfo.CurrentCulture, CommandLineParameterParserStrings.InvalidWindowStyleArgument, args[i], e.Message)); break; } #endif } else if (MatchSwitch(switchKey, "file", "f")) { if (!ParseFile(args, ref i, noexitSeen)) { break; } } #if DEBUG // this option is useful when debugging ConsoleHost remotely using VS remote debugging, as you can only // attach to an already running process with that debugger. else if (MatchSwitch(switchKey, "wait", "w")) { // This does not need to be localized: its chk only ((ConsoleHostUserInterface)_hostUI).WriteToConsole("Waiting - type enter to continue:", false); _hostUI.ReadLine(); } // this option is useful for testing the initial InitialSessionState experience else if (MatchSwitch(switchKey, "iss", "iss")) { // Just toss this option, it was processed earlier... } // this option is useful for testing the initial InitialSessionState experience // this is independent of the normal wait switch because configuration processing // happens so early in the cycle... else if (MatchSwitch(switchKey, "isswait", "isswait")) { // Just toss this option, it was processed earlier... } else if (MatchSwitch(switchKey, "modules", "mod")) { if (ConsoleHost.DefaultInitialSessionState == null) { WriteCommandLineError( "The -module option can only be specified with the -iss option.", showHelp: true, showBanner: false); break; } ++i; int moduleCount = 0; // Accumulate the arguments to this script... while (i < args.Length) { string arg = args[i]; if (!string.IsNullOrEmpty(arg) && SpecialCharacters.IsDash(arg[0])) { break; } else { ConsoleHost.DefaultInitialSessionState.ImportPSModule(new string[] { arg }); moduleCount++; } ++i; } if (moduleCount < 1) { _hostUI.WriteErrorLine("No modules specified for -module option"); } } #endif else if (MatchSwitch(switchKey, "outputformat", "o") || MatchSwitch(switchKey, "of", "o")) { ParseFormat(args, ref i, ref _outFormat, CommandLineParameterParserStrings.MissingOutputFormatParameter); } else if (MatchSwitch(switchKey, "inputformat", "in") || MatchSwitch(switchKey, "if", "if")) { ParseFormat(args, ref i, ref _inFormat, CommandLineParameterParserStrings.MissingInputFormatParameter); } else if (MatchSwitch(switchKey, "executionpolicy", "ex") || MatchSwitch(switchKey, "ep", "ep")) { ParseExecutionPolicy(args, ref i, ref _executionPolicy, CommandLineParameterParserStrings.MissingExecutionPolicyParameter); } else if (MatchSwitch(switchKey, "encodedcommand", "e") || MatchSwitch(switchKey, "ec", "e")) { _wasCommandEncoded = true; if (!ParseCommand(args, ref i, noexitSeen, true)) { break; } } else if (MatchSwitch(switchKey, "encodedarguments", "encodeda") || MatchSwitch(switchKey, "ea", "ea")) { if (!CollectArgs(args, ref i)) { break; } } else if (MatchSwitch(switchKey, "settingsfile", "settings")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingSettingsFileArgument); break; } string configFile = null; try { configFile = NormalizeFilePath(args[i]); } catch (Exception ex) { string error = string.Format(CultureInfo.CurrentCulture, CommandLineParameterParserStrings.InvalidSettingsFileArgument, args[i], ex.Message); WriteCommandLineError(error); break; } if (!System.IO.File.Exists(configFile)) { string error = string.Format(CultureInfo.CurrentCulture, CommandLineParameterParserStrings.SettingsFileNotExists, configFile); WriteCommandLineError(error); break; } PowerShellConfig.Instance.SetSystemConfigFilePath(configFile); } #if STAMODE // explicit setting of the ApartmentState Not supported on NanoServer else if (MatchSwitch(switchKey, "sta", "s")) { if (_staMode.HasValue) { // -sta and -mta are mutually exclusive. WriteCommandLineError( CommandLineParameterParserStrings.MtaStaMutuallyExclusive); break; } _staMode = true; } // Win8: 182409 PowerShell 3.0 should run in STA mode by default..so, consequently adding the switch -mta. // Not deleting -sta for backward compatability reasons else if (MatchSwitch(switchKey, "mta", "mta")) { if (_staMode.HasValue) { // -sta and -mta are mutually exclusive. WriteCommandLineError( CommandLineParameterParserStrings.MtaStaMutuallyExclusive); break; } _staMode = false; } #endif else if (MatchSwitch(switchKey, "workingdirectory", "wo") || MatchSwitch(switchKey, "wd", "wd")) { ++i; if (i >= args.Length) { WriteCommandLineError( CommandLineParameterParserStrings.MissingWorkingDirectoryArgument); break; } _workingDirectory = args[i]; } else { // The first parameter we fail to recognize marks the beginning of the file string. --i; if (!ParseFile(args, ref i, noexitSeen)) { break; } } } if (_showHelp) { ShowHelp(); } if (_showBanner && !_showHelp) { DisplayBanner(); } Dbg.Assert( ((_exitCode == ConsoleHost.ExitCodeBadCommandLineParameter) && _abortStartup) || (_exitCode == ConsoleHost.ExitCodeSuccess), "if exit code is failure, then abortstartup should be true"); }
public TestLogger(ConsoleControl.ConsoleControl consoleControl) { _ctrl = consoleControl; }