Ejemplo n.º 1
0
        private static void ChangeMapList(Map map)
        {
            try
            {
                switch (map.ChangeType)
                {
                case (int)ChangeMapType.新增:
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.修改:
                    MapList.RemoveAll(c => c.id == map.id);
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.除:
                    MapList.RemoveAll(c => c.id == map.id);
                    break;
                }
                LogHelper.Info($"服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.ToJson()}", false);
                LogHelper.Info($"【{map.name}】服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local_endpoint} --> {map.remote_endpoint}");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        static void ChangeMap(Map map)
        {
            if (MapList == null)
            {
                MapList = new List <Map>();
            }
            switch (map.ChangeType)
            {
            case (int)ChangeMapType.新增:
                MapList.Add(map);
                break;

            case (int)ChangeMapType.修改:
                var item = MapList.Find(c => c.id == map.id);
                if (item != null)
                {
                    item = map;
                }
                else
                {
                    MapList.Add(map);
                }
                break;

            case (int)ChangeMapType.除:
                MapList.RemoveAll(c => c.id == map.id);
                break;
            }
            HandleLog.WriteLine($"映射{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{JsonHelper.Instance.Serialize(map)}", false);
            HandleLog.WriteLine($"【{map.name}】映射{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local} --> {map.remote}");
        }
Ejemplo n.º 3
0
        static void ChangeMapList(Map map)
        {
            try
            {
                switch (map.ChangeType)
                {
                case (int)ChangeMapType.新增:
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.修改:
                    MapList.RemoveAll(c => c.id == map.id);
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.除:
                    MapList.RemoveAll(c => c.id == map.id);
                    break;
                }
                HandleLog.WriteLine($"服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{JsonHelper.Instance.Serialize(map)}", false);
                HandleLog.WriteLine($"【{map.name}】服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local_endpoint} --> {map.remote_endpoint}");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }