mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
1、修复了MongoDB在2.18.0以后需要自定义注册ObjectSerializer的问题。 2、Addressable的AddAddressable接口增加isLock参数、用来决定是否需要添加携程锁。 3、修复了APackInfo因为网络多线程的原因导致线程安全的问题。
1、修复了MongoDB在2.18.0以后需要自定义注册ObjectSerializer的问题。 2、Addressable的AddAddressable接口增加isLock参数、用来决定是否需要添加携程锁。 3、修复了APackInfo因为网络多线程的原因导致线程安全的问题。
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da9efac32374cb1a88c500e7ed43344
|
||||
timeCreated: 1691084274
|
@@ -0,0 +1,31 @@
|
||||
using ProtoBuf;
|
||||
|
||||
namespace TEngine.Core
|
||||
{
|
||||
[ProtoContract]
|
||||
public class IntDictionaryConfig
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public Dictionary<int, int> Dic;
|
||||
|
||||
public int this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out int value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : default;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34b41344fd6e462bae371207cdf8a5cd
|
||||
timeCreated: 1691084286
|
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace TEngine.Core
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed class StringDictionaryConfig
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public Dictionary<int, string> Dic;
|
||||
|
||||
public string this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out string value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private string GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : default;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a26ad73832de4b3e986ddb58426bcced
|
||||
timeCreated: 1691084294
|
@@ -735,6 +735,34 @@ public sealed class ExcelExporter
|
||||
|
||||
return;
|
||||
}
|
||||
case "IntDictionaryConfig":
|
||||
{
|
||||
if (value.Trim() == "" || value.Trim() == "{}")
|
||||
{
|
||||
propertyInfo.SetValue(config, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var attr = new IntDictionaryConfig {Dic = JsonConvert.DeserializeObject<Dictionary<int, int>>(value)};
|
||||
|
||||
propertyInfo.SetValue(config, attr);
|
||||
|
||||
return;
|
||||
}
|
||||
case "StringDictionaryConfig":
|
||||
{
|
||||
if (value.Trim() == "" || value.Trim() == "{}")
|
||||
{
|
||||
propertyInfo.SetValue(config, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var attr = new StringDictionaryConfig {Dic = JsonConvert.DeserializeObject<Dictionary<int, string>>(value)};
|
||||
|
||||
propertyInfo.SetValue(config, attr);
|
||||
|
||||
return;
|
||||
}
|
||||
default:
|
||||
throw new NotSupportedException($"不支持此类型: {type}");
|
||||
}
|
||||
|
@@ -424,7 +424,9 @@ public sealed class ProtoBufExporter
|
||||
"int32[]" => "int[] { }",
|
||||
"int64[]" => "long[] { }",
|
||||
"int32" => "int",
|
||||
"uint32" => "uint",
|
||||
"int64" => "long",
|
||||
"uint64" => "ulong",
|
||||
_ => type
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user