public void Add(T result) { if (!_results.Contains(result)) { _results.Add(result); } }
public void CheckNestedTypes( ) { string xml = String.Format( @"<?xml version='1.0'?>" + @"<Obfuscator>" + @"<Var name='InPath' value='{0}' />" + @"<Var name='OutPath' value='{1}' />" + @"<Module file='$(InPath)\AssemblyWithNestedTypes.dll'>" + @"<SkipType name='TestClasses.ClassA/NestedClassA' />" + @"</Module>" + @"</Obfuscator>", TestHelper.InputPath, TestHelper.OutputPath ); TestHelper.BuildAndObfuscate( "AssemblyWithNestedTypes", string.Empty, xml ); C5.HashSet<string> typesToFind = new C5.HashSet<string>( ); typesToFind.Add( "A.A" ); typesToFind.Add( "A.A/a" ); typesToFind.Add( "A.A/NestedClassA" ); AssemblyHelper.CheckAssembly( "AssemblyWithNestedTypes", 3, delegate( TypeDefinition typeDef ) { return true; }, delegate( TypeDefinition typeDef ) { Assert.IsTrue( typesToFind.Contains( typeDef.ToString( ) ), "Type {0} not expected.", typeDef.ToString( ) ); typesToFind.Remove( typeDef.ToString( ) ); } ); Assert.IsTrue( typesToFind.Count == 0, "Not all types found." ); }
public void CheckNestedTypes() { string xml = String.Format( @"<?xml version='1.0'?>" + @"<Obfuscator>" + @"<Var name='InPath' value='{0}' />" + @"<Var name='OutPath' value='{1}' />" + @"<Module file='$(InPath)\AssemblyWithNestedTypes.dll'>" + @"<SkipType name='TestClasses.ClassA/NestedClassA' />" + @"</Module>" + @"</Obfuscator>", TestHelper.InputPath, TestHelper.OutputPath); TestHelper.BuildAndObfuscate("AssemblyWithNestedTypes", string.Empty, xml); C5.HashSet <string> typesToFind = new C5.HashSet <string> (); typesToFind.Add("A.A"); typesToFind.Add("A.A/a"); typesToFind.Add("A.A/NestedClassA"); AssemblyHelper.CheckAssembly("AssemblyWithNestedTypes", 1, delegate(TypeDefinition typeDef) { return(true); }, delegate(TypeDefinition typeDef) { Assert.IsTrue(typesToFind.Contains(typeDef.ToString()), "Type {0} not expected.", typeDef.ToString()); typesToFind.Remove(typeDef.ToString()); }); Assert.IsTrue(typesToFind.Count == 0, "Not all types found."); }
public void UnseqequalityComparerViaBuilder2() { SCG.IEqualityComparer <C5.HashSet <int> > h = EqualityComparer <C5.HashSet <int> > .Default; C5.HashSet <int> s = new C5.HashSet <int>(); s.Add(1); s.Add(2); s.Add(3); Assert.AreEqual(CHC.unsequencedhashcode(1, 2, 3), h.GetHashCode(s)); }
internal void AddPrimSync(PhysxPrim prim, bool physical, bool kinematicStatic) { _allPrims.Add(prim); if (physical) { _dynPrims.Add(prim); } if (kinematicStatic) { _kinematicManager.KinematicChanged(prim); } }
// sets connection two ways, node <-> node public void setAccessibility(Nav2dNode[] nodes, int layerMask) { foreach (var neighbor in nodes) { //if input neighbor empty or neightbor already set SKIP if (neighbor == null || neighbors.Contains(neighbor)) { continue; } var hit = Physics2D.Raycast(worldPos, (neighbor.worldPos - worldPos), (neighbor.worldPos - worldPos).magnitude, layerMask); if (hit.collider == null) { walkableConnectionNum++; neighbor.walkableConnectionNum++; neighbor.zone = this.zone; // add the neighbor to the list neighbors.Add(neighbor); // add this node to the neightbor neighbor.neighbors.Add(this); } } this.accessible = walkableConnectionNum >= 1; }
/// <summary> /// Adds a triangle to the mesh using absolute vertices /// </summary> /// <param name="v1"></param> /// <param name="v2"></param> /// <param name="v3"></param> public void Add(Vertex v1, Vertex v2, Vertex v3) { //do not include any triangles that have been smashed into lines if (v1.Equals(v2) || v2.Equals(v3) || v1.Equals(v3)) { return; } // If a vertex of the triangle is not yet in the vertices list, // add it and set its index to the current index count if (!m_vertices.ContainsKey(v1)) { m_vertices[v1] = m_vertices.Count; } if (!m_vertices.ContainsKey(v2)) { m_vertices[v2] = m_vertices.Count; } if (!m_vertices.ContainsKey(v3)) { m_vertices[v3] = m_vertices.Count; } //do not include any triangles we already have if (!_triIndex.Add(new IndexedTriangle(m_vertices[v1], m_vertices[v2], m_vertices[v3]))) { return; } _meshData.AddTriangle(v1, v2, v3); }
public static void PopulateCollections25_25_50PctUnique(int maxN, out int[] uniqueArray, out int[] mixedArray, SCG.HashSet <int> h, FastHashSet <int> f = null, C5.HashSet <int> c5 = null, SCG.SortedSet <int> sortedSet = null, SCG.List <int> lst = null) { uniqueArray = new int[maxN]; mixedArray = new int[maxN]; Random rand = new Random(89); BenchUtil.PopulateIntArray(uniqueArray, rand, int.MinValue, int.MaxValue, 1.0); // a array should have 100% unique values int uniqueValuesCount = maxN / 2; // this should produce a c array that has 50% unique values (the other 50% are duplicates), but all are actually in the uniqueArray, so 1, 1, 2, 2 would be an example of this if (uniqueValuesCount == 0) { uniqueValuesCount = 1; } BenchUtil.PopulateIntArrayFromUniqueArray(mixedArray, rand, uniqueArray, uniqueValuesCount); BenchUtil.PopulateIntArrayAtRandomIndices(mixedArray, rand, int.MinValue, int.MaxValue, maxN - uniqueValuesCount); if (h != null) { for (int i = 0; i < maxN; i++) { h.Add(uniqueArray[i]); } } if (f != null) { for (int i = 0; i < maxN; i++) { f.Add(uniqueArray[i]); } } if (c5 != null) { for (int i = 0; i < maxN; i++) { c5.Add(uniqueArray[i]); } } if (sortedSet != null) { for (int i = 0; i < maxN; i++) { sortedSet.Add(uniqueArray[i]); } } if (lst != null) { for (int i = 0; i < maxN; i++) { lst.Add(uniqueArray[i]); } lst.Sort(); } }
IEnumerable <MemberReference> getMemberReferences() { C5.HashSet <MemberReference> memberreferences = new C5.HashSet <MemberReference>(); foreach (TypeDefinition type in this.GetAllTypeDefinitions()) { foreach (MethodDefinition method in type.Methods) { if (method.Body != null) { foreach (Instruction inst in method.Body.Instructions) { MemberReference memberref = inst.Operand as MemberReference; if (memberref != null) { if (memberref is MethodReference && !(memberref is MethodDefinition || memberref is MethodSpecification || memberref is CallSite) || memberref is FieldReference && !(memberref is FieldDefinition)) { int c = memberreferences.Count; memberreferences.Add(memberref); } } } } } } return(memberreferences); }
public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId, bool storeAssets, IEnumerable <UUID> allowedCreatorIds) : this(scene, savePath, requestId, storeAssets) { foreach (UUID creatorId in allowedCreatorIds) { m_allowedCreatorIds.Add(creatorId); } }
public static IEnumerable <IPathNode <N> > GetReachableNodes <N>(N start, float maxCost) where N : INode <N> { C5.IDictionary <N, PathNode <N> > nodeDictionary = new C5.HashDictionary <N, PathNode <N> >(); C5.IPriorityQueue <PathNode <N> > openSet = new C5.IntervalHeap <PathNode <N> >(new PathNodeComparer <N>(), C5.MemoryType.Normal); C5.ICollection <N> closedSet = new C5.HashSet <N>(); C5.ArrayList <IPathNode <N> > res = new C5.ArrayList <IPathNode <N> >(C5.MemoryType.Normal); PathNode <N> curNode = new PathNode <N>(start); curNode.g = 0; nodeDictionary.Add(start, curNode); while (true) { res.Add(curNode); foreach (IEdge <N> edge in curNode.node) { N other = edge.GetEnd(); if (!closedSet.Contains(other)) { PathNode <N> otherNode = null; if (!nodeDictionary.Find(ref other, out otherNode)) { otherNode = new PathNode <N>(other); nodeDictionary.Add(other, otherNode); } float newG = edge.GetCost() + curNode.g; if (otherNode.g > newG) { otherNode.g = newG; if (otherNode.queueHandle != null) { openSet.Replace(otherNode.queueHandle, otherNode); } otherNode.prev = curNode; } if (otherNode.queueHandle == null) { C5.IPriorityQueueHandle <PathNode <N> > handle = null; openSet.Add(ref handle, otherNode); otherNode.queueHandle = handle; } } } if (openSet.IsEmpty) { return(res); } closedSet.Add(curNode.node); curNode = openSet.DeleteMin(); if (curNode.g > maxCost) { return(res); } } }
public void Enqueue(SceneObjectPart part) { lock (m_syncObject) { if (!m_ids.Contains(part.LocalId)) { m_ids.Add(part.LocalId); m_queue.Enqueue(part); } } }
void GetBaseTypes(C5.HashSet <TypeKey> baseTypes, TypeDefinition type) { // check the interfaces foreach (TypeReference ifaceRef in type.Interfaces) { TypeDefinition iface = project.GetTypeDefinition(ifaceRef); if (iface != null) { GetBaseTypes(baseTypes, iface); baseTypes.Add(new TypeKey(iface)); } } // check the base type unless it isn't in the project, or we don't have one TypeDefinition baseType = project.GetTypeDefinition(type.BaseType); if (baseType != null && baseType.FullName != "System.Object") { GetBaseTypes(baseTypes, baseType); baseTypes.Add(new TypeKey(baseType)); } }
public void AddEntry() { if (_functionNames.Contains(id)) { return; } functions.Add(this.MakeSig()); _functionNames.Add(id); type = null; id = null; parmTypes.Clear(); parmNames.Clear(); }
/// <summary> /// Subscribe to receive notification when the transaction ends. /// </summary> /// <param name="subscriber"> /// The subscriber to be notified when the transaction ends. /// </param> /// <remarks> /// The subscription is OK to handle large number of subscribers. /// </remarks> public void Subscribe(ITransactionNotification subscriber) { Check.DoRequireArgumentNotNull(subscriber, "subscriber"); Check.DoCheckOperationValid(IsActive, "Transaction is not active"); EnsureSubscribedToMaster(); lock (_watchers) { if (!_watchers.Contains(subscriber)) { _watchers.Add(subscriber); } } }
public IInventoryStorage GetProvider(UUID userId) { if (!_migrationActive) { return(_cassandraStorage); } lock (_migratedUsers) { if (_migratedUsers.Contains(userId)) { return(_cassandraStorage); } } //nothing in our cache, we need to consult the database MigrationStatus status = _migrationStatusChecker.GetUserMigrationStatus(userId); if (status == MigrationStatus.Migrated) { lock (_migratedUsers) { _migratedUsers.Add(userId); } return(_cassandraStorage); } else if (status == MigrationStatus.InProgress) { throw new InventoryStorageException("Inventory can not be used while a migration is in progress"); } else { return(_legacyStorage); } }
private void CollectCreatedAssetIdsFromUserInventory(UUID creatorId, C5.HashSet <UUID> retAssets) { IInventoryProviderSelector selector = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); IInventoryStorage provider = selector.GetProvider(creatorId); List <InventoryFolderBase> skel = provider.GetInventorySkeleton(creatorId); foreach (InventoryFolderBase folder in skel) { InventoryFolderBase fullFolder = provider.GetFolder(folder.ID); foreach (InventoryItemBase item in fullFolder.Items) { if (m_allowedCreatorIds.Contains(item.CreatorIdAsUuid)) { retAssets.Add(item.AssetID); } } } }
public bool TryEnqueue(uint ack) { lock (m_hashSet) { if (m_hashSet.Add(ack)) { m_items[m_next] = ack; m_next = (m_next + 1) % m_capacity; if (m_next == m_first) { m_hashSet.Remove(m_items[m_first]); m_first = (m_first + 1) % m_capacity; } return(true); } } return(false); }
public void Add(string name) { names.Add(name); }
public static IEnumerable <IPathNode <N> > GetShortestPath <N>(N start, N goal, IHeuristic <N> heuristic) where N : INode <N> { C5.IDictionary <N, PathNode <N> > nodeDictionary = new C5.HashDictionary <N, PathNode <N> >(); C5.IPriorityQueue <PathNode <N> > openSet = new C5.IntervalHeap <PathNode <N> >(new PathNodeComparer <N>()); C5.ICollection <N> closedSet = new C5.HashSet <N>(); PathNode <N> curNode = new PathNode <N>(start); curNode.g = 0; nodeDictionary.Add(start, curNode); while (true) { foreach (IEdge <N> edge in curNode.Node) { N other = edge.GetEnd(); if (!closedSet.Contains(other)) { PathNode <N> otherNode = null; if (!nodeDictionary.Find(ref other, out otherNode)) { otherNode = new PathNode <N>(other); nodeDictionary.Add(other, otherNode); } float newG = edge.GetCost() + curNode.g; if (otherNode.g > newG) { otherNode.g = newG; if (otherNode.queueHandle != null) { openSet.Replace(otherNode.queueHandle, otherNode); } otherNode.prev = curNode; } if (otherNode.queueHandle == null) { otherNode.h = heuristic.MinDist(other, goal); C5.IPriorityQueueHandle <PathNode <N> > handle = null; openSet.Add(ref handle, otherNode); otherNode.queueHandle = handle; } } } if (openSet.IsEmpty) { return(null); } closedSet.Add(curNode.Node); curNode = openSet.DeleteMin(); if (curNode.Node.Equals(goal)) { C5.ArrayList <IPathNode <N> > res = new C5.ArrayList <IPathNode <N> >(); do { res.Add(curNode); curNode = curNode.prev; } while (curNode != null); res.Reverse(); return(res); } } }
static void Main(string[] args) { // cmd line params variables string dbConnStr = null; int runID = 0; int benchmarkMethodID = 0; int n; int maxN; try { DateTime startTime = DateTime.Now; //Console.WriteLine($"Args Count:" + args.Length.ToString()); //foreach (string s in args) //{ // Console.WriteLine(s); //} //Console.ReadKey(); string errMsg = PerfUtil.GetCmdLineParams_DbNAndMaxN(args, out dbConnStr, out runID, out benchmarkMethodID, out n, out maxN); //if (errMsg != null) //{ // Console.WriteLine(errMsg); //} //Console.WriteLine($"Args: {dbConnStr}; {runID.ToString()}; {benchmarkMethodID.ToString()}; {n.ToString()}; {maxN.ToString()}"); //Console.ReadKey(); int[] a; int[] c; C5.HashSet<int> set = new C5.HashSet<int>(); BenchUtil.PopulateArrays25_25_50PctUnique(maxN, out a, out c); // in a real world scenario, we will have probably have recently added the items into the set, so no need to try to clear the cache or anything for (int i = 0; i < maxN; i++) { set.Add(a[i]); } double overheadNanoSecs = PerfUtil.GetTimestampOverheadInNanoSeconds(); PerfUtil.DoGCCollect(); int iterations = 1; long startTicks; long endTicks; double ticks; // this is enough to jit things and not put everything in the cache bool isContained = set.Contains(0); if (maxN <= 1000) { iterations = 1; // there amount of time taken for these is too small to measure just one iteration - so we measure multiple iterations in a loop and get the time for these // the mean time is this total time / iterations startTicks = Stopwatch.GetTimestamp(); for (int i = 0; i < maxN; i++) { set.Contains(c[i]); } endTicks = Stopwatch.GetTimestamp(); ticks = ((endTicks - startTicks) * n) / (double)maxN; } else { iterations = 1; startTicks = Stopwatch.GetTimestamp(); for (int i = 0; i < n; i++) // loop overhead is ok because we assume there will be some loop in real-world scenario { set.Contains(c[i]); } endTicks = Stopwatch.GetTimestamp(); ticks = (double)(endTicks - startTicks); } double nanoSecs = PerfUtil.GetNanoSecondsFromTicks(ticks, Stopwatch.Frequency) - overheadNanoSecs; PerfDb.InsertMeasurement(dbConnStr, runID, benchmarkMethodID, n, iterations, nanoSecs, startTime, DateTime.Now); } catch (Exception ex) { Console.Write(ex.ToString()); if (!string.IsNullOrEmpty(dbConnStr)) { // write error to db PerfDb.InsertRunError(dbConnStr, runID, benchmarkMethodID, ex); } else { // log error to file } } }
/// <summary> /// Called by project to finish initializing the assembly. /// </summary> internal void Init() { unrenamedReferences = new List<MemberReference>(); foreach (MemberReference member in getMemberReferences()) { MethodReference mr = member as MethodReference; FieldReference fr = member as FieldReference; if (project.Contains(member.DeclaringType)) unrenamedReferences.Add(member); } C5.HashSet<TypeReference> typerefs = new C5.HashSet<TypeReference>(); foreach (TypeReference type in definition.MainModule.GetTypeReferences()) { if (type.FullName == "<Module>") continue; if (project.Contains(type)) typerefs.Add(type); } // Type references in CustomAttributes List<CustomAttribute> customattributes = new List<CustomAttribute>(); customattributes.AddRange(this.Definition.CustomAttributes); foreach (TypeDefinition type in GetAllTypeDefinitions()) { customattributes.AddRange(type.CustomAttributes); foreach (MethodDefinition methoddef in type.Methods) customattributes.AddRange(methoddef.CustomAttributes); foreach (FieldDefinition fielddef in type.Fields) customattributes.AddRange(fielddef.CustomAttributes); foreach (EventDefinition eventdef in type.Events) customattributes.AddRange(eventdef.CustomAttributes); foreach (PropertyDefinition propertydef in type.Properties) customattributes.AddRange(propertydef.CustomAttributes); foreach (CustomAttribute customattribute in customattributes) { // Check Constructor and named parameter for argument of type "System.Type". i.e. typeof() List<CustomAttributeArgument> customattributearguments = new List<CustomAttributeArgument>(); customattributearguments.AddRange(customattribute.ConstructorArguments); foreach (CustomAttributeNamedArgument namedargument in customattribute.Properties) customattributearguments.Add(namedargument.Argument); foreach (CustomAttributeArgument ca in customattributearguments) { if (ca.Type.FullName == "System.Type") typerefs.Add((TypeReference)ca.Value); } } customattributes.Clear(); } unrenamedTypeReferences = new List<TypeReference>(typerefs); initialized = true; }
protected void CheckEvents(string name, int expectedTypes, string[] expected, string[] notExpected) { C5.HashSet <string> eventsToFind = new C5.HashSet <string>( ); eventsToFind.AddAll(expected); C5.HashSet <string> eventsNotToFind = new C5.HashSet <string>( ); eventsNotToFind.AddAll(notExpected); C5.HashSet <string> methodsToFind = new C5.HashSet <string>( ); for (int i = 0; i < expected.Length; i++) { methodsToFind.Add("add_" + expected[i]); methodsToFind.Add("remove_" + expected[i]); } C5.HashSet <string> methodsNotToFind = new C5.HashSet <string>( ); for (int i = 0; i < notExpected.Length; i++) { methodsNotToFind.Add("add_" + notExpected[i]); methodsNotToFind.Add("remove_" + notExpected[i]); } bool foundDelType = false; AssemblyHelper.CheckAssembly(name, expectedTypes, delegate(TypeDefinition typeDef) { if (typeDef.BaseType.FullName == "System.MulticastDelegate") { foundDelType = true; return(false); } else { return(true); } }, delegate(TypeDefinition typeDef) { // make sure we have enough methods... // 2 methods / event + a method to fire them Assert.AreEqual(methodsToFind.Count + methodsNotToFind.Count + 1, typeDef.Methods.Count, "Some of the methods for the type are missing."); foreach (MethodDefinition method in typeDef.Methods) { Assert.IsFalse(methodsNotToFind.Contains(method.Name), String.Format( "Did not expect to find method '{0}'.", method.Name)); methodsToFind.Remove(method.Name); } Assert.AreEqual(expected.Length, typeDef.Events.Count, expected.Length == 1 ? "Type should have 1 event (others dropped by default)." : String.Format("Type should have {0} events (others dropped by default).", expected.Length)); foreach (EventDefinition evt in typeDef.Events) { Assert.IsFalse(eventsNotToFind.Contains(evt.Name), String.Format( "Did not expect to find event '{0}'.", evt.Name)); eventsToFind.Remove(evt.Name); } Assert.IsFalse(methodsToFind.Count > 0, "Failed to find all expected methods."); Assert.IsFalse(eventsToFind.Count > 0, "Failed to find all expected events."); }); Assert.IsTrue(foundDelType, "Should have found the delegate type."); }
IEnumerable<MemberReference> getMemberReferences() { C5.HashSet<MemberReference> memberreferences = new C5.HashSet<MemberReference>(); foreach (TypeDefinition type in this.GetAllTypeDefinitions()) { foreach (MethodDefinition method in type.Methods) { if (method.Body != null) { foreach (Instruction inst in method.Body.Instructions) { MemberReference memberref = inst.Operand as MemberReference; if (memberref != null) { if (memberref is MethodReference && !(memberref is MethodDefinition || memberref is MethodSpecification || memberref is CallSite) || memberref is FieldReference && !(memberref is FieldDefinition)) { int c = memberreferences.Count; memberreferences.Add(memberref); } } } } } } return memberreferences; }
protected internal void DelinkObjects(IClientAPI remoteClient, List<uint> primIds, bool sendEvents) { List<SceneObjectPart> childParts = new List<SceneObjectPart>(); List<SceneObjectPart> rootParts = new List<SceneObjectPart>(); List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); C5.HashSet<uint> allAffectedIds = new C5.HashSet<uint>(); lock (m_dictionary_lock) { // Look them all up in one go, since that is comparatively expensive // foreach (uint primID in primIds) { SceneObjectPart part = this.GetSceneObjectPart(primID); if (part != null) { if (!m_parentScene.Permissions.CanEditObject(part.ParentGroup.RootPart.UUID, remoteClient.AgentId)) continue; if ((part.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Modify) != (uint)PermissionMask.Modify) continue; if (part.LinkNum < 2) // Root or single rootParts.Add(part); else childParts.Add(part); SceneObjectGroup group = part.ParentGroup; if (!affectedGroups.Contains(group)) affectedGroups.Add(group); allAffectedIds.Add(part.LocalId); allAffectedIds.Add(group.LocalId); } else { m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID); } } } using (SceneTransaction transaction = _transactionMgr.BeginTransaction(allAffectedIds)) { foreach (SceneObjectPart child in childParts) { // Unlink all child parts from their groups // child.ParentGroup.DelinkFromGroup(child, sendEvents, false); } foreach (SceneObjectPart root in rootParts) { // In most cases, this will run only one time, and the prim // will be a solo prim // However, editing linked parts and unlinking may be different // SceneObjectGroup group = root.ParentGroup; List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Children.Values); int numChildren = group.Children.Count; // If there are prims left in a link set, but the root is // slated for unlink, we need to do this // if (numChildren != 1) { // Unlink the remaining set // bool sendEventsToRemainder = true; if (numChildren > 1) sendEventsToRemainder = false; foreach (SceneObjectPart p in newSet) { if (p != group.RootPart) group.DelinkFromGroup(p, sendEventsToRemainder, false); } // If there is more than one prim remaining, we // need to re-link // if (numChildren > 2) { // Remove old root // if (newSet.Contains(root)) newSet.Remove(root); // Preserve link ordering // newSet.Sort(delegate(SceneObjectPart a, SceneObjectPart b) { return a.LinkNum.CompareTo(b.LinkNum); }); // Determine new root // SceneObjectPart newRoot = newSet[0]; newSet.RemoveAt(0); List<uint> linkIDs = new List<uint>(); foreach (SceneObjectPart newChild in newSet) { linkIDs.Add(newChild.LocalId); } LinkObjects(remoteClient, newRoot.LocalId, linkIDs); if (!affectedGroups.Contains(newRoot.ParentGroup)) affectedGroups.Add(newRoot.ParentGroup); } } } // Finally, trigger events in the roots // foreach (SceneObjectGroup g in affectedGroups) { g.TriggerScriptChangedEvent(Changed.LINK); g.ScheduleGroupForFullUpdate(); } //m_log.DebugFormat("Delink finished for {0} prims", primIds.Count); } }
public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 size, bool isFlying, OpenMetaverse.Vector3 initialVelocity) { BasicActor act = new BasicActor(this, size.Z, size.X, position, rotation, isFlying, initialVelocity); _actors.Add(act); return act; }
public void C5_HashSet() => c5_hashset.Add(1);
public void PrimWantsCollisionRepeat(PhysxPrim prim) { _collisionRepeatPrims.Add(prim); }
protected void CheckEvents( string name, int expectedTypes, string[] expected, string[] notExpected ) { C5.HashSet<string> eventsToFind = new C5.HashSet<string>( ); eventsToFind.AddAll( expected ); C5.HashSet<string> eventsNotToFind = new C5.HashSet<string>( ); eventsNotToFind.AddAll( notExpected ); C5.HashSet<string> methodsToFind = new C5.HashSet<string>( ); for ( int i = 0; i < expected.Length; i++ ) { methodsToFind.Add( "add_" + expected[i] ); methodsToFind.Add( "remove_" + expected[i] ); } C5.HashSet<string> methodsNotToFind = new C5.HashSet<string>( ); for ( int i = 0; i < notExpected.Length; i++ ) { methodsNotToFind.Add( "add_" + notExpected[i] ); methodsNotToFind.Add( "remove_" + notExpected[i] ); } bool foundDelType = false; AssemblyHelper.CheckAssembly( name, expectedTypes, delegate( TypeDefinition typeDef ) { if ( typeDef.BaseType.FullName == "System.MulticastDelegate" ) { foundDelType = true; return false; } else return true; }, delegate( TypeDefinition typeDef ) { // make sure we have enough methods... // 2 methods / event + a method to fire them Assert.AreEqual( methodsToFind.Count + methodsNotToFind.Count + 1, typeDef.Methods.Count, "Some of the methods for the type are missing." ); foreach ( MethodDefinition method in typeDef.Methods ) { Assert.IsFalse( methodsNotToFind.Contains( method.Name ), String.Format( "Did not expect to find method '{0}'.", method.Name ) ); methodsToFind.Remove( method.Name ); } Assert.AreEqual( expected.Length, typeDef.Events.Count, expected.Length == 1 ? "Type should have 1 event (others dropped by default)." : String.Format( "Type should have {0} events (others dropped by default).", expected.Length ) ); foreach ( EventDefinition evt in typeDef.Events ) { Assert.IsFalse( eventsNotToFind.Contains( evt.Name ), String.Format( "Did not expect to find event '{0}'.", evt.Name ) ); eventsToFind.Remove( evt.Name ); } Assert.IsFalse( methodsToFind.Count > 0, "Failed to find all expected methods." ); Assert.IsFalse( eventsToFind.Count > 0, "Failed to find all expected events." ); } ); Assert.IsTrue( foundDelType, "Should have found the delegate type." ); }
internal void AddCharacterSync(PhysxCharacter newChar) { _charActors.Add(newChar); }
/// <summary> /// Called by project to finish initializing the assembly. /// </summary> internal void Init() { unrenamedReferences = new List <MemberReference>(); foreach (MemberReference member in getMemberReferences()) { MethodReference mr = member as MethodReference; FieldReference fr = member as FieldReference; if (project.Contains(member.DeclaringType)) { unrenamedReferences.Add(member); } } C5.HashSet <TypeReference> typerefs = new C5.HashSet <TypeReference>(); foreach (TypeReference type in definition.MainModule.GetTypeReferences()) { if (type.FullName == "<Module>") { continue; } if (project.Contains(type)) { typerefs.Add(type); } } // Type references in CustomAttributes List <CustomAttribute> customattributes = new List <CustomAttribute>(); customattributes.AddRange(this.Definition.CustomAttributes); foreach (TypeDefinition type in GetAllTypeDefinitions()) { customattributes.AddRange(type.CustomAttributes); foreach (MethodDefinition methoddef in type.Methods) { customattributes.AddRange(methoddef.CustomAttributes); } foreach (FieldDefinition fielddef in type.Fields) { customattributes.AddRange(fielddef.CustomAttributes); } foreach (EventDefinition eventdef in type.Events) { customattributes.AddRange(eventdef.CustomAttributes); } foreach (PropertyDefinition propertydef in type.Properties) { customattributes.AddRange(propertydef.CustomAttributes); } foreach (CustomAttribute customattribute in customattributes) { // Check Constructor and named parameter for argument of type "System.Type". i.e. typeof() List <CustomAttributeArgument> customattributearguments = new List <CustomAttributeArgument>(); customattributearguments.AddRange(customattribute.ConstructorArguments); foreach (CustomAttributeNamedArgument namedargument in customattribute.Properties) { customattributearguments.Add(namedargument.Argument); } foreach (CustomAttributeArgument ca in customattributearguments) { if (ca.Type.FullName == "System.Type") { typerefs.Add((TypeReference)ca.Value); } } } customattributes.Clear(); } unrenamedTypeReferences = new List <TypeReference>(typerefs); initialized = true; }