Skip to content

Commit

Permalink
Update Improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 10, 2023
1 parent c7f92c3 commit 9000a81
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/Portal/Sucrose.Portal/Sucrose.Portal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Downloader" Version="3.0.6" />
<PackageReference Include="Skylark.Wing" Version="3.1.1.4" />
<PackageReference Include="XamlFlair.WPF" Version="1.2.13" />
<PackageReference Include="WPF-UI" Version="3.0.0-preview.7" />
Expand Down
1 change: 1 addition & 0 deletions src/Shared/Sucrose.Shared.Dependency/Enum/UpdateType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ internal enum UpdateType
Error,
Update,
Status,
Channel,
Extract,
Network,
Updating,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">Beim Herunterladen der Aktualisierungsdatei haben wir einen Riss im Pfad entdeckt, und diese Reise ist vorerst zu Ende. Setzen Sie Ihre Reise mit der aktuellen Version fort, denn eine stärkere Aktualisierung erwartet Sie, wenn diese Risse repariert sind.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">Die Anwendung ist bereits bei Ihnen, wie die neueste Seite eines Buches, in ihrer aktuellsten und innovativsten Form. Hier, um Ihnen jederzeit das beste und aktuellste Erlebnis zu bieten.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">Wir stehen an der Schwelle eines Traums, in dem Update-Dateien nicht zugänglich sind. Sie können jedoch Ihren Traum weiterhin mit der aktuellen Version leben.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">Der ausgewählte Update-Kanal ist wie ein stiller Wald. Hier gibt es derzeit keine neuen Update-Informationen. Setzen Sie Ihre Reise mit der aktuellen Version fort, denn wenn diese Stille gebrochen ist, werden wir Ihnen mehr bieten.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">Beim Versuch, die Update-Datei zu extrahieren, sind wir auf ein Hindernis aus den Tiefen des Meeres gestoßen. Setzen Sie vorerst Ihre Reise mit der aktuellen Version fort, denn wir werden zurückkehren, um neue Schätze zu finden, wenn die See ruhiger ist.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">Die Schwäche Ihrer Verbindung, wie Wolken, die die Sonne verdecken. Ein helleres Erlebnis erwartet Sie, wenn die Wolken sich auflösen.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">Das Anwendungsupdate schreitet heimlich voran, wie neue Schätze, die von den Wellen des Meeres ans Ufer gebracht werden. Diese wertvollen Innovationen werden im Hintergrund für Sie gesammelt.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">While downloading the update file, we discovered a crack in the path, and this journey has come to an end for now. Continue your journey with the current version because a stronger update awaits when these cracks are repaired.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">The application is already with you, like the latest page of a book, in its most up-to-date and innovative form. Here to provide you with the best and most current experience at all times.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">We are on the threshold of a dream where update files cannot be accessed. But you can continue to live your dream using the current version.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">The selected update channel is like a silent forest. There are currently no new update information here. Continue your journey with the current version because when this silence is broken, we will offer you more.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">While attempting to extract the update file, we encountered an obstacle from the depths of the sea. For now, continue your journey with the current version, as we will return to find new treasures when the seas are calmer.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">Weakness in your connection, like clouds obscuring the sun. A brighter experience awaits you when the clouds clear.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">Application update is progressing stealthily, like new treasures brought by the waves of the sea to the shore. These valuable innovations are being gathered for you in the background.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">Mientras descargábamos el archivo de actualización, descubrimos una grieta en el camino y este viaje ha llegado a su fin por ahora. Continúa tu viaje con la versión actual porque una actualización más sólida te espera cuando estas grietas se reparen.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">La aplicación ya está contigo, como la página más nueva de un libro, en su forma más actual e innovadora. Aquí para ofrecerte en todo momento la mejor y más actualizada experiencia.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">Estamos al borde de un sueño en el que no se puede acceder a los archivos de actualización. Sin embargo, puedes seguir viviendo tu sueño con la versión actual.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">El canal de actualización seleccionado es como un bosque silencioso. Actualmente no hay nueva información de actualización aquí. Continúa tu viaje con la versión actual, porque cuando se rompa este silencio, te ofreceremos más.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">Mientras intentábamos extraer el archivo de actualización, encontramos un obstáculo desde las profundidades del mar. Por ahora, continúa tu viaje con la versión actual, ya que volveremos para encontrar nuevos tesoros cuando los mares estén más tranquilos.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">La debilidad de tu conexión, como nubes que ocultan el sol. Cuando las nubes se dispersen, te espera una experiencia más brillante.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">La actualización de la aplicación avanza sigilosamente, como nuevos tesoros que las olas del mar traen a la orilla. Estas valiosas novedades se están recopilando en segundo plano para ti.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">En téléchargeant le fichier de mise à jour, nous avons découvert une fissure dans le chemin, et ce voyage s'est terminé pour l'instant. Continuez votre voyage avec la version actuelle car une mise à jour plus solide vous attend lorsque ces fissures seront réparées.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">L'application est déjà avec vous, telle que la page la plus récente d'un livre, dans sa forme la plus actuelle et innovante. Ici pour vous offrir en tout temps la meilleure et la plus actuelle expérience.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">Nous sommes au bord d'un rêve où les fichiers de mise à jour ne sont pas accessibles. Cependant, vous pouvez continuer à vivre votre rêve avec la version actuelle.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">Le canal de mise à jour sélectionné est comme une forêt silencieuse. Il n'y a actuellement aucune nouvelle information de mise à jour ici. Poursuivez votre voyage avec la version actuelle, car lorsque ce silence sera rompu, nous vous offrirons plus.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">En tentant d'extraire le fichier de mise à jour, nous avons rencontré un obstacle venu des profondeurs de la mer. Pour l'instant, poursuivez votre voyage avec la version actuelle, car nous reviendrons pour trouver de nouveaux trésors lorsque les mers seront plus calmes.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">La faiblesse de votre connexion, comme des nuages cachant le soleil. Lorsque les nuages se dispersent, une expérience plus lumineuse vous attendra.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">La mise à jour de l'application avance sournoisement, comme de nouveaux trésors que les vagues de la mer apportent sur le rivage. Ces précieuses nouveautés sont collectées en arrière-plan pour vous.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">Podczas pobierania pliku aktualizacji odkryliśmy pęknięcie na ścieżce, a ta podróż na razie dobiegła końca. Kontynuuj swoją podróż z obecną wersją, ponieważ na ciebie czeka mocniejsza aktualizacja, gdy te pęknięcia zostaną naprawione.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">Aplikacja jest już z Tobą, podobnie jak najnowsza strona książki, w jej najnowszej i innowacyjnej formie. Tutaj, aby w każdej chwili zapewnić Ci najlepsze i najnowsze doświadczenie.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">Stojąc na progu snu, w którym nie można uzyskać dostępu do plików aktualizacji. Niemniej jednak możesz kontynuować życie swojego snu za pomocą obecnej wersji.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">Wybrany kanał aktualizacji jest jak cichy las. Obecnie nie ma tutaj nowych informacji o aktualizacjach. Kontynuuj swoją podróż z obecną wersją, ponieważ kiedy ta cisza zostanie przerwana, zaoferujemy Ci więcej.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">Podczas próby wyodrębnienia pliku aktualizacji napotkaliśmy przeszkodę ze spodów morza. Na razie kontynuuj podróż z aktualną wersją, ponieważ wrócimy, aby znaleźć nowe skarby, gdy morza staną się spokojniejsze.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">Słabość Twojego połączenia, jak chmury zakrywające słońce. Kiedy chmury się rozeszły, czeka Cię jaśniejsze doświadczenie.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">Aktualizacja aplikacji postępuje podstępnie, podobnie jak nowe skarby przyniesione na brzeg przez fale morza. Te cenne nowości są zbierane w tle dla Ciebie.</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<system:String x:Key="Update.InfoBox.TextMessage.Error">Güncelleme dosyasını indirirken, yolda bir çatlak oluştuğunu ve bu yolculuğun şimdilik sona erdiğini fark ettik. Mevcut sürümle yolculuğunuza devam edin, çünkü bu çatlaklar tamir edildiğinde daha güçlü bir güncelleme sizi bekliyor olacak.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Update">Uygulama, bir kitabın en yeni sayfası gibi zaten en güncel ve yenilikçi haliyle sizinle. Her an en iyi ve en güncel deneyimi yaşatmak için burada.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Status">Güncelleme dosyalarına erişilemeyen bir rüyanın eşiğindeyiz. Ancak mevcut sürümle de rüyanızı yaşamaya devam edebilirsiniz.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Channel">Seçili güncelleme kanalı, bir sessizlik ormanı gibi. Şu an için yeni güncelleme bilgileri burada bulunmuyor. Mevcut sürümle yolculuğunuza devam edin, çünkü bu sessizlik bozulduğunda size daha fazlasını sunacağız.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Extract">Güncelleme dosyasını çıkartmaya çalışırken, denizin derinliklerinden kaynaklanan bir engelle karşılaştık. Şimdilik mevcut sürümle yolculuğunuza devam edin, çünkü denizler daha sakin olduğunda yeni hazineleri bulmak için geri döneceğiz.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Network">Bağlantınızın zayıflığı, bulutların güneşi örtmesi gibi. Bulutlar dağıldığında daha aydınlık bir deneyim sizi bekliyor olacak.</system:String>
<system:String x:Key="Update.InfoBox.TextMessage.Updating">Uygulama güncellemesi, denizin dalgalarının kıyıya getirdiği yeni hazineler gibi sinsi bir şekilde ilerliyor. Bu değerli yenilikler, arkaplanda sizin için toplanıyor.</system:String>
Expand Down
99 changes: 56 additions & 43 deletions src/Update/Sucrose.Update/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using SMMI = Sucrose.Manager.Manage.Internal;
using SMMM = Sucrose.Manager.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;
using SSCHA = Sucrose.Shared.Core.Helper.Architecture;
using SSCHF = Sucrose.Shared.Core.Helper.Framework;
Expand Down Expand Up @@ -217,73 +218,85 @@ protected async void Configure()

