Exemple #1
0
        protected string StSlnPMap(string sln, IPM pm)
        {
            if (string.IsNullOrWhiteSpace(sln))
            {
                throw new ArgumentException($"Failed {nameof(StSlnPMap)}: sln is empty");
            }
            ProjectsMap map = GetProjectsMap(sln);

            if (pm.Is(LevelType.Property, "First"))
            {
                return(UseProjectsMap(map.FirstBy(env.IsCleanOperation), pm.PinTo(1)));
            }

            if (pm.Is(LevelType.Property, "Last"))
            {
                return(UseProjectsMap(map.LastBy(env.IsCleanOperation), pm.PinTo(1)));
            }

            if (pm.Is(LevelType.Property, "FirstRaw"))
            {
                return(UseProjectsMap(map.First, pm.PinTo(1)));
            }

            if (pm.Is(LevelType.Property, "LastRaw"))
            {
                return(UseProjectsMap(map.Last, pm.PinTo(1)));
            }

            if (pm.FinalEmptyIs(LevelType.Property, "GuidList"))
            {
                return(Value.From(map.GuidList));
            }

            if (pm.Is(LevelType.Method, "projectBy"))
            {
                ILevel lvlPrjBy = pm.FirstLevel;
                lvlPrjBy.Is("projectBy(string guid)", ArgumentType.StringDouble);
                return(UseProjectsMap(map.GetProjectBy((string)lvlPrjBy.Args[0].data), pm.PinTo(1)));
            }

            throw new IncorrectNodeException(pm);
        }
        protected string stSlnPMap(string sln, IPM pm)
        {
            if (String.IsNullOrWhiteSpace(sln))
            {
                throw new InvalidArgumentException("Failed stSlnPMap: sln is empty");
            }
            ProjectsMap map = getProjectsMap(sln);

            if (pm.Is(LevelType.Property, "First"))
            {
                return(projectsMap(map.FirstBy(env.BuildType), pm.pinTo(1)));
            }

            if (pm.Is(LevelType.Property, "Last"))
            {
                return(projectsMap(map.LastBy(env.BuildType), pm.pinTo(1)));
            }

            if (pm.Is(LevelType.Property, "FirstRaw"))
            {
                return(projectsMap(map.First, pm.pinTo(1)));
            }

            if (pm.Is(LevelType.Property, "LastRaw"))
            {
                return(projectsMap(map.Last, pm.pinTo(1)));
            }

            if (pm.FinalEmptyIs(LevelType.Property, "GuidList"))
            {
                return(Value.from(map.GuidList));
            }

            if (pm.Is(LevelType.Method, "projectBy"))
            {
                ILevel lvlPrjBy = pm.FirstLevel;
                lvlPrjBy.Is("projectBy(string guid)", ArgumentType.StringDouble);
                return(projectsMap(map.getProjectBy((string)lvlPrjBy.Args[0].data), pm.pinTo(1)));
            }

            throw new IncorrectNodeException(pm);
        }