public void Initialize()
 {
     _mockTwitter = new Mock <ITwitterService>();
     _mockTwitter.Setup(p => p.SearchAsync(It.IsAny <SearchOptions>())).Returns(
         Task.Factory.StartNew(() =>
     {
         var result      = new TwitterSearchResult();
         result.Statuses = new List <TwitterStatus> {
             new TwitterStatus()
         };
         return(result);
     }));
     _mockRepository = new Mock <ISearchWordRepository>();
     _searchWord     = new SearchWord {
         LastTweetId = 100, Word = Guid.NewGuid().ToString()
     };
     _searchWord.Product = new Product();
     _mockRepository.Setup(p => p.ReadAll()).Returns(() =>
     {
         SearchWord[] products = { _searchWord };
         return(products.AsQueryable());
     });
     _mockResultRepository = new Mock <ISearchResultRepository>();
     DependencyContainer.Instance.RegisterInstance(_mockRepository.Object);
     DependencyContainer.Instance.RegisterInstance(_mockResultRepository.Object);
     DependencyContainer.Instance.RegisterInstance(_mockTwitter.Object);
 }
        /// <summary>
        /// Process File , search for the given
        /// search term and returns searchResult Model
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="searchTerm"></param>
        /// <param name="searchResult"></param>
        private void ProcessFile(string fileName, string searchTerm, SearchResult searchResult)
        {
            int           wordCount   = 0;
            int           lineCount   = 0;
            string        fileContent = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), fileName));
            List <string> lines       = fileContent.Replace("\r", "").Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();

            foreach (var line in lines)
            {
                lineCount++;
                var        words      = line.Split(" ");
                int        counts     = 0;
                SearchWord searchWord = new SearchWord();
                if (words.Length >= 1)
                {
                    foreach (var word in words)
                    {
                        if (word.Equals(searchTerm, StringComparison.CurrentCultureIgnoreCase))
                        {
                            wordCount++;
                            counts++;
                        }
                    }
                    if (counts != 0)
                    {
                        searchWord.noOfWords  = counts;
                        searchWord.lineNumber = lineCount;
                        searchResult.countAndLineNumbers.Add(searchWord);
                    }
                }
            }
            searchResult.totalWordOccurences = wordCount;
        }
Esempio n. 3
0
 /// <summary>
 /// This event is called by Search button to search for a
 /// spelling and enter the text fields with the information found
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btSearch_Click(object sender, EventArgs e)
 {
     EditSpelling = string.Empty;
     //check to see if the text field is not empty
     if (!String.IsNullOrEmpty(tbSearchSpelling.Text))
     {
         Word       checkWordObj  = new Word();
         SearchWord searchWordObj = new SearchWord();
         checkWordObj = searchWordObj.checkWord(WordList, tbSearchSpelling.Text);
         if (!(checkWordObj == null))
         {
             tbSpelling.Text       = checkWordObj.Spelling;
             tbMeaning.Text        = checkWordObj.Meaning;
             tbSampleSentence.Text = checkWordObj.SampleSentence;
             EditSpelling          = checkWordObj.Spelling;
         }
         //if the word is already present then alert a message
         else
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('Word searched is not on list,Word Not Found')", true);
             ClearFields();
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('Search Field is empty,Please enter the word to search')", true);
         ClearFields();
     }
 }
        public void GetScore()
        {
            var searchWord = new SearchWord();

            searchWord.UpdateDate = new DateTime(2000, 1, 10);

            searchWord.SearchResults.Add(CreateResult(new DateTime(2000, 1, 3, 1, 0, 0), 30));
            searchWord.SearchResults.Add(CreateResult(new DateTime(2000, 1, 3, 2, 0, 0), 50));
            searchWord.SearchResults.Add(CreateResult(new DateTime(2000, 1, 4, 1, 0, 0), 20));
            searchWord.SearchResults.Add(CreateResult(new DateTime(2000, 1, 10, 1, 0, 0), 100));
            searchWord.SearchResults.Add(CreateResult(new DateTime(2000, 1, 10, 2, 0, 0), 100));

            var product = new Product();

            product.SearchWords.Add(searchWord);
            var company = new Mock <Company>();

            company.Setup(p => p.Products).Returns(new List <Product> {
                product
            });

            var calculator = new IncreaseTweetRateScoreCalculator();
            var score      = calculator.GetScore(company.Object);

            score.Is(400);
        }