if (Releases.Any())
{
SSIIR Release = Releases.First();
SSIIR Release = Release = Releases.FirstOrDefault();

Version Current = new(SSCHV.GetText());
Version Latest = SHV.Clear(Release.TagName);
if (SUMM.ChannelType == SSCECT.Release)
{
Release = Releases.FirstOrDefault(Releasing => !Releasing.PreRelease);
}

if (SHV.Compare(Current, Latest) == SEVT.Latest)
if (Release == null)
{
Info(SSDEUT.Channel);
}
else
{
List<SSIIA> Assets = Release.Assets;
Version Current = new(SSCHV.GetText());
Version Latest = SHV.Clear(Release.TagName);

if (Assets.Any())
if (SHV.Compare(Current, Latest) == SEVT.Latest)
{
foreach (SSIIA Asset in Assets)
{
string Name = $"{SMR.AppName}_{SMR.Bundle}_{SSCHF.GetDescription()}_{SSCHA.Get()}_{Latest}{SSCHU.GetDescription(SUMI.UpdateType)}";
List<SSIIA> Assets = Release.Assets;

string[] Required =
{
SSCHU.GetDescription(SUMI.UpdateType),
SSCHF.GetDescription(),
SSCHA.GetText(),
$"{Latest}",
SMR.AppName,
SMR.Bundle
};

if (Asset.Name.Contains(Name) && Required.All(Asset.Name.Contains))
if (Assets.Any())
{
foreach (SSIIA Asset in Assets)
{
Info(SSDEUT.Updating);
string Name = $"{SMR.AppName}_{SMR.Bundle}_{SSCHF.GetDescription()}_{SSCHA.Get()}_{Latest}{SSCHU.GetDescription(SUMI.UpdateType)}";

SUMI.Source = Asset.BrowserDownloadUrl;
string[] Required =
{
SSCHU.GetDescription(SUMI.UpdateType),
SSCHF.GetDescription(),
SSCHA.GetText(),
$"{Latest}",
SMR.AppName,
SMR.Bundle
};

if (Asset.Name.Contains(Name) && Required.All(Asset.Name.Contains))
{
Info(SSDEUT.Updating);

Bundle = Path.Combine(SUMM.CachePath, Path.GetFileName(SUMI.Source));
SUMI.Source = Asset.BrowserDownloadUrl;

if (File.Exists(Bundle))
{
File.Delete(Bundle);
}
Bundle = Path.Combine(SUMM.CachePath, Path.GetFileName(SUMI.Source));

if (File.Exists(Bundle))
{
File.Delete(Bundle);
}

UpdateLimit();
UpdateLimit();

SUMI.DownloadService = new(SUMI.DownloadConfiguration);
SUMI.DownloadService = new(SUMI.DownloadConfiguration);

SUMI.DownloadService.DownloadStarted += OnDownloadStarted;
SUMI.DownloadService.DownloadFileCompleted += OnDownloadFileCompleted;
SUMI.DownloadService.DownloadProgressChanged += OnDownloadProgressChanged;
SUMI.DownloadService.ChunkDownloadProgressChanged += OnChunkDownloadProgressChanged;
SUMI.DownloadService.DownloadStarted += OnDownloadStarted;
SUMI.DownloadService.DownloadFileCompleted += OnDownloadFileCompleted;
SUMI.DownloadService.DownloadProgressChanged += OnDownloadProgressChanged;
SUMI.DownloadService.ChunkDownloadProgressChanged += OnChunkDownloadProgressChanged;

await SUMI.DownloadService.DownloadFileTaskAsync(SUMI.Source, Bundle);
await SUMI.DownloadService.DownloadFileTaskAsync(SUMI.Source, Bundle);

break;
break;
}
}
}

if (string.IsNullOrEmpty(Bundle))
if (string.IsNullOrEmpty(Bundle))
{
Info(SSDEUT.Condition);
}
}
else
{
Info(SSDEUT.Condition);
Info(SSDEUT.Empty);
}
}
else
{
Info(SSDEUT.Empty);
Info(SSDEUT.Update);
}
}
else
{
Info(SSDEUT.Update);
}
}
else
{
Expand Down
Binary file added src/Update/Sucrose.Update/Assets/Icon/Lost.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Update/Sucrose.Update/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSCECT = Sucrose.Shared.Core.Enum.ChannelType;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;

namespace Sucrose.Update.Manage
Expand All @@ -11,6 +12,8 @@ internal static class Manager
{
public static string CachePath => Path.Combine(SMR.AppDataPath, SMR.AppName, SMR.CacheFolder, SMR.Bundle);

public static SSCECT ChannelType => SMMI.UpdateSettingManager.GetSetting(SMC.ChannelType, SSCECT.Release);

public static SEWTT ThemeType => SMMI.GeneralSettingManager.GetSetting(SMC.ThemeType, SWHWT.GetTheme());
}
}
Loading

0 comments on commit 9000a81

Please sign in to comment.