Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
More refacotring of types & namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
avanderhoorn committed Dec 16, 2015
1 parent 80d6953 commit 7b5cf60
Show file tree
Hide file tree
Showing 25 changed files with 79 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Glimpse.Agent.Inspectors;
using Glimpse.Initialization;
using System.Linq;
using Glimpse.Configuration;
using Glimpse.Platform;

namespace Glimpse.DependencyInjection
Expand Down
8 changes: 0 additions & 8 deletions src/Glimpse.Agent.Core/Inspectors/Execute.cs

This file was deleted.

68 changes: 0 additions & 68 deletions src/Glimpse.Agent.Core/Inspectors/Tab.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;
using Glimpse.Common.Internal.Serialization;
using Glimpse.Internal.Extensions;
using Glimpse.Internal.Serialization;
using Newtonsoft.Json;

namespace Glimpse.Agent.Internal.Messaging
Expand Down
2 changes: 1 addition & 1 deletion src/Glimpse.Agent.Core/Internal/Tabs/ConnectionTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
// };
// }

// public override Execute ExecuteWhen => Execute.BeforeResponse;
// public override TabExecute TabExecuteWhen => TabExecute.BeforeResponse;
// }
//}
1 change: 1 addition & 0 deletions src/Glimpse.Agent.Core/Messaging/HttpMessagePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Glimpse.Configuration;
using Glimpse.Initialization;

namespace Glimpse.Agent
Expand Down
46 changes: 46 additions & 0 deletions src/Glimpse.Agent.Core/Tab.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using Glimpse.Agent.AspNet.Messages;
using Glimpse.Agent.Inspectors;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;

namespace Glimpse.Agent
{
public abstract class Tab : Inspector
{
public override void Before(HttpContext context)
{
if (TabExecuteWhen == TabExecute.BeforeResponse)
Publish(context);
}

public override void After(HttpContext context)
{
if (TabExecuteWhen == TabExecute.AfterResponse)
Publish(context);
}

private void Publish(HttpContext context)
{
object data = null;
try
{
data = GetData(context);
}
catch (Exception exception)
{
data = exception;
}

var broker = context.RequestServices.GetService<IAgentBroker>();

broker.SendMessage(new TabMessage(Name, data));
}

public virtual TabExecute TabExecuteWhen => TabExecute.AfterResponse;

public abstract string Name { get; }

public abstract object GetData(HttpContext context);
}
}
8 changes: 8 additions & 0 deletions src/Glimpse.Agent.Core/TabExecute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Glimpse.Agent
{
public enum TabExecute
{
BeforeResponse,
AfterResponse
}
}
1 change: 1 addition & 0 deletions src/Glimpse.Agent.Dnx.Mvc/Razor/ScriptInjector.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Glimpse.Common;
using Glimpse.Configuration;
using Glimpse.Initialization;
using Glimpse.Platform;
using Microsoft.AspNet.Razor.TagHelpers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Glimpse.Initialization
using Glimpse.Initialization;

namespace Glimpse.Configuration
{
public interface IResourceOptionsProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.Extensions.OptionsModel;
using Glimpse.Initialization;
using Microsoft.Extensions.OptionsModel;

namespace Glimpse.Initialization
namespace Glimpse.Configuration
{
public class OptionsResourceOptionsProvider : IResourceOptionsProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Glimpse.Initialization
namespace Glimpse.Configuration
{
public class ResourceOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Glimpse;
using Glimpse.Common;
using Glimpse.Common.Internal.Serialization;
using Glimpse.Initialization;
using Glimpse.Internal;
using Glimpse.Internal.Serialization;
using Glimpse.Platform;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Globalization;
using System.IO;
using System.Text;
using Glimpse.Internal.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using GuidConverter = Glimpse.Common.Internal.Serialization.GuidConverter;
using GuidConverter = Glimpse.Internal.Serialization.GuidConverter;
using TimeSpanConverter = Glimpse.Internal.Serialization.TimeSpanConverter;

namespace Glimpse.Internal.Extensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Glimpse.Internal.Extensions;
using Newtonsoft.Json;

namespace Glimpse.Common.Internal.Serialization
namespace Glimpse.Internal.Serialization
{
public class DefaultJsonSerializerProvider : IJsonSerializerProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;

namespace Glimpse.Common.Internal.Serialization
namespace Glimpse.Internal.Serialization
{
public class GuidConverter : JsonConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Newtonsoft.Json;

namespace Glimpse.Common.Internal.Serialization
namespace Glimpse.Internal.Serialization
{
public interface IJsonSerializerProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;

namespace Glimpse.Internal
namespace Glimpse.Internal.Serialization
{
public class StringValuesConverter : JsonConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Newtonsoft.Json;

namespace Glimpse.Internal
namespace Glimpse.Internal.Serialization
{
public class TimeSpanConverter : JsonConverter
{
Expand Down
2 changes: 0 additions & 2 deletions src/Glimpse.Common.Core/Internal/TypeNameHelper.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Glimpse.Internal
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Glimpse.Common;

namespace Glimpse.Platform
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Glimpse.Configuration;
using Glimpse.Initialization;
using Glimpse.Internal.Extensions;
using Glimpse.Server.Internal.Extensions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Glimpse.Configuration;
using Glimpse.Initialization;
using Glimpse.Server;
using Glimpse.Server.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Glimpse.Configuration;
using Glimpse.Initialization;
using Glimpse.Server.Resources;
using Microsoft.AspNet.Http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Glimpse.Common.Internal.Serialization;
using Glimpse.Internal.Serialization;
using Glimpse.Server.Resources;
using Microsoft.AspNet.Http;
using Newtonsoft.Json;
Expand Down

0 comments on commit 7b5cf60

Please sign in to comment.