for Push.

This commit is contained in:
nobobo
2026-06-01 13:23:34 +09:00
parent 9e093ea99f
commit a6550e9928
93 changed files with 10393 additions and 0 deletions
@@ -0,0 +1,22 @@
using KssSmaPlaLib.AutoTest.Command.Definition;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KssSmaPlaLib.AutoTest.Command.Alias
{
public class CommandAliasUxer
{
private static Dictionary<string, CommandEnumUxer.Command> _reverseMap = new Dictionary<string, CommandEnumUxer.Command>();
public static void SetAleiasDic(Dictionary<string, CommandEnumUxer.Command> dic)
{
_reverseMap = dic;
}
public static bool TryTranslate(string userCommand, out CommandEnumUxer.Command command)
=> _reverseMap.TryGetValue(userCommand, out command);
}
}
@@ -0,0 +1,63 @@
using KssSmaPlaLib.AutoTest.Command.Definition;
using KssSmaPlaLib.AutoTest.Command.Translator;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KssSmaPlaLib.AutoTest.Command.Alias.Ini
{
public static class IniReaderUxer
{
public static bool Try(string iniFilePath, out Dictionary<string, CommandEnumUxer.Command> dic, out string resultMessage)
{
dic = new Dictionary<string, CommandEnumUxer.Command>();
resultMessage = string.Empty;
try
{
if (!File.Exists(iniFilePath))
{
resultMessage = "エイリアスファイルが存在しません。";
return false;
}
var lines = File.ReadAllLines(iniFilePath, System.Text.Encoding.GetEncoding("shift_jis"));
// ここでDTOにパース(例:セクションごとに分ける、キーと値を読み込むなど)
// ↓仮の処理(実際はINIパーサーCLがあると別府)
foreach (var line in lines)
{
if (line.StartsWith("#") ||
line.StartsWith(";") ||
string.IsNullOrWhiteSpace(line))
continue;
var parts = line.Split('=');
if (parts.Length == 2)
{
var command = parts[0].Trim();
var alias = parts[1].Trim();
if (!CommandTranslatorUxer.TryTranslate(command, out var commandEnum))
{
resultMessage = $"エイリアスファイルでコマンド名が不正です。[コマンド名:{command}]";
return false;
}
// エイリアス辞書登録
dic[alias] = commandEnum;
}
}
return true;
}
catch (Exception ex)
{
resultMessage = $"エイリアスロードに失敗しました。[エラー内容:{ex.Message}]";
return false;
}
}
}
}
@@ -0,0 +1,27 @@
using KssSmaPlaLib.AutoTest.Command.Alias.Ini;
using KssSmaPlaLib.AutoTest.Command.Definition;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KssSmaPlaLib.AutoTest.Command.Alias.Loader
{
public static class CommandAliasLoaderUxer
{
public const string COMMAND_ALIAS_FILE_PATH = ".\\command_alias.ini";
public static bool Try(out Dictionary<string,CommandEnumUxer.Command>dic, out string resultMessage)
{
resultMessage = string.Empty;
if (!IniReaderUxer.Try(COMMAND_ALIAS_FILE_PATH, out dic, out var messageForMe))
{
resultMessage = messageForMe;
return false;
}
return true;
}
}
}