Skip to content

Commit 0deec90

Browse files
committed
Add hint for AOT compile in CodeGenerator (Generic classes)
1 parent e9c76ed commit 0deec90

File tree

16 files changed

+115
-14
lines changed

16 files changed

+115
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
EuNet C# (.NET, .NET Core, Unity)
22
===
3-
[![GitHub Actions](https://github.com/zestylife/EuNet/workflows/Build-Debug/badge.svg)](https://github.com/zestylife/EuNet/actions) [![GitHub Actions](https://github.com/zestylife/EuNet/workflows/Build-Release/badge.svg)](https://github.com/zestylife/EuNet/actions) [![Releases](https://img.shields.io/github/v/release/zestylife/EuNet)](https://github.com/zestylife/EuNet/releases)
3+
[![GitHub Actions](https://github.com/zestylife/EuNet/workflows/Build-Debug/badge.svg)](https://github.com/zestylife/EuNet/actions) [![GitHub Actions](https://github.com/zestylife/EuNet/workflows/Build-Release/badge.svg)](https://github.com/zestylife/EuNet/actions) [![nuget](https://img.shields.io/nuget/dt/EuNet.svg)](https://www.nuget.org/packages/EuNet/) [![Releases](https://img.shields.io/github/v/release/zestylife/EuNet)](https://github.com/zestylife/EuNet/releases)
44

55
Easy Unity Network (EuNet) is a network solution for multiplayer games.
66

@@ -130,9 +130,9 @@ You can add package from UPM (Unity Package Manager)
130130
```
131131
https://github.com/zestylife/EuNet.git?path=src/EuNet.Unity/Assets/Plugins/EuNet
132132
```
133-
If you want to add a specific release version, add `#version` after the url. ex) version 1.1.11
133+
If you want to add a specific release version, add `#version` after the url. ex) version 1.1.13
134134
```
135-
https://github.com/zestylife/EuNet.git?path=src/EuNet.Unity/Assets/Plugins/EuNet#1.1.11
135+
https://github.com/zestylife/EuNet.git?path=src/EuNet.Unity/Assets/Plugins/EuNet#1.1.13
136136
```
137137

138138
![image](https://github.com/zestylife/EuNet/blob/main/doc/images/AddPackageFromUPM.png?raw=true)

sandbox/Dev/Client/Assets/Shared/Common/CodeGen/EuNet.Rpc.CodeGen.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,21 @@ public static string GetEnumName(int rpcNameHash)
763763
}
764764
}
765765

766+
#endregion
767+
#region Common.AOT
768+
769+
namespace Common.AOT
770+
{
771+
public sealed class AotCode
772+
{
773+
private void UsedOnlyForAOTCodeGeneration()
774+
{
775+
776+
throw new InvalidOperationException("This method is used for AOT code generation only.Do not call it at runtime.");
777+
}
778+
}
779+
}
780+
766781
#endregion
767782
#region Common.UserInfo
768783

sandbox/Dev/Common/CodeGen/EuNet.Rpc.CodeGen.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,21 @@ public static string GetEnumName(int rpcNameHash)
763763
}
764764
}
765765

766+
#endregion
767+
#region Common.AOT
768+
769+
namespace Common.AOT
770+
{
771+
public sealed class AotCode
772+
{
773+
private void UsedOnlyForAOTCodeGeneration()
774+
{
775+
776+
throw new InvalidOperationException("This method is used for AOT code generation only.Do not call it at runtime.");
777+
}
778+
}
779+
}
780+
766781
#endregion
767782
#region Common.UserInfo
768783

src/EuNet.Client/EuNet.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<Authors>zestylife</Authors>
77
<Company></Company>
8-
<Version>1.1.13</Version>
8+
<Version>1.1.14</Version>
99
<Copyright></Copyright>
1010
<PackageProjectUrl>https://github.com/zestylife/EuNet</PackageProjectUrl>
1111
<RepositoryUrl>https://github.com/zestylife/EuNet</RepositoryUrl>

