Change Skin -> Theme
To better align with commonly used terminology in industry renamed all references from Skin -> Theme.
This commit is contained in:
@ -4,8 +4,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface ISkinService
|
||||
public interface IThemeService
|
||||
{
|
||||
Task<List<Skin>> GetSkinsAsync();
|
||||
Task<List<Theme>> GetThemesAsync();
|
||||
}
|
||||
}
|
||||
|
@ -9,33 +9,33 @@ using System;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class SkinService : ServiceBase, ISkinService
|
||||
public class ThemeService : ServiceBase, IThemeService
|
||||
{
|
||||
private readonly HttpClient http;
|
||||
private readonly string apiurl;
|
||||
|
||||
private List<Skin> skins;
|
||||
private List<Theme> themes;
|
||||
|
||||
public SkinService(HttpClient http, IUriHelper urihelper)
|
||||
public ThemeService(HttpClient http, IUriHelper urihelper)
|
||||
{
|
||||
this.http = http;
|
||||
apiurl = CreateApiUrl(urihelper.GetAbsoluteUri(), "Skin");
|
||||
apiurl = CreateApiUrl(urihelper.GetAbsoluteUri(), "Theme");
|
||||
}
|
||||
|
||||
public async Task<List<Skin>> GetSkinsAsync()
|
||||
public async Task<List<Theme>> GetThemesAsync()
|
||||
{
|
||||
if (skins == null)
|
||||
if (themes == null)
|
||||
{
|
||||
skins = await http.GetJsonAsync<List<Skin>>(apiurl);
|
||||
themes = await http.GetJsonAsync<List<Theme>>(apiurl);
|
||||
|
||||
// get list of loaded assemblies
|
||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
|
||||
foreach (Skin skin in skins)
|
||||
foreach (Theme theme in themes)
|
||||
{
|
||||
if (skin.Dependencies != "")
|
||||
if (theme.Dependencies != "")
|
||||
{
|
||||
foreach (string dependency in skin.Dependencies.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (string dependency in theme.Dependencies.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
string assemblyname = dependency.Replace(".dll", "");
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
||||
@ -46,15 +46,15 @@ namespace Oqtane.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(skin.AssemblyName + ",")).FirstOrDefault() == null)
|
||||
if (assemblies.Where(item => item.FullName.StartsWith(theme.AssemblyName + ",")).FirstOrDefault() == null)
|
||||
{
|
||||
// download assembly from server and load
|
||||
var bytes = await http.GetByteArrayAsync("_framework/_bin/" + skin.AssemblyName + ".dll");
|
||||
var bytes = await http.GetByteArrayAsync("_framework/_bin/" + theme.AssemblyName + ".dll");
|
||||
Assembly.Load(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
return skins.OrderBy(item => item.Name).ToList();
|
||||
return themes.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user