-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from project-fika/natpunch-2.0-3.9-dev
NAT Punch 2.0
- Loading branch information
Showing
44 changed files
with
265 additions
and
2,237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Fika.Core.UI.Models | ||
{ | ||
[DataContract] | ||
public struct NatPunchServerConfigModel | ||
{ | ||
[DataMember(Name = "enable")] | ||
public bool Enable; | ||
|
||
[DataMember(Name = "port")] | ||
public int Port; | ||
|
||
[DataMember(Name = "natIntroduceAmount")] | ||
public int NatIntroduceAmount; | ||
|
||
public NatPunchServerConfigModel(bool enable, int port, int natIntroduceAmount) | ||
{ | ||
Enable = enable; | ||
Port = port; | ||
NatIntroduceAmount = natIntroduceAmount; | ||
} | ||
|
||
public void LogValues() | ||
{ | ||
FikaPlugin.Instance.FikaLogger.LogInfo("Received NatPunchServer config from server:"); | ||
FieldInfo[] fields = typeof(NatPunchServerConfigModel).GetFields(); | ||
foreach (FieldInfo field in fields) | ||
{ | ||
object value = field.GetValue(this); | ||
if (value is Array valueArray) | ||
{ | ||
string values = ""; | ||
for (int i = 0; i < valueArray.Length; i++) | ||
{ | ||
if (i == 0) | ||
{ | ||
values = valueArray.GetValue(i).ToString(); | ||
continue; | ||
} | ||
values = values + ", " + valueArray.GetValue(i).ToString(); | ||
} | ||
FikaPlugin.Instance.FikaLogger.LogInfo(field.Name + ": " + values); | ||
continue; | ||
} | ||
FikaPlugin.Instance.FikaLogger.LogInfo(field.Name + ": " + value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.