/* Read content from input file and convert it to automat */
        public List<AutomatonBase> readFile(string fileName)
        {
            try
            {
                System.IO.StreamReader file = new System.IO.StreamReader(fileName); /* Read file */
                int numOfAutomat = Int32.Parse(file.ReadLine().ToString()); /* Number of automata */
                bool isInit = false;
                List<AutomatonBase> models = new List<AutomatonBase>();

                for (int i = 0; i < numOfAutomat; i++)
                {
                    List<StateBase> inputStateList = new List<StateBase>();
                    string initState = file.ReadLine().ToString(); /* Init state */
                    string []listOfState = file.ReadLine().ToString().Split();

                    foreach (string state in listOfState)
                    {
                        if (state.CompareTo(initState) == 0)
                        {
                            isInit = true;
                            inputStateList.Add(new StateBase(state, state, isInit, true));
                            isInit = false;
                        }
                        else
                        {
                            inputStateList.Add(new StateBase(state, state, isInit, true));
                        }
                    }

                    /* Delete white space and ( */
                    string lineOfTrans = RemoveWhitespace(file.ReadLine().ToString());
                    string[] listOfTrans = lineOfTrans.Split(';'); /* Split to each transition */
                    List<StateBase> fromSt = new List<StateBase>();
                    List<StateBase> toSt = new List<StateBase>();

                    foreach (string trans in listOfTrans)
                    {

                        string[] list = trans.Split('.');
                        string from = list[0];
                        string evt = list[1];
                        string to = list[2];
                        StateBase sbFrom = inputStateList[0];
                        StateBase sbTo = inputStateList[0];

                        for (int j = 0; j < inputStateList.Count; j++)
                        {
                            // Add members to FromList state
                            bool flag = false;
                            if (from.CompareTo(inputStateList[j].ToString()) == 0)
                            {
                                sbFrom = inputStateList[j];
                                if(fromSt.Count > 0)
                                {
                                    foreach (StateBase s in fromSt)
                                        if (s.Name.CompareTo(from) == 0)
                                            flag = true;
                                }

                                if(flag == false)
                                    fromSt.Add(sbFrom);
                            }

                            // Add members to ToList state
                            flag = false;
                            if (to.CompareTo(inputStateList[j].ToString()) == 0)
                            {
                                sbTo = inputStateList[j];
                                if(toSt.Count > 0)
                                {
                                    foreach (StateBase s in toSt)
                                        if (s.Name.CompareTo(to) == 0)
                                            flag = true;
                                }

                                if(flag == false)
                                    toSt.Add(sbTo);
                            }
                        }


                        for (int j = 0; j < inputStateList.Count; j++)
                            if (inputStateList[j].ToString().CompareTo(from.ToString()) == 0)
                                inputStateList[j].OutgoingTransitions.Add(new Transition(new Event(evt), sbFrom, sbTo));
                    }
                    AutomatonBase input = new AutomatonBase("Input", null, inputStateList, fromSt, toSt);
                    input.CollectTransitions();
                    input.CollectEvent();
                    models.Add(input);
                }
                return models;
            }
            catch (IOException )
            {
                Console.WriteLine("File not found!");
                return null;
            }
        }