コード例 #1
0
        private static bool setSTSCLine(TranslationLine line, STSCInstructions.Instruction inst, bool ignoreKey)
        {
            switch (inst.Name)
            {
            case "Mes":
                // Check if the entry is a Message translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "Message")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(2) == line.Key || ignoreKey)
                {
                    inst.Arguments[2] = line.Translation;
                    return(true);
                }
                break;

            case "SetChoice":
                // Check if the entry is a Choice translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "Choice")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(1) == line.Key || ignoreKey)
                {
                    inst.Arguments[1] = line.Translation;
                    return(true);
                }
                break;

            case "MapPlace":
                // Check if the entry is a MapPlace translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "MapMarker")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(1) == line.Key || ignoreKey)
                {
                    inst.Arguments[1] = line.Translation;
                    return(true);
                }
                break;

            default:
                break;
            }
            return(false);
        }
コード例 #2
0
        private static bool SetSTSCLine(TranslationLine line, List <STSCInstructions.Instruction> instructions, int index, bool ignoreKey)
        {
            var inst = instructions[index];

            switch (inst.Name)
            {
            case "Message":
            case "Mes":
                // Check if the entry is a Message translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "Message")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(2) == line.Key || ignoreKey)
                {
                    inst.Arguments[2] = line.Translation;

                    if (index <= 2)
                    {
                        return(true);
                    }
                    for (int i = index; i > index - 3; --i)
                    {
                        if (instructions[i].Name == "Name")
                        {
                            instructions[i].Arguments[0] = line.Comment;
                            return(true);
                        }
                    }
                    return(true);
                }
                break;

            case "Choice":
            case "SetChoice":
                // Check if the entry is a Choice translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "Choice")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(1) == line.Key || ignoreKey)
                {
                    inst.Arguments[1] = line.Translation;
                    return(true);
                }
                break;

            case "MapPlace":
                // Check if the entry is a MapPlace translation
                if (!string.IsNullOrEmpty(line.Operator) && line.Operator != "MapMarker")
                {
                    break;
                }
                // Check if the key matches the current text
                if (inst.GetArgument <string>(1) == line.Key || ignoreKey)
                {
                    inst.Arguments[1] = line.Translation;
                    return(true);
                }
                break;

            default:
                break;
            }
            return(false);
        }