mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-17 04:27:13 +00:00
feat[protocol]: cut down ruby generated protocol
This commit is contained in:
@@ -53,7 +53,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -83,7 +83,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -113,7 +113,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -143,7 +143,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -173,7 +173,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -203,7 +203,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -233,7 +233,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -263,7 +263,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -293,7 +293,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -323,7 +323,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -353,7 +353,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -383,7 +383,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -413,7 +413,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -443,7 +443,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -473,7 +473,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeStringArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -503,8 +503,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case Enhance:
|
||||
builder.append(StringUtils.format("{}.writePacketArray($1, {}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
|
||||
break;
|
||||
case GdScript:
|
||||
case Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -554,7 +553,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readBoolArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readBoolArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -600,7 +599,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readBoolArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readBoolArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -643,7 +642,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readByteArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readByteArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -689,7 +688,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readByteArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readByteArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -732,7 +731,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readShortArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readShortArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -778,7 +777,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readShortArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readShortArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -821,7 +820,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -867,7 +866,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -910,7 +909,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -956,7 +955,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -999,7 +998,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readFloatArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readFloatArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -1045,7 +1044,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readFloatArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readFloatArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -1088,7 +1087,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readDoubleArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readDoubleArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -1134,7 +1133,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readDoubleArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readDoubleArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -1177,7 +1176,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringArray()", array)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringArray()", array)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -1221,7 +1220,7 @@ public class CutDownArraySerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readPacketArray({})", array, protocolId)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readPacketArray({})", array, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -85,7 +85,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -119,7 +119,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -152,7 +152,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -185,7 +185,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -219,7 +219,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -253,7 +253,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -287,7 +287,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeStringArray(&{});", objectStr)).append(LS);
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -320,7 +320,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case Enhance:
|
||||
builder.append(StringUtils.format("{}.writePacketList($1, (List){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
|
||||
break;
|
||||
case GdScript, Python:
|
||||
case GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -372,7 +372,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readBoolArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readBoolArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -418,7 +418,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readByteArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readByteArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -464,7 +464,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readShortArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readShortArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -510,7 +510,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -556,7 +556,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -602,7 +602,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readFloatArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readFloatArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -648,7 +648,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readDoubleArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readDoubleArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -694,7 +694,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringArray()", list)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringArray()", list)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -740,7 +740,7 @@ public class CutDownListSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readPacketArray({})", list, protocolId)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readPacketArray({})", list, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntIntMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntIntMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -86,7 +86,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntLongMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntLongMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -113,7 +113,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeIntStringMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntStringMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -138,7 +138,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Enhance:
|
||||
builder.append(StringUtils.format("{}.writeIntPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntPacketMap({}, {})", objectStr, protocolId)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -169,7 +169,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongIntMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongIntMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -196,7 +196,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongLongMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongLongMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -223,7 +223,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeLongStringMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongStringMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -248,7 +248,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Enhance:
|
||||
builder.append(StringUtils.format("{}.writeLongPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongPacketMap({}, {})", objectStr, protocolId)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -279,7 +279,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeStringIntMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringIntMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -306,7 +306,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeStringLongMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringLongMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -333,7 +333,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Rust:
|
||||
builder.append(StringUtils.format("buffer.writeStringStringMap(&{});", objectStr)).append(LS);
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringStringMap({})", objectStr)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -358,7 +358,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case Enhance:
|
||||
builder.append(StringUtils.format("{}.writeStringPacketMap($1, (Map){}, {});", EnhanceUtils.byteBufUtils, objectStr, EnhanceUtils.getProtocolRegistrationFieldNameByProtocolId(protocolId)));
|
||||
return true;
|
||||
case Kotlin, Scala, GdScript, Python:
|
||||
case Kotlin, Scala, GdScript, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringPacketMap({}, {})", objectStr, protocolId)).append(LS);
|
||||
return true;
|
||||
case Lua:
|
||||
@@ -408,7 +408,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -451,7 +451,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -494,7 +494,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -536,7 +536,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -579,7 +579,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -622,7 +622,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -665,7 +665,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -707,7 +707,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -751,7 +751,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringIntMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -794,7 +794,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringLongMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -837,7 +837,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringStringMap()", map)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
@@ -879,7 +879,7 @@ public class CutDownMapSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringPacketMap({})", map, protocolId)).append(LS);
|
||||
return map;
|
||||
case Lua:
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeBoolArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeBoolSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -89,7 +89,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeByteArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeByteSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -122,7 +122,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeShortArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeShortSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -155,7 +155,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeIntArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeIntSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -188,7 +188,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeLongArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeLongSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -218,7 +218,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeFloatArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeFloatSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -249,7 +249,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeDoubleSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -283,7 +283,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writeStringArray({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writeStringSet({})", objectStr)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -316,7 +316,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("buffer.writePacketArray({}, {})", objectStr, protocolId)).append(LS);
|
||||
break;
|
||||
case Python, Kotlin, Scala:
|
||||
case Kotlin, Scala, Python, Ruby:
|
||||
builder.append(StringUtils.format("buffer.writePacketSet({}, {})", objectStr, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -365,7 +365,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readBoolArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readBoolSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -411,7 +411,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readByteArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readByteSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -457,7 +457,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readShortArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readShortSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -503,7 +503,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readIntArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readIntSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -549,7 +549,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readLongArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readLongSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -592,7 +592,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readFloatArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readFloatSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -636,7 +636,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readDoubleArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readDoubleSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -683,7 +683,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readStringArray()", set)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readStringSet()", set)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
@@ -729,7 +729,7 @@ public class CutDownSetSerializer implements ICutDownSerializer {
|
||||
case GdScript:
|
||||
builder.append(StringUtils.format("var {} = buffer.readPacketArray({})", set, protocolId)).append(LS);
|
||||
break;
|
||||
case Python:
|
||||
case Python, Ruby:
|
||||
builder.append(StringUtils.format("{} = buffer.readPacketSet({})", set, protocolId)).append(LS);
|
||||
break;
|
||||
case Lua:
|
||||
|
||||
@@ -316,4 +316,699 @@ class ByteBuffer
|
||||
return protocolRegistration.read(self)
|
||||
end
|
||||
|
||||
def writeBoolArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeBool(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readBoolArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readBool())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeByteArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeByte(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readByteArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readByte())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeShortArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeShort(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readShortArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readShort())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeIntArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeInt(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readInt())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeLongArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeLong(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readLong())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeFloatArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeFloat(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readFloatArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readFloat())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeDoubleArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeDouble(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readDoubleArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readDouble())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeStringArray(array)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writeString(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readStringArray()
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readString())
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writePacketArray(array, protocolId)
|
||||
if array.nil? || array.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(array.length)
|
||||
for element in array
|
||||
writePacket(element, protocolId)
|
||||
end
|
||||
end
|
||||
|
||||
def readPacketArray(protocolId)
|
||||
array = Array.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
array.push(readPacket(protocolId))
|
||||
end
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
def writeBoolSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeBool(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readBoolSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readBool())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeByteSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeByte(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readByteSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readByte())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeShortSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeShort(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readShortSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readShort())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeIntSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeInt(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readInt())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeLongSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeLong(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readLong())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeFloatSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeFloat(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readFloatSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readFloat())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeDoubleSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeDouble(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readDoubleSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readDouble())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeStringSet(set)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writeString(element)
|
||||
end
|
||||
end
|
||||
|
||||
def readStringSet()
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readString())
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writePacketSet(set, protocolId)
|
||||
if set.nil? || set.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(set.length)
|
||||
for element in set
|
||||
writePacket(element, protocolId)
|
||||
end
|
||||
end
|
||||
|
||||
def readPacketSet(protocolId)
|
||||
set = Set.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
set.add(readPacket(protocolId))
|
||||
end
|
||||
end
|
||||
return set
|
||||
end
|
||||
|
||||
def writeIntIntMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeInt(key)
|
||||
writeInt(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntIntMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readInt()
|
||||
value = readInt()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeIntLongMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeInt(key)
|
||||
writeLong(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntLongMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readInt()
|
||||
value = readLong()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeIntStringMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeInt(key)
|
||||
writeString(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntStringMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readInt()
|
||||
value = readString()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeIntPacketMap(map, protocolId)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeInt(key)
|
||||
writePacket(value, protocolId)
|
||||
end
|
||||
end
|
||||
|
||||
def readIntPacketMap(protocolId)
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readInt()
|
||||
value = readPacket(protocolId)
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeLongIntMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeLong(key)
|
||||
writeInt(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongIntMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readLong()
|
||||
value = readInt()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeLongLongMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeLong(key)
|
||||
writeLong(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongLongMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readLong()
|
||||
value = readLong()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeLongStringMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeLong(key)
|
||||
writeString(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongStringMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readLong()
|
||||
value = readString()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeLongPacketMap(map, protocolId)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeLong(key)
|
||||
writePacket(value, protocolId)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongPacketMap(protocolId)
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readLong()
|
||||
value = readPacket(protocolId)
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeStringIntMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeString(key)
|
||||
writeInt(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readStringIntMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readString()
|
||||
value = readInt()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeStringLongMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeString(key)
|
||||
writeLong(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readLongLongMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readString()
|
||||
value = readLong()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeStringStringMap(map)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeString(key)
|
||||
writeString(value)
|
||||
end
|
||||
end
|
||||
|
||||
def readStringStringMap()
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readString()
|
||||
value = readString()
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
|
||||
def writeStringPacketMap(map, protocolId)
|
||||
if map.nil? || map.empty?
|
||||
writeInt(0)
|
||||
return
|
||||
end
|
||||
writeInt(map.length)
|
||||
map.each do |key, value|
|
||||
writeString(key)
|
||||
writePacket(value, protocolId)
|
||||
end
|
||||
end
|
||||
|
||||
def readStringPacketMap(protocolId)
|
||||
map = Hash.new()
|
||||
size = readInt()
|
||||
if size > 0
|
||||
for i in 0..(size - 1)
|
||||
key = readString()
|
||||
value = readPacket(protocolId)
|
||||
map[key] = value
|
||||
end
|
||||
end
|
||||
return map
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user