From f26711bad9d2c3c77baca5da9a5a54491eaa2593 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Tue, 1 Apr 2025 21:04:38 -0500 Subject: [PATCH] feat: protos --- packages/core/src/protos/tanks.ts | 63 ------- packages/core/src/protos/tanks_full.ts | 95 ++++++++++ src/BlitzKit.CLI/Protos/Tanks.cs | 196 +-------------------- src/BlitzKit.CLI/Protos/TanksFull.cs | 231 +++++++++++++++++++++++++ 4 files changed, 329 insertions(+), 256 deletions(-) create mode 100644 packages/core/src/protos/tanks_full.ts create mode 100644 src/BlitzKit.CLI/Protos/TanksFull.cs diff --git a/packages/core/src/protos/tanks.ts b/packages/core/src/protos/tanks.ts index cdf003962..6ba611a68 100644 --- a/packages/core/src/protos/tanks.ts +++ b/packages/core/src/protos/tanks.ts @@ -6,7 +6,6 @@ /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { Tank } from "./tank"; export const protobufPackage = "blitzkit"; @@ -14,10 +13,6 @@ export interface Tanks { tanks: string[]; } -export interface TanksFull { - tanks: Tank[]; -} - function createBaseTanks(): Tanks { return { tanks: [] }; } @@ -76,64 +71,6 @@ export const Tanks: MessageFns = { }, }; -function createBaseTanksFull(): TanksFull { - return { tanks: [] }; -} - -export const TanksFull: MessageFns = { - encode(message: TanksFull, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.tanks) { - Tank.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TanksFull { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTanksFull(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.tanks.push(Tank.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - fromJSON(object: any): TanksFull { - return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] }; - }, - - toJSON(message: TanksFull): unknown { - const obj: any = {}; - if (message.tanks?.length) { - obj.tanks = message.tanks.map((e) => Tank.toJSON(e)); - } - return obj; - }, - - create, I>>(base?: I): TanksFull { - return TanksFull.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): TanksFull { - const message = createBaseTanksFull(); - message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || []; - return message; - }, -}; - type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T diff --git a/packages/core/src/protos/tanks_full.ts b/packages/core/src/protos/tanks_full.ts new file mode 100644 index 000000000..9dbb7c048 --- /dev/null +++ b/packages/core/src/protos/tanks_full.ts @@ -0,0 +1,95 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.2 +// protoc v5.28.2 +// source: packages/core/src/protos/tanks_full.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Tank } from "./tank"; + +export const protobufPackage = "blitzkit"; + +export interface TanksFull { + tanks: Tank[]; +} + +function createBaseTanksFull(): TanksFull { + return { tanks: [] }; +} + +export const TanksFull: MessageFns = { + encode(message: TanksFull, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.tanks) { + Tank.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TanksFull { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTanksFull(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.tanks.push(Tank.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TanksFull { + return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] }; + }, + + toJSON(message: TanksFull): unknown { + const obj: any = {}; + if (message.tanks?.length) { + obj.tanks = message.tanks.map((e) => Tank.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TanksFull { + return TanksFull.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TanksFull { + const message = createBaseTanksFull(); + message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial } + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/BlitzKit.CLI/Protos/Tanks.cs b/src/BlitzKit.CLI/Protos/Tanks.cs index e23e57c69..70344d207 100644 --- a/src/BlitzKit.CLI/Protos/Tanks.cs +++ b/src/BlitzKit.CLI/Protos/Tanks.cs @@ -25,14 +25,11 @@ namespace Blitzkit { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiRwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFua3MucHJvdG8SCGJsaXR6", - "a2l0GiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90byIWCgVU", - "YW5rcxINCgV0YW5rcxgBIAMoCSIqCglUYW5rc0Z1bGwSHQoFdGFua3MYASAD", - "KAsyDi5ibGl0emtpdC5UYW5r")); + "a2l0IhYKBVRhbmtzEg0KBXRhbmtzGAEgAygJ")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Blitzkit.TankReflection.Descriptor, }, + new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tanks), global::Blitzkit.Tanks.Parser, new[]{ "Tanks_" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.TanksFull), global::Blitzkit.TanksFull.Parser, new[]{ "Tanks" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tanks), global::Blitzkit.Tanks.Parser, new[]{ "Tanks_" }, null, null, null, null) })); } #endregion @@ -226,193 +223,6 @@ namespace Blitzkit { } - [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] - public sealed partial class TanksFull : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TanksFull()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Blitzkit.TanksReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public TanksFull() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public TanksFull(TanksFull other) : this() { - tanks_ = other.tanks_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public TanksFull Clone() { - return new TanksFull(this); - } - - /// Field number for the "tanks" field. - public const int TanksFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_tanks_codec - = pb::FieldCodec.ForMessage(10, global::Blitzkit.Tank.Parser); - private readonly pbc::RepeatedField tanks_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField Tanks { - get { return tanks_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as TanksFull); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(TanksFull other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!tanks_.Equals(other.tanks_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - hash ^= tanks_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - tanks_.WriteTo(output, _repeated_tanks_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - tanks_.WriteTo(ref output, _repeated_tanks_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - size += tanks_.CalculateSize(_repeated_tanks_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(TanksFull other) { - if (other == null) { - return; - } - tanks_.Add(other.tanks_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - tanks_.AddEntriesFrom(input, _repeated_tanks_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - if ((tag & 7) == 4) { - // Abort on any end group tag. - return; - } - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - tanks_.AddEntriesFrom(ref input, _repeated_tanks_codec); - break; - } - } - } - } - #endif - - } - #endregion } diff --git a/src/BlitzKit.CLI/Protos/TanksFull.cs b/src/BlitzKit.CLI/Protos/TanksFull.cs new file mode 100644 index 000000000..2a74875dc --- /dev/null +++ b/src/BlitzKit.CLI/Protos/TanksFull.cs @@ -0,0 +1,231 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: packages/core/src/protos/tanks_full.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Blitzkit { + + /// Holder for reflection information generated from packages/core/src/protos/tanks_full.proto + public static partial class TanksFullReflection { + + #region Descriptor + /// File descriptor for packages/core/src/protos/tanks_full.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static TanksFullReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CilwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFua3NfZnVsbC5wcm90bxII", + "YmxpdHpraXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy90YW5rLnByb3Rv", + "IioKCVRhbmtzRnVsbBIdCgV0YW5rcxgBIAMoCzIOLmJsaXR6a2l0LlRhbms=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Blitzkit.TankReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.TanksFull), global::Blitzkit.TanksFull.Parser, new[]{ "Tanks" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TanksFull : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TanksFull()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Blitzkit.TanksFullReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TanksFull() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TanksFull(TanksFull other) : this() { + tanks_ = other.tanks_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TanksFull Clone() { + return new TanksFull(this); + } + + /// Field number for the "tanks" field. + public const int TanksFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_tanks_codec + = pb::FieldCodec.ForMessage(10, global::Blitzkit.Tank.Parser); + private readonly pbc::RepeatedField tanks_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Tanks { + get { return tanks_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TanksFull); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TanksFull other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!tanks_.Equals(other.tanks_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= tanks_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + tanks_.WriteTo(output, _repeated_tanks_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + tanks_.WriteTo(ref output, _repeated_tanks_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += tanks_.CalculateSize(_repeated_tanks_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TanksFull other) { + if (other == null) { + return; + } + tanks_.Add(other.tanks_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + tanks_.AddEntriesFrom(input, _repeated_tanks_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + tanks_.AddEntriesFrom(ref input, _repeated_tanks_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code