public IEWData GetEWData(string item, bool isGuid) { IItemEW ew = OWPItems._.getEW ( isGuid ? new OWPIdent() { guid = item } : new OWPIdent() { item = item } ); return(new _EWData(ew.Raw, ew.Errors, ew.Warnings)); }
protected string stOut(IPM pm) { if (!pm.Is(LevelType.Property, "out") && !pm.Is(LevelType.Method, "out")) { throw new IncorrectNodeException(pm); } string item = Settings._.DefaultOWPItem; // by default for all bool isGuid = false; if (pm.Is(LevelType.Method, "out")) { ILevel lvlOut = pm.FirstLevel; if (!lvlOut.Is(ArgumentType.StringDouble) && !lvlOut.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { throw new InvalidArgumentException("Incorrect arguments to `out(string ident [, boolean isGuid])`"); } Argument[] args = lvlOut.Args; item = (string)args[0].data; isGuid = (args.Length == 2)? (bool)args[1].data : false; // optional isGuid param } Log.Trace("stOut: out = item('{0}'), isGuid('{1}')", item, isGuid); IItemEW ew = OWPItems._.getEW((isGuid)? new OWPIdent() { guid = item } : new OWPIdent() { item = item }); string raw = StringHandler.escapeQuotes(ew.Raw); // #[OWP out.All] / #[OWP out] / #[OWP out("Build").All] / #[OWP out("Build")] ... if (pm.FinalEmptyIs(1, LevelType.Property, "All") || pm.FinalEmptyIs(1, LevelType.RightOperandEmpty)) { return(raw); } // #[OWP out.Warnings.Count] ... if (pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) { return(Value.from(ew.WarningsCount)); } // #[OWP out.Warnings.Codes] ... if (pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) { return(Value.from(ew.Warnings)); } // #[OWP out.Warnings.Raw] / #[OWP out.Warnings] ... if ((pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Raw")) || pm.FinalEmptyIs(1, LevelType.Property, "Warnings")) { return((ew.IsWarnings)? raw : Value.Empty); } // #[OWP out.Errors.Count] ... if (pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) { return(Value.from(ew.ErrorsCount)); } // #[OWP out.Errors.Codes] ... if (pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) { return(Value.from(ew.Errors)); } // #[OWP out.Errors.Raw] / #[OWP out.Errors] ... if ((pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Raw")) || pm.FinalEmptyIs(1, LevelType.Property, "Errors")) { return((ew.IsErrors)? raw : Value.Empty); } throw new IncorrectNodeException(pm, 1); }