src/EuNet.CodeGenerator.Templates/EuNet.CodeGenerator.Templates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
6-
<Version>1.1.13</Version>
6+
<Version>1.1.14</Version>
77
<PackageLicenseExpression>MIT</PackageLicenseExpression>
88
<PackageOutputPath>../../nupkg</PackageOutputPath>
99
<NuspecFile>EuNet.CodeGenerator.Templates.nuspec</NuspecFile>

src/EuNet.CodeGenerator.Templates/EuNet.CodeGenerator.Templates.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
44
<id>EuNet.CodeGenerator.Templates</id>
55
<title>EuNet.CodeGenerator.Templates</title>
6-
<version>1.1.13</version>
6+
<version>1.1.14</version>
77
<authors>zestylife</authors>
88
<owners>zestylife</owners>
99
<description>EuNet.CodeGenerator.Templates</description>
@@ -13,8 +13,8 @@
1313
<releaseNotes>EuNet.CodeGenerator.Templates</releaseNotes>
1414
<tags>C# TCP P2P UDP Network Unity RPC HolePunching Relay</tags>
1515
<dependencies>
16-
<dependency id="EuNet.Core" version="1.1.13" />
17-
<dependency id="EuNet.Rpc" version="1.1.13" />
16+
<dependency id="EuNet.Core" version="1.1.14" />
17+
<dependency id="EuNet.Rpc" version="1.1.14" />
1818
</dependencies>
1919
<references>
2020
</references>

src/EuNet.CodeGenerator/EuNet.CodeGenerator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackAsTool>true</PackAsTool>
77
<ToolCommandName>enc</ToolCommandName>
88
<PackageOutputPath>../../nupkg</PackageOutputPath>
9-
<Version>1.1.13</Version>
9+
<Version>1.1.14</Version>
1010
</PropertyGroup>
1111

1212
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/EuNet.Core/EuNet.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<Authors>zestylife</Authors>
77
<Company></Company>
8-
<Version>1.1.13</Version>
8+
<Version>1.1.14</Version>
99
<Copyright></Copyright>
1010
<PackageProjectUrl>https://github.com/zestylife/EuNet</PackageProjectUrl>
1111
<RepositoryUrl>https://github.com/zestylife/EuNet</RepositoryUrl>

src/EuNet.Core/Util/NetUtil.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Net;
3+
using System.Net.Sockets;
34

45
namespace EuNet.Core
56
{
@@ -36,6 +37,29 @@ public static IPEndPoint GetEndPoint(string address, int port)
3637
return null;
3738
}
3839

40+
public static string GetPublicIpAddress(int timeoutMilliseconds = 5000)
41+
{
42+
var client = new WebClient();
43+
var task = client.DownloadStringTaskAsync("http://icanhazip.com");
44+
if (task.Wait(timeoutMilliseconds) == false)
45+
return string.Empty;
46+
47+
return task.Result.Trim();
48+
}
49+
50+
public static string GetLocalIpAddress()
51+
{
52+
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
53+
for (int i = 0; i < host.AddressList.Length; i++)
54+
{
55+
if (host.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
56+
{
57+
return host.AddressList[i].ToString();
58+
}
59+
}
60+
return string.Empty;
61+
}
62+
3963
internal static int RelativeSequenceNumber(int number, int expected)
4064
{
4165
return (number - expected + NetPacket.MaxSequence + NetPacket.HalfMaxSequence) % NetPacket.MaxSequence - NetPacket.HalfMaxSequence;

src/EuNet.Rpc/EuNet.Rpc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
66
<Authors>zestylife</Authors>
77
<Company></Company>
8-
<Version>1.1.13</Version>
8+
<Version>1.1.14</Version>
99
<Copyright></Copyright>
1010
<PackageProjectUrl>https://github.com/zestylife/EuNet</PackageProjectUrl>
1111
<RepositoryUrl>https://github.com/zestylife/EuNet</RepositoryUrl>

0 commit comments

Comments
 (0)