internal void RemovePrim(PhysxPrim prim) { _dynPrims.Remove(prim); _allPrims.Remove(prim); _collisionRepeatPrims.Remove(prim); _kinematicManager.KinematicRemoved(prim); _delayedCommands.Remove(prim); prim.Dispose(); }
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." ); }
/// <summary> /// Unsubscribe from receiving notification when the transaction ends. /// </summary> /// <param name="subscriber"> /// The subscriber not to be notified when the transaction ends. /// </param> /// <returns> /// <see langword="true"/> the subscriber was successfully unsubscribed /// <see langword="false"/> the subscriber was not subscribed /// </returns> /// <remarks> /// The subscription is OK to handle large number of subscribers. /// </remarks> public bool Unsubscribe(ITransactionNotification subscriber) { lock (_watchers) { return(_watchers.Remove(subscriber)); } }
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 static void CheckAssembly(string name, int expectedTypes, string[] expectedMethods, string[] notExpectedMethods, Predicate <TypeDefinition> isType, Action <TypeDefinition> checkType) { C5.HashSet <string> methodsToFind = new C5.HashSet <string>( ); methodsToFind.AddAll(expectedMethods); C5.HashSet <string> methodsNotToFind = new C5.HashSet <string>( ); methodsNotToFind.AddAll(notExpectedMethods); CheckAssembly(name, expectedTypes, isType, delegate(TypeDefinition typeDef) { // make sure we have enough methods... Assert.AreEqual(expectedMethods.Length + notExpectedMethods.Length, 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); } if (checkType != null) { checkType(typeDef); } }); Assert.IsFalse(methodsToFind.Count > 0, "Failed to find all expected methods."); }
protected void CheckEnums(string name, int expectedTypes, string[] expected, string[] notExpected) { C5.HashSet <string> valsToFind = new C5.HashSet <string>( ); valsToFind.AddAll(expected); C5.HashSet <string> valsNotToFind = new C5.HashSet <string>( ); valsNotToFind.AddAll(notExpected); AssemblyHelper.CheckAssembly(name, expectedTypes, delegate(TypeDefinition typeDef) { return(typeDef.BaseType.FullName == "System.Enum"); }, delegate(TypeDefinition typeDef) { // num expected + num unexpected + field storage int totalValues = expected.Length + notExpected.Length + 1; Assert.AreEqual(totalValues, typeDef.Fields.Count, String.Format("Type should have {0} values.", totalValues)); foreach (FieldDefinition field in typeDef.Fields) { Assert.IsFalse(valsNotToFind.Contains(field.Name), String.Format( "Did not expect to find event '{0}'.", field.Name)); valsToFind.Remove(field.Name); } Assert.IsFalse(valsToFind.Count > 0, "Failed to find all expected values."); }); }
protected void CheckEnums( string name, int expectedTypes, string[] expected, string[] notExpected ) { C5.HashSet<string> valsToFind = new C5.HashSet<string>( ); valsToFind.AddAll( expected ); C5.HashSet<string> valsNotToFind = new C5.HashSet<string>( ); valsNotToFind.AddAll( notExpected ); AssemblyHelper.CheckAssembly( name, expectedTypes, delegate( TypeDefinition typeDef ) { return typeDef.BaseType.FullName == "System.Enum"; }, delegate( TypeDefinition typeDef ) { // num expected + num unexpected + field storage int totalValues = expected.Length + notExpected.Length + 1; Assert.AreEqual( totalValues, typeDef.Fields.Count, String.Format( "Type should have {0} values.", totalValues ) ); foreach ( FieldDefinition field in typeDef.Fields ) { Assert.IsFalse( valsNotToFind.Contains( field.Name ), String.Format( "Did not expect to find event '{0}'.", field.Name ) ); valsToFind.Remove( field.Name ); } Assert.IsFalse( valsToFind.Count > 0, "Failed to find all expected values." ); } ); }
public static void CheckAssembly( string name, int expectedTypes, string[] expectedMethods, string[] notExpectedMethods, Predicate<TypeDefinition> isType, Action<TypeDefinition> checkType ) { C5.HashSet<string> methodsToFind = new C5.HashSet<string>( ); methodsToFind.AddAll( expectedMethods ); C5.HashSet<string> methodsNotToFind = new C5.HashSet<string>( ); methodsNotToFind.AddAll( notExpectedMethods ); CheckAssembly( name, expectedTypes, isType, delegate( TypeDefinition typeDef ) { // make sure we have enough methods... Assert.AreEqual( expectedMethods.Length + notExpectedMethods.Length, 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 ); } if ( checkType != null ) checkType( typeDef ); } ); Assert.IsFalse( methodsToFind.Count > 0, "Failed to find all expected methods." ); }
public override void RemoveAvatar(PhysicsActor actor) { BasicActor act = (BasicActor)actor; if (_actors.Contains(act)) { _actors.Remove(act); } }
public SceneObjectPart Dequeue() { SceneObjectPart part = null; lock (m_syncObject) { if (m_queue.Count > 0) { part = m_queue.Dequeue(); m_ids.Remove(part.LocalId); } } return(part); }
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); }
protected void CheckProperties(string name, int expectedTypes, string[] expected, string[] notExpected) { C5.HashSet <string> propsToFind = new C5.HashSet <string> (); propsToFind.AddAll(expected); C5.HashSet <string> propsNotToFind = new C5.HashSet <string> (); propsNotToFind.AddAll(notExpected); string[] expectedMethods = new string[expected.Length * 2]; for (int i = 0; i < expected.Length; i++) { expectedMethods [i * 2 + 0] = "get_" + expected [i]; expectedMethods [i * 2 + 1] = "set_" + expected [i]; } string[] notExpectedMethods = new string[notExpected.Length * 2]; for (int i = 0; i < notExpected.Length; i++) { notExpectedMethods [i * 2 + 0] = "get_" + notExpected [i]; notExpectedMethods [i * 2 + 1] = "set_" + notExpected [i]; } AssemblyHelper.CheckAssembly(name, expectedTypes, expectedMethods, notExpectedMethods, delegate(TypeDefinition typeDef) { return(true); }, delegate(TypeDefinition typeDef) { Assert.AreEqual(expected.Length, typeDef.Properties.Count, expected.Length == 1 ? "Type should have 1 property (others dropped by default)." : String.Format("Type should have {0} properties (others dropped by default).", expected.Length)); foreach (PropertyDefinition prop in typeDef.Properties) { Assert.IsFalse(propsNotToFind.Contains(prop.Name), String.Format( "Did not expect to find property '{0}'.", prop.Name)); propsToFind.Remove(prop.Name); } Assert.IsFalse(propsToFind.Count > 0, "Failed to find all expected properties."); }); }
protected void CheckProperties( string name, int expectedTypes, string[] expected, string[] notExpected ) { C5.HashSet<string> propsToFind = new C5.HashSet<string>( ); propsToFind.AddAll( expected ); C5.HashSet<string> propsNotToFind = new C5.HashSet<string>( ); propsNotToFind.AddAll( notExpected ); string[] expectedMethods = new string[expected.Length * 2]; for ( int i = 0; i < expected.Length; i ++ ) { expectedMethods[i * 2 + 0] = "get_" + expected[i]; expectedMethods[i * 2 + 1] = "set_" + expected[i]; } string[] notExpectedMethods = new string[notExpected.Length * 2]; for ( int i = 0; i < notExpected.Length; i ++ ) { notExpectedMethods[i * 2 + 0] = "get_" + notExpected[i]; notExpectedMethods[i * 2 + 1] = "set_" + notExpected[i]; } AssemblyHelper.CheckAssembly( name, expectedTypes, expectedMethods, notExpectedMethods, delegate( TypeDefinition typeDef ) { return true; }, delegate( TypeDefinition typeDef ) { Assert.AreEqual( expected.Length, typeDef.Properties.Count, expected.Length == 1 ? "Type should have 1 property (others dropped by default)." : String.Format( "Type should have {0} properties (others dropped by default).", expected.Length ) ); foreach ( PropertyDefinition prop in typeDef.Properties ) { Assert.IsFalse( propsNotToFind.Contains( prop.Name ), String.Format( "Did not expect to find property '{0}'.", prop.Name ) ); propsToFind.Remove( prop.Name ); } Assert.IsFalse( propsToFind.Count > 0, "Failed to find all expected properties." ); } ); }
internal void RemoveCharacterSync(PhysxCharacter physxCharacter) { _charActors.Remove(physxCharacter); }
public void Remove(T result) { _results.Remove(result); }
internal void PrimMadeStaticKinematic(PhysxPrim actor) { _dynPrims.Remove(actor); _kinematicManager.KinematicChanged(actor); }
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." ); }
public void Remove(string name) { names.Remove(name); }
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."); }