Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lorddev committed Apr 4, 2017
1 parent a31d4d6 commit 82f8b3b
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 55 deletions.
10 changes: 4 additions & 6 deletions Devlord.Utilities.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">--------------------------------------------------------------------------------------------------------------------&#xD;
&lt;copyright file="$FILENAME$" company="Lord Design"&gt;&#xD;
© Lord Design&#xD;
© $CURRENT_YEAR$ Lord Design&#xD;
&lt;/copyright&gt;&#xD;
&lt;license type="GPL"&gt;&#xD;
You may use freely and commercially without modification; you can modify if result &#xD;
is also free.&#xD;
&lt;license type="GPL-3.0"&gt;&#xD;
You may use freely and commercially without modification; if you make changes, please share back to the&#xD;
community. &#xD;
&lt;/license&gt;&#xD;
&lt;summary&gt;&#xD;
&lt;/summary&gt;&#xD;
&lt;author&gt;$USER_NAME$&lt;/author&gt;&#xD;
--------------------------------------------------------------------------------------------------------------------&#xD;
</s:String>
Expand Down
14 changes: 7 additions & 7 deletions src/Devlord.Utilities/Crypt.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Crypt.cs" company="">
//
// <copyright file="Crypt.cs" company="Lord Design">
// © 2017 Lord Design
// </copyright>
// <created>10/22/2012 3:42 PM</created>
// <author>[email protected]</author>
// <summary>
// TODO: Update summary.
// </summary>
// <license type="GPL-3.0">
// You may use freely and commercially without modification; if you make changes, please share back to the
// community.
// </license>
// <author>Aaron Lord</author>
// --------------------------------------------------------------------------------------------------------------------

using System;
Expand Down
3 changes: 3 additions & 0 deletions src/Devlord.Utilities/Devlord.Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
-->
<PreBuildEvent></PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.3|AnyCPU'">
<DocumentationFile>bin\Debug\Devlord.Utilities.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
Expand Down
1 change: 0 additions & 1 deletion src/Devlord.Utilities/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public partial class Logger
protected Logger()
{
}

}

#if !NETSTANDARD1_3
Expand Down
43 changes: 22 additions & 21 deletions src/Devlord.Utilities/Mailbot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// --------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Devlord.Utilities
Expand All @@ -22,24 +21,12 @@ namespace Devlord.Utilities
/// </summary>
public partial class Mailbot
{
// Per minute 180, Per hour 3600, Per day 10,000

public async Task QueueMail(Botmail message)
{
await SendMail(message);
}

#region Fields
private readonly Crypt _crypt = new Crypt();

/// <summary>
/// The throttles.
/// </summary>
private Throttles _throttles = new Throttles();
private static readonly object DictionaryLock = new object();

#endregion
private static readonly Dictionary<string, Mailbot> Instances = new Dictionary<string, Mailbot>();

#region Constructors and Destructors

/// <summary>
/// Private constructor to enforce use of singleton.
/// </summary>
Expand All @@ -58,7 +45,21 @@ private Mailbot()

#endregion

private static readonly object DictionaryLock = new object();
#region Public Properties

/// <summary>
/// Gets the SMTP server.
/// </summary>
public string SmtpServer { get; private set; }

#endregion

// Per minute 180, Per hour 3600, Per day 10,000

public async Task QueueMail(Botmail message)
{
await SendMail(message);
}

/// <summary>
/// Gets the instance.
Expand All @@ -85,14 +86,14 @@ public static Mailbot GetInstance(string smtpServer)
}
}

private static readonly Dictionary<string, Mailbot> Instances = new Dictionary<string, Mailbot>();
#region Fields

#region Public Properties
private readonly Crypt _crypt = new Crypt();

/// <summary>
/// Gets the SMTP server.
/// The throttles.
/// </summary>
public string SmtpServer { get; private set; }
private Throttles _throttles = new Throttles();

#endregion
}
Expand Down
31 changes: 12 additions & 19 deletions src/Devlord.Utilities/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;

Expand All @@ -33,16 +32,6 @@ private Settings()
public string SmtpLogin => GetValue<string>("Devlord.Utilities:SmtpLogin");
public string SmtpPassword => GetValue<string>("Devlord.Utilities:SmtpPassword");

public T GetValue<T>(string propertyName)
{
string value = _configuration[propertyName];
if (value != null)
{
return JsonConvert.DeserializeObject<T>(value);
}
throw new SettingNotFoundException(propertyName);
}

private static IConfiguration GetConfig()
{
var builder = new ConfigurationBuilder()
Expand All @@ -52,16 +41,20 @@ private static IConfiguration GetConfig()
.SetBasePath(AppContext.BaseDirectory)
#endif
.AddJsonFile("devlord.utilities.json",
optional: true,
reloadOnChange: true);
true,
true);

return builder.Build();
}

public T GetValue<T>(string propertyName)
{
var value = _configuration[propertyName];
if (value != null)
{
return JsonConvert.DeserializeObject<T>(value);
}
throw new SettingNotFoundException(propertyName);
}
}

public class SettingNotFoundException : KeyNotFoundException
{
public SettingNotFoundException(string setting) : base($"{nameof(SettingNotFoundException)}: {setting}") { }
}
}
}
1 change: 0 additions & 1 deletion test/Devlord.Utilities.Tests/DRMapperTimeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public void TestDRMapperSingleRow()
{
Stopwatch stopwatch;
TestData result;
List<TestData> results;
var inMemoryData = Builder<TestData>.CreateListOfSize(1).Build();
using (var dataReader = ObjectReader.Create(inMemoryData))
{
Expand Down

0 comments on commit 82f8b3b

Please sign in to comment.