예제 #1
0
파일: Parser.cs 프로젝트: bneuhold/pb-dev
 public ParseToken(int id, string t, Word w)
 {
     termId = id;
     text = t;
     word = w;
 }
예제 #2
0
파일: Parser.cs 프로젝트: bneuhold/pb-dev
        public void Init()
        {
            try
            {
                SqlConnection conn = Utility.GetDefaultConnection();
                conn.Open();

                string strcmd = @"SELECT * From SearchTerm WHERE LanguageId IN (1, 2) AND SearchTermTypeId IN (1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15)";
                SqlCommand sqlcmd = new SqlCommand(strcmd, conn);
                SqlDataReader reader = sqlcmd.ExecuteReader();

                while (reader.Read())
                {
                    int id = Int32.Parse(reader["Id"].ToString());
                    string title = reader["Title"].ToString();
                    Regex regex = new Regex(reader["Regex"].ToString());
                    int lid = Int32.Parse(reader["LanguageId"].ToString());
                    int gid = reader["SearchGeoplaceId"] == DBNull.Value ? -1 : Int32.Parse(reader["SearchGeoplaceId"].ToString());
                    int tid = Int32.Parse(reader["SearchTermTypeId"].ToString());
                    string tag = reader["ParseTag"].ToString();

                    Word word = new Word(id, title, regex, lid, tid, tag, gid);
                    wordsForLang[lid].Add(id, word);
                    allWords.Add(id, word);
                }

                reader.Close();
                conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }