Skip to content

Commit

Permalink
Merge branch 'release/6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed May 22, 2019
2 parents 10a70dc + fedef51 commit a3cd4b2
Show file tree
Hide file tree
Showing 18 changed files with 287 additions and 138 deletions.
51 changes: 47 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,54 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
# This file is the top-most EditorConfig file
root = true

# Windows-style newlines with a newline ending every file
# All Files
[*]
charset = utf-8
end_of_line = crlf
indent_style = space
indent_size = 4
insert_final_newline = false
trim_trailing_whitespace = true

# .NET Code files
[*.{cs,csx,cake,vb}]
indent_style = tab
tab_width = 4
insert_final_newline = true

# Visual Studio Solution Files
[*.sln]
indent_style = tab
tab_width = 4

# Visual Studio XML Project Files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Various XML Configuration Files
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

# JSON Files
[*.{json,json5}]
indent_size = 2

# YAML Files
[*.{yml,yaml}]
indent_size = 2

# Markdown Files
[*.md]
trim_trailing_whitespace = false

# Web Files
[*.{htm,html,js,ts,tsx,css,sass,scss,less,svg,vue}]
indent_size = 2
insert_final_newline = true

# Batch Files
[*.{cmd,bat}]

# Bash Files
[*.sh]
end_of_line = lf
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
Expand Down Expand Up @@ -210,6 +213,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
Expand All @@ -235,8 +240,6 @@ orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
**/wwwroot/lib/

# RIA/Silverlight projects
Generated_Code/
Expand All @@ -261,6 +264,7 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl

# Microsoft Fakes
FakesAssemblies/
Expand Down Expand Up @@ -296,10 +300,6 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

Expand Down Expand Up @@ -344,6 +344,9 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# WinMerge
*.bak

Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Coverage Status](https://coveralls.io/repos/github/Jericho/Picton.Messaging/badge.svg?branch=master)](https://coveralls.io/github/Jericho/Picton.Messaging?branch=master)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FJericho%2FPicton.Messaging.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FJericho%2FPicton.Messaging?ref=badge_shield)


## About

Picton.Messaging is a C# library containing a high performance message processor (also known as a message "pump") designed to process messages from an Azure storage queue as efficiently as possible.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace Picton.Messaging.IntegrationTests
namespace Picton.Messaging.IntegrationTests
{
using Logging;
using Picton.Messaging.Logging.LogProviders;
using System;
using System.Collections.Generic;
using System.Globalization;

// Inspired by: https://github.com/damianh/LibLog/blob/master/src/LibLog.Example.ColoredConsoleLogProvider/ColoredConsoleLogProvider.cs
public class ColoredConsoleLogProvider : ILogProvider
{
private static readonly Dictionary<LogLevel, ConsoleColor> Colors = new Dictionary<LogLevel, ConsoleColor>
Expand Down Expand Up @@ -40,7 +40,7 @@ public Logger GetLogger(string name)
{
// Please note: locking is important to ensure that multiple threads
// don't attempt to change the foreground color at the same time
lock (this)
lock (Console.Out)
{
if (Colors.TryGetValue(logLevel, out ConsoleColor consoleColor))
{
Expand Down Expand Up @@ -75,7 +75,7 @@ public IDisposable OpenNestedContext(string message)
{
return NullDisposable.Instance;
}

/// <summary>
/// Opens a mapped diagnostics context. Not supported in EntLib logging.
/// </summary>
Expand Down
32 changes: 32 additions & 0 deletions Source/Picton.Messaging.IntegrationTests/ConsoleUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;

namespace Picton.Messaging.IntegrationTests
{
public static class ConsoleUtils
{
public static void CenterConsole()
{
var hWin = NativeMethods.GetConsoleWindow();
if (hWin == IntPtr.Zero) return;

var monitor = NativeMethods.MonitorFromWindow(hWin, NativeMethods.MONITOR_DEFAULT_TO_NEAREST);
if (monitor == IntPtr.Zero) return;

var monitorInfo = new NativeMethods.NativeMonitorInfo();
NativeMethods.GetMonitorInfo(monitor, monitorInfo);

NativeMethods.GetWindowRect(hWin, out NativeMethods.NativeRectangle consoleInfo);

var monitorWidth = monitorInfo.Monitor.Right - monitorInfo.Monitor.Left;
var monitorHeight = monitorInfo.Monitor.Bottom - monitorInfo.Monitor.Top;

var consoleWidth = consoleInfo.Right - consoleInfo.Left;
var consoleHeight = consoleInfo.Bottom - consoleInfo.Top;

var left = monitorInfo.Monitor.Left + (monitorWidth - consoleWidth) / 2;
var top = monitorInfo.Monitor.Top + (monitorHeight - consoleHeight) / 2;

NativeMethods.MoveWindow(hWin, left, top, consoleWidth, consoleHeight, false);
}
}
}
52 changes: 52 additions & 0 deletions Source/Picton.Messaging.IntegrationTests/NativeMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Runtime.InteropServices;

namespace Picton.Messaging.IntegrationTests
{
public static class NativeMethods
{
public const Int32 MONITOR_DEFAULT_TO_PRIMARY = 0x00000001;
public const Int32 MONITOR_DEFAULT_TO_NEAREST = 0x00000002;

[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll", SetLastError = true)]
public static extern bool GetWindowRect(IntPtr hWnd, out NativeRectangle rc);

[DllImport("user32.dll", SetLastError = true)]
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int w, int h, bool repaint);

[DllImport("user32.dll")]
public static extern IntPtr MonitorFromWindow(IntPtr handle, Int32 flags);

[DllImport("user32.dll")]
public static extern Boolean GetMonitorInfo(IntPtr hMonitor, NativeMonitorInfo lpmi);

[Serializable, StructLayout(LayoutKind.Sequential)]
public struct NativeRectangle
{
public Int32 Left;
public Int32 Top;
public Int32 Right;
public Int32 Bottom;

public NativeRectangle(Int32 left, Int32 top, Int32 right, Int32 bottom)
{
this.Left = left;
this.Top = top;
this.Right = right;
this.Bottom = bottom;
}
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public sealed class NativeMonitorInfo
{
public Int32 Size = Marshal.SizeOf(typeof(NativeMonitorInfo));
public NativeRectangle Monitor;
public NativeRectangle Work;
public Int32 Flags;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="App.Metrics.Reporting.Http" Version="3.0.0" />
<PackageReference Include="App.Metrics.Reporting.Http" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit a3cd4b2

Please sign in to comment.