Exemplo n.º 1
0
        /// <summary>
        /// Gets the object associated with a given marker of annotation
        /// </summary>
        /// <param name="vertex">The vertex</param>
        /// <param name="marker">The symbolic marker</param>
        /// <returns>The object that was associated with a given annotation</returns>
        public virtual object GetAnnotation(object vertex, int marker)
        {
            foreach (Pair <int, object> p in annotations.GetValues(vertex))
            {
                if (p.Object1 == marker)
                {
                    return(p.Object2);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        private void OnHostName(IPAddress remoteAddress, string hostName, NameSources source, int processId = 0)
        {
            CloneableList <HostObserveJob> Jobs = ObserverJobs.GetValues(remoteAddress, false);

            if (Jobs == null)
            {
                return;
            }

            foreach (HostObserveJob curJob in Jobs.Clone())
            {
                if (processId == 0 || curJob.processId == processId)
                {
                    if (hostName != null)
                    {
                        curJob.SetHostName(hostName, source);
                    }
                    curJob.Await &= ~source; // clear the await
                }

                if (!curJob.IsValid())
                {
                    ObserverJobs.Remove(remoteAddress, curJob);
                }
            }
        }
Exemplo n.º 3
0
    protected override IEnumerable <Node> GetChildren(Node node)
    {
        BGoapNode goapNode = (node as AStarDebugNode).content as BGoapNode;

        if (childLists.ContainsKey(goapNode))
        {
            foreach (var BGoapNode in childLists.GetValues(goapNode, true))
            {
                yield return(new AStarDebugNode(BGoapNode, goal));
            }
        }
    }
Exemplo n.º 4
0
        private bool ExecutedCore(string name, object value = null) {
            value = value ?? typeof(object);
            var keyValuePair = new KeyValuePair<string, ApplicationModulesManager>(name, ModuleManager);
            if (CallMonitor.ContainsKey(keyValuePair)) {
                if (!CallMonitor.GetValues(keyValuePair, true).Contains(value)) {
                    CallMonitor.Add(keyValuePair, value);
                    return false;
                }
                return true;
            }
            CallMonitor.Add(keyValuePair, value);

            return false;
        }
Exemplo n.º 5
0
 /// <summary>
 /// At end of update dictionary needs to be erased.(?)
 /// </summary>
 /// <param name="gameTime"></param>
 public void update(GameTime gameTime)
 {
     // Go through each collision
     foreach (Tangible key in collisions.Keys)
     {
         foreach (Tangible value in collisions.GetValues(key, false))
         {
             //System.Console.WriteLine("Resolving collision " + key.GetType().Name + " with " + value.GetType().Name + " at " + gameTime.TotalGameTime.TotalMilliseconds);
             key.collide(value, gameTime);
         }
     }
     //System.Console.WriteLine("Before collisions.Count " + collisions.Count);
     collisions.Clear();
     //System.Console.WriteLine("After collisions.Count " + collisions.Count);
 }
Exemplo n.º 6
0
        public List <SecretStashItemInfo> GetSecretStashItems()
        {
            var player = Player.m_localPlayer;

            if (player == null || AdventureDataManager.Config == null)
            {
                return(new List <SecretStashItemInfo>());
            }

            var random  = GetRandom();
            var results = new List <SecretStashItemInfo>();

            var availableMaterialsList = CollectItems(AdventureDataManager.Config.SecretStash.Materials,
                                                      (x) => x.Item,
                                                      (x) => x.IsMagic() || x.IsMagicCraftingMaterial() || x.IsRunestone());
            var availableMaterials = new MultiValueDictionary <ItemRarity, SecretStashItemInfo>();

            availableMaterialsList.ForEach(x => availableMaterials.Add(x.Item.GetRarity(), x));

            // Roll N times on each rarity list
            foreach (ItemRarity section in Enum.GetValues(typeof(ItemRarity)))
            {
                var items = availableMaterials.GetValues(section, true).ToList();
                var rolls = AdventureDataManager.Config.SecretStash.RollsPerRarity[(int)section];
                RollOnListNTimes(random, items, rolls, results);
            }

            // Remove the results that the player doesn't know about yet
            results.RemoveAll(result =>
            {
                if (result.Item.IsMagicCraftingMaterial() || result.Item.IsRunestone())
                {
                    return(!player.m_knownMaterial.Contains(result.Item.m_shared.m_name));
                }
                return(false);
            });

            var availableRandomItems = CollectItems(AdventureDataManager.Config.SecretStash.RandomItems);

            RollOnListNTimes(random, availableRandomItems, AdventureDataManager.Config.SecretStash.RandomItemsCount, results);

            var availableOtherItems = CollectItems(AdventureDataManager.Config.SecretStash.OtherItems);

            results.AddRange(availableOtherItems);

            return(results);
        }
Exemplo n.º 7
0
        private NetworkSocket FindSocket(MultiValueDictionary <UInt64, NetworkSocket> List, int ProcessId, UInt32 ProtocolType, IPAddress LocalAddress, UInt16 LocalPort, IPAddress RemoteAddress, UInt16 RemotePort, NetworkSocket.MatchMode Mode)
        {
            UInt64 HashID = NetworkSocket.MkHash(ProcessId, ProtocolType, LocalAddress, LocalPort, RemoteAddress, RemotePort);

            List <NetworkSocket> Matches = List.GetValues(HashID, false);

            if (Matches != null)
            {
                foreach (NetworkSocket CurSocket in Matches)
                {
                    if (CurSocket.Match(ProcessId, ProtocolType, LocalAddress, LocalPort, RemoteAddress, RemotePort, Mode))
                    {
                        return(CurSocket);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 8
0
        private void OnHostName(int processId, IPAddress remoteAddress, string hostName)
        {
            CloneableList <HostObserveJob> Jobs = ObserverJobs.GetValues(remoteAddress, false);

            if (Jobs == null)
            {
                return;
            }
            foreach (HostObserveJob Job in Jobs.Clone())
            {
                if (Job.processId == processId)
                {
                    Job.SetHostName(hostName, NameSources.CapturedQuery);
                }
                else if (Job.IsValid())
                {
                    continue;
                }
                ObserverJobs.Remove(remoteAddress, Job);
            }
        }
Exemplo n.º 9
0
        private MyMethodInfo FindExactMethod(Address fullAddress)
        {
            var infos = MethodsByAddress.GetValues(fullAddress, false);

            if (infos == null)
            {
                return(null);
            }

            foreach (var info in infos)
            {
                if ((int)info.MethodInfo.Mode != (cs.db ? 32 : 16))
                {
                    continue;
                }

                if (Implementation.Memory.Equals(fullAddress, info.MethodInfo.RawBytes))
                {
                    return(info);
                }
            }

            return(null);
        }
Exemplo n.º 10
0
 public IEnumerable <IResource> LookupSignature(uint signature)
 {
     return(m_signature_map.GetValues(signature, true));
 }
Exemplo n.º 11
0
 public IEnumerable <IResource> LookupExtension(string ext)
 {
     return(m_extension_map.GetValues(ext.ToUpperInvariant(), true));
 }