Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs (.../AvalonDockDockingManager.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/AvalonDockDockingManager.cs (.../AvalonDockDockingManager.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -522,7 +522,7 @@ { var anchorable = sender as LayoutAnchorable; - if (anchorable != null && e.PropertyName == TypeUtils.GetMemberName(o => o.IsHidden) && anchorable.IsHidden) + if (anchorable != null && e.PropertyName == TypeUtils.GetMemberName(la => la.IsHidden) && anchorable.IsHidden) { AnchorableOnClosing(sender, new CancelEventArgs()); Index: Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj =================================================================== diff -u -r770547be3030f73473282742f9a63ca6805ff74b -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 770547be3030f73473282742f9a63ca6805ff74b) +++ Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -110,9 +110,6 @@ - - - Index: Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs =================================================================== diff -u -rb81978adc73edcf368115b58fd37f34dc7fb6ab5 -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs (.../AssemblyUtils.cs) (revision b81978adc73edcf368115b58fd37f34dc7fb6ab5) +++ Core/Common/src/Core.Common.Utils/Reflection/AssemblyUtils.cs (.../AssemblyUtils.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -1,9 +1,8 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using Core.Common.Utils.Properties; + using log4net; namespace Core.Common.Utils.Reflection @@ -93,19 +92,19 @@ } else { - throw new Exception("Type found in multiple assemblies"); + throw new AmbiguousMatchException(string.Format("Type '{0}' found in multiple assemblies", typeName)); } } } return result; } /// - /// Gets a to a embedded resource of an assembly. + /// Gets a to an embedded resource of an assembly. /// /// The assembly from which to retrieve the embedded resource. /// Name of the embedded file. - /// + /// The byte-stream to the embedded resource. /// Embedded resource file with name /// cannot be found in . public static Stream GetAssemblyResourceStream(Assembly assembly, string fileName) @@ -125,69 +124,6 @@ } } - /// - /// Loads all assemblies from a given directory. - /// - /// The directory path. - /// The assemblies that have been loaded. - /// is a file name or a network error occurred. - /// The called does not have the required permission. - /// is a zero-length string, contains - /// only white space or contains one or more invalid characters as defined by . - /// is null. - /// The specified path, file name, or both - /// exceed the system-defined maximum length. For example, on Windows-based platforms, - /// paths must be less than 248 characters and file names must be less than 260 characters. - /// is invalid. - public static IEnumerable LoadAllAssembliesFromDirectory(string path) - { - foreach (string filename in Directory.GetFiles(path).Where(name => name.EndsWith(".dll"))) - { - if (!IsManagedDll(filename)) - { - continue; - } - - Assembly a; - try - { - a = Assembly.LoadFrom(filename); - } - catch (Exception exception) - { - var assemblyName = Path.GetFileNameWithoutExtension(filename); - log.ErrorFormat(Resources.AssemblyUtils_LoadAllAssembliesFromDirectory_Could_not_read_assembly_information_for_0_1_, - assemblyName, exception.Message); - continue; - } - - yield return a; - } - } - - private static bool IsManagedDll(string path) - { - // Implementation based on http://www.darwinsys.com/file/ - - if (!path.EndsWith(".dll", StringComparison.Ordinal) && !path.EndsWith(".exe", StringComparison.Ordinal)) - { - return false; - } - - FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); - fs.Seek(0x3C, SeekOrigin.Begin); // PE, SizeOfHeaders starts at 0x3B, second byte is 0x80 for .NET - int i1 = fs.ReadByte(); - - fs.Seek(0x86, SeekOrigin.Begin); // 0x03 for managed code - int i2 = fs.ReadByte(); - - fs.Close(); - - var isManagedDll = i1 == 0x80 && i2 == 0x03; - - return isManagedDll; - } - private static T GetAssemblyAttributeValue(Assembly assembly) where T : class { object[] attributes = assembly.GetCustomAttributes(typeof(T), true); Index: Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs =================================================================== diff -u -rb81978adc73edcf368115b58fd37f34dc7fb6ab5 -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision b81978adc73edcf368115b58fd37f34dc7fb6ab5) +++ Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -40,7 +40,7 @@ /// Determines whether the given type can be considered a number or not. /// /// The type. - /// + /// True if the type represents a numerical value; False when this is not the case. public static bool IsNumericalType(this Type type) { return (type == typeof(Single) || @@ -57,11 +57,12 @@ /// /// Gets the name of the member. /// - /// The type of the class on which the expression takes place. + /// The type of the class on which the expression takes place. /// The expression. /// The string name of the member. - /// When is invalid. - public static string GetMemberName(Expression> expression) + /// When + /// is not an expression with a member, such as a expression calling multiple methods. + public static string GetMemberName(Expression> expression) { var member = expression.Body as MemberExpression; @@ -88,23 +89,23 @@ /// /// Gets the value of a field of an instance. /// - /// Type of the field. + /// Type of the field. /// Instance holding the field. Cannot be null. /// Name of the field. /// The value of the field. /// When /// doesn't have a field with the name . /// When is null. /// This method can be used for fields of any visibility. - public static TField GetField(object instance, string fieldName) + public static T GetField(object instance, string fieldName) { FieldInfo fieldInfo = GetFieldInfo(instance.GetType(), fieldName); if (fieldInfo == null) { throw new ArgumentOutOfRangeException("fieldName"); } - return (TField)fieldInfo.GetValue(instance); + return (T)fieldInfo.GetValue(instance); } /// Fisheye: Tag 24813ad65687801c7e34ce33dd7a82b95b108c65 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/Validation/ValidationIssue.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 24813ad65687801c7e34ce33dd7a82b95b108c65 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/Validation/ValidationReport.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 24813ad65687801c7e34ce33dd7a82b95b108c65 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/Validation/ValidationSeverity.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj =================================================================== diff -u -r770547be3030f73473282742f9a63ca6805ff74b -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 770547be3030f73473282742f9a63ca6805ff74b) +++ Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -93,8 +93,6 @@ - - Fisheye: Tag 24813ad65687801c7e34ce33dd7a82b95b108c65 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/Validation/ValidationIssueTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 24813ad65687801c7e34ce33dd7a82b95b108c65 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/Validation/ValidationReportTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Utils.Test/WebLinkTest.cs =================================================================== diff -u -r770547be3030f73473282742f9a63ca6805ff74b -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Core/Common/test/Core.Common.Utils.Test/WebLinkTest.cs (.../WebLinkTest.cs) (revision 770547be3030f73473282742f9a63ca6805ff74b) +++ Core/Common/test/Core.Common.Utils.Test/WebLinkTest.cs (.../WebLinkTest.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -23,7 +23,7 @@ } [Test] - public void SipleProperties_SetAndGetValue_ReturnNewlySetValue() + public void SimpleProperties_SetAndGetValue_ReturnNewlySetValue() { // Setup var url = new WebLink("Deltares", new Uri("http://www.deltares.com")); Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs =================================================================== diff -u -r42ca97fdb85a553c6aac3bfdfe57c7be4af90821 -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 42ca97fdb85a553c6aac3bfdfe57c7be4af90821) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -128,7 +128,7 @@ private void InitializeGridColumns() { - var assessmentName = TypeUtils.GetMemberName(e => e.Assessment); + var assessmentName = TypeUtils.GetMemberName(fmci => fmci.Assessment); var columnNameFormat = "column_{0}"; var assessmentColumn = new DataGridViewTextBoxColumn { @@ -138,7 +138,7 @@ AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader }; - var contributionName = TypeUtils.GetMemberName(e => e.Contribution); + var contributionName = TypeUtils.GetMemberName(fmci => fmci.Contribution); var probabilityColumn = new DataGridViewTextBoxColumn { DataPropertyName = contributionName, @@ -147,7 +147,7 @@ AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader }; - var probabilitySpaceName = TypeUtils.GetMemberName(e => e.ProbabilitySpace); + var probabilitySpaceName = TypeUtils.GetMemberName(fmci => fmci.ProbabilitySpace); var probabilityPerYearColumn = new DataGridViewTextBoxColumn { DataPropertyName = probabilitySpaceName, Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSoilProfileSelectionEditor.cs =================================================================== diff -u -r79e69f1b4b303862f3572d0f6cb60acf63a957e9 -r24813ad65687801c7e34ce33dd7a82b95b108c65 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSoilProfileSelectionEditor.cs (.../PipingInputContextSoilProfileSelectionEditor.cs) (revision 79e69f1b4b303862f3572d0f6cb60acf63a957e9) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSoilProfileSelectionEditor.cs (.../PipingInputContextSoilProfileSelectionEditor.cs) (revision 24813ad65687801c7e34ce33dd7a82b95b108c65) @@ -16,7 +16,7 @@ /// public PipingInputContextSoilProfileSelectionEditor() { - DisplayMember = TypeUtils.GetMemberName(sl => sl.Name); + DisplayMember = TypeUtils.GetMemberName(sp => sp.Name); } protected override IEnumerable GetAvailableOptions(ITypeDescriptorContext context)