Esempio n. 5
0
        public List <WordDirection> CheckControl(SearchWord word, Vector2 pos)
        {
            List <WordDirection> possiblePositions = new List <WordDirection>();

            possiblePositions = CheckDirections(word, pos);
            possiblePositions = CheckPosition(possiblePositions, word, pos);
            return(possiblePositions);
        }
        public List <UploadingPointData> GetArrayForUpload()
        {
            var  user  = Membership.GetUser();
            Guid myUID = user == null ? new Guid() : (Guid)user.ProviderUserKey;
            var  db    = new DB();
            IQueryable <MapObject> objList = db.MapObjects.AsQueryable();

            if (SearchWord.IsFilled())
            {
                objList = objList.Where(
                    x =>
                    SqlMethods.Like(x.Address ?? "", "%" + SearchWord.Replace(" ", "%") + "%") ||
                    SqlMethods.Like(x.Name ?? "", "%" + SearchWord.Replace(" ", "%") + "%") ||
                    SqlMethods.Like(x.Description ?? "", "%" + SearchWord.Replace(" ", "%") + "%"));
            }
            else
            {
                objList =
                    objList.Where(
                        x =>
                        x.MapCoords.Any(
                            z =>
                            z.XPos >= CurrentMapView.LeftUpperCorner.Lat &&
                            z.XPos <= CurrentMapView.RightBottomCorner.Lat &&
                            z.YPos >= CurrentMapView.RightBottomCorner.Lng &&
                            z.YPos <= CurrentMapView.LeftUpperCorner.Lng));
            }
            if (IsFavorite == 1 && user != null)
            {
                objList = objList.Where(x => x.CreatorID == myUID);
            }

            if (SmokingType.HasValue)
            {
                objList = objList.Where(x => x.ObjectType == SmokingType);
            }

            if (ObjectFilter.SelectedTypes.Any())
            {
                var typeFiltered = (from type in ObjectFilter.SelectedTypes
                                    let qs = objList.Where(x => x.TypeID == type.TypeID)
                                             select
                                             type.ObjectType == 0
                                            ? qs.Where(x => x.MapCoords.All(z => z.IsMarker))
                                            : qs.Where(x => x.MapCoords.Any(z => !z.IsMarker)))
                                   .Aggregate <IQueryable <MapObject>, IQueryable <MapObject> >(null,
                                                                                                (current, qs) =>
                                                                                                current == null ? qs : current.Concat(qs));
                objList = typeFiltered;
            }


            if (LoadedPoints.Any())
            {
                objList = objList.Where(x => !LoadedPoints.Take(500).Contains(x.ID));
            }
            return(objList.Take(100).ToList().Select(x => x.ToUploadData()).ToList());
        }
Esempio n. 7
0
        public SearchWord FindRandomWord()
        {
            Random            random      = new Random();
            int               randomId    = random.Next(1, allSearchWords.Count + 1);
            List <SearchWord> randomWords = allSearchWords.Where(x => x.id == randomId).ToList();

            this.randomWord = randomWords[0];
            return(randomWord);
        }
        public int InstancesOfWordInSentence()
        {
            string[] words       = Sentence.Split(new char[] { '.', '?', '!', ' ', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
            var      wordMatches = from word in words
                                   where word.ToLower() == SearchWord.ToLower()
                                   select word;

            return(wordMatches.Count());
        }
Esempio n. 9
0
        private ParsedArtistQuery ParseTextQuery(string query)
        {
            if (string.IsNullOrWhiteSpace(query))
            {
                return(new ParsedArtistQuery());
            }

            var trimmed = query.Trim();

            var term = SearchWord.GetTerm(trimmed, "id");

            if (term == null)
            {
                var trimmedLc = trimmed.ToLowerInvariant();

                // Optimization: check prefix, in most cases the user won't be searching by URL
                if (trimmedLc.StartsWith("/ar/") || trimmedLc.StartsWith("http"))
                {
                    var entryId = entryUrlParser.Parse(trimmed, allowRelative: true);

                    if (entryId.EntryType == EntryType.Artist)
                    {
                        return new ParsedArtistQuery {
                                   Id = entryId.Id
                        }
                    }
                    ;
                }

                if (trimmedLc.StartsWith("http") || trimmedLc.StartsWith("mylist/") || trimmedLc.StartsWith("user/"))
                {
                    var extUrl = new ArtistExternalUrlParser().GetExternalUrl(trimmed);

                    if (extUrl != null)
                    {
                        return new ParsedArtistQuery {
                                   ExternalLinkUrl = extUrl
                        }
                    }
                    ;
                }
            }
            else
            {
                switch (term.PropertyName)
                {
                case "id":
                    return(new ParsedArtistQuery {
                        Id = PrimitiveParseHelper.ParseIntOrDefault(term.Value, 0)
                    });
                }
            }

            return(new ParsedArtistQuery {
                Name = trimmed
            });
        }
Esempio n. 10
0
        void webBrowser1_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            webBrowser1.Visibility = System.Windows.Visibility.Visible;

            if (searchWord != null)
            {
                VanDaleService_ReadFinished(searchWord.Description, false);
                searchWord = null;
            }
        }
Esempio n. 11
0
        public bool Equals(SearchWord other)
        {
            if (other == null)
                return false;

            if (ReferenceEquals(this, other))
                return true;

            return (PropertyName == other.PropertyName && Value == other.Value);
        }
Esempio n. 12
0
 private void BtnEditWord_Click(object sender, RoutedEventArgs e)
 {
     if (WordSettings.SelectedValue != null)
     {
         SearchWord selectedWord = (SearchWord)WordSettings.SelectedItem;
         TxtEditDisplay.Text   = selectedWord.Displayword;
         TxtEditSearch.Text    = selectedWord.Keyword;
         ChkIsActive.IsChecked = selectedWord.IsWordActive;
         lblSelectId.Content   = selectedWord.ID;
     }
 }
Esempio n. 13
0
        private Task <TwitterSearchResult> GetTweetCountAsync(SearchWord searchWord)
        {
            var service = new TwitterServiceProvider().GetService();
            var option  = new SearchOptions()
            {
                Count   = 100,
                Q       = searchWord.Word,
                SinceId = searchWord.LastTweetId
            };

            return(service.SearchAsync(option));
        }
Esempio n. 14
0
        public void FindRandomWord()
        {
            SearchWord randomWord = controller.FindRandomWord();

            this.randomWord = randomWord;
            string firstLetter = randomWord.word.Substring(0, 1);
            string restOfWord  = randomWord.word.Substring(1);
            Regex  rgx         = new Regex("[a-zA-Z]");

            restOfWord           = rgx.Replace(restOfWord, "_");
            labelSearchWord.Text = firstLetter + restOfWord;
        }
Esempio n. 15
0
        private double GetAverageTweetCount(SearchWord searchWord)
        {
            var lastSunday = GetLastSunday(searchWord.UpdateDate);
            var counts     = searchWord.SearchResults.Where(p => p.RegisterDate >= lastSunday.AddDays(-7) && p.RegisterDate < lastSunday)
                             .GroupBy(p => p.RegisterDate.Date).Select(p => GetSumOrDefault(p));

            if (counts.Any() == false)
            {
                return(0);
            }
            return(counts.Average());
        }
Esempio n. 16
0
        public SearchResult Create(SearchWord searchWord, Product product, long tweetCount, DateTime date)
        {
            var entity = new SearchResult();

            //entity.SearchWord = searchWord;
            //entity.Product = product;
            entity.SearchWordId = searchWord.SearchWordId;
            entity.ProductId    = product.ProductId;
            entity.TweetCount   = tweetCount;
            entity.SearchDate   = date;
            return(base.Create(entity));
        }
Esempio n. 17
0
 public MainController(onCopyFunc onCopy)
 {
     this.onCopy        = onCopy;
     LabelText          = getTokenFlg.Select(flg => flg ? "PINコード" : "検索ワード").ToReadOnlyReactiveProperty();
     ButtonText         = getTokenFlg.Select(flg => flg ? "入力" : "検索").ToReadOnlyReactiveProperty();
     showListViewFlg    = getTokenFlg.Select(flg => !flg).ToReadOnlyReactiveProperty();
     SearchStartCommand = SearchWord.Select(s => s.Length != 0).CombineLatest(progressFlg, (x, y) => x & !y).ToReactiveCommand();
     CopyLinkCommand    = SelectTweet.Select(t => t != null).ToReactiveCommand();
     OpenLinkCommand    = SelectTweet.Select(t => t != null).ToReactiveCommand();
     RtRtCommand        = SelectTweet.Select(t => t != null).ToReactiveCommand();
     SearchResult       = searchResult.ToReadOnlyReactiveCollection();
     //
     LoginCommand.Subscribe(_ => Login());
     SearchStartCommand.Subscribe(async _ => {
         if (getTokenFlg.Value)
         {
             // トークン入力処理
             token = session.GetTokens(SearchWord.Value);
             Application.Current.Properties["AccessToken"]       = token.AccessToken;
             Application.Current.Properties["AccessTokenSecret"] = token.AccessTokenSecret;
             getTokenFlg.Value = false;
             SearchWord.Value  = "";
         }
         else
         {
             // 検索処理
             await SearchTweet();
         }
     });
     CopyLinkCommand.Subscribe(_ => {
         string url = "https://twitter.com/" + SelectTweet.Value.User.ScreenName + "/status/" + SelectTweet.Value.Id;
         this.onCopy(url);
     });
     OpenLinkCommand.Subscribe(_ => {
         string url = "https://twitter.com/" + SelectTweet.Value.User.ScreenName + "/status/" + SelectTweet.Value.Id;
         Device.OpenUri(new Uri(url));
     });
     RtRtCommand.Subscribe(_ => {
     });
     //トークンが保存されているかを確かめ、されてない場合に限りログイン処理を行う
     if (Application.Current.Properties.ContainsKey("AccessToken") &&
         Application.Current.Properties.ContainsKey("AccessTokenSecret"))
     {
         token = Tokens.Create(Consumer.Key, Consumer.Secret,
                               Application.Current.Properties["AccessToken"] as string,
                               Application.Current.Properties["AccessTokenSecret"] as string);
     }
     else
     {
         Login();
     }
 }
Esempio n. 18
0
        public bool Equals(SearchWord other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(PropertyName == other.PropertyName && Value == other.Value);
        }
Esempio n. 19
0
    /// <summary>
    /// This event is invoked when save button is clicked
    /// It adds the words into text file only if the word doesnt exists
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btSave_Click(object sender, EventArgs e)
    {
        Word       checkWordObj  = new Word();
        SearchWord searchWordObj = new SearchWord();

        checkWordObj = searchWordObj.checkWord(WordList, tbSpelling.Text);
        if (String.IsNullOrEmpty(tbSpelling.Text) || String.IsNullOrEmpty(tbMeaning.Text) || String.IsNullOrEmpty(tbSampleSentence.Text))
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('Please enter value in all fields.')", true);
        }
        //if the fields are not empty,stores into text file
        else
        {
            //Check for word if it already exists
            if (!(checkWordObj == null))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('The word is already existing.Please Enter an other word')", true);
                return;
            }
            else
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WordsDBConnStr"].ConnectionString))
                {
                    conn.Open();
                    //Insert into the table with current contents
                    string     queryText = "insert into \"all-word-table\" values(@SpellingTxt, @MeaningTxt, @ExampleTxt, @TimeCreatedTxt,@TimeUpdatedTxt)";
                    SqlCommand cmd       = new SqlCommand(queryText, conn);
                    cmd.Parameters.AddWithValue("@SpellingTxt", tbSpelling.Text);
                    cmd.Parameters.AddWithValue("@MeaningTxt", tbMeaning.Text);
                    cmd.Parameters.AddWithValue("@ExampleTxt", tbSampleSentence.Text);
                    cmd.Parameters.AddWithValue("@TimeCreatedTxt", DateTime.Now);
                    cmd.Parameters.AddWithValue("@TimeUpdatedTxt", DBNull.Value);

                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Word has been Added Successfully')", true);
                        dgvCompleteGridView.DataBind();
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Failed", "alert('Word has not been added.')", true);
                    }
                }
            }

            //LoadData();
        }
        ClearFields();
    }
Esempio n. 20
0
        public static bool CheckIfWordISynonyms(string word, SearchWord searchWords)
        {
            foreach (SynonymSet synonmset in searchWords.Synonyms)
            {
                foreach (SynonymTerm synonymTerm in synonmset.Terms)
                {
                    if (word.ToLower() == synonymTerm.Term.ToLower())
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 21
0
        public static Word GetWord(string word)
        {
            SearchWord sw;

            try
            {
                sw = new SearchWord();
            }
            catch (Exception e)
            {
                throw new Exception("Could not open connection to offline database.", e);
            }

            Word w = sw.GetWordOffline(word);

            return(w);
        }
Esempio n. 22
0
        private ParsedArtistQuery ParseTextQuery(SearchTextQuery textQuery)
        {
            if (textQuery.IsEmpty)
            {
                return(new ParsedArtistQuery());
            }

            var trimmed = textQuery.OriginalQuery.Trim();

            var term = SearchWord.GetTerm(trimmed, "id");

            if (term == null)
            {
                var trimmedLc = trimmed.ToLowerInvariant();

                // Optimization: check prefix, in most cases the user won't be searching by URL
                var result = FindInternalUrl(trimmed, trimmedLc);

                if (result != null)
                {
                    return(result);
                }

                result = FindExternalUrl(trimmed, trimmedLc);

                if (result != null)
                {
                    return(result);
                }
            }
            else
            {
                switch (term.PropertyName)
                {
                case "id":
                    return(new ParsedArtistQuery {
                        Id = PrimitiveParseHelper.ParseIntOrDefault(term.Value, 0)
                    });
                }
            }

            return(new ParsedArtistQuery {
                Name = textQuery.Query
            });
        }
Esempio n. 23
0
        // When page is navigated to, set data context to selected item in list
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            _vanDaleService.ReadFinished += new VanDaleService.ReadFinishedDelegate(VanDaleService_ReadFinished);

            string selectedIndex = "";

            if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex))
            {
                int index = int.Parse(selectedIndex);

                var historyList = HistoryService.GetHistory();
                if (index < historyList.Count)
                {
                    searchWord = historyList[index];
                }
            }
        }
Esempio n. 24
0
        private void UpdateListeEvent()
        {
            if (SearchWord == "" || SearchWord == null)
            {
                ListeEventToShow = ListToObservableCollectionFactory.Convert(ListeEvent); return;
            }
            ObservableCollection <Evenement> tmp = new ObservableCollection <Evenement>();
            Regex r = new Regex("^.*" + SearchWord.ToLower() + ".*$");

            for (int i = 0; i < ListeEvent.Count(); i++)
            {
                if (r.IsMatch(ListeEvent[i].Nom.ToLower()))
                {
                    tmp.Add(ListeEvent[i]);
                }
            }
            ListeEventToShow = tmp;
            NotifyPropertyChanged("ListeEventToShow");
        }
Esempio n. 25
0
        public ActionResult AddSearchWord(string searchWord, int timeLineId, string searchWord2 = "")
        {
            using (FactFluxEntities db = new FactFluxEntities())
            {
                var timeLine = db.Timelines.FirstOrDefault(x => x.TimelineId == timeLineId);

                SearchWord newWord = new SearchWord
                {
                    SearchWordString  = searchWord,
                    SearchWordString2 = searchWord2,
                    TimelineId        = timeLineId
                };

                db.SearchWords.Add(newWord);
                db.SaveChanges();


                return(RedirectToAction("LoadTimeline", "TimelineLogic", new { slug = timeLine.TimelineSlug }));
            }
        }
Esempio n. 26
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var inputArray    = InputArray.Get(context);
            var searchWordCol = SearchWord.Get(context);
            var displayLog    = DisplayLog;

            //Convert Collection to Array
            string[] searchWord = Utils.ConvertCollectionToArray(searchWordCol);
            ///////////////////////////
            // Add execution logic HERE
            bool bIsFound = Utils.MatchItemInArrayOfStrings(inputArray, searchWord, displayLog);

            ///////////////////////////

            // Outputs
            return((ctx) => {
                IsFound.Set(ctx, bIsFound);
            });
        }
Esempio n. 27
0
        /// <summary>
        /// This event is invoked when save button is clicked
        /// It adds the words into text file only if the word doesnt exists
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSave_Click(object sender, EventArgs e)
        {
            Word       checkWordObj  = new Word();
            SearchWord searchWordObj = new SearchWord();

            checkWordObj = searchWordObj.checkWord(WordList, tbSpelling.Text);//calls the method in the library to check the word
            //see if the text fields are not empty and alert the user to enter all the fields
            if (String.IsNullOrEmpty(tbSpelling.Text) || String.IsNullOrEmpty(tbMeaning.Text) || String.IsNullOrEmpty(tbSampleSentence.Text))
            {
                MessageBox.Show("Please enter value in all fields.", "Error in adding word");
            }
            //if the fields are not empty,stores into text file
            else
            {
                //checks if the word is already present in the text file
                if (!(checkWordObj == null))
                {
                    MessageBox.Show("The word is already existing.Please Enter an other word");
                    return;
                }
                //if it is new word,adds into text file by writing it
                //creates a instance of writer in write mode
                StreamWriter writer = new StreamWriter(wordsFile, true);

                string line = string.Concat(tbSpelling.Text, "*", tbMeaning.Text, "*",
                                            tbSampleSentence.Text);
                //append the word to file
                try
                {
                    writer.WriteLine(line);
                    writer.Close();
                    LoadData();//update datagridview with new word
                }
                //let the user know what went wrong in appending the line
                catch (Exception ex)
                {
                    MessageBox.Show("There is some error caught. Err: " + ex.Message);
                }
            }
            ClearFields();//reset the fields
        }
Esempio n. 28
0
        public List <Student> SearchStudent(string searchOption)
        {
            string Sword = null;

            Sword = SearchWord;
            string         name        = null;
            int            age         = 0;
            int            course      = 0;
            string         classes     = null;
            double         avrgMrk     = 0;
            List <Student> fndtStudent = new List <Student>();

            if (searchOption.Equals("Name"))
            {
                name = SearchWord;
            }
            else if (searchOption.Equals("Class"))
            {
                classes = SearchWord;
            }
            List <Student> allStudents = ShowAllStudentsInData();

            foreach (Student searchedStudnt in allStudents)
            {
                if (SearchWord.Equals(""))
                {
                    fndtStudent = allStudents;
                }

                else if (name != null && name.Equals(searchedStudnt.Name))
                {
                    fndtStudent.Add(searchedStudnt);
                }
                else if (classes != null && classes.Equals(searchedStudnt.Class))
                {
                    fndtStudent.Add(searchedStudnt);
                }
            }
            Students = fndtStudent;
            return(Students);
        }
Esempio n. 29
0
        private void Searcher(String str)
        {
            String SearchWord;

            Displayer("けんさくなーう");
            if (str.IndexOf("Youtubeで") >= 0)
            {
                SearchWord = str.Replace("をYoutubeで検索して", "");
                Displayer(SearchWord + "をYoutubeで検索します");
                //SpeeSy.Speak(SearchWord + "を検索します");
                SearchWord = SearchWord.Replace("Youtubeで", "");
                Process.Start("https://www.youtube.com/results?search_query=" + SearchWord);
            }
            else
            {
                SearchWord = str.Replace("を検索して", "");
                Displayer(SearchWord + "を検索します");
                //SpeeSy.Speak(SearchWord + "を検索します");
                Process.Start("https://search.yahoo.co.jp/search?p=" + SearchWord + "&ei=UTF-8");
            }
        }
Esempio n. 30
0
        public List <WordDirection> CheckDirections(SearchWord word, Vector2 position)
        {
            List <WordDirection> directionTrueList = new List <WordDirection>();

            if (position.Y - word.Word.Count > 0)
            {
                directionTrueList.Add(WordDirection.Up);
            }
            if (position.X + word.Word.Count < PlayFieldWidth)
            {
                directionTrueList.Add(WordDirection.Right);
            }
            if (position.Y + word.Word.Count < PlayFieldHeight)
            {
                directionTrueList.Add(WordDirection.Down);
            }
            if (position.X - word.Word.Count > 0)
            {
                directionTrueList.Add(WordDirection.Left);
            }

            if (directionTrueList.Contains(WordDirection.Up) && directionTrueList.Contains(WordDirection.Right))
            {
                directionTrueList.Add(WordDirection.Up_Right);
            }
            if (directionTrueList.Contains(WordDirection.Down) && directionTrueList.Contains(WordDirection.Right))
            {
                directionTrueList.Add(WordDirection.Down_Right);
            }
            if (directionTrueList.Contains(WordDirection.Down) && directionTrueList.Contains(WordDirection.Left))
            {
                directionTrueList.Add(WordDirection.Down_Left);
            }
            if (directionTrueList.Contains(WordDirection.Up) && directionTrueList.Contains(WordDirection.Left))
            {
                directionTrueList.Add(WordDirection.Up_Left);
            }

            return(directionTrueList);
        }
Esempio n. 31
0
 private void Display(DirectoryInfo path)
 {
     try
     {
         foreach (DirectoryInfo dir in path.GetDirectories())
         {
             if (dir.Name.ToLower().Contains(SearchWord.ToLower()))
             {
                 matches.Add(dir);
             }
             Display(dir);
         }
         foreach (FileInfo file in path.GetFiles())
         {
             if (file.Name.ToLower().Contains(SearchWord.ToLower()))
             {
                 matches.Add(file);
             }
         }
     }
     catch (Exception e1) {  }
 }