示例#1
0
        /// <summary>
        ///     This method reads the input text file and makes LIQueries for each line in the file.
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        public List <object> createLIQueries()
        {
            string[]      lines   = File.ReadAllLines(LIQueriesRelativePath);
            List <object> queries = new List <object>();

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

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

                if (splitInput.Length == 7)
                {
                    bool onlygeteasy = true;
                    if ((splitInput[6].Contains('f')) || (splitInput[6].Contains('F')))
                    {
                        onlygeteasy = false;
                    }
                    string[]        jobtitles   = splitInput[3].Split('|');
                    string[]        experiences = splitInput[4].Split('|');
                    LIQueryAdvanced advquery    = new LIQueryAdvanced(splitInput[0], splitInput[1], splitInput[2], jobtitles, experiences, splitInput[5], onlygeteasy);
                    queries.Add(advquery);
                }
            }
            return(queries);
        }
示例#2
0
        /// <summary>
        ///     This primary accessory constructor takes in a list of queries and constructs their search url and creates a LIQuery object for each url.
        /// </summary>
        /// <param name="queries"></param>
        public LIService()
        {
            List <object> queries = createLIQueries();

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

            //TODO: Check to see how shortened links look for LinkedIn

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