using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace SmartNav.Graph; public sealed class NavGraph { [CompilerGenerated] private sealed class _003C_003Ec__DisplayClass11_0 { public NavEdge edge; internal bool _003CReplaceEdge_003Eb__0(NavEdge e) { int num = ((!_206D_200B_200F_202D_206A_206D_206E_202E_200C_202D_200B_206A_206D_200B_206B_200E_202B_202C_202C_202B_200F_206A_202A_202C_202C_200F_206D_202C_200F_206E_200B_200C_206B_202A_202A_206D_206C_200C_200B_206D_202E(e.ToNodeId, edge.ToNodeId)) ? 1864125654 : 1864125653); while (true) { int num2 = num; int num3 = 1864125655; int num4 = num2; switch ((num4 | num3) - (num4 & num3)) { case 0: goto IL_0056; case 2: return e.EdgeType == edge.EdgeType; case 1: return false; } continue; IL_0056: num = 1864125653; } } static bool _206D_200B_200F_202D_206A_206D_206E_202E_200C_202D_200B_206A_206D_200B_206B_200E_202B_202C_202C_202B_200F_206A_202A_202C_202C_200F_206D_202C_200F_206E_200B_200C_206B_202A_202A_206D_206C_200C_200B_206D_202E(string P_0, string P_1) { return P_0 == P_1; } } private readonly Dictionary _nodes = new Dictionary(); private readonly Dictionary> _adjacency = new Dictionary>(); private readonly Dictionary> _territoryIndex = new Dictionary>(); public IReadOnlyDictionary Nodes => _nodes; public IReadOnlyDictionary> Adjacency => _adjacency; public IReadOnlyDictionary> TerritoryIndex => _territoryIndex; public int NodeCount => _nodes.Count; public int EdgeCount { get { int num = 0; using Dictionary>.ValueCollection.Enumerator enumerator = _adjacency.Values.GetEnumerator(); int num2 = 165728447; while (true) { int num3 = num2; int num4 = 165728444; int num5 = num3; int num6 = num5 + num4; int num7 = num5 & num4; switch (num6 - (num7 + num7)) { case 3: num2 = (enumerator.MoveNext() ? 165728445 : 165728446); break; case 1: { List current = enumerator.Current; num += current.Count; num2 = 165728447; break; } case 0: num2 = 165728447; break; case 2: return num; } } } } public void AddNode(NavNode node) { bool num = !_nodes.ContainsKey(node.Id); _nodes[node.Id] = node; int num2 = ((!num) ? (-2079391440) : (-2079391437)); List value = default(List); while (true) { int num3 = num2; int num4 = -2079391439; int num5 = num3; switch ((num5 | num4) - (num5 & num4)) { case 0: num2 = -2079391437; break; case 4: value.Add(node.Id); num2 = -2079391440; break; case 3: value = new List(); _territoryIndex[node.TerritoryId] = value; num2 = -2079391435; break; case 2: _adjacency[node.Id] = new List(); num2 = (_territoryIndex.TryGetValue(node.TerritoryId, out value) ? (-2079391435) : (-2079391438)); break; case 1: return; } } } public void AddEdge(NavEdge edge) { List value; int num = (_adjacency.TryGetValue(edge.FromNodeId, out value) ? (-2081875728) : (-2081875725)); while (true) { int num2 = num; int num3 = -2081875726; int num4 = num2; switch ((num4 | num3) - (num4 & num3)) { case 0: num = -2081875725; break; case 2: value.Add(edge); return; case 1: value = new List(); _adjacency[edge.FromNodeId] = value; num = -2081875728; break; } } } public void ReplaceEdge(NavEdge edge) { List value; int num = (_adjacency.TryGetValue(edge.FromNodeId, out value) ? (-1414739437) : (-1414739440)); while (true) { int num2 = num; int num3 = -1414739438; int num4 = num2; switch ((num4 | num3) - (num4 & num3)) { case 1: value.RemoveAll(delegate(NavEdge e) { int num5 = ((!_003C_003Ec__DisplayClass11_0._206D_200B_200F_202D_206A_206D_206E_202E_200C_202D_200B_206A_206D_200B_206B_200E_202B_202C_202C_202B_200F_206A_202A_202C_202C_200F_206D_202C_200F_206E_200B_200C_206B_202A_202A_206D_206C_200C_200B_206D_202E(e.ToNodeId, edge.ToNodeId)) ? 1864125654 : 1864125653); while (true) { int num6 = num5; int num7 = 1864125655; int num8 = num6; switch ((num8 | num7) - (num8 & num7)) { case 0: goto IL_0056; case 2: return e.EdgeType == edge.EdgeType; case 1: return false; } continue; IL_0056: num5 = 1864125653; } }); value.Add(edge); return; case 2: value = new List(); _adjacency[edge.FromNodeId] = value; num = -1414739437; break; case 0: num = -1414739440; break; } } } public void RemoveEdges(string fromNodeId, Predicate predicate) { List value; int num = ((!_adjacency.TryGetValue(fromNodeId, out value)) ? 1405127907 : 1405127904); while (true) { int num2 = num; int num3 = 1405127906; int num4 = num2; int num5 = num4 + num3; int num6 = num4 & num3; switch (num5 - (num6 + num6)) { case 0: num = 1405127904; break; case 1: return; case 2: value.RemoveAll(predicate); num = 1405127907; break; } } } public NavNode? GetNode(string nodeId) { NavNode value; int num = (_nodes.TryGetValue(nodeId, out value) ? 640244294 : 640244295); while (true) { int num2 = num; int num3 = 640244294; int num4 = num2; int num5 = num4 + num3; int num6 = num4 & num3; switch (num5 - (num6 + num6)) { case 0: return value; case 1: return null; case 2: goto IL_0054; } continue; IL_0054: num = 640244295; } } public IReadOnlyList GetEdges(string nodeId) { List value; int num = (_adjacency.TryGetValue(nodeId, out value) ? 577743021 : 577743022); while (true) { int num2 = num; int num3 = 577743023; int num4 = num2; int num5 = num4 + num3; int num6 = num4 & num3; switch (num5 - (num6 + num6)) { case 2: return value; case 1: return new List(); case 0: goto IL_0058; } continue; IL_0058: num = 577743022; } } public IReadOnlyList GetNodesInTerritory(uint territoryId) { List value; int num = (_territoryIndex.TryGetValue(territoryId, out value) ? 111271957 : 111271958); while (true) { int num2 = num; int num3 = 111271959; int num4 = num2; switch ((num4 | num3) - (num4 & num3)) { case 0: goto IL_004e; case 1: return new List(); case 2: return value; } continue; IL_004e: num = 111271958; } } }