protected string StItemWrite(string name, bool newline, IPM pm) { if (!pm.IsMethodWithArgs("write", ArgumentType.Boolean) && !pm.IsMethodWithArgs("writeLine", ArgumentType.Boolean)) { throw new IncorrectNodeException(pm); } bool createIfNo = (bool)pm.FirstLevel.Args[0].data; if (pm.Levels[1].Type != LevelType.RightOperandColon) { throw new IncorrectNodeException(pm); } string content = pm.Levels[1].Data; env.Write(content, newline, name, createIfNo); return(Value.Empty); }
protected string stItemWrite(string name, bool newline, IPM pm) { if (!pm.IsMethodWithArgs("write", ArgumentType.Boolean) && !pm.IsMethodWithArgs("writeLine", ArgumentType.Boolean)) { throw new IncorrectNodeException(pm); } bool createIfNotExist = (bool)pm.FirstLevel.Args[0].data; if (pm.Levels[1].Type != LevelType.RightOperandColon) { throw new IncorrectNodeException(pm); } string content = pm.Levels[1].Data; EnvDTE.OutputWindowPane pane; if (!createIfNotExist) { try { pane = OWP.getByName(name, false); } catch (ArgumentException) { throw new NotFoundException("The item '{0}' does not exist. Use 'force' flag for automatic creation if needed.", name); } } else { pane = OWP.getByName(name, true); } if (newline) { content += System.Environment.NewLine; } pane.OutputString(content); return(Value.Empty); }
protected string stItemWrite(string name, bool newline, IPM pm) { if(!pm.IsMethodWithArgs("write", ArgumentType.Boolean) && !pm.IsMethodWithArgs("writeLine", ArgumentType.Boolean)) { throw new IncorrectNodeException(pm); } bool createIfNotExist = (bool)pm.FirstLevel.Args[0].data; if(pm.Levels[1].Type != LevelType.RightOperandColon) { throw new IncorrectNodeException(pm); } string content = pm.Levels[1].Data; EnvDTE.OutputWindowPane pane; if(!createIfNotExist) { try { pane = OWP.getByName(name, false); } catch(ArgumentException) { throw new NotFoundException("The item '{0}' does not exist. Use 'force' flag for automatic creation if needed.", name); } } else { pane = OWP.getByName(name, true); } if(newline) { content += System.Environment.NewLine; } pane.OutputString(content); return Value.Empty; }