Пример #1
0
        /// <summary>
        ///     This method reads the input text file and makes INQueries for each line in the file.
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        public List <object> createINQueries()
        {
            string[]      lines   = File.ReadAllLines(INQueriesRelativePath);
            List <object> queries = new List <object>();

            foreach (string line in lines)
            {
                string[] splitInput = line.Split('.');

                if (splitInput.Length == 3)
                {
                    INQuery query = new INQuery(splitInput[0], splitInput[1], splitInput[2]);
                    queries.Add(query);
                }

                if (splitInput.Length == 6)
                {
                    bool onlygeteasy = true;
                    if ((splitInput[5].Contains('f')) || (splitInput[5].Contains('F')))
                    {
                        onlygeteasy = false;
                    }
                    INQueryAdvanced advquery = new INQueryAdvanced(splitInput[0], splitInput[1], splitInput[2], splitInput[3], splitInput[4], onlygeteasy);
                    queries.Add(advquery);
                }
            }
            return(queries);
        }
Пример #2
0
        /// <summary>
        ///     This is the default constructor for the INService class which creates all the Indeed querys and links.
        /// </summary>
        public INService()
        {
            //TODO: Possibly add some sort of location resolution (maybe a library)
            //TODO: Possibly allow different search radius options
            List <object> queries = createINQueries();

            Queries  = queries.ToArray();
            FULLURLS = new string[queries.Count];

            for (int counter = 0; counter < Queries.Length; counter++)
            {
                object query = queries[counter];
                if (query.GetType().Equals(typeof(INQuery)))
                {
                    INQuery q = (INQuery)query;
                    setBaseSearchParams(q.KeyWords, q.City, q.State);
                    string url = BaseURL + BaseSearchParams;
                    FULLURLS[counter] = url;
                }
                else
                {
                    INQueryAdvanced advq = (INQueryAdvanced)query;
                    setBaseSearchParams(advq.KeyWords, advq.City, advq.State);
                    setAdvancedSearchParams(advq.JobTitle, advq.Experience);
                    string url = BaseURL + BaseSearchParams + AdvancedSearchParams;
                    FULLURLS[counter] = url;
                }
            }
        }