private static void ReplySubParse(List <DialogueParser> Args, string incode, OpcodeType _opcode) { int m, n = 0; do { OpcodeType opcode = _opcode; m = n; n = incode.IndexOf(opcode.ToString(), m, StringComparison.OrdinalIgnoreCase); if (n == -1) { foreach (var op in DialogFunctionsRules.opcodeTemplates) { if (op.Value.isDefault || op.Value.opcode != OpcodeType.Reply) { continue; } n = incode.IndexOf(op.Value.opcodeName, m, StringComparison.Ordinal); if (n != -1) { break; } } } if (n > -1) { string name = GetOpcodeName(incode, ref n); if (name == null) { break; // bad code } string nameLower = name.ToLowerInvariant(); if (opcode == OpcodeType.Message) { if (nameLower == "message_str") { break; } } if (nameLower == "gsay_reply" || nameLower == "gsay_message") { opcode = (opcode == OpcodeType.Reply) ? OpcodeType.gsay_reply : OpcodeType.gsay_message; //name = nameLower; } if ((n + 2) < incode.Length) { Args.Add(new DialogueParser(opcode, name, incode, n)); n = nextPosition; } } } while (n > -1 && n < incode.Length); }
private static void OptionSubParse(List <DialogueParser> Args, string incode) { int m, n = 0; do { OpcodeType opcode = OpcodeType.Option; m = n; n = incode.IndexOf(opcode.ToString(), m, StringComparison.OrdinalIgnoreCase); if (n == -1) { foreach (var op in DialogFunctionsRules.opcodeTemplates) { if (op.Value.isDefault || op.Value.opcode != OpcodeType.Option) { continue; } n = incode.IndexOf(op.Value.opcodeName, m, StringComparison.Ordinal); if (n != -1) { break; } } } if (n > -1) { string name = GetOpcodeName(incode, ref n); if (name == null) { break; // bad code } string nameLower = name.ToLowerInvariant(); if (nameLower == "gsay_option") { opcode = OpcodeType.gsay_option; //name = nameLower; } else if (nameLower == "giq_option") { opcode = OpcodeType.giq_option; //name = nameLower; } Args.Add(new DialogueParser(opcode, name, incode, n)); // n+6 n = nextPosition; } } while (n > -1 && n < incode.Length); }
private static ExecutableOpcodeType MapOpcodeType(OpcodeType opcodeType) { return((ExecutableOpcodeType)Enum.Parse(typeof(ExecutableOpcodeType), opcodeType.ToString())); }
private static ExecutableOpcodeType MapOpcodeType(OpcodeType opcodeType) { return (ExecutableOpcodeType) Enum.Parse(typeof (ExecutableOpcodeType), opcodeType.ToString()); }