Skip to content

Commit

Permalink
Release 2.1.1: Configuration feature and some refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
tusmester committed Mar 21, 2017
1 parent 1d5d7e6 commit adab27c
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 58 deletions.
23 changes: 3 additions & 20 deletions src/SenseNet.Tools.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SenseNet.Tools.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -14,23 +11,9 @@
[assembly: AssemblyTrademark("Sense/Net Inc.")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ec7fc58f-81cc-411b-92e0-079b7c39d0a5")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1")]
9 changes: 9 additions & 0 deletions src/SenseNet.Tools/Configuration/SnConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ namespace SenseNet.Configuration
/// </summary>
public abstract class SnConfig
{
/// <summary>
/// Initializes an instance of the SnConfig class.
/// </summary>
protected SnConfig()
{
// This technical constructor was created to prevent external code from
// instantiating this utility class using the default public constructor.
}

//============================================================================== Properties

/// <summary>
Expand Down
10 changes: 3 additions & 7 deletions src/SenseNet.Tools/Diagnostics/Analysis/FileReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;

#pragma warning disable 1591
Expand Down Expand Up @@ -30,13 +29,10 @@ public override IEnumerator<Entry> GetEnumerator()

protected override void Dispose(bool disposing)
{
IDisposable disposable;
if (!disposing)
return;
if (_reader == null)
return;
if ((disposable = _reader as IDisposable) != null)
disposable.Dispose();

_reader?.Dispose();
}
}
}
2 changes: 1 addition & 1 deletion src/SenseNet.Tools/Diagnostics/SnTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class Operation : IDisposable
{
private static long _nextId = 1;

internal static Operation Null = new Operation(0L);
internal static readonly Operation Null = new Operation(0L);

/// <summary>
/// Gets the operation identifier that is unique in the current AppDomain.
Expand Down
20 changes: 1 addition & 19 deletions src/SenseNet.Tools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SenseNet.Tools")]
[assembly: AssemblyDescription("Tools library for Sense/Net ECM")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -14,26 +11,11 @@
[assembly: AssemblyTrademark("Sense/Net Inc.")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9c2fa8d5-65f8-4cad-a65d-b7cc804a821f")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1-alpha")]
[assembly: AssemblyInformationalVersion("2.1.1")]

[assembly: InternalsVisibleTo("SenseNet.Tools.Tests")]
10 changes: 5 additions & 5 deletions src/SenseNet.Tools/SenseNet.Tools.nuspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>SenseNet.Tools</id>
<version>$version$</version>
<title>SenseNet Tools for .Net</title>
<title>Sense/Net Tools for .Net</title>
<authors>tusmester,kavics</authors>
<owners>Sense/Net</owners>
<licenseUrl>https://github.com/SenseNet/sn-tools/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/SenseNet/sn-tools</projectUrl>
<iconUrl>https://avatars2.githubusercontent.com/u/4069121?v=3&amp;s=200</iconUrl>
<iconUrl>https://raw.githubusercontent.com/SenseNet/sn-resources/master/images/sn-icon/sensenet-icon-64.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>General .Net tools that can be used even in projects independent from SenseNet ECM.</description>
<description>General .Net tools that can be used even in projects independent from Sense/Net ECM.</description>
<copyright>Copyright © Sense/Net Inc.</copyright>
<language>en-US</language>
<tags>sensenet tools</tags>
</metadata>
</package>
</package>
2 changes: 1 addition & 1 deletion src/SenseNet.Tools/Tools/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static Task ForEachAsync<T>(this IEnumerable<T> source, int degreeOfParal
{
using (partition)
while (partition.MoveNext())
await action(partition.Current);
await action(partition.Current).ConfigureAwait(false);
})));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/SenseNet.Tools/Tools/Retrier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SenseNet.Tools
/// the maximum number of retry attempts, the callback that should be
/// called and the exception type that should be suppressed.
/// </summary>
public class Retrier
public static class Retrier
{
/// <summary>
/// Calls the callback method safely. If the given type of exception is caught,
Expand Down Expand Up @@ -204,7 +204,7 @@ public static async Task<T> RetryAsync<T>(int count, int waitMilliseconds, Func<

try
{
result = await callback();
result = await callback().ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down Expand Up @@ -247,7 +247,7 @@ public static async Task RetryAsync(int count, int waitMilliseconds, Func<Task>

try
{
await callback();
await callback().ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down
5 changes: 3 additions & 2 deletions src/SenseNet.Tools/Tools/TypeResolver.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -114,10 +115,10 @@ public static Type FindTypeInAppDomain(string typeName, bool throwOnError = true
{
var split = typeName.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var tname = split[0];
var asmName = split.Length > 1 ? split[1].ToLower().Trim() : null;
var asmName = split.Length > 1 ? split[1].ToLower(CultureInfo.InvariantCulture).Trim() : null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (asmName != null && asmName != assembly.GetName().Name.ToLower())
if (asmName != null && asmName != assembly.GetName().Name.ToLower(CultureInfo.InvariantCulture))
continue;
try
{
Expand Down

0 comments on commit adab27c

Please sign in to comment.