Beispiel #1
0
 /// <summary>
 /// 构建代理数据
 /// </summary>
 /// <param name="isAutoCreate">是否自动创建代理</param>
 public AgentData(bool isAutoCreate)
 {
     if (isAutoCreate)
     {
         var type = GetType();
         _ref = new AgentRef(type, type.IsDefined(typeof(KeepAgentValueAttribute), false), this);
     }
     else
     {
         _ref = new AgentRef(null, false, null);
     }
     HotfixMgr.Instance.AddAgentRef(_ref);
     // 如果不为空 就创建
     if (_ref.type != null)
     {
         Task.Run(_ref.CreateAgent);
     }
 }
Beispiel #2
0
 internal void AddAgentRef(AgentRef agentRef)
 {
     lock (agentRefs) agentRefs.Add(new WeakReference <AgentRef>(agentRef));
 }