本文整理汇总了C#中Word类的典型用法代码示例。如果您正苦于以下问题:C# Word类的具体用法?C# Word怎么用?C# Word使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Word类属于命名空间,在下文中一共展示了Word类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestGetHiddenWord
public void TestGetHiddenWord()
{
Word word = new Word("test");
string hiddenWord = word.GetHiddenWord;
Assert.AreEqual(hiddenWord, "_ _ _ _");
}
开发者ID:smo82,项目名称:Americium,代码行数:7,代码来源:WordTest.cs
示例2: Conjugation
public Conjugation(Word verb, FirstTense firstTense, SecondTense secondTense, Person person)
{
this.verb = verb;
FirstTense = firstTense;
SecondTense = secondTense;
Person = person;
}
开发者ID:diegolinan,项目名称:nuve,代码行数:7,代码来源:Conjugation.cs
示例3: Print
public virtual string Print(Word word)
{
_counter.Increment();
if (_counter.Value > 1)
return word.Value + " " + _counter.Value + " times!";
return word.Value;
}
开发者ID:mroed,项目名称:practice,代码行数:7,代码来源:WordPrinter.cs
示例4: DrawWord
private static void DrawWord(Graphics grph, Word word)
{
foreach (Character ch in word.CharList)
DrawChar(grph, ch);
word.Draw(grph);
}
开发者ID:mjmoura,项目名称:tesseractdotnet,代码行数:7,代码来源:Program.cs
示例5: PhonologicalRuleNotUnapplied
public void PhonologicalRuleNotUnapplied(IPhonologicalRule rule, int subruleIndex, Word input)
{
((XElement) input.CurrentTrace).Add(new XElement("PhonologicalRuleAnalysisTrace",
CreateHCRuleElement("PhonologicalRule", rule),
CreateWordElement("Input", input, true),
CreateWordElement("Output", input, true)));
}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:FwXmlTraceManager.cs
示例6: Add
public void Add(Word verb)
{
if (!verb.IsTypeOf(typeof(VerbType)))
{
throw new Exception(verb + " is not verb!");
}
foreach (WordType type in verb.types)
{
if (type is VerbType)
{
VerbType tv = (type as VerbType);
tv.table = this;
string tense = (tv.tense != null ? tv.tense : "");
Person person = (tv.person != null ? tv.person : new Person(0, 0, "", "", ""));
if (!this.table.ContainsKey(tv.mood)) this.table.Add(tv.mood, new Dictionary<string, Dictionary<Person, Word>>());
if (!this.table[tv.mood].ContainsKey(tense)) this.table[tv.mood].Add(tense, new Dictionary<Person, Word>());
this.table[tv.mood][tense].Add(person, verb);
}
}
}
开发者ID:Gigatrappeur,项目名称:NLE,代码行数:26,代码来源:ConjugationTable.cs
示例7: GetChars
/// <summary>
/// Analyses type of last char (volve or consonant) and removes all chars of same type.
/// This creates <volve>,<consonant>,<volve>,<consonant>,... password.
/// </summary>
/// <returns type="System.Char[]">Array of chars.</returns>
public override char[] GetChars(Generator generator, Word password, char[] charsList)
{
ValidateInput(generator, password, charsList);
if (charsList.Length == 0) return charsList;
// Keep only proper chars (volves and consonants).
var chars = charsList.Intersect(charsets.Chars["Letters"]);
// If password already contains some chars then...
if (password.Chars.Length > 0)
{
// If last character is volve then...
if (charsets.Chars["Volves"].Contains(password.Chars.Last()))
{
// Keep only consonants.
chars = chars.Intersect(charsets.Chars["Consonants"]);
}
else
{
// Keep only volves.
chars = chars.Intersect(charsets.Chars["Volves"]);
}
}
charsList = chars.ToArray();
ValidateOutput(generator, password, charsList);
return charsList;
}
开发者ID:JocysCom,项目名称:PassGen,代码行数:30,代码来源:Remember.cs
示例8: GetChars
/// <summary>
/// Analyses last char of password and removes all chars which are located on same phone key.
/// </summary>
/// <returns type="System.Char[]">Array of chars.</returns>
public override char[] GetChars(Generator generator, Word password, char[] charsList)
{
ValidateInput(generator, password, charsList);
if (charsList.Length == 0) return charsList;
// Keep only letters and numbers.
var chars = charsList.Intersect(charsets.Chars["Letnums"]);
// Limit if this is second+ letter only.
if (password.Chars.Length > 0)
{
// Get last char.
var lastChar = password.Chars.Last();
// Route thru GSM Phone keys.
for (int i = 0; i == 9; i++)
{
char[] keys = charsets.Chars["PhoneKey" + i];
// If current key contains last char of password then...
if (keys.Contains(lastChar))
{
// Remove all chars located on same key.
chars = chars.Intersect(keys);
break;
}
}
}
charsList = chars.ToArray();
ValidateOutput(generator, password, charsList);
return charsList;
}
开发者ID:JocysCom,项目名称:PassGen,代码行数:32,代码来源:Phone.cs
示例9: Load
public new void Load(string card)
{
this.Name = card.Substring(0, 4);
string localNUPU = card.Substring(7, 3);
this.NUPU = Convert.ToInt32(localNUPU);
try
{
Word newWord;
for (int i = 10; i <= card.Length - 1; i += 5)
{
if (i == 10)
{
newWord = new Word { Name = "Delta-s = change in wing area(m2)", Position = EpplerCommon.WordPosition.F1, Format = EpplerCommon.WordFormat.F5p2, Value = Convert.ToSingle(card.Substring(i, 5)) };
words.Add(newWord);
}
else if (i == 15)
{
newWord = new Word { Name = "Delta-w = change in aircraft mass(kg)", Position = EpplerCommon.WordPosition.F2, Format = EpplerCommon.WordFormat.F5p2, Value = Convert.ToSingle(card.Substring(i, 5)) };
words.Add(newWord);
}
else if (i == 20)
{
newWord = new Word { Name = "Delta-Ap = change in parasite-drag area(m2)", Position = EpplerCommon.WordPosition.F3, Format = EpplerCommon.WordFormat.F5p2, Value = Convert.ToSingle(card.Substring(i, 5)) };
words.Add(newWord);
}
}
}
catch (Exception ex)
{
//TODO: implement message passing
//MessageBox.show(ex.Message);
}
}
开发者ID:philipebutler,项目名称:EpplerStudio,代码行数:35,代码来源:PLWA.cs
示例10: IsApplicable
public override bool IsApplicable(Word input)
{
if (!_subrule.RequiredSyntacticFeatureStruct.IsUnifiable(input.SyntacticFeatureStruct))
{
if (input.CurrentRuleResults != null)
input.CurrentRuleResults[_index] = new Tuple<FailureReason, object>(FailureReason.RequiredSyntacticFeatureStruct, _subrule.RequiredSyntacticFeatureStruct);
return false;
}
MprFeatureGroup group;
if (_subrule.RequiredMprFeatures.Count > 0 && !_subrule.RequiredMprFeatures.IsMatchRequired(input.MprFeatures, out group))
{
if (input.CurrentRuleResults != null)
input.CurrentRuleResults[_index] = new Tuple<FailureReason, object>(FailureReason.RequiredMprFeatures, group);
return false;
}
if (_subrule.ExcludedMprFeatures.Count > 0 && !_subrule.ExcludedMprFeatures.IsMatchExcluded(input.MprFeatures, out group))
{
if (input.CurrentRuleResults != null)
input.CurrentRuleResults[_index] = new Tuple<FailureReason, object>(FailureReason.ExcludedMprFeatures, group);
return false;
}
return true;
}
开发者ID:sillsdev,项目名称:hermitcrab,代码行数:26,代码来源:SynthesisRewriteSubruleSpec.cs
示例11: LoadWords
public void LoadWords(Word[] words)
{
Array.Sort(words);
HashTable = new Dictionary<string, List<string>>(words.Length);
foreach (var word in words)
{
for (var i = 1; i <= word.Text.Length; i++)
{
var prefix = word.Text.Substring(0, i);
if (HashTable.ContainsKey(prefix))
{
if (HashTable[prefix].Count < 10)
{
HashTable[prefix].Add(word.Text);
}
}
else
{
HashTable[prefix] = new List<string> { word.Text };
}
}
}
}
开发者ID:kdrake,项目名称:iNotepad,代码行数:26,代码来源:HashTableAutocompeleProcessor.cs
示例12: AddFromTranslator
public ActionResult AddFromTranslator(string wordText, string translationsConcated)
{
try
{
var activeDict = _authService.CurrentAccount.ActiveDictionary;
var translations = translationsConcated.Split(';');
string firstTranslation = translations.First();
var newWord = new Word { Original = wordText, InsertedOn = DateTime.Now };
try
{
var pronounceFile = _translationService.GetPronounceAudioFile(wordText, activeDict.From, "mp3", String.Empty);
newWord.PronounceAudioFile = pronounceFile;
}
catch (TranslatorException)
{
}
activeDict.Words.Add(newWord);
newWord.Translations = translations.Select(t => new Translation { Value = t }).ToArray();
_wordRepository.SaveChanges();
return RedirectToAction("List", new { dictionaryId = activeDict.ID });
}
catch (Exception ex)
{
LoggingService.Instance.Log.Fatal(String.Format("A fatal error has occurred while adding a new word using an external translator service. The new word is {0}. The error is {1}", wordText, ex));
return RedirectToAction("Error", "Home");
}
}
开发者ID:xunter,项目名称:keepwordswebapp,代码行数:27,代码来源:WordController.cs
示例13: Start
void Start()
{
NextSentence();
Word[] words = new Word[tests.WordBank.Values.Count];
int j = 0;
foreach (Word w in tests.WordBank.Values) {
words[j] = w;
j++;
}
// scramble the word order
int num = words.Length;
// decide a random order to add nouns
int[] indices = new int[num];
for (int i = 0; i < num; ++i) indices[i] = i;
for (int i = 0; i < num - 1; ++i)
{
int swp = Random.Range(i, num);
int tmp = indices[swp];
indices[swp] = indices[i];
indices[i] = tmp;
}
// add nouns
for (int i = 0; i < num; ++i)
{
CreateNoun(words[indices[i]]);
}
}
开发者ID:silverhammermba,项目名称:ggj2016,代码行数:34,代码来源:TestManager.cs
示例14: TestGetWord
public void TestGetWord()
{
Word word = new Word("test");
string originalWord = word.GetWord;
Assert.AreEqual(originalWord, "test");
}
开发者ID:smo82,项目名称:Americium,代码行数:7,代码来源:WordTest.cs
示例15: StringToWords
private Word[] StringToWords(string s)
{
if (s == null)
{
return null;
}
int wordCount = s.Length / 4;
Word[] words = new Word[wordCount];
for (int i = 0; i < wordCount; i++)
{
words[i] = new Word(s.Substring(i * 4, 4));
}
string remaining = s.Substring(s.Length - s.Length % 4);
if (remaining.Length > 0)
{
Word[] allWords = new Word[wordCount + 1];
words.CopyTo(allWords, 0);
allWords[allWords.Length - 1] = new Word(remaining);
return allWords;
}
else
{
return words;
}
}
开发者ID:ICanHaz,项目名称:Os-model,代码行数:25,代码来源:Memory.cs
示例16: ValidateOutput
public virtual void ValidateOutput(Generator generator, Word password, char[] chars)
{
if (chars.Length == 0)
{
password.AppendLog("Error: '{0}' filter removed all chars from list.\r\n", FilterName);
}
}
开发者ID:JocysCom,项目名称:PassGen,代码行数:7,代码来源:Filter.cs
示例17: ConjugationTable
public ConjugationTable(Word verbBase)
{
this.verbBase = null;
this.table = new Dictionary<string, Dictionary<string, Dictionary<Person, Word>>>();
this.setBase(verbBase);
}
开发者ID:Gigatrappeur,项目名称:NLE,代码行数:7,代码来源:ConjugationTable.cs
示例18: Main
static void Main(string[] args)
{
var dictionary = new Dictionary<int, HashSet<Word>>();
int N = int.Parse(Console.ReadLine());
for (int i = 0; i < N; i++)
{
string W = Console.ReadLine();
//Filtrera bort alla dict. ord > 7 texten
if (W.Length <= 7)
{
var word = new Word(W, i);
//Gruppera dict. efter poäng
HashSet<Word> hashSet;
if (!dictionary.TryGetValue(word.Value, out hashSet))
{
hashSet = new HashSet<Word>();
dictionary.Add(word.Value, hashSet);
}
hashSet.Add(word);
}
}
string LETTERS = Console.ReadLine();
LETTERS = string.Join("", LETTERS.OrderBy(x => x));
var allUniqueVariants = LETTERS.Variants()
.Distinct()
.Select(x => new Word(x, 0))
.OrderByDescending(x => x.Value)
.ToArray();
foreach (var word in allUniqueVariants)
{
HashSet<Word> hashSet;
if (dictionary.TryGetValue(word.Value, out hashSet))
{
var found = hashSet.Contains(word);
if (found)
{
var lookupTable = hashSet.ToLookup(x => x.Chars, x => x);
var wordToFind = lookupTable[word.Chars].OrderBy(x => x.Index).First();
Console.WriteLine(wordToFind);
return;
}
}
}
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
Console.WriteLine("invalid word");
}
开发者ID:aquamoth,项目名称:CodeinGame,代码行数:60,代码来源:Program.cs
示例19: AddRange
public void AddRange(Word[] list)
{
foreach (Word item in list)
{
this.Add(item);
}
}
开发者ID:Gigatrappeur,项目名称:NLE,代码行数:7,代码来源:ConjugationTable.cs
示例20: checkin
public void checkin(Word._Document activeDocument)
{
try
{
if (MessageBox.Show(resources.GetString("sure_check_in"), resources.GetString("checkin"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
{
object saveChanges = Word.WdSaveOptions.wdSaveChanges;
object missing = Type.Missing;
String localFileName = activeDocument.FullName;
activeDocument.Close(ref saveChanges, ref missing, ref missing); // Always we save document
docXML.refresh(); // Refresh document list
if (docXML.isOpenKMDocument(localFileName))
{
OKMDocument oKMDocument = docXML.getOpenKMDocument(localFileName);
docXML.remove(oKMDocument);
DocumentLogic.checkin(oKMDocument, configXML.getHost(), configXML.getUser(), configXML.getPassword());
if (File.Exists(localFileName))
{
File.Delete(localFileName);
}
}
}
}
catch (Exception e)
{
String errorMsg = "OpenKMWordAddIn - (checkinButton_Click)\n" + e.Message + "\n\n" + e.StackTrace;
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
开发者ID:MG-Automation-Technologies,项目名称:dms,代码行数:29,代码来源:OpenkMAddIn.cs
注:本文中的Word类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论