예제 #1
0
        public static void readFile(string filename)
        {
            string[] lines = System.IO.File.ReadAllLines(@filename);

            foreach (string line in lines)
            {
                if (line.Length < 1)
                {
                    continue;
                }
                if (line[0] == '•')
                {
                    string[] separator = { " : " };
                    string[] inputSI   = line.Substring(2).Split(separator, StringSplitOptions.None);
                    inputSI[1] = inputSI[1].Trim();
                    SearchInterest interest = listSI.Find(x => x.getName() == inputSI[1]);
                    if (interest != null)
                    {
                        interest.AddAlias(inputSI[0]);
                    }
                    else
                    {
                        listSI.Add(new SearchInterest(inputSI[1], inputSI[0]));
                    }
                }
            }
        }
예제 #2
0
        public static void printResults(SearchInterest sI)
        {
            string filename = sI.getName() + "_Alias.txt";

            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter(@filename))
            {
                foreach (string alias in sI.ShowAliasJobs())
                {
                    file.WriteLine(alias);
                }
            }
        }
예제 #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (location == null)
     {
         MessageBox.Show("Insert a file!", "No file found!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         return;
     }
     button3.Enabled    = false;
     interest           = SearchParser.startSearch(location, textBox2.Text);
     results.DataSource = new List <string>();
     if (interest == null)
     {
         MessageBox.Show("We couldn't find what you were looking for.", "No results found!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         results.DataSource = interest.ShowAliasJobs();
         button3.Enabled    = true;
     }
 }
예제 #4
0
        public static SearchInterest getResults(string searchName)
        {
            SearchInterest si = listSI.Find(x => x.getName().ToUpper().CompareTo(searchName.ToUpper()) == 0);

            return(si);
        }