Exemplo n.º 1
0
 string FromSectionType(bool isProjectSection, SlnSectionType type)
 {
     if (type == SlnSectionType.PreProcess)
     {
         return(isProjectSection ? "preProject" : "preSolution");
     }
     else
     {
         return(isProjectSection ? "postProject" : "postSolution");
     }
 }
Exemplo n.º 2
0
 public SlnSection GetOrCreateSection(string id, SlnSectionType sectionType)
 {
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     var sec = this.FirstOrDefault(s => s.Id == id);
     if (sec == null)
     {
         sec = new SlnSection { Id = id };
         sec.SectionType = sectionType;
         Add(sec);
     }
     return sec;
 }
Exemplo n.º 3
0
        internal void Read(TextReader reader, string line, ref int curLineNum)
        {
            Line = curLineNum;
            int k = line.IndexOf('(');

            if (k == -1)
            {
                throw new InvalidSolutionFormatException(
                          curLineNum,
                          "SectionIdMissingError");
            }
            var tag = line.Substring(0, k).Trim();
            var k2  = line.IndexOf(')', k);

            if (k2 == -1)
            {
                throw new InvalidSolutionFormatException(
                          curLineNum,
                          "SectionIdMissingError");
            }
            Id = line.Substring(k + 1, k2 - k - 1);

            k           = line.IndexOf('=', k2);
            SectionType = ToSectionType(curLineNum, line.Substring(k + 1).Trim());

            var endTag = "End" + tag;

            _sectionLines = new List <string>();
            _baseIndex    = ++curLineNum;
            while ((line = reader.ReadLine()) != null)
            {
                curLineNum++;
                line = line.Trim();
                if (line == endTag)
                {
                    break;
                }
                _sectionLines.Add(line);
            }
            if (line == null)
            {
                throw new InvalidSolutionFormatException(
                          curLineNum,
                          "ClosingSectionTagNotFoundError");
            }
        }
Exemplo n.º 4
0
 public SlnSection GetSection(string id, SlnSectionType sectionType)
 {
     return(this.FirstOrDefault(s => s.Id == id && s.SectionType == sectionType));
 }
Exemplo n.º 5
0
 public SolutionDataSectionAttribute(string sectionName, SlnSectionType processOrder = SlnSectionType.PostProcess)
 {
     SectionName  = sectionName;
     ProcessOrder = processOrder;
 }
		public SolutionDataSectionAttribute (string sectionName, SlnSectionType processOrder = SlnSectionType.PostProcess)
		{
			SectionName = sectionName;
			ProcessOrder = processOrder;
		}