private void writeKeyMapEntry(KeyMapEntry kme) { _writer.WriteStartElement("wne", "keymap", OpenXmlNamespaces.MicrosoftWordML); //primary KCM if (kme.kcm1 > 0) { _writer.WriteAttributeString("wne", "kcmPrimary", OpenXmlNamespaces.MicrosoftWordML, String.Format("{0:x4}", kme.kcm1)); } _writer.WriteStartElement("wne", "macro", OpenXmlNamespaces.MicrosoftWordML); _writer.WriteAttributeString("wne", "macroName", OpenXmlNamespaces.MicrosoftWordML, _tcg.MacroNames[kme.paramCid.ibstMacro] ); _writer.WriteEndElement(); _writer.WriteEndElement(); }
/// <param name="args"> array of command line arguments </param> public static void Main(string[] args) { initialize_History(); initialize_KeyMapEntry(); // TODO: Check and accomplish variable declarations: string varPart; // Converts the input to lowercase, cuts out interpunctation // and pads the string string userInput; string reply; int posAster; int[] offsets; bool isRepeated; bool isGone; int[] findInfo; // TODO: You may have to modify input instructions, // possibly by enclosing Console.ReadLine() calls with // Parse methods according to the variable type, e.g.: // i = int.Parse(Console.ReadLine()); // Title information Console.WriteLine("************* ELIZA **************"); Console.WriteLine("* Original design by J. Weizenbaum"); Console.WriteLine("**********************************"); Console.WriteLine("* Adapted for Basic on IBM PC by"); Console.WriteLine("* - Patricia Danielson"); Console.WriteLine("* - Paul Hashfield"); Console.WriteLine("**********************************"); Console.WriteLine("* Adapted for Structorizer by"); Console.WriteLine("* - Kay Gürtzig / FH Erfurt 2016"); Console.WriteLine("* Version: 2.3 (2020-02-24)"); Console.WriteLine("* (Requires at least Structorizer 3.30-03 to run)"); Console.WriteLine("**********************************"); // Stores the last five inputs of the user in a ring buffer, // the second component is the rolling (over-)write index. History history = new History(new string[] { "", "", "", "", "" }, 0); const string[,] replies = setupReplies(); const string[,] reflexions = setupReflexions(); const string[,] byePhrases = setupGoodByePhrases(); const KeyMapEntry[] keyMap = setupKeywords(); offsets[length(keyMap) - 1] = 0; isGone = false; // Starter Console.WriteLine("Hi! I\'m your new therapist. My name is Eliza. What\'s your problem?"); do { userInput = Console.ReadLine(); // Converts the input to lowercase, cuts out interpunctation // and pads the string // Converts the input to lowercase, cuts out interpunctation // and pads the string userInput = normalizeInput(userInput); isGone = checkGoodBye(userInput, byePhrases); if (!isGone) { reply = "Please don\'t repeat yourself!"; isRepeated = checkRepetition(history, userInput); if (!isRepeated) { findInfo = findKeyword(keyMap, userInput); ??? keyIndex = findInfo[0]; if (keyIndex < 0) { // Should never happen... keyIndex = length(keyMap) - 1; } KeyMapEntry entry = keyMap[keyIndex]; // Variable part of the reply varPart = ""; if (length(entry.keyword) > 0) { varPart = conjugateStrings(userInput, entry.keyword, findInfo[1], reflexions); }