Skip to content

Commit

Permalink
Update to version 1.4.2. Fixes:
Browse files Browse the repository at this point in the history
 - fixed path separator usage in localization file builder method. Now plugin should be compatible with Linux OS.
  • Loading branch information
iAlexeyProkhorov committed Nov 8, 2022
1 parent fb7e181 commit 482622c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions BaseBaroquePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ public BaseBaroquePlugin()
protected string GenerateLocalizationXmlFilePathByCulture(string culture = "en-US")
{
string fileName = string.Format("localization.{0}.xml", culture);
string contentDirectoryPath = $"{_originalAssemblyFile.DirectoryName}\\Content\\";
string contentDirectoryPath = $"{_originalAssemblyFile.DirectoryName}{Path.DirectorySeparatorChar}Content{Path.DirectorySeparatorChar}";

return $"{contentDirectoryPath}{fileName}";
}

/// <summary>
/// Install available plugin localizations
/// </summary>
protected virtual void InstallLocalization()
protected virtual async Task InstallLocalizationAsync()
{
var allLanguages = _languageService.GetAllLanguagesAsync().GetAwaiter().GetResult();
var allLanguages = await _languageService.GetAllLanguagesAsync();
var language = allLanguages.FirstOrDefault();

//if shop have no available languages method generate exception
Expand All @@ -95,7 +95,7 @@ protected virtual void InstallLocalization()
{
using (var sr = new StreamReader(stream, Encoding.UTF8))
{
_localizationService.ImportResourcesFromXmlAsync(l, sr);
await _localizationService.ImportResourcesFromXmlAsync(l, sr);
}
}
}
Expand All @@ -104,7 +104,7 @@ protected virtual void InstallLocalization()
/// <summary>
/// Uninstall plugin localization
/// </summary>
protected virtual void UninstallLocalization()
protected virtual async Task UninstallLocalizationAsync()
{
var localizationPath = GenerateLocalizationXmlFilePathByCulture();

Expand All @@ -118,7 +118,7 @@ protected virtual void UninstallLocalization()
{
using (var sr = new StreamReader(stream, Encoding.UTF8))
{
var result = sr.ReadToEnd();
var result = await sr.ReadToEndAsync();
var xLang = new XmlDocument();
xLang.LoadXml(result);

Expand All @@ -128,7 +128,7 @@ protected virtual void UninstallLocalization()
if (elem.Name == "LocaleResource")
{
var localResource = elem.Attributes["Name"].Value;
_localizationService.DeleteLocaleResourceAsync(localResource);
await _localizationService.DeleteLocaleResourceAsync(localResource);
}
}
}
Expand All @@ -141,14 +141,14 @@ protected virtual void UninstallLocalization()
public override async Task InstallAsync()
{

InstallLocalization();
await InstallLocalizationAsync();
await base.InstallAsync();
}


public override async Task UninstallAsync()
{
UninstallLocalization();
await UninstallLocalizationAsync();
await base.UninstallAsync();
}

Expand Down
2 changes: 1 addition & 1 deletion Nop.Plugin.Widgets.qBoSlider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl>https://github.com/iAlexeyProkhorov/qBoSlider</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<Version>1.3.0</Version>
<Version>1.4.2</Version>
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Widgets.qBoSlider</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Group": "Widgets",
"FriendlyName": "qBoSlider",
"SystemName": "Widgets.qBoSlider",
"Version": "1.4.1",
"Version": "1.4.2",
"SupportedVersions": [ "4.50" ],
"Author": "Baroque team",
"DisplayOrder": 1,
Expand Down

0 comments on commit 482622c

Please sign in to comment.