Esempio n. 1
0
    // <summary>
    // Processes a single line from the input file. Assumes the following format is followed in the input file:
    // <class type>,<class name>,<fan out count>,<comma separated list of dependent class names>.
    // </summary>
    private void processLine(string aLine)
    {
        string[] lineSplit = aLine.Split(',');
        int fanOutCnt;
        if((lineSplit.Length >= 3) && (int.TryParse(lineSplit[2], out fanOutCnt)))
        {
            string clName = lineSplit[1];
            string clType = lineSplit[0];
            //check there is enough fan-out data on the line
                if((fanOutCnt + 3) != lineSplit.Length){
                    System.Console.WriteLine("ERROR: Incorrect format found in input file.");
                    System.Environment.Exit(1);
                }

            if(!classNames.Contains(clName))
            {
                ClassInfo newInfo = new ClassInfo(clType);
                classNames.Add(clName);
                classes.Add(clName, newInfo);

                if(fanOutCnt > 0)
                {
                    for(int i = 3; i != lineSplit.Length; ++i){
                        newInfo.addFanOut(lineSplit[i]);
                    }
                }
            }
        }
        else
        {
            System.Console.WriteLine("ERROR: Input file in wrong format.");
            System.Environment.Exit(1);
        }
    }