Skip to content

Commit adb5f54

Browse files
committed
release: Remove package streaming feature.
1 parent 2ae0d1f commit adb5f54

File tree

5 files changed

+6
-26
lines changed

5 files changed

+6
-26
lines changed

src/Flarial.Launcher/Management/AppSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ sealed class AppSettings
1010
[DataMember]
1111
internal bool AutomaticUpdates { get; set; } = true;
1212

13-
[DataMember]
14-
internal bool DownloadVersions { get; set; } = false;
15-
1613
[DataMember]
1714
internal bool WaitForInitialization { get; set; } = true;
1815

@@ -27,7 +24,6 @@ void OnDeserializing(StreamingContext context)
2724
{
2825
UseCustomDll = false;
2926
AutomaticUpdates = true;
30-
DownloadVersions = false;
3127
CustomDllPath = string.Empty;
3228
WaitForInitialization = true;
3329
}

src/Flarial.Launcher/Pages/SettingsPage.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ sealed class SettingsPage : Grid
1919
OffContent = "No, ask before updating."
2020
};
2121

22-
readonly ToggleSwitch _downloadVersions = new()
23-
{
24-
Header = "Should the launcher download first then install a version?",
25-
VerticalAlignment = VerticalAlignment.Stretch,
26-
HorizontalAlignment = HorizontalAlignment.Stretch,
27-
OnContent = "Yes, download first then install.",
28-
OffContent = "No, download & install at once."
29-
};
30-
3122
readonly ToggleSwitch _waitForInitialization = new()
3223
{
3324
Header = "Should the launcher wait for the game to initialize?",
@@ -41,7 +32,6 @@ void OnToggleSwitchToggled(object sender, RoutedEventArgs args)
4132
{
4233
var value = ((ToggleSwitch)sender).IsOn;
4334
if (ReferenceEquals(_automaticUpdates, sender)) _settings.AutomaticUpdates = value;
44-
else if (ReferenceEquals(_downloadVersions, sender)) _settings.DownloadVersions = value;
4535
else if (ReferenceEquals(_waitForInitialization, sender)) _settings.WaitForInitialization = value;
4636
}
4737

@@ -69,7 +59,6 @@ internal SettingsPage(AppSettings settings)
6959
SetColumn(folderButtonsBox, 0);
7060

7161
stackPanel.Children.Add(_automaticUpdates);
72-
stackPanel.Children.Add(_downloadVersions);
7362
stackPanel.Children.Add(_waitForInitialization);
7463
stackPanel.Children.Add(new DllSelectionBox(settings));
7564

@@ -78,10 +67,8 @@ internal SettingsPage(AppSettings settings)
7867

7968
_automaticUpdates.Toggled += OnToggleSwitchToggled;
8069
_waitForInitialization.Toggled += OnToggleSwitchToggled;
81-
_downloadVersions.Toggled += OnToggleSwitchToggled;
8270

8371
_automaticUpdates.IsOn = _settings.AutomaticUpdates;
84-
_downloadVersions.IsOn = _settings.DownloadVersions;
8572
_waitForInitialization.IsOn = _settings.WaitForInitialization;
8673
}
8774
}

src/Flarial.Launcher/Pages/VersionsPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async void OnButtonClick(object sender, RoutedEventArgs args)
8080
_item = (VersionItem)_listBox.SelectedItem;
8181
_listBox.ScrollIntoView(_item);
8282

83-
await _item.InstallAsync(_settings.DownloadVersions, OnVersionItemInstallAsync);
83+
await _item.InstallAsync(OnVersionItemInstallAsync);
8484
}
8585
finally
8686
{

src/Flarial.Runtime/Versions/GDKVersionItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ protected override async Task<string> GetUriAsync()
8383
throw new InvalidOperationException();
8484
}
8585

86-
public override async Task InstallAsync(bool download, Action<int, bool> callback)
86+
public override async Task InstallAsync(Action<int, bool> callback)
8787
{
8888
if (!Minecraft.IsGamingServicesInstalled)
8989
throw new Win32Exception((int)ERROR_INSTALL_PREREQUISITE_FAILED);
9090

91-
await base.InstallAsync(download, callback);
91+
await base.InstallAsync(callback);
9292
var path = Path.Combine(Minecraft.Package.InstalledPath, "gamelaunchhelper.dll");
9393

9494
using var stream = File.Create(path);

src/Flarial.Runtime/Versions/VersionItem.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal static string Stringify(string version)
2727
return key._minor >= 26 ? $"{key._minor}.{key._build}" : version;
2828
}
2929

30-
public virtual async Task InstallAsync(bool download, Action<int, bool> callback)
30+
public virtual async Task InstallAsync(Action<int, bool> callback)
3131
{
3232
if (!Minecraft.IsInstalled)
3333
throw new Win32Exception((int)ERROR_INSTALL_PACKAGE_NOT_FOUND);
@@ -38,11 +38,8 @@ public virtual async Task InstallAsync(bool download, Action<int, bool> callback
3838
var path = Path.Combine(s_path, Path.GetRandomFileName());
3939
try
4040
{
41-
var downloadUri = await GetUriAsync();
42-
Uri appUri = new(download ? path : downloadUri);
43-
44-
if (download) await HttpStack.DownloadAsync(downloadUri, path, _ => callback(_, false));
45-
await Task.Run(() => AppManager.Add(appUri, _ => callback(_, true)));
41+
await HttpStack.DownloadAsync(await GetUriAsync(), path, _ => callback(_, false));
42+
await Task.Run(() => AppManager.Add(new(path), _ => callback(_, true)));
4643
}
4744
finally
4845
{

0 commit comments

Comments
 (0)