mirror of
https://gitlab.com/2009scape/Saradomin-Launcher.git
synced 2026-08-01 14:19:14 -06:00
Fix some issues with plugin updating
This commit is contained in:
parent
e88ac062d1
commit
656c4727cf
3 changed files with 27 additions and 6 deletions
|
|
@ -153,9 +153,8 @@ namespace Saradomin.Infrastructure.Services
|
||||||
|
|
||||||
if (isUpdateCheck && updatedInfo.Version != info.Version)
|
if (isUpdateCheck && updatedInfo.Version != info.Version)
|
||||||
{
|
{
|
||||||
if (writePersistentUpdateFlag)
|
|
||||||
await File.WriteAllTextAsync(filePath, fileContent + "\r\nUPDATEAVAILABLE=1");
|
|
||||||
info.UpdateAvailable = true;
|
info.UpdateAvailable = true;
|
||||||
|
if (writePersistentUpdateFlag) WritePluginInfoToFile(info, pluginFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.Installed = File.Exists(Path.Combine(pluginFolder, "plugin.class"));
|
info.Installed = File.Exists(Path.Combine(pluginFolder, "plugin.class"));
|
||||||
|
|
@ -170,6 +169,7 @@ namespace Saradomin.Infrastructure.Services
|
||||||
|
|
||||||
foreach (var lineInfo in lines.Select(t => t.Split("=")))
|
foreach (var lineInfo in lines.Select(t => t.Split("=")))
|
||||||
{
|
{
|
||||||
|
if (parsedData.ContainsKey(lineInfo[0])) continue;
|
||||||
if (lineInfo.Length > 1)
|
if (lineInfo.Length > 1)
|
||||||
{
|
{
|
||||||
parsedData.Add (lineInfo[0], lineInfo[1].Trim('\'').Trim());
|
parsedData.Add (lineInfo[0], lineInfo[1].Trim('\'').Trim());
|
||||||
|
|
@ -203,5 +203,18 @@ namespace Saradomin.Infrastructure.Services
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void WritePluginInfoToFile(PluginInfo info, string pluginFolder)
|
||||||
|
{
|
||||||
|
var content = $"NAME={info.Name}\r\n" +
|
||||||
|
$"AUTHOR={info.Author}\r\n" +
|
||||||
|
$"DESCRIPTION={info.Description.Replace(System.Environment.NewLine, "\\\r\n")}\r\n" +
|
||||||
|
$"VERSION={info.Version}";
|
||||||
|
|
||||||
|
if (info.UpdateAvailable)
|
||||||
|
content += "\r\nUPDATEAVAILABLE=1";
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(pluginFolder, "plugin.properties"), content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Classes="OutsideNavigator"
|
Classes="OutsideNavigator"
|
||||||
Command="{Binding $parent[local:PluginManagerView].DataContext.UpdateLocalPlugin}"
|
Command="{Binding $parent[local:PluginManagerView].DataContext.UpdateLocalPlugin}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Content="Update"
|
Content="Update"
|
||||||
IsVisible="{Binding CanUpdate}" />
|
IsVisible="{Binding CanUpdate}" />
|
||||||
|
|
@ -100,8 +101,14 @@
|
||||||
Command="{Binding $parent[local:PluginManagerView].DataContext.UninstallLocalPlugin}"
|
Command="{Binding $parent[local:PluginManagerView].DataContext.UninstallLocalPlugin}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Content="Uninstall"
|
Content="Uninstall">
|
||||||
IsVisible="{Binding Installed}" />
|
<Button.IsVisible>
|
||||||
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
|
<Binding Path="!CanUpdate" />
|
||||||
|
<Binding Path="Installed" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.IsVisible>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@
|
||||||
xmlns:glitonea="clr-namespace:Glitonea.Controls;assembly=Glitonea"
|
xmlns:glitonea="clr-namespace:Glitonea.Controls;assembly=Glitonea"
|
||||||
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
|
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
|
||||||
xmlns:windows="clr-namespace:Saradomin.ViewModel.Windows"
|
xmlns:windows="clr-namespace:Saradomin.ViewModel.Windows"
|
||||||
|
xmlns:windows1="clr-namespace:Saradomin.View.Windows"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
Height="120"
|
Height="120"
|
||||||
MaxWidth="400"
|
MaxWidth="400"
|
||||||
Background="{StaticResource WindowBackgroundBrush}"
|
Background="{StaticResource WindowBackgroundBrush}"
|
||||||
CanResize="False"
|
CanResize="False"
|
||||||
DataContext="{Binding #NotificationBox}"
|
DataContext="{mvvm:DataContextSource windows1:NotificationBox}"
|
||||||
ShowActivated="True"
|
ShowActivated="True"
|
||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
|
|
@ -25,7 +26,7 @@
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontWeight="Light"
|
FontWeight="Light"
|
||||||
Foreground="{StaticResource AccentBrush}"
|
Foreground="{StaticResource AccentBrush}"
|
||||||
Text="{Binding #NotificationBox.Title}"
|
Text="{Binding Title}"
|
||||||
TextAlignment="Center">
|
TextAlignment="Center">
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue