Ejemplo n.º 1
0
        public string ToText()
        {
            string result = Name.ToString() + "\r\n";

            result += Annoucement.ToString() + "\r\n";
            result += Meaning.ToString() + "\r\n";
            result += AddTime.ToString() + "\r\n";
            result += ToProficiencyString(Proficiency) + "\r\n";
            return(result);
        }
Ejemplo n.º 2
0
        public static IEnumerable <string> GetSynonyms(string word, List <string> invalid_synonyms, Microsoft.Office.Interop.Word.Application wordApp)
        {
            word = word.ToLower();

            var found       = new List <string>();
            var theSynonyms = wordApp.get_SynonymInfo(word);

            foreach (var Meaning in theSynonyms.MeaningList as Array)
            {
                if (found.Count >= 4)
                {
                    return(found);
                }

                var synonym = Meaning.ToString();
                if (!IsSynonymTooSimilar(word, synonym, found))
                {
                    if (!invalid_synonyms.Contains(synonym))
                    {
                        found.Add(synonym);
                    }
                    else
                    {
                        Debug.WriteLine("Synonym " + synonym + " was blocked because it was on the invalid list.");
                    }
                }
            }

            for (int ii = 0; ii < found.Count; ii++)
            {
                theSynonyms = wordApp.SynonymInfo[found[ii]];

                foreach (string synonym in theSynonyms.MeaningList as Array)
                {
                    if (found.Count >= 4)
                    {
                        return(found);
                    }

                    if (IsSynonymTooSimilar(word, synonym, found))
                    {
                        continue;
                    }

                    found.Add(synonym);
                }
            }

            return(found);
        }
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            Func <string, object, string> f = (n, o) => string.Format(CultureInfo.InvariantCulture,
                                                                      "{0,40}: " + (o is byte? "0x{1:X2}" : "{1}"), n, o);

            var builder = new StringBuilder();

            builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "{0}", GetType().Name));
            builder.AppendLine(f("TVR[0]", ByteOne));
            builder.AppendLine(f("TVR[1]", ByteTwo));
            builder.AppendLine(f("TVR[2]", ByteThree));
            builder.AppendLine(f("TVR[3]", ByteFour));
            builder.AppendLine(f("TVR[4]", ByteFive));
            Meaning.ToString().Split(',').ForEach(x => builder.AppendLine(f("TVR", x.Trim())));
            builder.AppendLine(f("Offline Approved", OfflineApproved));
            return(builder.ToString());
        }
Ejemplo n.º 4
0
 private static void DebugPrintMeaning(IntentionGrid grid, Meaning meaning)
 {
     //Debug
     Console.WriteLine(meaning.ToString() + ":  ");
     for (var y = 0; y < grid.Height; y++)
     {
         var str = "";
         for (var x = 0; x < grid.Width; x++)
         {
             if (grid.Positions[x, y].Intentions.Any(i => i.Meaning == meaning))
             {
                 str = str + "X";
             }
             else
             {
                 str = str + "-";
             }
         }
         Console.WriteLine(str);
     }
     Console.WriteLine("");
 }