mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Improve translation rule parsing
This commit is contained in:
parent
de50e07f54
commit
6347d832ce
2 changed files with 11 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace MinecraftClient
|
namespace MinecraftClient
|
||||||
{
|
{
|
||||||
|
|
@ -139,7 +140,15 @@ namespace MinecraftClient
|
||||||
if (!init) { InitRules(); init = true; }
|
if (!init) { InitRules(); init = true; }
|
||||||
if (TranslationRules.ContainsKey(rulename))
|
if (TranslationRules.ContainsKey(rulename))
|
||||||
{
|
{
|
||||||
string[] syntax = TranslationRules[rulename].Split(new string[2] { "%s", "%d" }, StringSplitOptions.None);
|
if ((TranslationRules[rulename].IndexOf("%1$s") >= 0 && TranslationRules[rulename].IndexOf("%2$s") >= 0)
|
||||||
|
&& (TranslationRules[rulename].IndexOf("%1$s") > TranslationRules[rulename].IndexOf("%2$s")))
|
||||||
|
{
|
||||||
|
while (using_data.Count < 2) { using_data.Add(""); }
|
||||||
|
string tmp = using_data[0];
|
||||||
|
using_data[0] = using_data[1];
|
||||||
|
using_data[1] = tmp;
|
||||||
|
}
|
||||||
|
string[] syntax = TranslationRules[rulename].Split(new string[] { "%s", "%d", "%1$s", "%2$s" }, StringSplitOptions.None);
|
||||||
while (using_data.Count < syntax.Length - 1) { using_data.Add(""); }
|
while (using_data.Count < syntax.Length - 1) { using_data.Add(""); }
|
||||||
string[] using_array = using_data.ToArray();
|
string[] using_array = using_data.ToArray();
|
||||||
string translated = "";
|
string translated = "";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
<StartArguments>TestBot - localhost bot:scripting:testscript.txt</StartArguments>
|
<StartArguments>TestBot - localhost</StartArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue