Exemple #1
0
 private void ParseLine(string line)
 {
     string[] parts = line.Split(new char[] { '\t' });
     if ((parts.Length == 2) && (parts[0] == "rootdir"))
     {
         basePath = parts[1];
     }
     else if ((parts.Length == 2) && (parts[0] == "batch"))
     {
         string parsedBatchName = parts[1];
         batch  newBatch        = new batch(parsedBatchName);
         batchList.Add(newBatch);
     }
     else
     {
         //if the line starts with the name of a batch
         var relevantBatch = batchList.Find(x => string.Compare(x.batchName, parts[0], ignoreCase: true) == 0);
         if (relevantBatch != null)
         {
             if ((parts.Length == 3) && (parts[1] == "CONCEPTS"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "CADDIES"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "TOPLEVEL"))
             {
                 relevantBatch.ddiToplevelFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "VARIABLES"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 5) && (parts[1] == "MAPPING"))
             {
                 string         mappingFile  = parts[2].Trim();
                 string         ccScheme     = parts[3].Trim();
                 List <string>  ccSchemeList = ReadCcScheme(ccScheme);
                 string         vScheme      = parts[4].Trim();
                 ddiMappingFile mf           = new ddiMappingFile(mappingFile, ccScheme, ccSchemeList, vScheme);
                 relevantBatch.ddiMappingFileList.Add(mf);
             }
             else if ((parts.Length == 4) && (parts[1] == "LINKING"))
             {
                 string         linkingFile = parts[2].Trim();
                 string         vScheme     = parts[3].Trim();
                 ddiLinkingFile lf          = new ddiLinkingFile(linkingFile, vScheme);
                 relevantBatch.ddiLinkingFileList.Add(lf);
             }
             else if ((parts.Length == 4) && (parts[1] == "QLINK"))
             {
                 string questionLinkingFile = parts[2].Trim();
                 string qcScheme            = parts[3].Trim();
                 ddiQuestionLinkingFile lf  = new ddiQuestionLinkingFile(questionLinkingFile, qcScheme);
                 relevantBatch.ddiQuestionLinkingFileList.Add(lf);
             }
             else if ((parts.Length == 4) && (parts[1] == "DERIVATION"))
             {
                 string            derivationFile = parts[2].Trim();
                 string            vScheme        = parts[3].Trim();
                 ddiDerivationFile df             = new ddiDerivationFile(derivationFile, vScheme);
                 relevantBatch.ddiDerivationFileList.Add(df);
             }
             else
             {
                 Trace.WriteLine("ERROR: Invalid batch line: " + line);
             }
         }
         else
         {
             //Trace.WriteLine("Irrelevant line: " + line);
         }
     }
 }
Exemple #2
0
 private void ParseLine(string line)
 {
     string[] parts = line.Split(new char[] { '\t' });
     if ((parts.Length == 2) && (parts[0] == "rootdir"))
     {
         basePath = parts[1];
     }
     else if ((parts.Length == 2) && (parts[0] == "batch"))
     {
         string parsedBatchName = parts[1];
         batch newBatch = new batch(parsedBatchName);
         batchList.Add(newBatch);
     }
     else
     {
         //if the line starts with the name of a batch
         var relevantBatch = batchList.Find(x => string.Compare(x.batchName, parts[0], ignoreCase: true) == 0);
         if (relevantBatch != null)
         {
             if ((parts.Length == 3) && (parts[1] == "CONCEPTS"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "CADDIES"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "TOPLEVEL"))
             {
                 relevantBatch.ddiToplevelFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 3) && (parts[1] == "VARIABLES"))
             {
                 relevantBatch.ddiFileList.Add(parts[2].Trim());
             }
             else if ((parts.Length == 5) && (parts[1] == "MAPPING"))
             {
                 string mappingFile = parts[2].Trim();
                 string ccScheme = parts[3].Trim();
                 List<string> ccSchemeList = ReadCcScheme(ccScheme);
                 string vScheme = parts[4].Trim();
                 ddiMappingFile mf = new ddiMappingFile(mappingFile, ccScheme, ccSchemeList, vScheme);
                 relevantBatch.ddiMappingFileList.Add(mf);
             }
             else if ((parts.Length == 4) && (parts[1] == "LINKING"))
             {
                 string linkingFile = parts[2].Trim();
                 string vScheme = parts[3].Trim();
                 ddiLinkingFile lf = new ddiLinkingFile(linkingFile, vScheme);
                 relevantBatch.ddiLinkingFileList.Add(lf);
             }
             else if ((parts.Length == 4) && (parts[1] == "QLINK"))
             {
                 string questionLinkingFile = parts[2].Trim();
                 string qcScheme = parts[3].Trim();
                 ddiQuestionLinkingFile lf = new ddiQuestionLinkingFile(questionLinkingFile, qcScheme);
                 relevantBatch.ddiQuestionLinkingFileList.Add(lf);
             }
             else if ((parts.Length == 4) && (parts[1] == "DERIVATION"))
             {
                 string derivationFile = parts[2].Trim();
                 string vScheme = parts[3].Trim();
                 ddiDerivationFile df = new ddiDerivationFile(derivationFile, vScheme);
                 relevantBatch.ddiDerivationFileList.Add(df);
             }
             else
             {
                 Trace.WriteLine("ERROR: Invalid batch line: " + line);
             }
         }
         else
         {
             //Trace.WriteLine("Irrelevant line: " + line);
         }
     }
 }