Skip to content

Commit

Permalink
Fix a bug introduce when rename namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy Zhang committed Dec 5, 2018
1 parent 6f97960 commit 6666b17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
16 changes: 7 additions & 9 deletions Rapr/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ namespace Rapr
{
public static class Program
{
private static Assembly ResolveEventHandler(Object sender, ResolveEventArgs args)
private static Assembly ResolveEventHandler(object sender, ResolveEventArgs args)
{
Assembly assembly = Assembly.GetEntryAssembly();
String resourceName = string.Format("{0}.{1}.dll", assembly.EntryPoint.DeclaringType.Namespace, new AssemblyName(args.Name).Name);
string resourceName = $"{assembly.EntryPoint.DeclaringType.Namespace}.{new AssemblyName(args.Name).Name}.dll";

using (var stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream != null)
{
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
else
if (stream == null)
{
return null;
}

byte[] assemblyData = new byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
}

Expand Down
5 changes: 3 additions & 2 deletions Rapr/Rapr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand All @@ -132,7 +134,6 @@
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion Rapr/TextFileTraceListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void TraceEvent(TraceEventCache eventCache, string source, Trace

this.Write($"{DateTime.UtcNow:u} [{eventType}]: ");

if (args.Length > 0)
if (args?.Length > 0)
{
base.WriteLine(string.Format(format, args));
}
Expand Down
2 changes: 1 addition & 1 deletion Rapr/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="Rapr.Core.TextFileTraceListener, Rapr" initializeData="%LOCALAPPDATA%\\DriverStore Explorer\\Rapr.log" />
<add name="myListener" type="Rapr.TextFileTraceListener, Rapr" initializeData="%LOCALAPPDATA%\\DriverStore Explorer\\Rapr.log" />
</listeners>
</trace>
</system.diagnostics>
Expand Down

0 comments on commit 6666b17

Please sign in to comment.