Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Removed SentryModule in place of an IDictionary<string, string> as per
Browse files Browse the repository at this point in the history
…@xpicio's suggestion in #55.
  • Loading branch information
asbjornu committed Nov 12, 2014
1 parent 58a380a commit 944b912
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 66 deletions.
4 changes: 1 addition & 3 deletions src/app/SharpRaven/Data/JsonPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ public JsonPacket(string project)
private JsonPacket()
{
// Get assemblies.
Modules = SystemUtil
.GetModules()
.ToDictionary(k => k.Name, v => v.Version);
Modules = SystemUtil.GetModules();

// The current hostname
ServerName = Environment.MachineName;
Expand Down
54 changes: 0 additions & 54 deletions src/app/SharpRaven/Data/SentryModule.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/app/SharpRaven/SharpRaven.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<Compile Include="Data\ExceptionFrame.cs" />
<Compile Include="Data\IJsonPacketFactory.cs" />
<Compile Include="Data\SentryMessage.cs" />
<Compile Include="Data\SentryModule.cs" />
<Compile Include="Data\SentryException.cs" />
<Compile Include="Data\SentryRequest.cs" />
<Compile Include="Data\SentryStacktrace.cs" />
Expand Down
23 changes: 15 additions & 8 deletions src/app/SharpRaven/Utilities/SystemUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
using System.Collections.Generic;
using System.Linq;

using SharpRaven.Data;

namespace SharpRaven.Utilities
{
/// <summary>
Expand All @@ -47,15 +45,24 @@ public static class SystemUtil
/// <returns>
/// All loaded modules.
/// </returns>
public static IEnumerable<SentryModule> GetModules()
public static IDictionary<string, string> GetModules()
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var assemblies = AppDomain.CurrentDomain
.GetAssemblies()
.Select(a => a.GetName())
.OrderBy(a => a.Name);

var dictionary = new Dictionary<string, string>();

return assemblies.Select(a => a.GetName()).OrderBy(a => a.Name).Select(a => new SentryModule
foreach (var assembly in assemblies)
{
Name = a.Name,
Version = a.Version.ToString()
});
if (dictionary.ContainsKey(assembly.Name))
continue;

dictionary.Add(assembly.Name, assembly.Version.ToString());
}

return dictionary;
}
}
}

0 comments on commit 944b912

Please sign in to comment.