public static string GetObjName(TranslationTypes type) { switch (type) { case TranslationTypes.Buffs: return("Buff"); case TranslationTypes.Items: return("Item"); case TranslationTypes.NPCs: return("NPC"); case TranslationTypes.Tiles: return("Tile"); default: return(null); } }
public void WriteThisFile(string file, TranslationTypes type) { // GetCommonThroughFile(file); writer.WriteLine(); writer.WriteLine($"// {Path.GetFileNameWithoutExtension(file)}"); writer.WriteLine("\n"); string jstr; using (var reader = new StreamReader(new FileStream(file, FileMode.Open))) { jstr = reader.ReadToEnd(); } var jarr = JArray.Parse(jstr); string typeName = null; string tip = null; string name = null; foreach (var obj in jarr) { typeName = obj["TypeName"].Value <string>(); name = obj["Name"].Value <string>(); name = needsReplacement ? CheckReplace(name) : name; if (type != TranslationTypes.Tiles && name.Length == 0) { writer.WriteLine(unknown); } if (type == TranslationTypes.Buffs) { tip = obj["Tip"].Value <string>().Replace("\n", "\\n"); tip = needsReplacement ? CheckReplace(tip) : tip; writer.WriteLine($"BuffName.{typeName}={name}"); if (tip.Length != 0) { writer.WriteLine($"BuffDescription.{typeName}={tip}"); } writer.WriteLine(); } else if (type == TranslationTypes.Items) { tip = obj["ToolTip"].Value <string>().Replace("\n", "\\n"); tip = needsReplacement ? CheckReplace(tip) : tip; writer.WriteLine($"ItemName.{typeName}={name}"); if (tip.Length != 0) { writer.WriteLine($"ItemTooltip.{typeName}={tip}"); } writer.WriteLine(); } else if (type == TranslationTypes.NPCs) { writer.WriteLine($"NPCName.{typeName}={name}"); writer.WriteLine(); } else if (type == TranslationTypes.Tiles) { if (name.Length != 0) { writer.WriteLine($"MapObject.{typeName}={name}"); writer.WriteLine(); } } } // flush writer writer.Flush(); }
/// <summary> /// Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a /// virtual-key code. /// To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx /// function. /// </summary> /// <param name="key"> /// The virtual key code for a key. How this value is interpreted depends on the value of the uMapType parameter. /// </param> /// <param name="translation"> /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. /// </param> /// <returns> /// The return value is either a scan code, a virtual-key code, or a character value, depending on the value of uCode /// and uMapType. /// If there is no translation, the return value is zero. /// </returns> public static uint MapVirtualKey(Keys key, TranslationTypes translation) { return MapVirtualKey((uint) key, translation); }
/// <summary> /// Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a /// virtual-key code. /// To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx /// function. /// </summary> /// <param name="key"> /// The virtual key code or scan code for a key. How this value is interpreted depends on the value of the uMapType /// parameter. /// </param> /// <param name="translation"> /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. /// </param> /// <returns> /// The return value is either a scan code, a virtual-key code, or a character value, depending on the value of uCode /// and uMapType. /// If there is no translation, the return value is zero. /// </returns> public static uint MapVirtualKey(uint key, TranslationTypes translation) { return NativeMethods.MapVirtualKey(key, translation); }
/// <summary> /// Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a /// virtual-key code. /// To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx /// function. /// </summary> /// <param name="key"> /// The virtual key code for a key. How this value is interpreted depends on the value of the uMapType parameter. /// </param> /// <param name="translation"> /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. /// </param> /// <returns> /// The return value is either a scan code, a virtual-key code, or a character value, depending on the value of uCode /// and uMapType. /// If there is no translation, the return value is zero. /// </returns> public static int MapVirtualKey(Keys key, TranslationTypes translation) { return(MapVirtualKey((int)key, translation)); }
/// <summary> /// Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a /// virtual-key code. /// To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx /// function. /// </summary> /// <param name="key"> /// The virtual key code or scan code for a key. How this value is interpreted depends on the value of the uMapType /// parameter. /// </param> /// <param name="translation"> /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. /// </param> /// <returns> /// The return value is either a scan code, a virtual-key code, or a character value, depending on the value of uCode /// and uMapType. /// If there is no translation, the return value is zero. /// </returns> public static int MapVirtualKey(int key, TranslationTypes translation) { return(User32.MapVirtualKey(key, translation)); }
public static extern int MapVirtualKey(int key, TranslationTypes translation);
public static extern uint MapVirtualKey(uint key, TranslationTypes translation);
public static uint MapVirtualKey(Keys key, TranslationTypes translation) { return(WindowsAPI.MapVirtualKey((uint)key, translation)); }
/// <summary> /// Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. /// To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function. /// </summary> /// <param name="key"> /// The virtual key code or scan code for a key. How this value is interpreted depends on the value of the uMapType parameter. /// </param> /// <param name="translation"> /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. /// </param> /// <returns> /// The return value is either a scan code, a virtual-key code, or a character value, depending on the value of uCode and uMapType. /// If there is no translation, the return value is zero. /// </returns> public static uint MapVirtualKey(uint key, TranslationTypes translation) { return(NativeMethods.MapVirtualKey(key, translation)); }