简化代码 | protobuf类库换成google.protobuf.dll

This commit is contained in:
sin365 2023-05-24 17:51:17 +08:00
parent 4cb9797f4a
commit d6a4c5d0e7
69 changed files with 2161 additions and 6231 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
NetLib/Google.Protobuf.dll Normal file

Binary file not shown.

View File

@ -1,13 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="protobuf-net" Version="3.0.101" /> <Reference Include="Google.Protobuf">
<HintPath>..\Google.Protobuf.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,14 +1,6 @@
using HunterProtobufCore; using Google.Protobuf;
using ProtoBuf; using HunterProtobufCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace HaoYueNet.ClientNetwork namespace HaoYueNet.ClientNetwork
{ {
@ -159,9 +151,9 @@ namespace HaoYueNet.ClientNetwork
{ {
LogOut("准备数据 CMDID=> "+CMDID); LogOut("准备数据 CMDID=> "+CMDID);
HunterNet_C2S _c2sdata = new HunterNet_C2S(); HunterNet_C2S _c2sdata = new HunterNet_C2S();
_c2sdata.HunterNetCore_CmdID = CMDID; _c2sdata.HunterNetCoreCmdID = CMDID;
_c2sdata.HunterNetCore_Data = data; _c2sdata.HunterNetCoreData = ByteString.CopyFrom(data);
byte[] _finaldata = Serizlize<HunterNet_C2S>(_c2sdata); byte[] _finaldata = Serizlize(_c2sdata);
SendToSocket(_finaldata); SendToSocket(_finaldata);
} }
@ -239,7 +231,7 @@ namespace HaoYueNet.ClientNetwork
HunterNet_S2C _c2s = DeSerizlize<HunterNet_S2C>(data); HunterNet_S2C _c2s = DeSerizlize<HunterNet_S2C>(data);
OnDataCallBack((int)_c2s.HunterNetCore_CmdID, (int)_c2s.HunterNetCore_ERRORCode, _c2s.HunterNetCore_Data); OnDataCallBack(_c2s.HunterNetCoreCmdID, _c2s.HunterNetCoreERRORCode, _c2s.HunterNetCoreData.ToArray());
} }
private void Recive(object o) private void Recive(object o)
@ -332,25 +324,19 @@ namespace HaoYueNet.ClientNetwork
} }
} }
public static byte[] Serizlize<T>(T MsgObj) public static byte[] Serizlize(IMessage msg)
{ {
using (MemoryStream ms = new MemoryStream()) return msg.ToByteArray();
{
Serializer.Serialize<T>(ms, MsgObj);
byte[] data1 = ms.ToArray();
return data1;
}
} }
public static T DeSerizlize<T>(byte[] MsgObj) public static T DeSerizlize<T>(byte[] bytes)
{ {
using (MemoryStream ms = new MemoryStream(MsgObj)) var msgType = typeof(T);
{ object msg = Activator.CreateInstance(msgType);
var ds_obj = Serializer.Deserialize<T>(ms); ((IMessage)msg).MergeFrom(bytes);
return ds_obj; return (T)msg;
}
} }
public void LogOut(string Msg) public void LogOut(string Msg)
{ {
//Console.WriteLine(Msg); //Console.WriteLine(Msg);

View File

@ -0,0 +1,506 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_HunterNetCore.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#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 HunterProtobufCore {
/// <summary>Holder for reflection information generated from protobuf_HunterNetCore.proto</summary>
public static partial class ProtobufHunterNetCoreReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_HunterNetCore.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufHunterNetCoreReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chxwcm90b2J1Zl9IdW50ZXJOZXRDb3JlLnByb3RvEhJIdW50ZXJQcm90b2J1",
"ZkNvcmUiSAoNSHVudGVyTmV0X0MyUxIbChNIdW50ZXJOZXRDb3JlX0NtZElE",
"GAEgASgFEhoKEkh1bnRlck5ldENvcmVfRGF0YRgCIAEoDCJpCg1IdW50ZXJO",
"ZXRfUzJDEhsKE0h1bnRlck5ldENvcmVfQ21kSUQYASABKAUSHwoXSHVudGVy",
"TmV0Q29yZV9FUlJPUkNvZGUYAiABKAUSGgoSSHVudGVyTmV0Q29yZV9EYXRh",
"GAMgASgMQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_C2S), global::HunterProtobufCore.HunterNet_C2S.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreData" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_S2C), global::HunterProtobufCore.HunterNet_S2C.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreERRORCode", "HunterNetCoreData" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///上行
/// </summary>
public sealed partial class HunterNet_C2S : pb::IMessage<HunterNet_C2S>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_C2S> _parser = new pb::MessageParser<HunterNet_C2S>(() => new HunterNet_C2S());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_C2S> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S(HunterNet_C2S other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S Clone() {
return new HunterNet_C2S(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 2;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_C2S);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_C2S other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_C2S other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
/// <summary>
///下行
/// </summary>
public sealed partial class HunterNet_S2C : pb::IMessage<HunterNet_S2C>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_S2C> _parser = new pb::MessageParser<HunterNet_S2C>(() => new HunterNet_S2C());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_S2C> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C(HunterNet_S2C other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreERRORCode_ = other.hunterNetCoreERRORCode_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C Clone() {
return new HunterNet_S2C(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_ERRORCode" field.</summary>
public const int HunterNetCoreERRORCodeFieldNumber = 2;
private int hunterNetCoreERRORCode_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreERRORCode {
get { return hunterNetCoreERRORCode_; }
set {
hunterNetCoreERRORCode_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 3;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_S2C);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_S2C other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreERRORCode != other.HunterNetCoreERRORCode) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreERRORCode != 0) hash ^= HunterNetCoreERRORCode.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_S2C other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreERRORCode != 0) {
HunterNetCoreERRORCode = other.HunterNetCoreERRORCode;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

View File

@ -1,120 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
// Generated from: proto/protobuf_HunterNetCore.proto
namespace HunterProtobufCore
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_C2S")]
public partial class HunterNet_C2S : global::ProtoBuf.IExtensible
{
public HunterNet_C2S() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_S2C")]
public partial class HunterNet_S2C : global::ProtoBuf.IExtensible
{
public HunterNet_S2C() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private int? _HunterNetCore_ERRORCode;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_ERRORCode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_ERRORCode
{
get { return _HunterNetCore_ERRORCode; }
set { _HunterNetCore_ERRORCode = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_ERRORCodeSpecified
{
get { return this._HunterNetCore_ERRORCode != null; }
set { if (value == (this._HunterNetCore_ERRORCode== null)) this._HunterNetCore_ERRORCode = value ? this.HunterNetCore_ERRORCode : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_ERRORCode() { return HunterNetCore_ERRORCodeSpecified; }
private void ResetHunterNetCore_ERRORCode() { HunterNetCore_ERRORCodeSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HaoYueNet.ClientNetworkNet4x</RootNamespace> <RootNamespace>HaoYueNet.ClientNetworkNet4x</RootNamespace>
<AssemblyName>HaoYueNet.ClientNetworkNet4x</AssemblyName> <AssemblyName>HaoYueNet.ClientNetworkNet4x</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@ -32,12 +32,24 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL"> <Reference Include="Google.Protobuf">
<SpecificVersion>False</SpecificVersion> <HintPath>..\Google.Protobuf.dll</HintPath>
<HintPath>.\protobuf-net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -48,10 +60,14 @@
<ItemGroup> <ItemGroup>
<Compile Include="NetworkHelperCore.cs" /> <Compile Include="NetworkHelperCore.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="protobuf_HunterNetCore.cs" /> <Compile Include="ProtobufHunterNetCore.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="protobuf-net.dll" /> <Content Include="protobuf-net.dll" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -1,14 +1,10 @@
using HunterProtobufCore; using Google.Protobuf;
using ProtoBuf; using HunterProtobufCore;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace HaoYueNet.ClientNetworkNet4x namespace HaoYueNet.ClientNetworkNet4x
{ {
@ -159,9 +155,9 @@ namespace HaoYueNet.ClientNetworkNet4x
{ {
LogOut("准备数据 CMDID=> "+CMDID); LogOut("准备数据 CMDID=> "+CMDID);
HunterNet_C2S _c2sdata = new HunterNet_C2S(); HunterNet_C2S _c2sdata = new HunterNet_C2S();
_c2sdata.HunterNetCore_CmdID = CMDID; _c2sdata.HunterNetCoreCmdID = CMDID;
_c2sdata.HunterNetCore_Data = data; _c2sdata.HunterNetCoreData = ByteString.CopyFrom(data);
byte[] _finaldata = Serizlize<HunterNet_C2S>(_c2sdata); byte[] _finaldata = Serizlize(_c2sdata);
SendToSocket(_finaldata); SendToSocket(_finaldata);
} }
@ -239,7 +235,7 @@ namespace HaoYueNet.ClientNetworkNet4x
HunterNet_S2C _c2s = DeSerizlize<HunterNet_S2C>(data); HunterNet_S2C _c2s = DeSerizlize<HunterNet_S2C>(data);
OnDataCallBack((int)_c2s.HunterNetCore_CmdID, (int)_c2s.HunterNetCore_ERRORCode, _c2s.HunterNetCore_Data); OnDataCallBack(_c2s.HunterNetCoreCmdID, _c2s.HunterNetCoreERRORCode, _c2s.HunterNetCoreData.ToArray());
} }
private void Recive(object o) private void Recive(object o)
@ -332,25 +328,19 @@ namespace HaoYueNet.ClientNetworkNet4x
} }
} }
public static byte[] Serizlize<T>(T MsgObj) public static byte[] Serizlize(IMessage msg)
{ {
using (MemoryStream ms = new MemoryStream()) return msg.ToByteArray();
{
Serializer.Serialize<T>(ms, MsgObj);
byte[] data1 = ms.ToArray();
return data1;
}
} }
public static T DeSerizlize<T>(byte[] MsgObj) public static T DeSerizlize<T>(byte[] bytes)
{ {
using (MemoryStream ms = new MemoryStream(MsgObj)) var msgType = typeof(T);
{ object msg = Activator.CreateInstance(msgType);
var ds_obj = Serializer.Deserialize<T>(ms); ((IMessage)msg).MergeFrom(bytes);
return ds_obj; return (T)msg;
}
} }
public void LogOut(string Msg) public void LogOut(string Msg)
{ {
//Console.WriteLine(Msg); //Console.WriteLine(Msg);

View File

@ -0,0 +1,506 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_HunterNetCore.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#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 HunterProtobufCore {
/// <summary>Holder for reflection information generated from protobuf_HunterNetCore.proto</summary>
public static partial class ProtobufHunterNetCoreReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_HunterNetCore.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufHunterNetCoreReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chxwcm90b2J1Zl9IdW50ZXJOZXRDb3JlLnByb3RvEhJIdW50ZXJQcm90b2J1",
"ZkNvcmUiSAoNSHVudGVyTmV0X0MyUxIbChNIdW50ZXJOZXRDb3JlX0NtZElE",
"GAEgASgFEhoKEkh1bnRlck5ldENvcmVfRGF0YRgCIAEoDCJpCg1IdW50ZXJO",
"ZXRfUzJDEhsKE0h1bnRlck5ldENvcmVfQ21kSUQYASABKAUSHwoXSHVudGVy",
"TmV0Q29yZV9FUlJPUkNvZGUYAiABKAUSGgoSSHVudGVyTmV0Q29yZV9EYXRh",
"GAMgASgMQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_C2S), global::HunterProtobufCore.HunterNet_C2S.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreData" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_S2C), global::HunterProtobufCore.HunterNet_S2C.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreERRORCode", "HunterNetCoreData" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///上行
/// </summary>
public sealed partial class HunterNet_C2S : pb::IMessage<HunterNet_C2S>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_C2S> _parser = new pb::MessageParser<HunterNet_C2S>(() => new HunterNet_C2S());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_C2S> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S(HunterNet_C2S other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S Clone() {
return new HunterNet_C2S(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 2;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_C2S);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_C2S other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_C2S other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
/// <summary>
///下行
/// </summary>
public sealed partial class HunterNet_S2C : pb::IMessage<HunterNet_S2C>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_S2C> _parser = new pb::MessageParser<HunterNet_S2C>(() => new HunterNet_S2C());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_S2C> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C(HunterNet_S2C other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreERRORCode_ = other.hunterNetCoreERRORCode_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C Clone() {
return new HunterNet_S2C(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_ERRORCode" field.</summary>
public const int HunterNetCoreERRORCodeFieldNumber = 2;
private int hunterNetCoreERRORCode_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreERRORCode {
get { return hunterNetCoreERRORCode_; }
set {
hunterNetCoreERRORCode_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 3;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_S2C);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_S2C other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreERRORCode != other.HunterNetCoreERRORCode) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreERRORCode != 0) hash ^= HunterNetCoreERRORCode.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_S2C other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreERRORCode != 0) {
HunterNetCoreERRORCode = other.HunterNetCoreERRORCode;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
</packages>

View File

@ -1,120 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
// Generated from: proto/protobuf_HunterNetCore.proto
namespace HunterProtobufCore
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_C2S")]
public partial class HunterNet_C2S : global::ProtoBuf.IExtensible
{
public HunterNet_C2S() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_S2C")]
public partial class HunterNet_S2C : global::ProtoBuf.IExtensible
{
public HunterNet_S2C() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private int? _HunterNetCore_ERRORCode;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_ERRORCode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_ERRORCode
{
get { return _HunterNetCore_ERRORCode; }
set { _HunterNetCore_ERRORCode = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_ERRORCodeSpecified
{
get { return this._HunterNetCore_ERRORCode != null; }
set { if (value == (this._HunterNetCore_ERRORCode== null)) this._HunterNetCore_ERRORCode = value ? this.HunterNetCore_ERRORCode : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_ERRORCode() { return HunterNetCore_ERRORCodeSpecified; }
private void ResetHunterNetCore_ERRORCode() { HunterNetCore_ERRORCodeSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

View File

@ -1,13 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="protobuf-net" Version="3.0.101" /> <Reference Include="Google.Protobuf">
<HintPath>..\Google.Protobuf.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,5 @@
using HunterProtobufCore; using Google.Protobuf;
using ProtoBuf; using HunterProtobufCore;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@ -9,6 +9,7 @@ using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using static Google.Protobuf.Reflection.FieldOptions.Types;
namespace HaoYueNet.ServerNetwork namespace HaoYueNet.ServerNetwork
@ -727,10 +728,10 @@ namespace HaoYueNet.ServerNetwork
{ {
AsyncUserToken token = GetAsyncUserTokenForSocket(sk); AsyncUserToken token = GetAsyncUserTokenForSocket(sk);
HunterNet_S2C _s2cdata = new HunterNet_S2C(); HunterNet_S2C _s2cdata = new HunterNet_S2C();
_s2cdata.HunterNetCore_CmdID = CMDID; _s2cdata.HunterNetCoreCmdID = CMDID;
_s2cdata.HunterNetCore_Data = data; _s2cdata.HunterNetCoreData = ByteString.CopyFrom(data);
_s2cdata.HunterNetCore_ERRORCode = ERRCODE; _s2cdata.HunterNetCoreERRORCode = ERRCODE;
byte[] _finaldata = Serizlize<HunterNet_S2C>(_s2cdata); byte[] _finaldata = Serizlize(_s2cdata);
SendWithIndex(token, _finaldata); SendWithIndex(token, _finaldata);
} }
@ -762,7 +763,6 @@ namespace HaoYueNet.ServerNetwork
private void DataCallBackReady(AsyncUserToken sk, byte[] data) private void DataCallBackReady(AsyncUserToken sk, byte[] data)
{ {
//增加接收计数 //增加接收计数
sk.RevIndex = MaxRevIndexNum; sk.RevIndex = MaxRevIndexNum;
@ -776,7 +776,7 @@ namespace HaoYueNet.ServerNetwork
try try
{ {
HunterNet_C2S _s2c = DeSerizlize<HunterNet_C2S>(data); HunterNet_C2S _s2c = DeSerizlize<HunterNet_C2S>(data);
DataCallBack(sk, (int)_s2c.HunterNetCore_CmdID, _s2c.HunterNetCore_Data); DataCallBack(sk, (int)_s2c.HunterNetCoreCmdID, _s2c.HunterNetCoreData.ToArray());
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -816,25 +816,17 @@ namespace HaoYueNet.ServerNetwork
} }
#endregion #endregion
public static byte[] Serizlize<T>(T MsgObj) public static byte[] Serizlize(IMessage msg)
{ {
using (MemoryStream ms = new MemoryStream()) return msg.ToByteArray();
{
Serializer.Serialize<T>(ms, MsgObj);
byte[] data1 = ms.ToArray();
return data1;
}
} }
public static T DeSerizlize<T>(byte[] MsgObj) public static T DeSerizlize<T>(byte[] bytes)
{ {
using (MemoryStream ms = new MemoryStream(MsgObj)) var msgType = typeof(T);
{ object msg = Activator.CreateInstance(msgType);
var ds_obj = Serializer.Deserialize<T>(ms); ((IMessage)msg).MergeFrom(bytes);
//ds_obj = MySet(ds_obj); return (T)msg;
return ds_obj;
}
} }
} }
} }

View File

@ -0,0 +1,506 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_HunterNetCore.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#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 HunterProtobufCore {
/// <summary>Holder for reflection information generated from protobuf_HunterNetCore.proto</summary>
public static partial class ProtobufHunterNetCoreReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_HunterNetCore.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufHunterNetCoreReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chxwcm90b2J1Zl9IdW50ZXJOZXRDb3JlLnByb3RvEhJIdW50ZXJQcm90b2J1",
"ZkNvcmUiSAoNSHVudGVyTmV0X0MyUxIbChNIdW50ZXJOZXRDb3JlX0NtZElE",
"GAEgASgFEhoKEkh1bnRlck5ldENvcmVfRGF0YRgCIAEoDCJpCg1IdW50ZXJO",
"ZXRfUzJDEhsKE0h1bnRlck5ldENvcmVfQ21kSUQYASABKAUSHwoXSHVudGVy",
"TmV0Q29yZV9FUlJPUkNvZGUYAiABKAUSGgoSSHVudGVyTmV0Q29yZV9EYXRh",
"GAMgASgMQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_C2S), global::HunterProtobufCore.HunterNet_C2S.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreData" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_S2C), global::HunterProtobufCore.HunterNet_S2C.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreERRORCode", "HunterNetCoreData" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///上行
/// </summary>
public sealed partial class HunterNet_C2S : pb::IMessage<HunterNet_C2S>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_C2S> _parser = new pb::MessageParser<HunterNet_C2S>(() => new HunterNet_C2S());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_C2S> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S(HunterNet_C2S other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S Clone() {
return new HunterNet_C2S(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 2;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_C2S);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_C2S other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_C2S other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
/// <summary>
///下行
/// </summary>
public sealed partial class HunterNet_S2C : pb::IMessage<HunterNet_S2C>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_S2C> _parser = new pb::MessageParser<HunterNet_S2C>(() => new HunterNet_S2C());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_S2C> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C(HunterNet_S2C other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreERRORCode_ = other.hunterNetCoreERRORCode_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C Clone() {
return new HunterNet_S2C(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_ERRORCode" field.</summary>
public const int HunterNetCoreERRORCodeFieldNumber = 2;
private int hunterNetCoreERRORCode_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreERRORCode {
get { return hunterNetCoreERRORCode_; }
set {
hunterNetCoreERRORCode_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 3;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_S2C);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_S2C other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreERRORCode != other.HunterNetCoreERRORCode) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreERRORCode != 0) hash ^= HunterNetCoreERRORCode.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_S2C other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreERRORCode != 0) {
HunterNetCoreERRORCode = other.HunterNetCoreERRORCode;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

View File

@ -1,120 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
// Generated from: proto/protobuf_HunterNetCore.proto
namespace HunterProtobufCore
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_C2S")]
public partial class HunterNet_C2S : global::ProtoBuf.IExtensible
{
public HunterNet_C2S() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_S2C")]
public partial class HunterNet_S2C : global::ProtoBuf.IExtensible
{
public HunterNet_S2C() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private int? _HunterNetCore_ERRORCode;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_ERRORCode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_ERRORCode
{
get { return _HunterNetCore_ERRORCode; }
set { _HunterNetCore_ERRORCode = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_ERRORCodeSpecified
{
get { return this._HunterNetCore_ERRORCode != null; }
set { if (value == (this._HunterNetCore_ERRORCode== null)) this._HunterNetCore_ERRORCode = value ? this.HunterNetCore_ERRORCode : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_ERRORCode() { return HunterNetCore_ERRORCodeSpecified; }
private void ResetHunterNetCore_ERRORCode() { HunterNetCore_ERRORCodeSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

View File

@ -1,10 +0,0 @@
ä
proto/HunterNetCore.protoStargoogle/protobuf/any.proto"o
HunterNet_C2S/
HunterNetCore_CmdID (RHunterNetCoreCmdID-
HunterNetCore_Data ( RHunterNetCoreData"¨
HunterNet_S2C/
HunterNetCore_CmdID (RHunterNetCoreCmdID7
HunterNetCore_ERRORCode (RHunterNetCoreERRORCode-
HunterNetCore_Data ( RHunterNetCoreDataBHbproto3

View File

@ -1,267 +0,0 @@
†3
proto/KyMsgProtocol.protoCC"*
SystemErrorReponse
State (RState"F
SystemErrorInfoReponse
State (RState
ErrMsg ( RErrMsg"§
CreateRoles
Acc ( RAcc
UserName ( RUserName
Sex (RSex
ZoneID (RZoneID
occup (Roccup*
PlatformDataList ( RPlatformDataList"Z
CreateRolesReponse
State (RState.
SubRoleinfo ( 2 .CC.RoleinfoR SubRoleinfo"é
Roleinfo
JobID (RJobID
CurLv (RCurLv
CurExp (RCurExp
NextLvExp (R NextLvExp
POW (RPOW
AGL (RAGL
CON (RCON
INT (RINT
NickName ( RNickName
Sex
(RSex
Position ( RPosition
Regtime ( RRegtime
Lasttime ( RLasttime
Isdel (RIsdel
Deltime ( RDeltime
RoleID (RRoleID
MapCode (RMapCode$
RoleDirection (R RoleDirection
PosX (RPosX
PosY (RPosY
LifeV (RLifeV
MaxLifeV (RMaxLifeV
MagicV (RMagicV
MaxMagicV (R MaxMagicV
ZoneID (RZoneID
RolePic (RRolePic
KillLv (RKillLv
Vitality (RVitality
VitalityTop (R VitalityTop
Vigor (RVigor
VigorTop (RVigorTop
Mate (RMate
Faction! (RFaction
Dianjuan" (RDianjuan
Yuanbao# (RYuanbao
Money1$ (RMoney1
Reputation% (R
Reputation
Prestige& (RPrestige"
Contribution' (R Contribution&
Transmigration( (RTransmigration
PKMode) (RPKMode$
TeacherPlayer* (R TeacherPlayer"
AbilityPoint+ (R AbilityPoint
MyIntroduce, (R MyIntroduce3
SkillInfoList- ( 2 .CC.SkillInfoR SkillInfoList$
isFlashplayer. (R isFlashplayer"s
SkillInfo
DBID (RDBID
SkillID (RSkillID
SkillLevel (R
SkillLevel
UsedNum (RUsedNum"8
GetRolesList
Acc ( RAcc
ZoneID (RZoneID"[
GetRolesListReponse
State (RState.
SubRoleinfo ( 2 .CC.RoleinfoR SubRoleinfo"7
InitialGame
Acc ( RAcc
RoleID (RRoleID"Z
InitialGameReponse
State (RState.
SubRoleinfo ( 2 .CC.RoleinfoR SubRoleinfo""
PlayGame
RoleID (RRoleID")
PlayGameReponse
RoleID (RRoleID"°
SpriteMove
RoleID (RRoleID
MapCode (RMapCode
action (Raction
toX (RtoX
toY (RtoY
extAction (R extAction
fromX (RfromX
fromY (RfromY&
startMoveTicks (RstartMoveTicks
pathString
( R
pathString"
targetRoleID (R targetRoleID"è
SpriteMovePosition
RoleID (RRoleID
MapCode (RMapCode
ToMapX (RToMapX
ToMapY (RToMapY
ToDiection (R
ToDiection
clientTicks (R clientTicks
action (Raction
TryRun (RTryRun"E
SpriteMovePositionReponse
RoleID (RRoleID
xxx (Rxxx"ã
SpriteExchangeMap
RoleID (RRoleID
TeleportID (R
TeleportID
NewMapCode (R
NewMapCode
ToNewMapX (R ToNewMapX
ToNewMapY (R ToNewMapY$
ToNewDiection (R ToNewDiection
State (RState"J
OthersLeaveMap
RoleID (RRoleID
SpriteTypes (R SpriteTypes"œ
RoleInfoDataMini
RoleID (RRoleID
RoleName ( RRoleName
RoleSex (RRoleSex
Occupation (R
Occupation
Level (RLevel
MapCode (RMapCode
PosX (RPosX
PosY (RPosY$
RoleDirection (R RoleDirection
LifeV
(RLifeV
MaxLifeV (RMaxLifeV
MagicV (RMagicV
MaxMagicV (R MaxMagicV
ZoneID (RZoneID
SkillList (R SkillList"ÿ
MonsterInfoData
RoleID (RRoleID
RoleName ( RRoleName
RoleSex (RRoleSex
Level (RLevel
Experience (R
Experience
PosX (RPosX
PosY (RPosY$
RoleDirection (R RoleDirection
LifeV (RLifeV
MaxLifeV
(RMaxLifeV
MagicV (RMagicV
MaxMagicV (R MaxMagicV$
EquipmentBody (R EquipmentBody
ExtensionID (R ExtensionID
MonsterType (R MonsterType"
MasterRoleID (R MasterRoleID$
AiControlType (R AiControlType
AnimalSound ( R AnimalSound"
MonsterLevel (R MonsterLevel"
ZhongDuStart (R ZhongDuStart&
ZhongDuSeconds (RZhongDuSeconds
FaintStart (R
FaintStart"
FaintSeconds (R FaintSeconds(
BattleWitchSide (RBattleWitchSide"µ
ProAttackData
roleID (RroleID
roleX (RroleX
roleY (RroleY
magicCode (R magicCode7
AttackObjList ( 2.CC.AttackObjInfoR AttackObjList
WeaponsType (R WeaponsTypeA
PointAttackdoube ( 2.CC.PointAttackDoubleRPointAttackdoube$
BallisticGUID ( R BallisticGUID"5
PointAttack
PosX (RPosX
PosY (RPosY";
PointAttackDouble
PosX (RPosX
PosY (RPosY"•
AttackObjInfo
enemy (Renemy
enemyX (RenemyX
enemyY (RenemyY
realEnemyX (R
realEnemyX
realEnemyY (R
realEnemyY"é
ProAttackDataReponse$
attackerLevel (R attackerLevel&
attackerRoleID (RattackerRoleID
SkillID (RSkillID8
AttackObjList ( 2.CC.AttackDataInfoR AttackObjList"
attackerPosX (R attackerPosX"
attackerPosY (R attackerPosYA
PointAttackdoube ( 2.CC.PointAttackDoubleRPointAttackdoube$
BallisticGUID ( R BallisticGUID"ö
AttackDataInfo$
injuredRoleID (R injuredRoleID
burst (Rburst
injure (Rinjure$
newExperience (R newExperience,
currentExperience (RcurrentExperience
newLevel (RnewLevel"
MerlinInjuer (R MerlinInjuer
MerlinType (R
MerlinType(
injuredRoleLife (RinjuredRoleLife0
injuredRoleMaxLifeV
(RinjuredRoleMaxLifeV*
injuredRoleMagic (RinjuredRoleMagic2
injuredRoleMaxMagicV (RinjuredRoleMaxMagicV
injuredType (R injuredType"P
DBAddSkill
RoleID (RRoleID
SkillID (RSkillID
Lvl (RLvl"=
DBAddSkillReponse
State (RState
DBID (RDBID"°
AttackReadyData
AttackerID (R
AttackerID
SkillID (RSkillIDA
PointAttackdoube ( 2.CC.PointAttackDoubleRPointAttackdoube
NextSkillID ( R NextSkillID"5
SpriteMonsterDead
MonsterList (R MonsterList"Þ
PLAYBallisticData
roleID (RroleID
roleX (RroleX
roleY (RroleY
magicCode (R magicCodeA
PointAttackdoube ( 2.CC.PointAttackDoubleRPointAttackdoube$
BallisticGUID ( R BallisticGUID"¶
WorldEffectData
roleID (RroleID
roleX (RroleX
roleY (RroleY
magicCode (R magicCodeA
PointAttackdoube ( 2.CC.PointAttackDoubleRPointAttackdoube"
OtherEffectDatabproto3

View File

@ -1,10 +0,0 @@
à
"proto/protobuf_HunterNetCore.protoHunterProtobufCore"o
HunterNet_C2S/
HunterNetCore_CmdID (RHunterNetCoreCmdID-
HunterNetCore_Data ( RHunterNetCoreData"¨
HunterNet_S2C/
HunterNetCore_CmdID (RHunterNetCoreCmdID7
HunterNetCore_ERRORCode (RHunterNetCoreERRORCode-
HunterNetCore_Data ( RHunterNetCoreDataBHbproto3

View File

@ -1,425 +0,0 @@
IMPORTANT NOTICE
Copyright (C) 1998-2008 Free Software Foundation, Inc.
Copyright (C) 1996-2012 Oracle and/or its affiliates
Copyright (C) 2002-2012 Jeroen Frijters
Some files in this distribution are part of GNU Classpath or OpenJDK and
are licensed under the GNU General Public License (GPL) version 2
with "Classpath" exception. This applies in particular to:
- IKVM.OpenJDK.*.dll
- some of the *.java files (see each file header for license)
See http://www.gnu.org/software/classpath/ for information on the
GNU Classpath license and "Classpath" exception.
See below for a full copy of the GPL license and the Sun version of the
"Classpath" exception.
-----------------------------------------------------------------------------
Copyright (C) 2002-2012 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
-----------------------------------------------------------------------------
The GNU General Public License (GPL)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software is
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free software (and charge for this service if you wish),
that you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs; and that you know you
can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must
make sure that they, too, receive or can get the source code. And you must
show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients to
know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program proprietary.
To prevent this, we have made it clear that any patent must be licensed for
everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included
without limitation in the term "modification".) Each licensee is addressed as
"you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may
at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all of
these conditions:
a) You must cause the modified files to carry prominent notices stating
that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of
this License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the
most ordinary way, to print or display an announcement including an
appropriate copyright notice and a notice that there is no warranty (or
else, saying that you provide a warranty) and that users may redistribute
the program under these conditions, and telling the user how to view a copy
of this License. (Exception: if the Program itself is interactive but does
not normally print such an announcement, your work based on the Program is
not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and
its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a
work based on the Program, the distribution of the whole must be on the terms
of this License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise the
right to control the distribution of derivative or collective works based on
the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1 and
2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1
and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in
object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code
distributed need not include anything that is normally distributed (in either
source or binary form) with the major components (compiler, kernel, and so on)
of the operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source
code from the same place counts as distribution of the source code, even though
third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so
long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not
accept this License. Therefore, by modifying or distributing the Program (or
any work based on the Program), you indicate your acceptance of this License to
do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to
copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance by
third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In
such case, this License incorporates the limitation as if written in the body
of this License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems
or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any later
version", you have the option of following the terms and conditions either of
that version or of any later version published by the Free Software Foundation.
If the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it
starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
software, and you are welcome to redistribute it under certain conditions;
type 'show c' for details.
The hypothetical commands 'show w' and 'show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than 'show w' and 'show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
'Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General Public
License instead of this License.
"CLASSPATH" EXCEPTION TO THE GPL
Certain source files distributed by Oracle America and/or its affiliates are
subject to the following clarification and special exception to the GPL, but
only where Oracle has expressly included in the particular source file's header
the words "Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the LICENSE file that accompanied this code."
Linking this library statically or dynamically with other modules is making
a combined work based on this library. Thus, the terms and conditions of
the GNU General Public License cover the whole combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,
and to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent module,
the terms and conditions of the license of that module. An independent
module is a module which is not derived from or based on this library. If
you modify this library, you may extend this exception to your version of
the library, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version.
-----------------------------------------------------------------------------
-------------------------------------------------------------------------
$Id: LICENSE,v 1.7.4.1 2012/06/12 08:44:39 jfrijters Exp $
-------------------------------------------------------------------------
Copyright (c) 1999 Visual Numerics Inc. All Rights Reserved.
Permission to use, copy, modify, and distribute this software is freely
granted by Visual Numerics, Inc., provided that the copyright notice
above and the following warranty disclaimer are preserved in human
readable form.
Because this software is licenses free of charge, it is provided
"AS IS", with NO WARRANTY. TO THE EXTENT PERMITTED BY LAW, VNI
DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO ITS PERFORMANCE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
VNI WILL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING OUT OF THE USE
OF OR INABILITY TO USE THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO DIRECT,
INDIRECT, SPECIAL, CONSEQUENTIAL, PUNITIVE, AND EXEMPLARY DAMAGES, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This Java code is based on C code in the package fdlibm,
which can be obtained from www.netlib.org.
The original fdlibm C code contains the following notice.
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunSoft, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
-----------------------------------------------------------------------------

View File

@ -1,460 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

View File

@ -1,53 +0,0 @@
// this is prototype only!!!
package bcl;
message TimeSpan {
optional sint64 value = 1; // the size of the timespan (in units of the selected scale)
optional TimeSpanScale scale = 2 [default = DAYS]; // the scale of the timespan
enum TimeSpanScale {
DAYS = 0;
HOURS = 1;
MINUTES = 2;
SECONDS = 3;
MILLISECONDS = 4;
TICKS = 5;
MINMAX = 15; // dubious
}
}
message DateTime {
optional sint64 value = 1; // the offset (in units of the selected scale) from 1970/01/01
optional TimeSpanScale scale = 2 [default = DAYS]; // the scale of the timespan
enum TimeSpanScale {
DAYS = 0;
HOURS = 1;
MINUTES = 2;
SECONDS = 3;
MILLISECONDS = 4;
TICKS = 5;
MINMAX = 15; // dubious
}
}
message NetObjectProxy {
optional int32 existingObjectKey = 1; // for a tracked object, the key of the **first** time this object was seen
optional int32 newObjectKey = 2; // for a tracked object, a **new** key, the first time this object is seen
optional int32 existingTypeKey = 3; // for dynamic typing, the key of the **first** time this type was seen
optional int32 newTypeKey = 4; // for dynamic typing, a **new** key, the first time this type is seen
optional string typeName = 8; // for dynamic typing, the name of the type (only present along with newTypeKey)
optional bytes payload = 10; // the new string/value (only present along with newObjectKey)
}
message Guid {
optional fixed64 lo = 1; // the first 8 bytes of the guid
optional fixed64 hi = 2; // the second 8 bytes of the guid
}
message Decimal {
optional uint64 lo = 1; // the first 64 bits of the underlying value
optional uint32 hi = 2; // the last 32 bis of the underlying value
optional uint32 signScale = 3; // the number of decimal digits (bits 1-16), and the sign (bit 0)
}

View File

@ -1,5 +0,0 @@
package DAL;
message Database {
repeated group Order Orders = 1;
}

View File

@ -1,31 +0,0 @@
package DAL;
message Database {
repeated Order Orders = 1;
}
message Order {
optional int32 OrderID = 1;
optional string CustomerID = 2;
optional int32 EmployeeID = 3;
optional bcl.DateTime OrderDate = 4;
optional bcl.DateTime RequiredDate = 5;
optional bcl.DateTime ShippedDate = 6;
optional int32 ShipVia = 7;
optional bcl.Decimal Freight = 8;
optional string ShipName = 9;
optional string ShipAddress = 10;
optional string ShipCity = 11;
optional string ShipRegion = 12;
optional string ShipPostalCode = 13;
optional string ShipCountry = 14;
repeated OrderLine Lines = 15;
}
message OrderLine {
optional int32 OrderID = 1;
optional int32 ProductID = 2;
optional bcl.Decimal UnitPrice = 3;
optional sint32 Quantity = 4;
optional float Discount = 5;
}

View File

@ -1,15 +0,0 @@
Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
http://code.google.com/p/protobuf/
This package contains a precompiled Win32 binary version of the protocol buffer
compiler (protoc). This binary is intended for Windows users who want to
use Protocol Buffers in Java or Python but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.
This binary was built using MinGW, but the output is the same regardless of
the C++ compiler used.
You will still need to download the source code package in order to obtain the
Java or Python runtime libraries. Get it from:
http://code.google.com/p/protobuf/downloads/

Binary file not shown.

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<!--
<xsl:template name="capitalizeFirst">
<xsl:param name="value"/>
<xsl:value-of select="translate(substring($value,1,1),$alpha,$ALPHA)"/>
<xsl:value-of select="substring($value,2)"/>
</xsl:template>
-->
<xsl:template match="*">
<xsl:message terminate="yes">
Node not handled: <xsl:for-each select="ancestor-or-self::*">/<xsl:value-of select="name()"/></xsl:for-each>
<xsl:for-each select="*">
; <xsl:value-of select="concat(name(),'=',.)"/>
</xsl:for-each>
</xsl:message>
</xsl:template>
<xsl:param name="fixCase"/>
<xsl:variable name="optionFixCase" select="$fixCase='true'"/>
<xsl:template name="escapeKeyword">
<xsl:param name="value"/>
<xsl:value-of select="$value"/>
</xsl:template>
<xsl:template name="toCamelCase">
<xsl:param name="value"/>
<xsl:param name="delimiter" select="'_'"/>
<xsl:param name="keepDelimiter" select="false()"/>
<xsl:variable name="segment" select="substring-before($value, $delimiter)"/>
<xsl:choose>
<xsl:when test="$segment != ''">
<xsl:value-of select="$segment"/><xsl:if test="$keepDelimiter"><xsl:value-of select="$delimiter"/></xsl:if>
<xsl:call-template name="toPascalCase">
<xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
<xsl:with-param name="keepDelimiter" select="$keepDelimiter"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:variable name="alpha" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="ALPHA" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:template name="toPascalCase">
<xsl:param name="value"/>
<xsl:param name="delimiter" select="'_'"/>
<xsl:param name="keepDelimiter" select="false()"/>
<xsl:if test="$value != ''">
<xsl:variable name="segment" select="substring-before($value, $delimiter)"/>
<xsl:choose>
<xsl:when test="$segment != ''">
<xsl:value-of select="translate(substring($segment,1,1),$alpha,$ALPHA)"/><xsl:value-of select="substring($segment,2)"/><xsl:if test="$keepDelimiter"><xsl:value-of select="$delimiter"/></xsl:if>
<xsl:call-template name="toPascalCase">
<xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
<xsl:with-param name="keepDelimiter" select="$keepDelimiter"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(substring($value,1,1),$alpha,$ALPHA)"/><xsl:value-of select="substring($value,2)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="pascal">
<xsl:param name="value" select="name"/>
<xsl:param name="delimiter" select="'_'"/>
<xsl:call-template name="escapeKeyword">
<xsl:with-param name="value"><xsl:choose>
<xsl:when test="$optionFixCase"><xsl:variable name="dotted"><xsl:call-template name="toPascalCase">
<xsl:with-param name="value" select="$value"/>
<xsl:with-param name="delimiter" select="'.'"/>
<xsl:with-param name="keepDelimiter" select="true()"/>
</xsl:call-template></xsl:variable><xsl:call-template name="toPascalCase">
<xsl:with-param name="value" select="$dotted"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
</xsl:call-template></xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose></xsl:with-param></xsl:call-template>
</xsl:template>
<xsl:template name="PickNamespace"><xsl:param name="defaultNamespace"/><xsl:choose>
<xsl:when test="package"><xsl:call-template name="pascal">
<xsl:with-param name="value" select="package"/>
</xsl:call-template></xsl:when>
<xsl:when test="$defaultNamespace"><xsl:value-of select="$defaultNamespace"/></xsl:when>
<xsl:otherwise><xsl:variable name="trimmedName"><xsl:choose>
<xsl:when test="substring(name,string-length(name)-5,6)='.proto'"><xsl:value-of select="substring(name,1,string-length(name)-6)"/></xsl:when>
<xsl:otherwise><xsl:value-of select="name"/></xsl:otherwise>
</xsl:choose></xsl:variable><xsl:call-template name="pascal">
<xsl:with-param name="value" select="$trimmedName"/>
</xsl:call-template></xsl:otherwise>
</xsl:choose></xsl:template>
<xsl:template match="FieldDescriptorProto/options"/>
<xsl:template match="FileDescriptorProto/options"/>
<xsl:template match="DescriptorProto/options"/>
<xsl:template match="EnumValueDescriptorProto/options"/>
<xsl:template match="EnumDescriptorProto/options"/>
<xsl:template match="ServiceDescriptorProto/options"/>
<xsl:template match="MethodDescriptorProto/options"/>
</xsl:stylesheet>

View File

@ -1,628 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl msxsl"
>
<xsl:import href="common.xslt"/>
<xsl:param name="help"/>
<xsl:param name="xml"/>
<xsl:param name="datacontract"/>
<xsl:param name="binary"/>
<xsl:param name="protoRpc"/>
<xsl:param name="observable"/>
<xsl:param name="preObservable"/>
<xsl:param name="partialMethods"/>
<xsl:param name="detectMissing"/>
<xsl:param name="lightFramework"/>
<xsl:param name="asynchronous"/>
<xsl:param name="clientProxy"/>
<xsl:param name="defaultNamespace"/>
<xsl:param name="import"/>
<xsl:key name="fieldNames" match="//FieldDescriptorProto" use="name"/>
<xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
<xsl:variable name="optionXml" select="$xml='true'"/>
<xsl:variable name="optionDataContract" select="$datacontract='true'"/>
<xsl:variable name="optionBinary" select="$binary='true'"/>
<xsl:variable name="optionProtoRpc" select="$protoRpc='true'"/>
<xsl:variable name="optionObservable" select="$observable='true'"/>
<xsl:variable name="optionPreObservable" select="$preObservable='true'"/>
<xsl:variable name="optionPartialMethods" select="$partialMethods='true'"/>
<xsl:variable name="optionDetectMissing" select="$detectMissing='true'"/>
<xsl:variable name="optionFullFramework" select="not($lightFramework='true')"/>
<xsl:variable name="optionAsynchronous" select="$asynchronous='true'"/>
<xsl:variable name="optionClientProxy" select="$clientProxy='true'"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">//------------------------------------------------------------------------------
// &lt;auto-generated&gt;
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// &lt;/auto-generated&gt;
//------------------------------------------------------------------------------
</xsl:text><!--
--><xsl:apply-templates select="*"/><!--
--></xsl:template>
<xsl:template name="WriteUsings">
<xsl:param name="ns"/>
<xsl:if test="$ns != ''"><xsl:choose>
<xsl:when test="contains($ns,';')">
using <xsl:value-of select="substring-before($ns,';')"/>;<!--
--><xsl:call-template name="WriteUsings">
<xsl:with-param name="ns" select="substring-after($ns,';')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
using <xsl:value-of select="$ns"/>;
</xsl:otherwise>
</xsl:choose></xsl:if></xsl:template>
<xsl:template match="FileDescriptorSet">
<xsl:if test="$help='true'">
<xsl:message terminate="yes">
CSharp template for protobuf-net.
Options:
General:
"help" - this page
Additional serializer support:
"xml" - enable explicit xml support (XmlSerializer)
"datacontract" - enable data-contract support (DataContractSerializer; requires .NET 3.0)
"binary" - enable binary support (BinaryFormatter; not supported on Silverlight)
Other:
"protoRpc" - enable proto-rpc client
"observable" - change notification (observer pattern) support
"preObservable" - pre-change notification (observer pattern) support (requires .NET 3.5)
"partialMethods" - provide partial methods for changes (requires C# 3.0)
"detectMissing" - provide *Specified properties to indicate whether fields are present
"lightFramework" - omit additional attributes not included in CF/Silverlight
"asynchronous" - emit asynchronous methods for use with WCF
"clientProxy" - emit asynchronous client proxy class
"import" - additional namespaces to import (semicolon delimited)
"fixCase" - change type/member names (types/properties become PascalCase; fields become camelCase)
</xsl:message>
</xsl:if>
<xsl:if test="$optionXml and $optionDataContract">
<xsl:message terminate="yes">
Invalid options: xml and data-contract serialization are mutually exclusive.
</xsl:message>
</xsl:if>
<xsl:if test="$optionXml">
// Option: xml serialization ([XmlType]/[XmlElement]) enabled
</xsl:if><xsl:if test="$optionDataContract">
// Option: data-contract serialization ([DataContract]/[DataMember]) enabled
</xsl:if><xsl:if test="$optionBinary">
// Option: binary serialization (ISerializable) enabled
</xsl:if><xsl:if test="$optionObservable">
// Option: observable (OnPropertyChanged) enabled
</xsl:if><xsl:if test="$optionPreObservable">
// Option: pre-observable (OnPropertyChanging) enabled
</xsl:if><xsl:if test="$partialMethods">
// Option: partial methods (On*Changing/On*Changed) enabled
</xsl:if><xsl:if test="$optionDetectMissing">
// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
</xsl:if><xsl:if test="not($optionFullFramework)">
// Option: light framework (CF/Silverlight) enabled
</xsl:if><xsl:if test="$optionProtoRpc">
// Option: proto-rpc enabled
</xsl:if>
<xsl:call-template name="WriteUsings">
<xsl:with-param name="ns" select="$import"/>
</xsl:call-template>
<xsl:apply-templates select="file/FileDescriptorProto"/>
</xsl:template>
<xsl:template match="FileDescriptorProto">
// Generated from: <xsl:value-of select="name"/>
<xsl:apply-templates select="dependency/string[.!='']"/>
<xsl:variable name="namespace"><xsl:call-template name="PickNamespace">
<xsl:with-param name="defaultNamespace" select="$defaultNamespace"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string($namespace) != ''">
namespace <xsl:value-of select="translate($namespace,':-/\','__..')"/>
{</xsl:if>
<xsl:apply-templates select="message_type | enum_type | service"/>
<xsl:if test="string($namespace) != ''">
}</xsl:if></xsl:template>
<xsl:template match="FileDescriptorProto/dependency/string">
// Note: requires additional types generated from: <xsl:value-of select="."/></xsl:template>
<xsl:template name="camel">
<xsl:param name="value" select="name"/>
<xsl:param name="delimiter" select="'_'"/>
<xsl:choose>
<xsl:when test="$optionFixCase"><xsl:call-template name="toCamelCase">
<xsl:with-param name="value" select="$value"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
</xsl:call-template></xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="DescriptorProto">
[<xsl:if test="$optionFullFramework">global::System.Serializable, </xsl:if>global::ProtoBuf.ProtoContract(Name=@"<xsl:value-of select="name"/>")]
<xsl:if test="$optionDataContract">[global::System.Runtime.Serialization.DataContract(Name=@"<xsl:value-of select="name"/>")]
</xsl:if><xsl:if test="$optionXml">[global::System.Xml.Serialization.XmlType(TypeName=@"<xsl:value-of select="name"/>")]
</xsl:if><!--
-->public partial class <xsl:call-template name="pascal"/> : global::ProtoBuf.IExtensible<!--
--><xsl:if test="$optionBinary">, global::System.Runtime.Serialization.ISerializable</xsl:if><!--
--><xsl:if test="$optionObservable">, global::System.ComponentModel.INotifyPropertyChanged</xsl:if><!--
--><xsl:if test="$optionPreObservable">, global::System.ComponentModel.INotifyPropertyChanging</xsl:if>
{
public <xsl:call-template name="pascal"/>() {}
<xsl:apply-templates select="*"/><xsl:if test="$optionBinary">
protected <xsl:call-template name="pascal"/>(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context)
: this() { global::ProtoBuf.Serializer.Merge(info, this); }
void global::System.Runtime.Serialization.ISerializable.GetObjectData(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context)
{ global::ProtoBuf.Serializer.Serialize(info, this); }
</xsl:if><xsl:if test="$optionObservable">
public event global::System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{ if(PropertyChanged != null) PropertyChanged(this, new global::System.ComponentModel.PropertyChangedEventArgs(propertyName)); }
</xsl:if><xsl:if test="$optionPreObservable">
public event global::System.ComponentModel.PropertyChangingEventHandler PropertyChanging;
protected virtual void OnPropertyChanging(string propertyName)
{ if(PropertyChanging != null) PropertyChanging(this, new global::System.ComponentModel.PropertyChangingEventArgs(propertyName)); }
</xsl:if>
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
</xsl:template>
<xsl:template match="DescriptorProto/name | DescriptorProto/extension_range | DescriptorProto/extension"/>
<xsl:template match="
FileDescriptorProto/message_type | FileDescriptorProto/enum_type | FileDescriptorProto/service
| DescriptorProto/enum_type | DescriptorProto/message_type
| DescriptorProto/nested_type | EnumDescriptorProto/value | ServiceDescriptorProto/method">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="DescriptorProto/field">
<xsl:apply-templates select="*"/>
<xsl:variable name="extName" select="concat('.',(ancestor::FileDescriptorProto/package)[1],'.',../name)"/>
<xsl:apply-templates select="//FieldDescriptorProto[extendee=$extName]"/>
</xsl:template>
<xsl:template match="EnumDescriptorProto">
[global::ProtoBuf.ProtoContract(Name=@"<xsl:value-of select="name"/>")]
<xsl:if test="$optionDataContract">[global::System.Runtime.Serialization.DataContract(Name=@"<xsl:value-of select="name"/>")]
</xsl:if>
<xsl:if test="$optionXml">[global::System.Xml.Serialization.XmlType(TypeName=@"<xsl:value-of select="name"/>")]
</xsl:if><!--
-->public enum <xsl:call-template name="pascal"/>
{
<xsl:apply-templates select="value"/>
}
</xsl:template>
<xsl:template match="EnumValueDescriptorProto">
<xsl:variable name="value"><xsl:choose>
<xsl:when test="number"><xsl:value-of select="number"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
[global::ProtoBuf.ProtoEnum(Name=@"<xsl:value-of select="name"/>", Value=<xsl:value-of select="$value"/>)]<!--
--><xsl:if test="$optionDataContract">
[global::System.Runtime.Serialization.EnumMember(Value=@"<xsl:value-of select="name"/>")]</xsl:if><!--
--><xsl:if test="$optionXml">
[global::System.Xml.Serialization.XmlEnum(@"<xsl:value-of select="name"/>")]</xsl:if><!--
--><xsl:text disable-output-escaping="yes">
</xsl:text><xsl:call-template name="pascal"/><xsl:text xml:space="preserve"> = </xsl:text><xsl:value-of select="$value"/><xsl:if test="position()!=last()">,
</xsl:if>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="field">
<xsl:variable name="field"><xsl:choose>
<xsl:when test="$optionFixCase"><xsl:call-template name="toCamelCase">
<xsl:with-param name="value" select="name"/>
</xsl:call-template></xsl:when>
<xsl:otherwise><xsl:value-of select="name"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:call-template name="escapeKeyword">
<xsl:with-param name="value"><xsl:choose>
<xsl:when test="not(key('fieldNames',concat('_',$field)))"><xsl:value-of select="concat('_',$field)"/></xsl:when>
<xsl:when test="not(key('fieldNames',concat($field,'Field')))"><xsl:value-of select="concat($field,'Field')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat('_',generate-id())"/></xsl:otherwise>
</xsl:choose></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="escapeKeyword">
<xsl:param name="value"/>
<xsl:if test="contains($keywords,concat('|',$value,'|'))">@</xsl:if><xsl:value-of select="$value"/>
</xsl:template>
<xsl:variable name="keywords">|abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|</xsl:variable>
<xsl:template match="FieldDescriptorProto" mode="format">
<xsl:choose>
<xsl:when test="type='TYPE_DOUBLE' or type='TYPE_FLOAT'
or type='TYPE_FIXED32' or type='TYPE_FIXED64'
or type='TYPE_SFIXED32' or type='TYPE_SFIXED64'">FixedSize</xsl:when>
<xsl:when test="type='TYPE_GROUP'">Group</xsl:when>
<xsl:when test="not(type) or type='TYPE_INT32' or type='TYPE_INT64'
or type='TYPE_UINT32' or type='TYPE_UINT64'
or type='TYPE_ENUM'">TwosComplement</xsl:when>
<xsl:when test="type='TYPE_SINT32' or type='TYPE_SINT64'">ZigZag</xsl:when>
<xsl:otherwise>Default</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="primitiveType">
<xsl:choose>
<xsl:when test="not(type)">struct</xsl:when>
<xsl:when test="type='TYPE_DOUBLE'">struct</xsl:when>
<xsl:when test="type='TYPE_FLOAT'">struct</xsl:when>
<xsl:when test="type='TYPE_INT64'">struct</xsl:when>
<xsl:when test="type='TYPE_UINT64'">struct</xsl:when>
<xsl:when test="type='TYPE_INT32'">struct</xsl:when>
<xsl:when test="type='TYPE_FIXED64'">struct</xsl:when>
<xsl:when test="type='TYPE_FIXED32'">struct</xsl:when>
<xsl:when test="type='TYPE_BOOL'">struct</xsl:when>
<xsl:when test="type='TYPE_STRING'">class</xsl:when>
<xsl:when test="type='TYPE_BYTES'">class</xsl:when>
<xsl:when test="type='TYPE_UINT32'">struct</xsl:when>
<xsl:when test="type='TYPE_SFIXED32'">struct</xsl:when>
<xsl:when test="type='TYPE_SFIXED64'">struct</xsl:when>
<xsl:when test="type='TYPE_SINT32'">struct</xsl:when>
<xsl:when test="type='TYPE_SINT64'">struct</xsl:when>
<xsl:when test="type='TYPE_ENUM'">struct</xsl:when>
<xsl:when test="type='TYPE_GROUP' or type='TYPE_MESSAGE'">none</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
Field type not implemented: <xsl:value-of select="type"/> (<xsl:value-of select="../../name"/>.<xsl:value-of select="name"/>)
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="type">
<xsl:choose>
<xsl:when test="not(type)">double</xsl:when>
<xsl:when test="type='TYPE_DOUBLE'">double</xsl:when>
<xsl:when test="type='TYPE_FLOAT'">float</xsl:when>
<xsl:when test="type='TYPE_INT64'">long</xsl:when>
<xsl:when test="type='TYPE_UINT64'">ulong</xsl:when>
<xsl:when test="type='TYPE_INT32'">int</xsl:when>
<xsl:when test="type='TYPE_FIXED64'">ulong</xsl:when>
<xsl:when test="type='TYPE_FIXED32'">uint</xsl:when>
<xsl:when test="type='TYPE_BOOL'">bool</xsl:when>
<xsl:when test="type='TYPE_STRING'">string</xsl:when>
<xsl:when test="type='TYPE_BYTES'">byte[]</xsl:when>
<xsl:when test="type='TYPE_UINT32'">uint</xsl:when>
<xsl:when test="type='TYPE_SFIXED32'">int</xsl:when>
<xsl:when test="type='TYPE_SFIXED64'">long</xsl:when>
<xsl:when test="type='TYPE_SINT32'">int</xsl:when>
<xsl:when test="type='TYPE_SINT64'">long</xsl:when>
<xsl:when test="type='TYPE_GROUP' or type='TYPE_MESSAGE' or type='TYPE_ENUM'"><xsl:call-template name="pascal">
<xsl:with-param name="value" select="substring-after(type_name,'.')"/>
</xsl:call-template></xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
Field type not implemented: <xsl:value-of select="type"/> (<xsl:value-of select="../../name"/>.<xsl:value-of select="name"/>)
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto[default_value]" mode="defaultValue">
<xsl:choose>
<xsl:when test="type='TYPE_STRING'">@"<xsl:value-of select="default_value"/>"</xsl:when>
<xsl:when test="type='TYPE_ENUM'"><xsl:apply-templates select="." mode="type"/>.<xsl:call-template name="pascal">
<xsl:with-param name="value" select="default_value"/>
</xsl:call-template></xsl:when>
<xsl:when test="type='TYPE_BYTES'"> /*
<xsl:value-of select="default_value"/>
*/ null </xsl:when>
<xsl:otherwise>(<xsl:apply-templates select="." mode="type"/>)<xsl:value-of select="default_value"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
We need to find the first enum value given .foo.bar.SomeEnum - but the enum itself
only knows about SomeEnum; we need to look at all parent DescriptorProto nodes, and
the FileDescriptorProto for the namespace.
This does an annoying up/down recursion... a bit expensive, but *generally* OK.
Could perhaps index the last part of the enum name to reduce overhead?
-->
<xsl:template name="GetFirstEnumValue">
<xsl:variable name="hunt" select="type_name"/>
<xsl:for-each select="//EnumDescriptorProto">
<xsl:variable name="fullName">
<xsl:for-each select="ancestor::FileDescriptorProto[package!='']">.<xsl:value-of select="package"/></xsl:for-each>
<xsl:for-each select="ancestor::DescriptorProto">.<xsl:value-of select="name"/></xsl:for-each>
<xsl:value-of select="'.'"/>
<xsl:call-template name="pascal"/>
</xsl:variable>
<xsl:if test="$fullName=$hunt"><xsl:value-of select="(value/EnumValueDescriptorProto)[1]/name"/></xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="FieldDescriptorProto[not(default_value)]" mode="defaultValue">
<xsl:choose>
<xsl:when test="type='TYPE_STRING'">""</xsl:when>
<xsl:when test="type='TYPE_MESSAGE'">null</xsl:when>
<xsl:when test="type='TYPE_BYTES'">null</xsl:when>
<xsl:when test="type='TYPE_ENUM'"><xsl:apply-templates select="." mode="type"/>.<xsl:call-template name="GetFirstEnumValue"/></xsl:when>
<xsl:otherwise>default(<xsl:apply-templates select="." mode="type"/>)</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="checkDeprecated"><!--
--><xsl:if test="options/deprecated='true'">global::System.Obsolete, </xsl:if><!--
--></xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_OPTIONAL' or not(label)]">
<xsl:variable name="propType"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="primitiveType"><xsl:apply-templates select="." mode="primitiveType"/></xsl:variable>
<xsl:variable name="defaultValue"><xsl:apply-templates select="." mode="defaultValue"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
<xsl:variable name="specified" select="$optionDetectMissing and ($primitiveType='struct' or $primitiveType='class')"/>
<xsl:variable name="fieldType"><xsl:value-of select="$propType"/><xsl:if test="$specified and $primitiveType='struct'">?</xsl:if></xsl:variable>
private <xsl:value-of select="concat($fieldType,' ',$field)"/><xsl:if test="not($specified)"> = <xsl:value-of select="$defaultValue"/></xsl:if>;
[<xsl:apply-templates select="." mode="checkDeprecated"/>global::ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired = false, Name=@"<xsl:value-of select="name"/>", DataFormat = global::ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)]<!--
--><xsl:if test="not($specified)">
[global::System.ComponentModel.DefaultValue(<xsl:value-of select="$defaultValue"/>)]</xsl:if><!--
--><xsl:if test="$optionXml">
[global::System.Xml.Serialization.XmlElement(@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>)]
</xsl:if><xsl:if test="$optionDataContract">
[global::System.Runtime.Serialization.DataMember(Name=@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>, IsRequired = false)]
</xsl:if><xsl:call-template name="WriteGetSet">
<xsl:with-param name="fieldType" select="$fieldType"/>
<xsl:with-param name="propType" select="$propType"/>
<xsl:with-param name="name"><xsl:call-template name="pascal"/></xsl:with-param>
<xsl:with-param name="field" select="$field"/>
<xsl:with-param name="defaultValue" select="$defaultValue"/>
<xsl:with-param name="specified" select="$specified"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_REQUIRED']">
<xsl:variable name="type"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
private <xsl:value-of select="concat($type, ' ', $field)"/>;
[<xsl:apply-templates select="." mode="checkDeprecated"/>global::ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired = true, Name=@"<xsl:value-of select="name"/>", DataFormat = global::ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)]<!--
--><xsl:if test="$optionXml">
[global::System.Xml.Serialization.XmlElement(@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>)]
</xsl:if><xsl:if test="$optionDataContract">
[global::System.Runtime.Serialization.DataMember(Name=@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>, IsRequired = true)]
</xsl:if><xsl:call-template name="WriteGetSet">
<xsl:with-param name="fieldType" select="$type"/>
<xsl:with-param name="propType" select="$type"/>
<xsl:with-param name="name"><xsl:call-template name="pascal"/></xsl:with-param>
<xsl:with-param name="field" select="$field"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="stripKeyword">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="starts-with($value,'@')"><xsl:value-of select="substring-after($value,'@')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="WriteGetSet">
<xsl:param name="fieldType"/>
<xsl:param name="propType"/>
<xsl:param name="name"/>
<xsl:param name="field"/>
<xsl:param name="specified" select="false()"/>
<xsl:param name="defaultValue"/>
<xsl:variable name="nameNoKeyword">
<xsl:call-template name="stripKeyword">
<xsl:with-param name="value" select="$name"/>
</xsl:call-template></xsl:variable>
public <xsl:value-of select="concat($fieldType,' ',$name)"/>
{
get { return <xsl:value-of select="$field"/>; }
set { <xsl:if test="$optionPartialMethods">On<xsl:value-of select="$nameNoKeyword"/>Changing(value); </xsl:if><xsl:if test="$optionPreObservable">OnPropertyChanging(@"<xsl:value-of select="$nameNoKeyword"/>"); </xsl:if><xsl:value-of select="$field"/> = value; <xsl:if test="$optionObservable">OnPropertyChanged(@"<xsl:value-of select="$nameNoKeyword"/>"); </xsl:if><xsl:if test="$optionPartialMethods">On<xsl:value-of select="$nameNoKeyword"/>Changed();</xsl:if>}
}<xsl:if test="$optionPartialMethods">
partial void On<xsl:value-of select="$nameNoKeyword"/>Changing(<xsl:value-of select="$propType"/> value);
partial void On<xsl:value-of select="$nameNoKeyword"/>Changed();</xsl:if><xsl:if test="$specified">
[global::System.Xml.Serialization.XmlIgnore]
<xsl:if test="$optionFullFramework">[global::System.ComponentModel.Browsable(false)]</xsl:if>
public bool <xsl:value-of select="$nameNoKeyword"/>Specified
{
get { return this.<xsl:value-of select="$field"/> != null; }
set { if (value == (this.<xsl:value-of select="$field"/>== null)) this.<xsl:value-of select="$field"/> = value ? this.<xsl:value-of select="$name"/> : (<xsl:value-of select="$fieldType"/>)null; }
}
private bool ShouldSerialize<xsl:value-of select="$nameNoKeyword"/>() { return <xsl:value-of select="$nameNoKeyword"/>Specified; }
private void Reset<xsl:value-of select="$nameNoKeyword"/>() { <xsl:value-of select="$nameNoKeyword"/>Specified = false; }
</xsl:if>
</xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_REPEATED']">
<xsl:variable name="type"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
private <xsl:if test="not($optionXml)">readonly</xsl:if> global::System.Collections.Generic.List&lt;<xsl:value-of select="$type" />&gt; <xsl:value-of select="$field"/> = new global::System.Collections.Generic.List&lt;<xsl:value-of select="$type"/>&gt;();
[<xsl:apply-templates select="." mode="checkDeprecated"/>global::ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, Name=@"<xsl:value-of select="name"/>", DataFormat = global::ProtoBuf.DataFormat.<xsl:value-of select="$format"/><xsl:if test="options/packed='true'">, Options = global::ProtoBuf.MemberSerializationOptions.Packed</xsl:if>)]<!--
--><xsl:if test="$optionDataContract">
[global::System.Runtime.Serialization.DataMember(Name=@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>, IsRequired = false)]
</xsl:if><xsl:if test="$optionXml">
[global::System.Xml.Serialization.XmlElement(@"<xsl:value-of select="name"/>", Order = <xsl:value-of select="number"/>)]
</xsl:if>
public global::System.Collections.Generic.List&lt;<xsl:value-of select="$type" />&gt; <xsl:call-template name="pascal"/>
{
get { return <xsl:value-of select="$field"/>; }<!--
--><xsl:if test="$optionXml">
set { <xsl:value-of select="$field"/> = value; }</xsl:if>
}
</xsl:template>
<xsl:template match="ServiceDescriptorProto">
<xsl:if test="($optionClientProxy or $optionDataContract)">
[global::System.ServiceModel.ServiceContract(Name = @"<xsl:value-of select="name"/>")]</xsl:if>
public interface I<xsl:value-of select="name"/>
{
<xsl:apply-templates select="method"/>
}
<xsl:if test="$optionProtoRpc">
public class <xsl:value-of select="name"/>Client : global::ProtoBuf.ServiceModel.RpcClient
{
public <xsl:value-of select="name"/>Client() : base(typeof(I<xsl:value-of select="name"/>)) { }
<xsl:apply-templates select="method/MethodDescriptorProto" mode="protoRpc"/>
}
</xsl:if>
<xsl:apply-templates select="." mode="clientProxy"/>
</xsl:template>
<xsl:template match="MethodDescriptorProto">
<xsl:if test="($optionClientProxy or $optionDataContract)">
[global::System.ServiceModel.OperationContract(Name = @"<xsl:value-of select="name"/>")]
<xsl:if test="$optionFullFramework">[global::ProtoBuf.ServiceModel.ProtoBehavior]</xsl:if>
</xsl:if>
<xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request);
<xsl:if test="$optionAsynchronous and ($optionClientProxy or $optionDataContract)">
[global::System.ServiceModel.OperationContract(AsyncPattern = true, Name = @"<xsl:value-of select="name"/>")]
global::System.IAsyncResult Begin<xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request, global::System.AsyncCallback callback, object state);
<xsl:apply-templates select="output_type"/> End<xsl:value-of select="name"/>(global::System.IAsyncResult ar);
</xsl:if>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="protoRpc">
<xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request)
{
return (<xsl:apply-templates select="output_type"/>) Send(@"<xsl:value-of select="name"/>", request);
}
</xsl:template>
<xsl:template match="MethodDescriptorProto/input_type | MethodDescriptorProto/output_type">
<xsl:value-of select="substring-after(.,'.')"/>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="CompleteEvent">
<xsl:if test="$optionAsynchronous and $optionDataContract">
public partial class <xsl:value-of select="name"/>CompletedEventArgs : global::System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
public <xsl:value-of select="name"/>CompletedEventArgs(object[] results, global::System.Exception exception, bool cancelled, object userState)
: base(exception, cancelled, userState)
{
this.results = results;
}
public <xsl:apply-templates select="output_type"/> Result
{
get {
base.RaiseExceptionIfNecessary();
return (<xsl:apply-templates select="output_type"/>)(this.results[0]);
}
}
}
</xsl:if>
</xsl:template>
<xsl:template match="ServiceDescriptorProto" mode="clientProxy">
<xsl:if test="$optionAsynchronous and $optionDataContract and $optionClientProxy">
<xsl:apply-templates select="method/MethodDescriptorProto" mode="CompleteEvent"/>
[global::System.Diagnostics.DebuggerStepThroughAttribute()]
public partial class <xsl:value-of select="name"/>Client : global::System.ServiceModel.ClientBase&lt;I<xsl:value-of select="name"/>&gt;, I<xsl:value-of select="name"/>
{
public <xsl:value-of select="name"/>Client()
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName)
: base(endpointConfigurationName)
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName, string remoteAddress)
: base(endpointConfigurationName, remoteAddress)
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName, global::System.ServiceModel.EndpointAddress remoteAddress)
: base(endpointConfigurationName, remoteAddress)
{}
public <xsl:value-of select="name"/>Client(global::System.ServiceModel.Channels.Binding binding, global::System.ServiceModel.EndpointAddress remoteAddress)
: base(binding, remoteAddress)
{}
<xsl:apply-templates select="method/MethodDescriptorProto" mode="clientProxy"/>
}
</xsl:if>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="clientProxy">
<xsl:if test="$optionAsynchronous and $optionDataContract and $optionClientProxy">
private BeginOperationDelegate onBegin<xsl:value-of select="name"/>Delegate;
private EndOperationDelegate onEnd<xsl:value-of select="name"/>Delegate;
private global::System.Threading.SendOrPostCallback on<xsl:value-of select="name"/>CompletedDelegate;
public event global::System.EventHandler&lt;<xsl:value-of select="name"/>CompletedEventArgs&gt; <xsl:value-of select="name"/>Completed;
public <xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request)
{
return base.Channel.<xsl:value-of select="name"/>(request);
}
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public global::System.IAsyncResult Begin<xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request, global::System.AsyncCallback callback, object asyncState)
{
return base.Channel.Begin<xsl:value-of select="name"/>(request, callback, asyncState);
}
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public <xsl:apply-templates select="output_type"/> End<xsl:value-of select="name"/>(global::System.IAsyncResult result)
{
return base.Channel.End<xsl:value-of select="name"/>(result);
}
private global::System.IAsyncResult OnBegin<xsl:value-of select="name"/>(object[] inValues, global::System.AsyncCallback callback, object asyncState)
{
<xsl:apply-templates select="input_type"/> request = ((<xsl:apply-templates select="input_type"/>)(inValues[0]));
return this.Begin<xsl:value-of select="name"/>(request, callback, asyncState);
}
private object[] OnEnd<xsl:value-of select="name"/>(global::System.IAsyncResult result)
{
<xsl:apply-templates select="output_type"/> retVal = this.End<xsl:value-of select="name"/>(result);
return new object[] {
retVal};
}
private void On<xsl:value-of select="name"/>Completed(object state)
{
if ((this.<xsl:value-of select="name"/>Completed != null))
{
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.<xsl:value-of select="name"/>Completed(this, new <xsl:value-of select="name"/>CompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void <xsl:value-of select="name"/>Async(<xsl:apply-templates select="input_type"/> request)
{
this.<xsl:value-of select="name"/>Async(request, null);
}
public void <xsl:value-of select="name"/>Async(<xsl:apply-templates select="input_type"/> request, object userState)
{
if ((this.onBegin<xsl:value-of select="name"/>Delegate == null))
{
this.onBegin<xsl:value-of select="name"/>Delegate = new BeginOperationDelegate(this.OnBegin<xsl:value-of select="name"/>);
}
if ((this.onEnd<xsl:value-of select="name"/>Delegate == null))
{
this.onEnd<xsl:value-of select="name"/>Delegate = new EndOperationDelegate(this.OnEnd<xsl:value-of select="name"/>);
}
if ((this.on<xsl:value-of select="name"/>CompletedDelegate == null))
{
this.on<xsl:value-of select="name"/>CompletedDelegate = new global::System.Threading.SendOrPostCallback(this.On<xsl:value-of select="name"/>Completed);
}
base.InvokeAsync(this.onBegin<xsl:value-of select="name"/>Delegate, new object[] {
request}, this.onEnd<xsl:value-of select="name"/>Delegate, this.on<xsl:value-of select="name"/>CompletedDelegate, userState);
}
</xsl:if>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>

View File

@ -1,745 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl msxsl"
>
<xsl:import href="common.xslt"/>
<xsl:param name="help"/>
<xsl:param name="xml"/>
<xsl:param name="datacontract"/>
<xsl:param name="binary"/>
<xsl:param name="protoRpc"/>
<xsl:param name="observable"/>
<xsl:param name="preObservable"/>
<xsl:param name="partialMethods"/>
<xsl:param name="detectMissing"/>
<xsl:param name="lightFramework"/>
<xsl:param name="asynchronous"/>
<xsl:param name="clientProxy"/>
<xsl:param name="defaultNamespace"/>
<xsl:key name="fieldNames" match="//FieldDescriptorProto" use="name"/>
<xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
<xsl:variable name="types" select="//EnumDescriptorProto | //DescriptorProto"/>
<xsl:variable name="optionXml" select="$xml='true'"/>
<xsl:variable name="optionDataContract" select="$datacontract='true'"/>
<xsl:variable name="optionBinary" select="$binary='true'"/>
<xsl:variable name="optionProtoRpc" select="$protoRpc='true'"/>
<xsl:variable name="optionObservable" select="$observable='true'"/>
<xsl:variable name="optionPreObservable" select="$preObservable='true'"/>
<xsl:variable name="optionPartialMethods" select="$partialMethods='true'"/>
<xsl:variable name="optionDetectMissing" select="$detectMissing='true'"/>
<xsl:variable name="optionFullFramework" select="not($lightFramework='true')"/>
<xsl:variable name="optionAsynchronous" select="$asynchronous='true'"/>
<xsl:variable name="optionClientProxy" select="$clientProxy='true'"/>
<xsl:variable name="optionFixCase" select="$fixCase='true'"/>
<xsl:template match="FileDescriptorSet">
<xsl:if test="$help='true'">
<xsl:message terminate="yes">
VisualBasic template for protobuf-net.
Options:
General:
"help" - this page
Additional serializer support:
"xml" - enable explicit xml support (XmlSerializer)
"datacontract" - enable data-contract support (DataContractSerializer; requires .NET 3.0)
"binary" - enable binary support (BinaryFormatter; not supported on Silverlight)
Other:
"protoRpc" - enable proto-rpc client
"observable" - change notification (observer pattern) support
"preObservable" - pre-change notification (observer pattern) support (requires .NET 3.5)
"partialMethods" - provide partial methods for changes (requires C# 3.0)
"detectMissing" - provide *Specified properties to indicate whether fields are present
"lightFramework" - omit additional attributes not included in CF/Silverlight
"asynchronous" - emit asynchronous methods for use with WCF
"clientProxy" - emit asynchronous client proxy class
</xsl:message>
</xsl:if>
<xsl:if test="$optionXml and $optionDataContract">
<xsl:message terminate="yes">
Invalid options: xml and data-contract serialization are mutually exclusive.
</xsl:message>
</xsl:if>
' Generated from <xsl:value-of select="name"/>
<xsl:if test="$optionXml">
' Option: xml serialization ([XmlType]/[XmlElement]) enabled
</xsl:if><xsl:if test="$optionDataContract">
' Option: data-contract serialization ([DataContract]/[DataMember]) enabled
</xsl:if><xsl:if test="$optionBinary">
' Option: binary serialization (ISerializable) enabled
</xsl:if><xsl:if test="$optionObservable">
' Option: observable (OnPropertyChanged) enabled
</xsl:if><xsl:if test="$optionPreObservable">
' Option: pre-observable (OnPropertyChanging) enabled
</xsl:if><xsl:if test="$partialMethods">
' Option: partial methods (On*Changing/On*Changed) enabled
</xsl:if><xsl:if test="$detectMissing">
' Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
</xsl:if><xsl:if test="not($optionFullFramework)">
' Option: light framework (CF/Silverlight) enabled
</xsl:if><xsl:if test="$optionProtoRpc">
' Option: proto-rpc enabled
</xsl:if>
<xsl:apply-templates select="file/FileDescriptorProto"/>
</xsl:template>
<xsl:template match="FileDescriptorProto">
' Generated from: <xsl:value-of select="name"/>
<xsl:apply-templates select="dependency/string[.!='']"/>
<xsl:variable name="namespace"><xsl:call-template name="PickNamespace">
<xsl:with-param name="defaultNamespace" select="$defaultNamespace"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string($namespace) != ''">
Namespace <xsl:value-of select="translate($namespace,':-/\','__..')"/>
</xsl:if>
<xsl:apply-templates select="message_type | enum_type | service"/>
<xsl:if test="string($namespace) != ''">
End Namespace</xsl:if></xsl:template>
<xsl:template match="FileDescriptorProto/dependency/string">
' Note: requires additional types generated from: <xsl:value-of select="."/></xsl:template>
<xsl:template match="DescriptorProto">
<xsl:choose>
<xsl:when test="$optionDataContract">
&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:="<xsl:value-of select="name"/>")&gt; _
&lt;Global.System.Runtime.Serialization.DataContract(Name:="<xsl:value-of select="name"/>")&gt; _
</xsl:when>
<xsl:when test="$optionXml">
&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:="<xsl:value-of select="name"/>")&gt; _
&lt;Global.System.Xml.Serialization.XmlType(TypeName:="<xsl:value-of select="name"/>")&gt; _
</xsl:when>
<xsl:otherwise>
&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:="<xsl:value-of select="name"/>")&gt; _
</xsl:otherwise>
</xsl:choose><!--
-->Public Partial Class <xsl:call-template name="pascal"/>
implements Global.ProtoBuf.IExtensible<!--
--><xsl:if test="$optionBinary">, Global.System.Runtime.Serialization.ISerializable</xsl:if><!--
--><xsl:if test="$optionObservable">, Global.System.ComponentModel.INotifyPropertyChanged</xsl:if><!--
--><xsl:if test="$optionPreObservable">, Global.System.ComponentModel.INotifyPropertyChanging</xsl:if>
Public Sub New
End Sub
<xsl:apply-templates select="*"/><xsl:if test="$optionBinary">
Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext)
MyBase.New()
Global.ProtoBuf.Serializer.Merge(info, Me)
End Sub
Sub GetObjectData(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext) implements Global.System.Runtime.Serialization.ISerializable.GetObjectData
Global.ProtoBuf.Serializer.Serialize(info, Me)
End Sub
</xsl:if><xsl:if test="$optionObservable">
Public Event PropertyChanged As Global.System.ComponentModel.PropertyChangedEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Protected Overridable Sub OnPropertyChanged(ByVal propertyName As String)
RaiseEvent PropertyChanged(Me, New Global.System.ComponentModel.PropertyChangedEventArgs(propertyName))
End Sub
</xsl:if><xsl:if test="$optionPreObservable">
Public Event PropertyChanging As Global.System.ComponentModel.PropertyChangingEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanging.PropertyChanging
Protected Overridable Sub OnPropertyChanging(ByVal propertyName As String)
RaiseEvent PropertyChanging(Me, New Global.System.ComponentModel.PropertyChangingEventArgs(propertyName))
End Sub
</xsl:if>
Private extensionObject As Global.ProtoBuf.IExtension
Function GetExtensionObject(createIfMissing As Boolean) As Global.ProtoBuf.IExtension Implements Global.ProtoBuf.IExtensible.GetExtensionObject
Return Global.ProtoBuf.Extensible.GetExtensionObject(extensionObject, createIfMissing)
End Function
End Class
</xsl:template>
<xsl:template match="DescriptorProto/name | DescriptorProto/extension_range | DescriptorProto/extension"/>
<xsl:template match="
FileDescriptorProto/message_type | FileDescriptorProto/enum_type | FileDescriptorProto/service
| DescriptorProto/field | DescriptorProto/enum_type | DescriptorProto/message_type
| DescriptorProto/nested_type | EnumDescriptorProto/value | ServiceDescriptorProto/method">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="EnumDescriptorProto">
Public Enum <xsl:call-template name="pascal"/>
<xsl:apply-templates select="value"/>
End Enum
</xsl:template>
<xsl:template match="EnumValueDescriptorProto">
<xsl:text>
</xsl:text>
<xsl:value-of select="name"/>
<xsl:text xml:space="preserve"> = </xsl:text><xsl:choose>
<xsl:when test="number"><xsl:value-of select="number"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose><xsl:if test="position()!=last()">
</xsl:if>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="field">
<xsl:choose>
<xsl:when test="not(key('fieldNames',concat('_',name)))"><xsl:value-of select="concat('_',name)"/></xsl:when>
<xsl:when test="not(key('fieldNames',concat(name,'Field')))"><xsl:value-of select="concat(name,'Field')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat('_',generate-id())"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="format">
<xsl:choose>
<xsl:when test="type='TYPE_DOUBLE' or type='TYPE_FLOAT'
or type='TYPE_FIXED32' or type='TYPE_FIXED64'
or type='TYPE_SFIXED32' or type='TYPE_SFIXED64'">FixedSize</xsl:when>
<xsl:when test="type='TYPE_GROUP'">Group</xsl:when>
<xsl:when test="not(type) or type='TYPE_INT32' or type='TYPE_INT64'
or type='TYPE_UINT32' or type='TYPE_UINT64'
or type='TYPE_ENUM'">TwosComplement</xsl:when>
<xsl:when test="type='TYPE_SINT32' or type='TYPE_SINT64'">ZigZag</xsl:when>
<xsl:otherwise>Default</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="primitiveType">
<xsl:choose>
<xsl:when test="not(type)">struct</xsl:when>
<xsl:when test="type='TYPE_DOUBLE'">struct</xsl:when>
<xsl:when test="type='TYPE_FLOAT'">struct</xsl:when>
<xsl:when test="type='TYPE_INT64'">struct</xsl:when>
<xsl:when test="type='TYPE_UINT64'">struct</xsl:when>
<xsl:when test="type='TYPE_INT32'">struct</xsl:when>
<xsl:when test="type='TYPE_FIXED64'">struct</xsl:when>
<xsl:when test="type='TYPE_FIXED32'">struct</xsl:when>
<xsl:when test="type='TYPE_BOOL'">struct</xsl:when>
<xsl:when test="type='TYPE_STRING'">class</xsl:when>
<xsl:when test="type='TYPE_BYTES'">class</xsl:when>
<xsl:when test="type='TYPE_UINT32'">struct</xsl:when>
<xsl:when test="type='TYPE_SFIXED32'">struct</xsl:when>
<xsl:when test="type='TYPE_SFIXED64'">struct</xsl:when>
<xsl:when test="type='TYPE_SINT32'">struct</xsl:when>
<xsl:when test="type='TYPE_SINT64'">struct</xsl:when>
<xsl:when test="type='TYPE_ENUM'">struct</xsl:when>
<xsl:when test="type='TYPE_GROUP' or type='TYPE_MESSAGE'">none</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
Field type not implemented: <xsl:value-of select="type"/> (<xsl:value-of select="../../name"/>.<xsl:value-of select="name"/>)
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto" mode="type">
<xsl:choose>
<xsl:when test="not(type)">double</xsl:when>
<xsl:when test="type='TYPE_DOUBLE'">Double</xsl:when>
<xsl:when test="type='TYPE_FLOAT'">Single</xsl:when>
<xsl:when test="type='TYPE_INT64'">Long</xsl:when>
<xsl:when test="type='TYPE_UINT64'">ULong</xsl:when>
<xsl:when test="type='TYPE_INT32'">Integer</xsl:when>
<xsl:when test="type='TYPE_FIXED64'">ULong</xsl:when>
<xsl:when test="type='TYPE_FIXED32'">UInteger</xsl:when>
<xsl:when test="type='TYPE_BOOL'">Boolean</xsl:when>
<xsl:when test="type='TYPE_STRING'">String</xsl:when>
<xsl:when test="type='TYPE_BYTES'">Byte()</xsl:when>
<xsl:when test="type='TYPE_UINT32'">UInteger</xsl:when>
<xsl:when test="type='TYPE_SFIXED32'">Integer</xsl:when>
<xsl:when test="type='TYPE_SFIXED64'">Long</xsl:when>
<xsl:when test="type='TYPE_SINT32'">Integer</xsl:when>
<xsl:when test="type='TYPE_SINT64'">Long</xsl:when>
<xsl:when test="type='TYPE_GROUP' or type='TYPE_MESSAGE' or type='TYPE_ENUM'"><xsl:call-template name="pascal">
<xsl:with-param name="value" select="substring-after(type_name,'.')"/>
</xsl:call-template></xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
Field type not implemented: <xsl:value-of select="type"/> (<xsl:value-of select="../../name"/>.<xsl:value-of select="name"/>)
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto[default_value]" mode="defaultValue">
<xsl:choose>
<xsl:when test="type='TYPE_STRING'">"<xsl:value-of select="default_value"/>"</xsl:when>
<xsl:when test="type='TYPE_ENUM'"><xsl:apply-templates select="." mode="type"/>.<xsl:value-of select="default_value"/></xsl:when>
<xsl:when test="type='TYPE_BYTES'"> ' <xsl:value-of select="default_value"/></xsl:when>
<xsl:otherwise>CType(<xsl:value-of select="default_value"/>, <xsl:apply-templates select="." mode="type"/>)</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
We need to find the first enum value given .foo.bar.SomeEnum - but the enum itself
only knows about SomeEnum; we need to look at all parent DescriptorProto nodes, and
the FileDescriptorProto for the namespace.
This does an annoying up/down recursion... a bit expensive, but *generally* OK.
Could perhaps index the last part of the enum name to reduce overhead?
-->
<xsl:template name="GetFirstEnumValue">
<xsl:variable name="hunt" select="type_name"/>
<xsl:for-each select="//EnumDescriptorProto">
<xsl:variable name="fullName">
<xsl:for-each select="ancestor::FileDescriptorProto">.<xsl:value-of select="package"/></xsl:for-each>
<xsl:for-each select="ancestor::DescriptorProto">.<xsl:value-of select="name"/></xsl:for-each>
<xsl:value-of select="concat('.',name)"/>
</xsl:variable>
<xsl:if test="$fullName=$hunt"><xsl:value-of select="(value/EnumValueDescriptorProto)[1]/name"/></xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="FieldDescriptorProto[not(default_value)]" mode="defaultValue">
<xsl:choose>
<xsl:when test="type='TYPE_DOUBLE'">0.0</xsl:when>
<xsl:when test="type='TYPE_FLOAT'">0.0F</xsl:when>
<xsl:when test="type='TYPE_INT64'">0L</xsl:when>
<xsl:when test="type='TYPE_UINT64'">0L</xsl:when>
<xsl:when test="type='TYPE_INT32'">0</xsl:when>
<xsl:when test="type='TYPE_FIXED64'">0L</xsl:when>
<xsl:when test="type='TYPE_FIXED32'">0</xsl:when>
<xsl:when test="type='TYPE_BOOL'">False</xsl:when>
<xsl:when test="type='TYPE_STRING'">""</xsl:when>
<xsl:when test="type='TYPE_BYTES'">Nothing</xsl:when>
<xsl:when test="type='TYPE_UINT32'">0</xsl:when>
<xsl:when test="type='TYPE_SFIXED32'">0</xsl:when>
<xsl:when test="type='TYPE_SFIXED64'">0L</xsl:when>
<xsl:when test="type='TYPE_SINT32'">0</xsl:when>
<xsl:when test="type='TYPE_SINT64'">0L</xsl:when>
<xsl:when test="type='TYPE_MESSAGE'">Nothing</xsl:when>
<xsl:when test="type='TYPE_ENUM'"><xsl:apply-templates select="." mode="type"/>.<xsl:call-template name="GetFirstEnumValue"/></xsl:when>
<xsl:otherwise>Nothing</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_OPTIONAL' or not(label)]">
<xsl:variable name="propType"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="primitiveType"><xsl:apply-templates select="." mode="primitiveType"/></xsl:variable>
<xsl:variable name="defaultValue"><xsl:apply-templates select="." mode="defaultValue"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
<xsl:variable name="specified" select="$optionDetectMissing and ($primitiveType='struct' or $primitiveType='class')"/>
<xsl:variable name="fieldType"><xsl:if test="$specified and $primitiveType='struct'">Nullable(Of </xsl:if><xsl:value-of select="$propType"/><xsl:if test="$specified and $primitiveType='struct'">)</xsl:if></xsl:variable>
<xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
Private <xsl:value-of select="concat($field,' As ',substring-after($fieldType, 'google.protobuf.'))"/><xsl:if test="not($specified)"> =<xsl:value-of select="$defaultValue"/></xsl:if>
</xsl:when>
<xsl:otherwise>
Private <xsl:value-of select="concat($field,' As ',$fieldType)"/><xsl:if test="not($specified)"> =<xsl:value-of select="$defaultValue"/></xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="not($specified) and $optionXml">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
<xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="substring-after($fieldType, 'google.protobuf.')"/>))&gt; _
</xsl:when>
<xsl:otherwise>
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="$fieldType"/>))&gt; _
</xsl:otherwise>
</xsl:choose>
&lt;Global.System.Xml.Serialization.XmlElement("<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>)&gt; _ <!--
--></xsl:when>
<xsl:when test="not($specified) and $optionDataContract">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
<xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="substring-after($fieldType, 'google.protobuf.')"/>))&gt; _
</xsl:when>
<xsl:otherwise>
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="$fieldType"/>))&gt; _
</xsl:otherwise>
</xsl:choose>
&lt;Global.System.Runtime.Serialization.DataMember(Name:="<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>, IsRequired:=False)&gt; _ <!--
--></xsl:when>
<xsl:when test="not($specified)">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _ <!--
--><xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="substring-after($fieldType, 'google.protobuf.')"/>))&gt; _ <!--
--></xsl:when>
<xsl:otherwise>
&lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select="$defaultValue"/>, <xsl:value-of select="$fieldType"/>))&gt; _ <!--
--></xsl:otherwise>
</xsl:choose><!--
--></xsl:when>
<xsl:when test="$optionDataContract">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Runtime.Serialization.DataMember(Name:="<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>, IsRequired:=False)&gt; _ <!--
--></xsl:when>
<xsl:when test="$optionXml">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Xml.Serialization.XmlElement("<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>)&gt; _ <!--
--></xsl:when>
<xsl:otherwise>
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=False, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _ <!--
--></xsl:otherwise>
</xsl:choose><!--
--><xsl:call-template name="WriteGetSet">
<xsl:with-param name="fieldType" select="$fieldType"/>
<xsl:with-param name="propType" select="$propType"/>
<xsl:with-param name="name"><xsl:call-template name="pascalPropName"/></xsl:with-param>
<xsl:with-param name="field" select="$field"/>
<xsl:with-param name="defaultValue" select="$defaultValue"/>
<xsl:with-param name="specified" select="$specified"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="pascalPropName">
<xsl:param name="value" select="name"/>
<xsl:param name="delimiter" select="'_'"/>
<xsl:variable name="valueUC" select="translate($value,$alpha,$ALPHA)"/>
<xsl:variable name="finalName">
<xsl:choose>
<xsl:when test="$types[translate(name,$alpha,$ALPHA)=$valueUC]"><xsl:value-of select="concat($value,$delimiter,'Property')"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="pascal">
<xsl:with-param name="value" select="$finalName"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_REQUIRED']">
<xsl:variable name="type"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
Private <xsl:value-of select="concat($field, ' As ', $type)"/>
<xsl:choose>
<xsl:when test="$optionDataContract">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=True, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Runtime.Serialization.DataMember(Name:="<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>, IsRequired:=True)&gt; _ <!--
--></xsl:when>
<xsl:when test="$optionXml">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=True, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Xml.Serialization.XmlElement("<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>)&gt; _ <!--
--></xsl:when>
<xsl:otherwise>
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, IsRequired:=True, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _ <!--
--></xsl:otherwise>
</xsl:choose><!--
--><xsl:call-template name="WriteGetSet">
<xsl:with-param name="fieldType" select="$type"/>
<xsl:with-param name="propType" select="$type"/>
<xsl:with-param name="name" select="name"/>
<xsl:with-param name="field" select="$field"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="WriteGetSet">
<xsl:param name="fieldType"/>
<xsl:param name="propType"/>
<xsl:param name="name"/>
<xsl:param name="field"/>
<xsl:param name="specified" select="false()"/>
<xsl:param name="defaultValue"/>
<xsl:variable name="primitiveType"><xsl:apply-templates select="." mode="primitiveType"/></xsl:variable>
<xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
Public Property <xsl:value-of select="concat($name,' As ',substring-after($fieldType, 'google.protobuf.'))"/>
</xsl:when>
<xsl:otherwise>
Public Property <xsl:value-of select="concat($name,' As ',$fieldType)"/>
</xsl:otherwise>
</xsl:choose>
Get
<xsl:choose>
<xsl:when test="$specified and $primitiveType='struct'"><!--
-->Return <xsl:value-of select="$field"/><!--
--></xsl:when>
<xsl:when test="$specified">
If Not <xsl:value-of select="$field"/> Is Nothing Then
Return <xsl:value-of select="$field"/>
Else
Return <xsl:value-of select="$defaultValue"/>
End If<!--
--></xsl:when>
<xsl:otherwise><!--
-->Return <xsl:value-of select="$field"/><!--
--></xsl:otherwise>
</xsl:choose>
End Get
<xsl:choose>
<xsl:when test="substring-after($fieldType, 'google.protobuf.')">
Set(<xsl:value-of select="concat('value As ',substring-after($fieldType, 'google.protobuf.'))"/>)
</xsl:when>
<xsl:otherwise>
Set(<xsl:value-of select="concat('value As ',$fieldType)"/>)
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$optionPartialMethods">On<xsl:value-of select="$name"/>Changing(value)
</xsl:if><xsl:if test="$optionPreObservable">OnPropertyChanging("<xsl:value-of select="$name"/>")
</xsl:if><xsl:value-of select="$field"/> = value
<xsl:if test="$optionObservable">OnPropertyChanged("<xsl:value-of select="$name"/>") </xsl:if><xsl:if test="$optionPartialMethods">On<xsl:value-of select="$name"/>Changed()</xsl:if>
End Set
End Property
<xsl:if test="$optionPartialMethods">
partial void On<xsl:value-of select="$name"/>Changing(<xsl:value-of select="$propType"/> value);
partial void On<xsl:value-of select="$name"/>Changed();</xsl:if><xsl:if test="$specified">
&lt;Global.System.Xml.Serialization.XmlIgnore&gt; _
<xsl:if test="$optionFullFramework">&lt;Global.System.ComponentModel.Browsable(false)&gt; _ </xsl:if>
<xsl:choose>
<xsl:when test="$specified and $primitiveType='struct'">
Public Property <xsl:value-of select="$name"/>Specified As Boolean
Get
Return <xsl:value-of select="$field"/>.HasValue
End Get
Set (ByVal value As Boolean)
If Not <xsl:value-of select="$field"/>.HasValue Then
If value = True then <xsl:value-of select="$field"/> = <xsl:value-of select="$name"/>
Else
If value = False then <xsl:value-of select="$field"/> = Nothing
End If
End Set
End Property
</xsl:when>
<xsl:otherwise>
Public Property <xsl:value-of select="$name"/>Specified As Boolean
Get
Return <xsl:value-of select="$field"/> IsNot Nothing
End Get
Set (ByVal value As Boolean)
If <xsl:value-of select="$field"/> Is Nothing Then
If value = True then <xsl:value-of select="$field"/> = <xsl:value-of select="$name"/>
Else
If value = False then <xsl:value-of select="$field"/> = Nothing
End If
End Set
End Property
</xsl:otherwise>
</xsl:choose>
Private Function ShouldSerialize<xsl:value-of select="$name"/>() As Boolean
Return <xsl:value-of select="$name"/>Specified
End Function
Private Sub Reset<xsl:value-of select="$name"/>()
<xsl:value-of select="$name"/>Specified = false
End Sub
</xsl:if>
</xsl:template>
<xsl:template match="FieldDescriptorProto[label='LABEL_REPEATED']">
<xsl:variable name="type"><xsl:apply-templates select="." mode="type"/></xsl:variable>
<xsl:variable name="format"><xsl:apply-templates select="." mode="format"/></xsl:variable>
<xsl:variable name="field"><xsl:apply-templates select="." mode="field"/></xsl:variable>
<xsl:choose>
<xsl:when test="substring-after($type, 'google.protobuf.')">
Private <xsl:if test="not($optionXml)">ReadOnly </xsl:if> <xsl:value-of select="$field"/> as Global.System.Collections.Generic.List(Of <xsl:value-of select="substring-after($type, 'google.protobuf.')" />) = New Global.System.Collections.Generic.List(Of <xsl:value-of select="substring-after($type, 'google.protobuf.')"/>)()
</xsl:when>
<xsl:otherwise>
Private <xsl:if test="not($optionXml)">ReadOnly </xsl:if> <xsl:value-of select="$field"/> as Global.System.Collections.Generic.List(Of <xsl:value-of select="$type" />) = New Global.System.Collections.Generic.List(Of <xsl:value-of select="$type"/>)()
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$optionDataContract">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Runtime.Serialization.DataMember(Name:="<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>, IsRequired:=False)&gt; _
</xsl:when>
<xsl:when test="$optionXml">
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
&lt;Global.System.Xml.Serialization.XmlElement("<xsl:value-of select="name"/>", Order:=<xsl:value-of select="number"/>)&gt; _
</xsl:when>
<xsl:otherwise>
&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select="number"/>, Name:="<xsl:value-of select="name"/>", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select="$format"/>)&gt; _
</xsl:otherwise>
</xsl:choose><!--
--><xsl:choose>
<xsl:when test="substring-after($type, 'google.protobuf.')"><!--
-->Public <xsl:if test="not($optionXml)">ReadOnly </xsl:if>Property <xsl:value-of select="name"/> As Global.System.Collections.Generic.List(Of <xsl:value-of select="substring-after($type, 'google.protobuf.')" />)
</xsl:when>
<xsl:otherwise><!--
-->Public <xsl:if test="not($optionXml)">ReadOnly </xsl:if>Property <xsl:value-of select="name"/> As Global.System.Collections.Generic.List(Of <xsl:value-of select="$type" />)
</xsl:otherwise>
</xsl:choose>
Get
Return <xsl:value-of select="$field"/>
End Get
<!----><xsl:if test="$optionXml">
<xsl:choose>
<xsl:when test="substring-after($type, 'google.protobuf.')">
Set (value As Global.System.Collections.Generic.List(Of <xsl:value-of select="substring-after($type, 'google.protobuf.')" />))
</xsl:when>
<xsl:otherwise>
Set (value As Global.System.Collections.Generic.List(Of <xsl:value-of select="$type" />))
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$field"/> = value
End Set
</xsl:if>
End Property
</xsl:template>
<xsl:template match="ServiceDescriptorProto">
<xsl:if test="($optionClientProxy or $optionDataContract)">
&lt;Global.System.ServiceModel.ServiceContract(Name:="<xsl:value-of select="name"/>")&gt; _
</xsl:if>
Public Interface I<xsl:value-of select="name"/>
<xsl:apply-templates select="method"/>
End Interface
<xsl:if test="$optionProtoRpc">
Public Class <xsl:value-of select="name"/>Client : Global.ProtoBuf.ServiceModel.RpcClient
public <xsl:value-of select="name"/>Client() : base(typeof(I<xsl:value-of select="name"/>)) { }
<xsl:apply-templates select="method/MethodDescriptorProto" mode="protoRpc"/>
End Class
</xsl:if>
<xsl:apply-templates select="." mode="clientProxy"/>
</xsl:template>
<xsl:template match="MethodDescriptorProto">
<xsl:if test="$optionDataContract">
&lt;Global.System.ServiceModel.OperationContract(Name:="<xsl:value-of select="name"/>")&gt; _
&lt;Global.ProtoBuf.ServiceModel.ProtoBehavior()&gt; _
</xsl:if>
<xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request);
<xsl:if test="$optionAsynchronous and $optionDataContract">
&lt;Global.System.ServiceModel.OperationContract(AsyncPattern:=True, Name:="<xsl:value-of select="name"/>")&gt; _
Global.System.IAsyncResult Begin<xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request, Global.System.AsyncCallback callback, object state);
<xsl:apply-templates select="output_type"/> End<xsl:value-of select="name"/>(Global.System.IAsyncResult ar);
</xsl:if>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="protoRpc">
<xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request)
{
return (<xsl:apply-templates select="output_type"/>) Send("<xsl:value-of select="name"/>", request);
}
</xsl:template>
<xsl:template match="MethodDescriptorProto/input_type | MethodDescriptorProto/output_type">
<xsl:value-of select="substring-after(.,'.')"/>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="CompleteEvent">
<xsl:if test="$optionAsynchronous and $optionDataContract">
Public Class <xsl:value-of select="name"/>CompletedEventArgs : Global.System.ComponentModel.AsyncCompletedEventArgs
private object[] results;
public <xsl:value-of select="name"/>CompletedEventArgs(object[] results, Global.System.Exception exception, bool cancelled, object userState)
: base(exception, cancelled, userState)
{
this.results = results;
}
public <xsl:apply-templates select="output_type"/> Result
{
get {
base.RaiseExceptionIfNecessary();
return (<xsl:apply-templates select="output_type"/>)(this.results[0]);
}
}
End Class
</xsl:if>
</xsl:template>
<xsl:template match="ServiceDescriptorProto" mode="clientProxy">
<xsl:if test="$optionAsynchronous and $optionDataContract and $optionClientProxy">
<xsl:apply-templates select="method/MethodDescriptorProto" mode="CompleteEvent"/>
&lt;Global.System.Diagnostics.DebuggerStepThroughAttribute()&gt; _
public partial class <xsl:value-of select="name"/>Client : Global.System.ServiceModel.ClientBase&lt;I<xsl:value-of select="name"/>&gt;, I<xsl:value-of select="name"/>
{
public <xsl:value-of select="name"/>Client()
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName)
: base(endpointConfigurationName)
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName, string remoteAddress)
: base(endpointConfigurationName, remoteAddress)
{}
public <xsl:value-of select="name"/>Client(string endpointConfigurationName, Global.System.ServiceModel.EndpointAddress remoteAddress)
: base(endpointConfigurationName, remoteAddress)
{}
public <xsl:value-of select="name"/>Client(Global.System.ServiceModel.Channels.Binding binding, Global.System.ServiceModel.EndpointAddress remoteAddress)
: base(binding, remoteAddress)
{}
<xsl:apply-templates select="method/MethodDescriptorProto" mode="clientProxy"/>
}
</xsl:if>
</xsl:template>
<xsl:template match="MethodDescriptorProto" mode="clientProxy">
<xsl:if test="$optionAsynchronous and $optionDataContract and $optionClientProxy">
private BeginOperationDelegate onBegin<xsl:value-of select="name"/>Delegate;
private EndOperationDelegate onEnd<xsl:value-of select="name"/>Delegate;
private Global.System.Threading.SendOrPostCallback on<xsl:value-of select="name"/>CompletedDelegate;
public event Global.System.EventHandler&lt;<xsl:value-of select="name"/>CompletedEventArgs&gt; <xsl:value-of select="name"/>Completed;
public <xsl:apply-templates select="output_type"/><xsl:text xml:space="preserve"> </xsl:text><xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request)
{
return base.Channel.<xsl:value-of select="name"/>(request);
}
&lt;Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)&gt; _
public Global.System.IAsyncResult Begin<xsl:value-of select="name"/>(<xsl:apply-templates select="input_type"/> request, Global.System.AsyncCallback callback, object asyncState)
{
return base.Channel.Begin<xsl:value-of select="name"/>(request, callback, asyncState);
}
&lt;Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)&gt; _
public <xsl:apply-templates select="output_type"/> End<xsl:value-of select="name"/>(Global.System.IAsyncResult result)
{
return base.Channel.End<xsl:value-of select="name"/>(result);
}
private Global.System.IAsyncResult OnBegin<xsl:value-of select="name"/>(object[] inValues, Global.System.AsyncCallback callback, object asyncState)
{
<xsl:apply-templates select="input_type"/> request = ((<xsl:apply-templates select="input_type"/>)(inValues[0]));
return this.Begin<xsl:value-of select="name"/>(request, callback, asyncState);
}
private object[] OnEnd<xsl:value-of select="name"/>(Global.System.IAsyncResult result)
{
<xsl:apply-templates select="output_type"/> retVal = this.End<xsl:value-of select="name"/>(result);
return new object[] {
retVal};
}
private void On<xsl:value-of select="name"/>Completed(object state)
{
if ((this.<xsl:value-of select="name"/>Completed != null))
{
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.<xsl:value-of select="name"/>Completed(this, new <xsl:value-of select="name"/>CompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void <xsl:value-of select="name"/>Async(<xsl:apply-templates select="input_type"/> request)
{
this.<xsl:value-of select="name"/>Async(request, null);
}
public void <xsl:value-of select="name"/>Async(<xsl:apply-templates select="input_type"/> request, object userState)
{
if ((this.onBegin<xsl:value-of select="name"/>Delegate == null))
{
this.onBegin<xsl:value-of select="name"/>Delegate = new BeginOperationDelegate(this.OnBegin<xsl:value-of select="name"/>);
}
if ((this.onEnd<xsl:value-of select="name"/>Delegate == null))
{
this.onEnd<xsl:value-of select="name"/>Delegate = new EndOperationDelegate(this.OnEnd<xsl:value-of select="name"/>);
}
if ((this.on<xsl:value-of select="name"/>CompletedDelegate == null))
{
this.on<xsl:value-of select="name"/>CompletedDelegate = new Global.System.Threading.SendOrPostCallback(this.On<xsl:value-of select="name"/>Completed);
}
base.InvokeAsync(this.onBegin<xsl:value-of select="name"/>Delegate, new object[] {
request}, this.onEnd<xsl:value-of select="name"/>Delegate, this.on<xsl:value-of select="name"/>CompletedDelegate, userState);
}
</xsl:if>
</xsl:template>
<xsl:template name="escapeKeyword"><xsl:param name="value"/><xsl:choose>
<xsl:when test="contains($keywordsUpper,concat('|',translate($value, $alpha, $ALPHA),'|'))">[<xsl:value-of select="$value"/>]</xsl:when>
<xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
</xsl:choose></xsl:template>
<xsl:variable name="keywords">|AddHandler|AddressOf|Alias|And|AndAlso|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDec|CDbl|Char|CInt|Class|CLng|CObj|Const|Continue|CSByte|CShort|CSng|CStr|CType|CUInt|CULng|CUShort|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|False|Finally|For|Friend|Function|Get|GetType|GetXMLNamespace|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|Narrowing|New|Next|Not|Nothing|NotInheritable|NotOverridable|Object|Of|On|Operator|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|REM|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|True|Try|TryCast|TypeOf|Variant|Wend|UInteger|ULong|UShort|Using|When|While|Widening|With|WithEvents|WriteOnly|Xor|</xsl:variable>
<xsl:variable name="keywordsUpper" select="translate($keywords, $alpha, $ALPHA)"/>
</xsl:stylesheet>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl msxsl"
>
<xsl:param name="help"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/*">
<xsl:if test="$help='true'">
<xsl:message terminate="yes">
Xml template for protobuf-net.
This template writes the proto descriptor as xml.
No options available.
</xsl:message>
</xsl:if>
<xsl:call-template name="main"/>
</xsl:template>
<xsl:template match="@* | node()" name="main">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,120 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled
// Generated from: proto/protobuf_HunterNetCore.proto
namespace HunterProtobufCore
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_C2S")]
public partial class HunterNet_C2S : global::ProtoBuf.IExtensible
{
public HunterNet_C2S() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"HunterNet_S2C")]
public partial class HunterNet_S2C : global::ProtoBuf.IExtensible
{
public HunterNet_S2C() {}
private int? _HunterNetCore_CmdID;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"HunterNetCore_CmdID", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_CmdID
{
get { return _HunterNetCore_CmdID; }
set { _HunterNetCore_CmdID = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_CmdIDSpecified
{
get { return this._HunterNetCore_CmdID != null; }
set { if (value == (this._HunterNetCore_CmdID== null)) this._HunterNetCore_CmdID = value ? this.HunterNetCore_CmdID : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_CmdID() { return HunterNetCore_CmdIDSpecified; }
private void ResetHunterNetCore_CmdID() { HunterNetCore_CmdIDSpecified = false; }
private int? _HunterNetCore_ERRORCode;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"HunterNetCore_ERRORCode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int? HunterNetCore_ERRORCode
{
get { return _HunterNetCore_ERRORCode; }
set { _HunterNetCore_ERRORCode = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_ERRORCodeSpecified
{
get { return this._HunterNetCore_ERRORCode != null; }
set { if (value == (this._HunterNetCore_ERRORCode== null)) this._HunterNetCore_ERRORCode = value ? this.HunterNetCore_ERRORCode : (int?)null; }
}
private bool ShouldSerializeHunterNetCore_ERRORCode() { return HunterNetCore_ERRORCodeSpecified; }
private void ResetHunterNetCore_ERRORCode() { HunterNetCore_ERRORCodeSpecified = false; }
private byte[] _HunterNetCore_Data;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"HunterNetCore_Data", DataFormat = global::ProtoBuf.DataFormat.Default)]
public byte[] HunterNetCore_Data
{
get { return _HunterNetCore_Data; }
set { _HunterNetCore_Data = value; }
}
[global::System.Xml.Serialization.XmlIgnore]
[global::System.ComponentModel.Browsable(false)]
public bool HunterNetCore_DataSpecified
{
get { return this._HunterNetCore_Data != null; }
set { if (value == (this._HunterNetCore_Data== null)) this._HunterNetCore_Data = value ? this.HunterNetCore_Data : (byte[])null; }
}
private bool ShouldSerializeHunterNetCore_Data() { return HunterNetCore_DataSpecified; }
private void ResetHunterNetCore_Data() { HunterNetCore_DataSpecified = false; }
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

View File

@ -1,7 +0,0 @@
@echo off
cd..
set "protopath=%cd%"
cd protocol
protoc --proto_path=./proto --cpp_out=out "./proto/KyCmdProtocol.proto"
protoc --proto_path=./proto --cpp_out=out "./proto/KyMsgProtocol.proto"
pause

17
ProtobufCore/build_cs.bat Normal file
View File

@ -0,0 +1,17 @@
@echo off
set "PROTOC_EXE=%cd%\protoc.exe"
set "WORK_DIR=%cd%\proto"
set "CS_OUT_PATH=%cd%\out\CS"
echo "==>>buildStart"
for /f "delims=" %%i in ('dir /b proto "proto/*.proto"') do (
echo build file:%%%i
%PROTOC_EXE% --proto_path="%WORK_DIR%" --csharp_out="%CS_OUT_PATH%" "%WORK_DIR%\%%i"
)
echo "==>>build finish"
echo "==>>copy cs"
::copy %cd%\out\CS\ ..\Project2\Assets\Scripts\HotFix\ProtoBuf\
pause

View File

@ -0,0 +1,506 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_HunterNetCore.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#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 HunterProtobufCore {
/// <summary>Holder for reflection information generated from protobuf_HunterNetCore.proto</summary>
public static partial class ProtobufHunterNetCoreReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_HunterNetCore.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufHunterNetCoreReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chxwcm90b2J1Zl9IdW50ZXJOZXRDb3JlLnByb3RvEhJIdW50ZXJQcm90b2J1",
"ZkNvcmUiSAoNSHVudGVyTmV0X0MyUxIbChNIdW50ZXJOZXRDb3JlX0NtZElE",
"GAEgASgFEhoKEkh1bnRlck5ldENvcmVfRGF0YRgCIAEoDCJpCg1IdW50ZXJO",
"ZXRfUzJDEhsKE0h1bnRlck5ldENvcmVfQ21kSUQYASABKAUSHwoXSHVudGVy",
"TmV0Q29yZV9FUlJPUkNvZGUYAiABKAUSGgoSSHVudGVyTmV0Q29yZV9EYXRh",
"GAMgASgMQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_C2S), global::HunterProtobufCore.HunterNet_C2S.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreData" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HunterProtobufCore.HunterNet_S2C), global::HunterProtobufCore.HunterNet_S2C.Parser, new[]{ "HunterNetCoreCmdID", "HunterNetCoreERRORCode", "HunterNetCoreData" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///上行
/// </summary>
public sealed partial class HunterNet_C2S : pb::IMessage<HunterNet_C2S>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_C2S> _parser = new pb::MessageParser<HunterNet_C2S>(() => new HunterNet_C2S());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_C2S> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S(HunterNet_C2S other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_C2S Clone() {
return new HunterNet_C2S(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 2;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_C2S);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_C2S other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(18);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_C2S other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 18: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
/// <summary>
///下行
/// </summary>
public sealed partial class HunterNet_S2C : pb::IMessage<HunterNet_S2C>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<HunterNet_S2C> _parser = new pb::MessageParser<HunterNet_S2C>(() => new HunterNet_S2C());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HunterNet_S2C> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::HunterProtobufCore.ProtobufHunterNetCoreReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C(HunterNet_S2C other) : this() {
hunterNetCoreCmdID_ = other.hunterNetCoreCmdID_;
hunterNetCoreERRORCode_ = other.hunterNetCoreERRORCode_;
hunterNetCoreData_ = other.hunterNetCoreData_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HunterNet_S2C Clone() {
return new HunterNet_S2C(this);
}
/// <summary>Field number for the "HunterNetCore_CmdID" field.</summary>
public const int HunterNetCoreCmdIDFieldNumber = 1;
private int hunterNetCoreCmdID_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreCmdID {
get { return hunterNetCoreCmdID_; }
set {
hunterNetCoreCmdID_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_ERRORCode" field.</summary>
public const int HunterNetCoreERRORCodeFieldNumber = 2;
private int hunterNetCoreERRORCode_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HunterNetCoreERRORCode {
get { return hunterNetCoreERRORCode_; }
set {
hunterNetCoreERRORCode_ = value;
}
}
/// <summary>Field number for the "HunterNetCore_Data" field.</summary>
public const int HunterNetCoreDataFieldNumber = 3;
private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString HunterNetCoreData {
get { return hunterNetCoreData_; }
set {
hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HunterNet_S2C);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HunterNet_S2C other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HunterNetCoreCmdID != other.HunterNetCoreCmdID) return false;
if (HunterNetCoreERRORCode != other.HunterNetCoreERRORCode) return false;
if (HunterNetCoreData != other.HunterNetCoreData) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (HunterNetCoreCmdID != 0) hash ^= HunterNetCoreCmdID.GetHashCode();
if (HunterNetCoreERRORCode != 0) hash ^= HunterNetCoreERRORCode.GetHashCode();
if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HunterNetCoreCmdID != 0) {
output.WriteRawTag(8);
output.WriteInt32(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
output.WriteRawTag(16);
output.WriteInt32(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
output.WriteRawTag(26);
output.WriteBytes(HunterNetCoreData);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (HunterNetCoreCmdID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreCmdID);
}
if (HunterNetCoreERRORCode != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HunterNetCoreERRORCode);
}
if (HunterNetCoreData.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HunterNet_S2C other) {
if (other == null) {
return;
}
if (other.HunterNetCoreCmdID != 0) {
HunterNetCoreCmdID = other.HunterNetCoreCmdID;
}
if (other.HunterNetCoreERRORCode != 0) {
HunterNetCoreERRORCode = other.HunterNetCoreERRORCode;
}
if (other.HunterNetCoreData.Length != 0) {
HunterNetCoreData = other.HunterNetCoreData;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HunterNetCoreCmdID = input.ReadInt32();
break;
}
case 16: {
HunterNetCoreERRORCode = input.ReadInt32();
break;
}
case 26: {
HunterNetCoreData = input.ReadBytes();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

BIN
ProtobufCore/proto2cpp.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +0,0 @@
call protoc proto\protobuf_HunterNetCore.proto --descriptor_set_out=Desc\protobuf_HunterNetCore.protodesc
pause

View File

@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>

View File

@ -1,2 +0,0 @@
call Protogen-Tools\protogen -i:Desc\protobuf_HunterNetCore.protodesc -o:Target\protobuf_HunterNetCore.cs -p:detectMissing

View File

@ -0,0 +1,6 @@
call proto2cpp.exe protoc.exe
cd..
set "protopath=%cd%"
cd new_server_proto
copy %cd%\out\cpp\ %protopath%\newhxserver\ProtocolSrc\
pause

View File

@ -1,4 +1,4 @@
using ProtoBuf; using Google.Protobuf;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -9,24 +9,17 @@ namespace SimpleClient
{ {
public static class NetBase public static class NetBase
{ {
//序列化 public static byte[] Serizlize(IMessage msg)
public static byte[] Serizlize<T>(T MsgObj)
{ {
using (MemoryStream ms = new MemoryStream()) return msg.ToByteArray();
{
Serializer.Serialize<T>(ms, MsgObj);
byte[] data1 = ms.ToArray();
return data1;
}
} }
//反序列化
public static T DeSerizlize<T>(byte[] MsgObj) public static T DeSerizlize<T>(byte[] bytes)
{ {
using (MemoryStream ms = new MemoryStream(MsgObj)) var msgType = typeof(T);
{ object msg = Activator.CreateInstance(msgType);
var ds_obj = Serializer.Deserialize<T>(ms); ((IMessage)msg).MergeFrom(bytes);
return ds_obj; return (T)msg;
}
} }
} }

View File

@ -1,19 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Data\" /> <Compile Remove="Data\**" />
<Folder Include="Manager\" /> <Compile Remove="Manager\**" />
<EmbeddedResource Remove="Data\**" />
<EmbeddedResource Remove="Manager\**" />
<None Remove="Data\**" />
<None Remove="Manager\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\NetLib\HaoYueNet.ClientNetwork\HaoYueNet.ClientNetwork.csproj" /> <ProjectReference Include="..\..\NetLib\HaoYueNet.ClientNetwork\HaoYueNet.ClientNetwork.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="Google.Protobuf">
<HintPath>..\..\NetLib\Google.Protobuf.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>