SobaScript.Z.VS/OwpComponent.cs
/// <summary>
/// Gets data from the output pane.
/// </summary>
/// <param name="pm"></param>
/// <returns></returns>
Gets data from the output pane.
Gets data from the output pane .
[Method("out",
                "Streaming of getting the mixed data from selected pane. Returns: partial raw data.", 
                new[] { "name" }, 
                new[] { "Name of pane" }, 
                CValType.String, 
                CValType.String)]
        [Method("out",
                "Streaming of getting the mixed data from selected pane. Returns: partial raw data.",
                new[] { "ident", "isGuid" },
                new[] { "Identifier of pane", "Use Guid as identifier or as name of item" },
                CValType.String,
                CValType.String, CValType.Boolean)]
        [Property("out", "Alias for: out(\"Build\").", CValType.String)]
        [Property("All", "Get raw data if exists.", "out", nameof(StOut), CValType.String)]
        [Property("Warnings", "For work with warnings from received data. Also used as short alias for: Warnings.Raw", "out", nameof(StOut), CValType.String)]
        [Property("Raw", "Return the partial raw data with warning/s if an exists.", "Warnings", nameof(StOut), CValType.String)]
        [Property("Count", "Count of warnings from data", "Warnings", nameof(StOut), CValType.Integer)]
        [Property("Codes", "List of warnings from data as C4702,4505, ...", "Warnings", nameof(StOut), CValType.List)]
        [Property("Errors", "For work with errors from received data. Also used as short alias for: Errors.Raw:", "out", nameof(StOut), CValType.String)]
        [Property("Raw", "Return the partial raw data with errors if an exists", "Errors", nameof(StOut), CValType.String)]
        [Property("Count", "Count of errors from data", "Errors", nameof(StOut), CValType.Integer)]
        [Property("Codes", "List of errors from data as C4702,4505, ...", "Errors", nameof(StOut), CValType.List)]
        protected string StOut(IPM pm)
        {
            if(!pm.Is(LevelType.Property, "out") && !pm.Is(LevelType.Method, "out")) {
                throw new IncorrectNodeException(pm);
            }
            string item = env.DefaultItem; 
            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 PMLevelException(lvlOut, "`out(string ident [, boolean isGuid])`");
                }
                var args = lvlOut.Args;
                item    = (string)args[0].data;
                isGuid  = args.Length == 2 ? (bool)args[1].data : false; 
            }
            LSender.Send(this, $"StOut: out = item('{item}'), isGuid('{isGuid}')", MsgLevel.Trace);
            IEWData ew  = env.GetEWData(item, isGuid);
            string raw  = StringHandler.EscapeQuotes(ew.Raw);
            if(pm.FinalEmptyIs(1, LevelType.Property, "All") || pm.FinalEmptyIs(1, LevelType.RightOperandEmpty)) {
                return raw;
            }
            if(pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) {
                return Value.From(ew.Warnings.Count);
            }
            if(pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) {
                return Value.From(ew.Warnings);
            }
            if((pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Raw"))
                || pm.FinalEmptyIs(1, LevelType.Property, "Warnings"))
            {
                return ew.Warnings.Count > 0 ? raw : Value.Empty;
            }
            if(pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) {
                return Value.From(ew.Errors.Count);
            }
            if(pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) {
                return Value.From(ew.Errors);
            }
            if((pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Raw"))
                || pm.FinalEmptyIs(1, LevelType.Property, "Errors"))
            {
                return ew.Errors.Count > 0 ? raw : Value.Empty;
            }
            throw new IncorrectNodeException(pm, 1);
        }
[ Method ( " " , " " , new [ ] { " " } , new [ ] { " " } , CValType . String , CValType . String ) ] [ Method ( " " , " " , new [ ] { " " , " " } , new [ ] { " " , " " } , CValType . String , CValType . String , CValType . Boolean ) ] [ Property ( " " , " \" \" " , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . Integer ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . List ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . String ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . Integer ) ] [ Property ( " " , " " , " " , nameof ( StOut ) , CValType . List ) ] protected string StOut ( IPM pm ) { if ( ! pm . Is ( LevelType . Property , " " ) && ! pm . Is ( LevelType . Method , " " ) ) { throw new IncorrectNodeException ( pm ) ; } string item = env . DefaultItem ; bool isGuid = false ; if ( pm . Is ( LevelType . Method , " " ) ) { ILevel lvlOut = pm . FirstLevel ; if ( ! lvlOut . Is ( ArgumentType . StringDouble ) && ! lvlOut . Is ( ArgumentType . StringDouble , ArgumentType . Boolean ) ) { throw new PMLevelException ( lvlOut , " " ) ; } var args = lvlOut . Args ; item = ( string ) args [ 0 ] . data ; isGuid = args . Length == 2 ? ( bool ) args [ 1 ] . data : false ; } LSender . Send ( this , $" StOut: out = item(' { item } '), isGuid(' { isGuid } ') " , MsgLevel . Trace ) ; IEWData ew = env . GetEWData ( item , isGuid ) ; string raw = StringHandler . EscapeQuotes ( ew . Raw ) ; if ( pm . FinalEmptyIs ( 1 , LevelType . Property , " " ) || pm . FinalEmptyIs ( 1 , LevelType . RightOperandEmpty ) ) { return raw ; } if ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) { return Value . From ( ew . Warnings . Count ) ; } if ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) { return Value . From ( ew . Warnings ) ; } if ( ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) || pm . FinalEmptyIs ( 1 , LevelType . Property , " " ) ) { return ew . Warnings . Count > 0 ? raw : Value . Empty ; } if ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) { return Value . From ( ew . Errors . Count ) ; } if ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) { return Value . From ( ew . Errors ) ; } if ( ( pm . Is ( 1 , LevelType . Property , " " ) && pm . FinalEmptyIs ( 2 , LevelType . Property , " " ) ) || pm . FinalEmptyIs ( 1 , LevelType . Property , " " ) ) { return ew . Errors . Count > 0 ? raw : Value . Empty ; } throw new IncorrectNodeException ( pm , 1 ) ; }
Gets data from the output pane.
Gets data from the output pane .
// by default for all // optional isGuid param // #[OWP out.All] / #[OWP out] / #[OWP out("Build").All] / #[OWP out("Build")] ... // #[OWP out.Warnings.Count] ... // #[OWP out.Warnings.Codes] ... // #[OWP out.Warnings.Raw] / #[OWP out.Warnings] ... // #[OWP out.Errors.Count] ... // #[OWP out.Errors.Codes] ... // #[OWP out.Errors.Raw] / #[OWP out.Errors] ...
None
pm
IPM
None