Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Fixed #70
Browse files Browse the repository at this point in the history
  • Loading branch information
kipusoep committed May 1, 2015
1 parent af237f2 commit e245a42
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.6.*")]
[assembly: AssemblyVersion("3.7.*")]

// SQL
[assembly: WebResource("InfoCaster.Umbraco.UrlTracker.SQL.MicrosoftSqlServer.create-table-1.sql", "text/plain")]
Expand Down
90 changes: 46 additions & 44 deletions Providers/EmbeddedResourcesVirtualPathProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,57 @@

namespace InfoCaster.Umbraco.UrlTracker.Providers
{
public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider
{
public EmbeddedResourcesVirtualPathProvider()
{
}
public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider
{
public EmbeddedResourcesVirtualPathProvider()
{
}

private bool IsEmbeddedResourcePath(string virtualPath)
{
var checkPath = VirtualPathUtility.ToAppRelative(virtualPath);
return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase);
}
private bool IsEmbeddedResourcePath(string virtualPath)
{
var checkPath = VirtualPathUtility.ToAppRelative(virtualPath);
return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase);
}

public override bool FileExists(string virtualPath)
{
return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath);
}
public override bool FileExists(string virtualPath)
{
return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath);
}

public override VirtualFile GetFile(string virtualPath)
{
if (IsEmbeddedResourcePath(virtualPath))
return new EmbeddedResourceVirtualFile(virtualPath);
return base.GetFile(virtualPath);
}
public override VirtualFile GetFile(string virtualPath)
{
if (IsEmbeddedResourcePath(virtualPath))
return new EmbeddedResourceVirtualFile(virtualPath);
return base.GetFile(virtualPath);
}

public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
if (IsEmbeddedResourcePath(virtualPath))
return null;
return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
}
}
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
{
if (IsEmbeddedResourcePath(virtualPath))
return null;
return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
}
}

public class EmbeddedResourceVirtualFile : VirtualFile
{
string _path;
public class EmbeddedResourceVirtualFile : VirtualFile
{
readonly string _path;

public EmbeddedResourceVirtualFile(string virtualPath)
: base(virtualPath)
{
_path = VirtualPathUtility.ToAppRelative(virtualPath);
}
public EmbeddedResourceVirtualFile(string virtualPath)
: base(virtualPath)
{
_path = VirtualPathUtility.ToAppRelative(virtualPath);
}

public override Stream Open()
{
var resourceName = _path.Split('/').Last();
var assembly = GetType().Assembly;
if (assembly != null)
return assembly.GetManifestResourceStream(resourceName);
return null;
}
}
public override Stream Open()
{
var resourceName = _path.Split('/').Last();
var assembly = GetType().Assembly;
resourceName = assembly.GetManifestResourceNames()
.SingleOrDefault(x => x.Equals(resourceName, StringComparison.OrdinalIgnoreCase));
if (string.IsNullOrEmpty(resourceName))
return null;
return assembly.GetManifestResourceStream(resourceName);
}
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Set to true to disable tracking not found (404) requests.
Set to false to disable appending a port number to redirect URLs

## Changelog ##
* 3.7 [2015/05/01]
* [BugFix] Exception on install ([#70](https://github.com/kipusoep/UrlTracker/issues/70))
* 3.6 [2015/03/21]
* [BugFix] Rootnode resolving bug fixed ([#69](https://github.com/kipusoep/UrlTracker/issues/69))
* 3.5 [2015/02/20]
Expand Down
6 changes: 6 additions & 0 deletions UI/UrlTrackerInfo.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
</div>
<div class="tab-pane" id="changeLog">
<ul>
<li>
3.7 [2015/05/01]
<ul>
<li>[BugFix] Exception on install (<a target="_blank" href="https://github.com/kipusoep/UrlTracker/issues/70">#70</a>)</li>
</ul>
</li>
<li>
3.6 [2015/03/21]
<ul>
Expand Down

0 comments on commit e245a42

Please sign in to comment.