-
Notifications
You must be signed in to change notification settings - Fork 13
/
BundleUrlHelper.cs
31 lines (28 loc) · 1016 Bytes
/
BundleUrlHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace UIShell.OSGi
{
using System;
using System.IO;
using Utility;
public static class BundleUrlHelper
{
public static string Content(string symbolicName, string url)
{
var bundleBySymbolicName = BundleRuntime.Instance.Framework.Bundles.GetBundleBySymbolicName(symbolicName);
if (bundleBySymbolicName == null)
{
throw new Exception(string.Format(Messages.BundleNotExist, symbolicName));
}
return Content(bundleBySymbolicName, url);
}
public static string Content(IBundle bundle, string url)
{
AssertUtility.ArgumentNotNull(bundle, "bundle");
AssertUtility.ArgumentHasText(url, "url");
while (url.StartsWith("~") || (url.StartsWith("/") || url.StartsWith(@"\")))
{
url = url.Remove(0, 1);
}
return Path.Combine(bundle.Location, url);
}
}
}