/// <summary> /// Searches for provided object in directory and resolves it to distinguished name. /// </summary> /// <param name="objectCls">The object class to search for.</param> /// <param name="returnValue">The format of the returned string.</param> /// <param name="objectName">The common name of the object to search for.</param> /// <param name="ldapDomain">The LDAP domain to search in.</param> /// <returns></returns> /// <remarks>http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C</remarks> public static string GetObjectDistinguishedName(ObjectClass objectCls, ReturnType returnValue, string objectName, string ldapDomain) { var distinguishedName = string.Empty; var connectionPrefix = string.Format("LDAP://{0}", ldapDomain); using (var entry = new DirectoryEntry(connectionPrefix)) { using (var mySearcher = new DirectorySearcher(entry)) { switch (objectCls) { case ObjectClass.User: mySearcher.Filter = string.Format("(&(objectClass=user)(|(cn={0})(sAMAccountName={0})))", objectName); break; case ObjectClass.Group: mySearcher.Filter = string.Format("(&(objectClass=group)(|(cn={0})(dn={0})))", objectName); break; case ObjectClass.Computer: mySearcher.Filter = string.Format("(&(objectClass=computer)(|(cn={0})(dn={0})))", objectName); break; } var result = mySearcher.FindOne(); if (result == null) { throw new NullReferenceException ("unable to locate the distinguishedName for the object " + objectName + " in the " + ldapDomain + " domain"); } var directoryObject = result.GetDirectoryEntry(); if (returnValue.Equals(ReturnType.DistinguishedName)) { distinguishedName = string.Format("LDAP://{0}", directoryObject.Properties ["distinguishedName"].Value); } if (returnValue.Equals(ReturnType.ObjectGuid)) { distinguishedName = directoryObject.Guid.ToString(); } } } return(distinguishedName); }
public static string GetObjectDistinguishedName(string objectName, ObjectClass objectCls = ObjectClass.user, ReturnType returnValue = ReturnType.distinguishedName) { DirectoryEntry directoryObject = GetObjectDirectoryEntry(objectName, objectCls, returnValue); string distinguishedName = String.Empty; if (returnValue.Equals(ReturnType.distinguishedName)) { distinguishedName = directoryObject.Properties["distinguishedName"].Value.ToString(); } if (returnValue.Equals(ReturnType.ObjectGUID)) { distinguishedName = directoryObject.Guid.ToString(); } return(distinguishedName); }
/// <summary> /// Compares <paramref name="obj"/> to this instance. /// </summary> /// <param name="obj"><see langword="object"/> to compare.</param> /// <returns>True if equal, false if not.</returns> public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } if (!base.Equals(obj)) { return(false); } InterLinqMethodInfo other = (InterLinqMethodInfo)obj; if (GenericArguments.Count != other.GenericArguments.Count) { return(false); } for (int i = 0; i < GenericArguments.Count; i++) { if (!GenericArguments[i].Equals(other.GenericArguments[i])) { return(false); } } return(ReturnType.Equals(other.ReturnType)); }
bool EqualSignature(CallIndirect other) { if (IsInstance != other.IsInstance) { return(false); } if (HasExplicitThis != other.HasExplicitThis) { return(false); } if (CallingConvention != other.CallingConvention) { return(false); } if (ParameterTypes.Length != other.ParameterTypes.Length) { return(false); } for (int i = 0; i < ParameterTypes.Length; i++) { if (!ParameterTypes[i].Equals(other.ParameterTypes[i])) { return(false); } } return(ReturnType.Equals(other.ReturnType)); }
public bool IsCompatibleWith(BasicSignature other) { return(CallingConvention == other.CallingConvention && ((ParameterTypes == null && other.ParameterTypes == null) || ParameterTypes.SequenceEqual(other.ParameterTypes)) && ReturnType.Equals(other.ReturnType)); }
ObjectFormulaTree IDerivationOperation.Derivation(ObjectFormulaTree tree, string s) { Double a = 0; double val = 0; bool zero = false; if (ReturnType.Equals(a)) { zero = true; if (s.Length == 1) { if (symbol is Char) { if (s[0] == (char)symbol) { val = 1; zero = false; } } } } if (zero) { return(ElementaryRealConstant.RealZero); } ElementaryRealConstant op = new ElementaryRealConstant(val); return(new ObjectFormulaTree(op, new List <ObjectFormulaTree>())); }
/// <summary> /// Builds an return message. /// </summary> /// <param name="type"></param> /// <param name="returnValue"></param> /// <param name="correlationId"></param> /// <returns></returns> private MethodResultMessage CreateMethodReturn(ReturnType type, object returnValue, string correlationId) { MethodResult methodResult = new MethodResult(); methodResult.Type = type; methodResult.Arg = returnValue; if (returnValue == null) { methodResult.ClassName = "null"; } else { if (!type.Equals(ReturnType.Exception)) { methodResult.ClassName = new LocalType(returnValue.GetType()).RemoteTypeFullName; } else { methodResult.ClassName = returnValue.GetType().ToString(); } } methodResult.MetaData = new Dictionary <string, string>(); return(MethodResultMessage.CreateInstance(methodResult, correlationId)); }
public bool Equals(Delegate other) { return (Name.Equals(other.Name) && Parameters.Equals(other.Parameters) && ReturnType.Equals(other.ReturnType)); }
public override bool Equals(object obj) { if (!(obj is FunctionSymbol symbol)) { return(false); } if (!Name.Equals(symbol.Name) || !ReturnType.Equals(symbol.ReturnType)) { return(false); } if (Parameters.Length != symbol.Parameters.Length) { return(false); } for (int index = 0; index < Parameters.Length; index++) { if (!Parameters[index].Equals(symbol.Parameters[index])) { return(false); } } return(true); }
public bool IsEquivalent(TaskInfo otherTaskInfo) { if (otherTaskInfo == null) { throw new ArgumentException("otherTaskInfo must not be null"); } if (Args.Length != otherTaskInfo.Args.Length) { return(false); } for (var i = 0; i < Args.Length; ++i) { if (!Args[i].Equals(otherTaskInfo.Args[i])) { return(false); } } return(string.Equals(AssemblyName, otherTaskInfo.AssemblyName, StringComparison.Ordinal) && string.Equals(TypeName, otherTaskInfo.TypeName, StringComparison.Ordinal) && string.Equals(MethodName, otherTaskInfo.MethodName, StringComparison.Ordinal) && ReturnType.Equals(otherTaskInfo.ReturnType)); }
public bool Equals(MethodDeclaration compareNode) { return (compareNode != null && ReturnType?.Equals(compareNode.ReturnType) != false && SemanticReturnType?.Equals(compareNode.SemanticReturnType) != false && base.Equals(compareNode)); }
// 傳入Domain User Account Name取得DN public static string GetObjectDistinguishedName(ObjectClass objectCls, ReturnType returnValue, string objectName, string ldapDomain) { string distinguishedName = string.Empty; string connectionPrefix = "LDAP://" + ldapDomain; DirectoryEntry entry = new DirectoryEntry(connectionPrefix); DirectorySearcher mySearcher = new DirectorySearcher(entry); switch (objectCls) { case ObjectClass.User: mySearcher.Filter = "(&(objectClass=user)(|(cn=" + objectName + ")(sAMAccountName=" + objectName + ")))"; break; case ObjectClass.Group: mySearcher.Filter = "(&(objectClass=group)(|(cn=" + objectName + ")(dn=" + objectName + ")))"; break; case ObjectClass.Computer: mySearcher.Filter = "(&(objectClass=computer)(|(cn=" + objectName + ")(dn=" + objectName + ")))"; break; } SearchResult result = mySearcher.FindOne(); if (result == null) { throw new NullReferenceException ("unable to locate the distinguishedName for the object " + objectName + " in the " + ldapDomain + " domain"); } DirectoryEntry directoryObject = result.GetDirectoryEntry(); if (returnValue.Equals(ReturnType.DistinguishedName)) { distinguishedName = "LDAP://" + directoryObject.Properties ["distinguishedName"].Value; } if (returnValue.Equals(ReturnType.ObjectGuid)) { distinguishedName = directoryObject.Guid.ToString(); } entry.Close(); entry.Dispose(); mySearcher.Dispose(); return(distinguishedName); }
public bool Equals(LambdaExpression compareNode) { return (compareNode != null && LambdaType?.Equals(compareNode.LambdaType) != false && ReturnType?.Equals(compareNode.ReturnType) != false && SemanticProperties?.Equals(compareNode.SemanticProperties) != false && base.Equals(compareNode)); }
public override bool Equals(object obj) { MBeanOperationInfo other = obj as MBeanOperationInfo; return(other != null && Name.Equals(other.Name) && Description.Equals(other.Description) && Descriptor.Equals(other.Descriptor) && ReturnType.Equals(other.ReturnType) && Impact.Equals(other.Impact) && Signature.SequenceEqual(other.Signature)); }
public bool Equals(Prototype other) { var result = ReturnType.Equals(other.ReturnType) && Parameters.Count.Equals(other.Parameters.Count); if (result) { for (var i = 0; i < Parameters.Count; i++) { result = result && Parameters[i].Equals(other.Parameters[i]); } } return(result); }
public bool Equals(Prototype other) { if (other == null) { return(false); } if (!ReturnType.Equals(other.ReturnType) || !Parameters.Count.Equals(other.Parameters.Count)) { return(false); } return(!Parameters.Where((t, i) => !t.Equals(other.Parameters[i])).Any()); }
protected override bool LLEquals(SwiftType other) { var fn = other as SwiftBaseFunctionType; if (fn == null) { return(false); } if (Name != null) { Name.Equals(fn.Name); } return(MemberType == fn.MemberType && Parameters.Equals(fn.Parameters) && ReturnType.Equals(fn.ReturnType)); }
public override bool Equals(object obj) { var type = obj as FunctionType; if (type == null) { return(false); } if (ReturnType.Equals(type.ReturnType) == false) { return(false); } return(CheckArgs(type.Args)); }
//only compare return type, attributes and signature public override bool Equals(object other) { var otherNode = other as FunctionDefinitionNode; if (null == otherNode) { return(false); } bool equalSignature = EqualityComparer <ArgumentSignatureNode> .Default.Equals(Signature, otherNode.Signature) && ReturnType.Equals(otherNode.ReturnType) && Attributes.SequenceEqual(otherNode.Attributes); bool equalBody = FunctionBody.Equals(otherNode.FunctionBody); return(equalSignature && equalBody); }
public bool Equals(IType other) { if (other is AnyType) { return(true); } if (!(other is IFunctionType f)) { return(false); } var returnTypeMatches = ReturnType.Equals(f.ReturnType); var paramTypesMatches = Enumerable.SequenceEqual(ParameterTypes, f.ParameterTypes); return(returnTypeMatches && paramTypesMatches); }
public override bool Equals(TSMemberDescription other) { if (ReadOnly != other.ReadOnly) { return(false); } if (Parameters?.Count != other.Parameters?.Count) { return(false); } if (!ReturnType.Equals(other.ReturnType)) { return(false); } if (Parameters == null) { return(true); } return(Parameters.SequenceEqual(other.Parameters)); }
private bool Equals(CppFunctionType other) { if (base.Equals(other) && ReturnType.Equals(other.ReturnType)) { if (Parameters.Count != other.Parameters.Count) { return(false); } for (int i = 0; i < Parameters.Count; i++) { var fromType = Parameters[i].Type; var otherType = other.Parameters[i].Type; if (!fromType.Equals(otherType)) { return(false); } } return(true); } return(false); }
public bool Equals(MethodData?other) => other != null && Name == other.Name && ReturnType.Equals(other.ReturnType) && Parameters.Count == other.Parameters.Count && Parameters.Select((p, i) => (p, i)).All(t => t.p.Equals(other.Parameters[t.i]));
public bool TryFoldInto(TSMemberDescription destination) { if (!ReturnType.Equals(destination.ReturnType)) { return(false); } if (Parameters == null ^ destination.Parameters == null) { return(false); } //one is a property, the other is not if (Parameters == null) { return(true); } var corresponding = Parameters.Zip(destination.Parameters).ToList(); var equalTypes = corresponding.All((sourceP, destP) => sourceP.Value.Type.Equals(destP.Value.Type)); if (equalTypes) //if there is only one additional parameter, we can fold using optional (or a rest) parameter { var allPairs = Parameters.ZipLongest(destination.Parameters, (sourceP, destP) => (sourceP: sourceP, destP: destP)).ToList(); switch (allPairs.Count - corresponding.Count) { case 0: return(true); case var x when x > 1: return(false); case 1: var extra = allPairs.Last(); var(sourceName, sourceDescr) = extra.sourceP; var(destName, destDescr) = extra.destP; if (sourceName.IsNullOrEmpty()) //extra parameter in destination { if (destDescr.ParameterType == Standard) { destDescr.ParameterType = Optional; } } else //extra parameter in source { if (sourceDescr.ParameterType == Standard) { sourceDescr.ParameterType = Optional; } destination.Parameters.Add(sourceName, sourceDescr); } return(true); } } // TODO it might be possible to fold a method with one differing type, and a rest parameter. if (Parameters.Values().Any(x => x.ParameterType == Rest) || destination.Parameters.Values().Any(x => x.ParameterType == Rest)) { return(false); } /*if (Parameters.Count != destination.Parameters.Count) { * return false; * } else if (Parameters.Values().SequenceEqual(destination.Parameters.Values())) { * return true; * }*/ var foldableMethod = true; var unfoldableParameters = Parameters.Values().Zip(destination.Parameters.Values(), (sourceParam, destParam) => { if (!foldableMethod) { return(null); } if (sourceParam.ParameterType != destParam.ParameterType) //if "optionality" of corresponding parameters doesn't match { foldableMethod = false; return(null); } var alreadyIncludesType = false; if (destParam.Type is TSComposedType x && sourceParam.Type is TSComposedType y) { alreadyIncludesType = y.Parts.Except(x.Parts).None(); }
public override bool Equals(object obj) { return(obj is CFunctionType o && ReturnType.Equals(o.ReturnType) && ParameterTypesEqual(o)); }
public bool IsReturnType(string fullyQualifiedMetadataName) { return(ReturnType.Equals(SemanticModel.GetTypeByMetadataName(fullyQualifiedMetadataName))); }
private bool Equals(CppFunctionType other) { return(base.Equals(other) && ReturnType.Equals(other.ReturnType) && ParameterTypes.SequenceEqual(other.ParameterTypes)); }
/// <summary> /// Compares <paramref name="obj"/> to this instance. /// </summary> /// <param name="obj"><see langword="object"/> to compare.</param> /// <returns>True if equal, false if not.</returns> public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } if (!base.Equals(obj)) { return(false); } InterLinqMethodInfo other = (InterLinqMethodInfo)obj; if (GenericArguments.Count != other.GenericArguments.Count) { return(false); } return(!GenericArguments.Where((t, i) => !t.Equals(other.GenericArguments[i])).Any() && ReturnType.Equals(other.ReturnType)); }
/// <inheritdoc /> public bool Equals(MethodDescriptor other) => ReturnType.Equals(other.ReturnType) && Parameters.SequenceEqual(other.Parameters);