Hungarian layout v2

This commit is contained in:
2021-03-16 11:23:49 +01:00
parent 759d901b57
commit 5d6832bdb8

View File

@@ -17,16 +17,16 @@ namespace LanguageGenerator
{
private static readonly char[,] smallCharacters = new char[4, 8]
{
{'k', 's', 'i', 'n', 'e', 'l', 'a', 't'},
{'g', 'b', 'm', 'o', 'z', 'r', 'y', 'v'},
{'x', 'p', 'f', 'd', 'j', 'c', 'u', 'h'},
{'k', 'l', 's', 'n', 'e', 'i', 'a', 't'},
{'b', 'r', 'm', 'y', 'g', 'v', 'o', 'z'},
{'c', 'f', 'p', 'x', 'h', 'j', 'u', 'd'},
{'q', '?', '!', 'w', '@', ',', '.', '\''}
};
private static readonly char[,] capitalCharacters = new char[4, 8]
{
{'K', 'S', 'I', 'N', 'E', 'L', 'A', 'T'},
{'G', 'B', 'M', 'O', 'Z', 'R', 'Y', 'V'},
{'X', 'P', 'F', 'D', 'J', 'C', 'U', 'H'},
{'K', 'L', 'S', 'N', 'E', 'I', 'A', 'T'},
{'B', 'R', 'M', 'Y', 'G', 'V', 'O', 'Z'},
{'C', 'F', 'P', 'X', 'H', 'J', 'U', 'D'},
{'Q', '-', '_', 'W', '*', '/', ':', '\"'}
};
@@ -111,13 +111,34 @@ namespace LanguageGenerator
generatedOutput.Append(keyboardActionsString);
}
using var writer = File.CreateText(fileName);
using (var writer = File.CreateText(fileName))
{
writer.Write("<keyboardActionMap>" + Environment.NewLine);
writer.Write(generatedOutput);
writer.Write(File.ReadAllText("append.xml"));
writer.Write(Environment.NewLine + "</keyboardActionMap>");
}
var lowerCaseBuilder = new StringBuilder();
var upperCaseBuilder = new StringBuilder();
foreach (var column in new int[] { 2, 4, 6, 0 })
{
for (var i = 0; i < 4; i++)
{
lowerCaseBuilder.Append(smallCharacters[i, column]);
lowerCaseBuilder.Append(smallCharacters[i, column + 1]);
upperCaseBuilder.Append(capitalCharacters[i, column]);
upperCaseBuilder.Append(capitalCharacters[i, column + 1]);
}
}
var lowerCaseDisplay = lowerCaseBuilder.ToString();
var upperCaseDisplay = upperCaseBuilder.ToString();
Console.WriteLine(lowerCaseDisplay);
Console.WriteLine(upperCaseDisplay);
}
private static KeyboardAction CharToKeyboardAction(char chr, int circle, int line)
{
var movementActions = PositionToMovementSequenceEdges(circle, line);
@@ -126,20 +147,7 @@ namespace LanguageGenerator
{
var c when c >= 'a' && c <= 'z' => new KeyboardAction(new KeyCodeContent(c, circle, line), movementActions),
var c when c >= 'A' && c <= 'Z' => new KeyboardAction(new KeyCodeContent(c, circle, line), movementActions, upperCaseFlags),
/* var c when c == '?' => new KeyboardAction(new StringContent("?"), movementActions),
var c when c == '!' => new KeyboardAction(new StringContent("!"), movementActions),
var c when c == '@' => new KeyboardAction(new StringContent("@"), movementActions),
var c when c == ',' => new KeyboardAction(new StringContent(","), movementActions),
var c when c == '.' => new KeyboardAction(new StringContent("."), movementActions),
var c when c == '\'' => new KeyboardAction(new StringContent("\'"), movementActions),
var c when c == '-' => new KeyboardAction(new StringContent("?"), movementActions),
var c when c == '_' => new KeyboardAction(new StringContent("!"), movementActions),
var c when c == '*' => new KeyboardAction(new StringContent("@"), movementActions),
var c when c == '/' => new KeyboardAction(new StringContent(","), movementActions),
var c when c == ':' => new KeyboardAction(new StringContent("."), movementActions),
var c when c == '\"' => new KeyboardAction(new StringContent("\'"), movementActions), */
var c => new KeyboardAction(new StringContent(c.ToString()), movementActions)
//_ => throw new ArgumentException($"Unknown character: '{chr}' ({(int)chr})")
};
}
@@ -258,7 +266,7 @@ namespace LanguageGenerator
public int Line { get; }
public string GetContent() => $"<inputKey>{KeyCodeText}</inputKey>";
public string GetActionType() =>"INPUT_KEY";
public string GetActionType() => "INPUT_KEY";
}
public class StringContent : IKeyboardContent