Ejemplo n.º 1
0
        // ---------- ---------- ---------- ---------- ---------- ----------
        // The following methods are used to search through the raw data
        //   and compile the lists of first examples. They will be used
        //   by the configuration form.
        // ---------- ---------- ---------- ---------- ---------- ----------

        /// <summary>
        /// Search though everything to determine a complete list of first
        ///   examples
        /// </summary>
        public void RunSearchAll()
        {
            string[] dirNamesArray = System.IO.Directory.GetDirectories(BasePathReader.GetBasePath() + StaticResources.baPath);
            string   dirName       = string.Empty;
            int      currentYear   = 0;

            m_listNumber   = new List <FirstExampleType>();
            m_listLocation = new List <FirstExampleType>();

            // looping through years
            for (int index = 0; index < dirNamesArray.Count(); ++index)
            {
                dirName = dirNamesArray[index].Substring(dirNamesArray[index].LastIndexOf('\\') + 1);
                if (int.TryParse(dirName, out currentYear))
                {
                    string[] fileNamesArray = System.IO.Directory.GetFiles(dirNamesArray[index]);
                    SearchThroughSingleYear(currentYear, fileNamesArray);
                }
            }

            FirstExampleIOController firstExampleController = FirstExampleIOController.GetInstance();

            firstExampleController.WriteFileNumber(m_listNumber);
            firstExampleController.WriteFileLocation(m_listLocation);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// loads the annual lists for the provided year.
        /// </summary>
        /// <param name="year">year to load the lists for.</param>
        public void LoadAnnualList(string year)
        {
            FirstExampleIOController firstExampleController = FirstExampleIOController.GetInstance();

            m_annualListNumber.Clear();
            m_annualListNumber = firstExampleController.GetFirstExampleListNumber(year);
            m_annualListLocation.Clear();
            m_annualListLocation = firstExampleController.GetFirstExampleListLocation(year);
        }
Ejemplo n.º 3
0
        // ---------- ---------- ---------- ---------- ---------- ----------
        // The following methods load the lists.
        // ---------- ---------- ---------- ---------- ---------- ----------

        /// <summary>
        ///   loads complete list.
        /// </summary>
        public void LoadCompleteList()
        {
            FirstExampleIOController firstExampleController = FirstExampleIOController.GetInstance();

            m_completeListNumber.Clear();
            m_completeListNumber = firstExampleController.GetFirstExampleListNumber();
            m_completeListLocation.Clear();
            m_completeListLocation = firstExampleController.GetFirstExampleListLocation();
        }
Ejemplo n.º 4
0
        public static FirstExampleIOController GetInstance()
        {
            if (m_instance == null)
            {
                m_instance = new FirstExampleIOController();
            }

            return(m_instance);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///   loads complete list.
        /// </summary>
        /// <remarks>
        /// 04/06/16 BS: This looks like the annual list? What is the difference.
        /// </remarks>
        /// <param name="year">current year</param>
        public void LoadAllPurposeList(string year)
        {
            // TODO, check out the remarks when ported.

            if (string.Compare(year, this.AllPurposeYear) != 0)
            {
                this.AllPurposeYear = year;
                FirstExampleIOController firstExampleController = FirstExampleIOController.GetInstance();

                m_listNumber.Clear();
                m_listNumber = firstExampleController.GetFirstExampleListNumber(year);
                m_listLocation.Clear();
                m_listLocation = firstExampleController.GetFirstExampleListLocation(year);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Search though everything to determine an annual list of first
        ///   examples as determined by the year argument.
        /// </summary>
        /// <param name="year">year to search</param>
        public void RunSearchYear(string year)
        {
            int currentYear = 0;

            m_listNumber   = new List <FirstExampleType>();
            m_listLocation = new List <FirstExampleType>();

            if (int.TryParse(year, out currentYear))
            {
                string[] fileNamesArray = System.IO.Directory.GetFiles(BasePathReader.GetBasePath() +
                                                                       StaticResources.baPath +
                                                                       year);
                SearchThroughSingleYear(currentYear, fileNamesArray);
            }

            FirstExampleIOController firstExampleController = FirstExampleIOController.GetInstance();

            firstExampleController.WriteFileNumber(m_listNumber, year);
            firstExampleController.WriteFileLocation(m_listLocation, year);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Appends first example to the relevant list and file. localList
        /// determines which list/file. If looking at a specific year, then
        /// this is defined by the year argument.
        /// </summary>
        /// <param name="firstExamples">first example to append</param>
        /// <param name="localList">type of list</param>
        /// <param name="year">current year</param>
        public void AppendNumber(FirstExampleType firstExamples,
                                 LocalListType localList,
                                 string year = "1970")
        {
            FirstExampleIOController firstExampleController;

            switch (localList)
            {
            case LocalListType.complete:
                m_completeListNumber.Add(firstExamples);
                firstExampleController = FirstExampleIOController.GetInstance();
                firstExampleController.AppendFileNumber(firstExamples);
                break;

            case LocalListType.annual:
                m_annualListNumber.Add(firstExamples);
                firstExampleController = FirstExampleIOController.GetInstance();
                firstExampleController.AppendFileNumber(firstExamples, year);
                break;
            }
        }