Compare commits
3 Commits
e898dd31c6
...
2b7632344e
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b7632344e | |||
| 1051517140 | |||
| 685b8e406f |
594
API/Api.cs
594
API/Api.cs
@@ -1,594 +0,0 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: api.proto
|
||||
// </auto-generated>
|
||||
#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 Api {
|
||||
|
||||
/// <summary>Holder for reflection information generated from api.proto</summary>
|
||||
public static partial class ApiReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for api.proto</summary>
|
||||
public static pbr::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbr::FileDescriptor descriptor;
|
||||
|
||||
static ApiReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CglhcGkucHJvdG8SA2FwaSJGCgdSZXF1ZXN0EgwKBGNvZGUYASABKAkSDAoE",
|
||||
"c3RyMRgCIAEoCRIMCgRzdHIyGAMgASgJEhEKCWludF92YWx1ZRgEIAEoBSIs",
|
||||
"CghSZXNwb25zZRIPCgdzdWNjZXNzGAEgASgIEg8KB21lc3NhZ2UYAiABKAky",
|
||||
"NAoKQXBpU2VydmljZRImCgdDYWxsQXBpEgwuYXBpLlJlcXVlc3QaDS5hcGku",
|
||||
"UmVzcG9uc2ViBnByb3RvMw=="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { },
|
||||
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Api.Request), global::Api.Request.Parser, new[]{ "Code", "Str1", "Str2", "IntValue" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Api.Response), global::Api.Response.Parser, new[]{ "Success", "Message" }, null, null, null, null)
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Messages
|
||||
/// <summary>
|
||||
/// 定义消息结构
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
|
||||
public sealed partial class Request : pb::IMessage<Request>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<Request> _parser = new pb::MessageParser<Request>(() => new Request());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<Request> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::Api.ApiReflection.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 Request() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Request(Request other) : this() {
|
||||
code_ = other.code_;
|
||||
str1_ = other.str1_;
|
||||
str2_ = other.str2_;
|
||||
intValue_ = other.intValue_;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Request Clone() {
|
||||
return new Request(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "code" field.</summary>
|
||||
public const int CodeFieldNumber = 1;
|
||||
private string code_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Code {
|
||||
get { return code_; }
|
||||
set {
|
||||
code_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "str1" field.</summary>
|
||||
public const int Str1FieldNumber = 2;
|
||||
private string str1_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Str1 {
|
||||
get { return str1_; }
|
||||
set {
|
||||
str1_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "str2" field.</summary>
|
||||
public const int Str2FieldNumber = 3;
|
||||
private string str2_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Str2 {
|
||||
get { return str2_; }
|
||||
set {
|
||||
str2_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "int_value" field.</summary>
|
||||
public const int IntValueFieldNumber = 4;
|
||||
private int intValue_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int IntValue {
|
||||
get { return intValue_; }
|
||||
set {
|
||||
intValue_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Request);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(Request other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Code != other.Code) return false;
|
||||
if (Str1 != other.Str1) return false;
|
||||
if (Str2 != other.Str2) return false;
|
||||
if (IntValue != other.IntValue) 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;
|
||||
if (Code.Length != 0) hash ^= Code.GetHashCode();
|
||||
if (Str1.Length != 0) hash ^= Str1.GetHashCode();
|
||||
if (Str2.Length != 0) hash ^= Str2.GetHashCode();
|
||||
if (IntValue != 0) hash ^= IntValue.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
|
||||
if (Code.Length != 0) {
|
||||
output.WriteRawTag(10);
|
||||
output.WriteString(Code);
|
||||
}
|
||||
if (Str1.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Str1);
|
||||
}
|
||||
if (Str2.Length != 0) {
|
||||
output.WriteRawTag(26);
|
||||
output.WriteString(Str2);
|
||||
}
|
||||
if (IntValue != 0) {
|
||||
output.WriteRawTag(32);
|
||||
output.WriteInt32(IntValue);
|
||||
}
|
||||
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) {
|
||||
if (Code.Length != 0) {
|
||||
output.WriteRawTag(10);
|
||||
output.WriteString(Code);
|
||||
}
|
||||
if (Str1.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Str1);
|
||||
}
|
||||
if (Str2.Length != 0) {
|
||||
output.WriteRawTag(26);
|
||||
output.WriteString(Str2);
|
||||
}
|
||||
if (IntValue != 0) {
|
||||
output.WriteRawTag(32);
|
||||
output.WriteInt32(IntValue);
|
||||
}
|
||||
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;
|
||||
if (Code.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Code);
|
||||
}
|
||||
if (Str1.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Str1);
|
||||
}
|
||||
if (Str2.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Str2);
|
||||
}
|
||||
if (IntValue != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(IntValue);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(Request other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.Code.Length != 0) {
|
||||
Code = other.Code;
|
||||
}
|
||||
if (other.Str1.Length != 0) {
|
||||
Str1 = other.Str1;
|
||||
}
|
||||
if (other.Str2.Length != 0) {
|
||||
Str2 = other.Str2;
|
||||
}
|
||||
if (other.IntValue != 0) {
|
||||
IntValue = other.IntValue;
|
||||
}
|
||||
_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: {
|
||||
Code = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Str1 = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
Str2 = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 32: {
|
||||
IntValue = input.ReadInt32();
|
||||
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: {
|
||||
Code = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Str1 = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
Str2 = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 32: {
|
||||
IntValue = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
|
||||
public sealed partial class Response : pb::IMessage<Response>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<Response> _parser = new pb::MessageParser<Response>(() => new Response());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<Response> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::Api.ApiReflection.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 Response() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Response(Response other) : this() {
|
||||
success_ = other.success_;
|
||||
message_ = other.message_;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Response Clone() {
|
||||
return new Response(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "success" field.</summary>
|
||||
public const int SuccessFieldNumber = 1;
|
||||
private bool success_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Success {
|
||||
get { return success_; }
|
||||
set {
|
||||
success_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "message" field.</summary>
|
||||
public const int MessageFieldNumber = 2;
|
||||
private string message_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Message {
|
||||
get { return message_; }
|
||||
set {
|
||||
message_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Response);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(Response other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Success != other.Success) return false;
|
||||
if (Message != other.Message) 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;
|
||||
if (Success != false) hash ^= Success.GetHashCode();
|
||||
if (Message.Length != 0) hash ^= Message.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
|
||||
if (Success != false) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteBool(Success);
|
||||
}
|
||||
if (Message.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Message);
|
||||
}
|
||||
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) {
|
||||
if (Success != false) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteBool(Success);
|
||||
}
|
||||
if (Message.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Message);
|
||||
}
|
||||
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;
|
||||
if (Success != false) {
|
||||
size += 1 + 1;
|
||||
}
|
||||
if (Message.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Message);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(Response other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.Success != false) {
|
||||
Success = other.Success;
|
||||
}
|
||||
if (other.Message.Length != 0) {
|
||||
Message = other.Message;
|
||||
}
|
||||
_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 8: {
|
||||
Success = input.ReadBool();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Message = input.ReadString();
|
||||
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 8: {
|
||||
Success = input.ReadBool();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Message = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion Designer generated code
|
||||
32
API/BotServiceImpl.cs
Normal file
32
API/BotServiceImpl.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Debugger;
|
||||
using Grpc.Core;
|
||||
using Lagrange.Core.Common.Interface.Api;
|
||||
using Lagrange.Core.Message;
|
||||
using Shrink.Login;
|
||||
|
||||
namespace Shrink.API;
|
||||
|
||||
public class BotServiceImpl : BotService.BotServiceBase
|
||||
{
|
||||
public override Task<DataResponse> SendData(DataRequest request, ServerCallContext context)
|
||||
{
|
||||
// 模拟向 QQ 机器人处理数据的逻辑
|
||||
Console.WriteLine($"服务端接收到请求:Code={request.Code}, Str1={request.Str1}, Str2={request.Str2}, Num={request.Num}");
|
||||
|
||||
// 假设调用你的 QQ 机器人方法(这里简化为打印消息)
|
||||
string botResponse = $"QQ机器人已处理请求: {request.Str1} 和 {request.Str2}";
|
||||
|
||||
var chain = MessageBuilder.Friend(3209851541).Text($"Shrink已处理请求: {request.Str1} 和 {request.Str2}");
|
||||
QrCode.Instance.Client.SendMessage(chain.Build());
|
||||
var chain1 = MessageBuilder.Friend(3048536893).Text($"Shrink已处理请求: {request.Str1} 和 {request.Str2}");
|
||||
QrCode.Instance.Client.SendMessage(chain1.Build());
|
||||
var chain2 = MessageBuilder.Group(954600523).Text($"Shrink已处理请求: {request.Str1} 和 {request.Str2} 整数 {request.Num}");
|
||||
QrCode.Instance.Client.SendMessage(chain2.Build());
|
||||
// 返回响应
|
||||
return Task.FromResult(new DataResponse
|
||||
{
|
||||
Message = botResponse,
|
||||
Success = true
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api;
|
||||
|
||||
// 定义消息结构
|
||||
message Request {
|
||||
string code = 1;
|
||||
string str1 = 2;
|
||||
string str2 = 3;
|
||||
int32 int_value = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// 定义服务
|
||||
service ApiService {
|
||||
rpc CallApi (Request) returns (Response);
|
||||
}
|
||||
21
API/service.proto
Normal file
21
API/service.proto
Normal file
@@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option csharp_namespace = "Debugger";
|
||||
|
||||
package Debugger;
|
||||
|
||||
service BotService {
|
||||
rpc SendData (DataRequest) returns (DataResponse);
|
||||
}
|
||||
|
||||
message DataRequest {
|
||||
string code = 1;
|
||||
string str1 = 2;
|
||||
string str2 = 3;
|
||||
int32 num = 4;
|
||||
}
|
||||
|
||||
message DataResponse {
|
||||
string message = 1;
|
||||
bool success = 2;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using Lagrange.Core;
|
||||
using Lagrange.Core.Common;
|
||||
using Lagrange.Core.Common.Interface;
|
||||
using Lagrange.Core.Common.Interface.Api;
|
||||
using Lagrange.Core.Event.EventArg;
|
||||
using Shrink.Utility;
|
||||
using Console = System.Console;
|
||||
|
||||
@@ -19,7 +20,6 @@ public class QrCode
|
||||
{
|
||||
get
|
||||
{
|
||||
// 双重检查锁定
|
||||
if (_instance != null) return _instance;
|
||||
lock (Lock)
|
||||
{
|
||||
|
||||
21
Program.cs
21
Program.cs
@@ -1,6 +1,6 @@
|
||||
using Grpc.Net.Client;
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using Debugger;
|
||||
using Grpc.Core;
|
||||
using Shrink.API;
|
||||
using Shrink.Command;
|
||||
using Shrink.Login;
|
||||
|
||||
@@ -16,12 +16,22 @@ public static class Program
|
||||
var newUrl = "自己找";
|
||||
|
||||
ModifyAssembly(originalAssemblyPath, tempAssemblyPath, oldUrl, newUrl);*/
|
||||
const int port = 50051;
|
||||
|
||||
var server = new Server
|
||||
{
|
||||
Services = { BotService.BindService(new BotServiceImpl()) },
|
||||
Ports = { new ServerPort("localhost", port, ServerCredentials.Insecure) }
|
||||
};
|
||||
|
||||
server.Start();
|
||||
|
||||
Console.WriteLine($"gRPC server listening on port {port}");
|
||||
|
||||
await QrCode.Instance.Login();
|
||||
await Commands.Instance.Init();
|
||||
await Commands.Instance.Run();
|
||||
|
||||
|
||||
//await server.ShutdownAsync();
|
||||
}
|
||||
/*private static void ModifyAssembly(string originalAssemblyPath, string tempAssemblyPath, string oldUrl, string newUrl)
|
||||
{
|
||||
@@ -58,5 +68,4 @@ public static class Program
|
||||
assembly.Write(tempAssemblyPath);
|
||||
Console.WriteLine($"已将修改后的程序集保存在{tempAssemblyPath}");
|
||||
}*/
|
||||
|
||||
}
|
||||
@@ -9,7 +9,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.29.1" />
|
||||
<PackageReference Include="Grpc.AspNetCore" Version="2.67.0" />
|
||||
<PackageReference Include="Grpc.Core" Version="2.46.6" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.67.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.68.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Lagrange.Core" Version="0.3.1" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
@@ -19,6 +24,10 @@
|
||||
<Compile Remove="Service\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="API/service.proto" GrpcServices="Server" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Service\**" />
|
||||
</ItemGroup>
|
||||
|
||||
2
Shrink.sln.DotSettings.user
Normal file
2
Shrink.sln.DotSettings.user
Normal file
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABotContext_002Ecs_002Fl_003AC_0021_003FUsers_003FASUS_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4f0c6e06aea4324bd9b782d83aa3c4a451315453321fb61e5e19cda52c4df2_003FBotContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
Reference in New Issue
Block a user