Skip to content

Commit

Permalink
2.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
natsurainko committed Feb 19, 2023
1 parent 6b41d28 commit 033753f
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
MainPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_x64.msix
SymbolPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0\Natsurainko.FluentLauncher (Package)_2.1.3.0_x64.appxsym
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-ru.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-zh-hans.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-zh-hant.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-100.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-125.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-150.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-400.msix
MainPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_x64.msix
SymbolPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0\Natsurainko.FluentLauncher (Package)_2.1.4.0_x64.appxsym
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-ru.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-zh-hans.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-zh-hant.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-100.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-125.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-150.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Upload\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-400.msix
18 changes: 9 additions & 9 deletions Natsurainko.FluentLauncher (Package)/BundleArtifacts/x64.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
MainPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_x64.msix
SymbolPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\obj\x64\Release\Symbols\Natsurainko.FluentLauncher (Package)_2.1.3.0_x64.appxsym
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-ru.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-zh-hans.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_language-zh-hant.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-100.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-125.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-150.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.3.0_scale-400.msix
MainPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_x64.msix
SymbolPackage=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\obj\x64\Release\Symbols\Natsurainko.FluentLauncher (Package)_2.1.4.0_x64.appxsym
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-ru.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-zh-hans.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_language-zh-hant.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-100.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-125.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-150.msix
ResourcePack=D:\Git\fluentlauncher-preview-edition\Natsurainko.FluentLauncher (Package)\bin\x64\Release\Natsurainko.FluentLauncher (Package)_2.1.4.0_scale-400.msix
4 changes: 2 additions & 2 deletions Natsurainko.FluentLauncher (Package)/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="26553XcubeStudio.Natsurianko.FluentLauncher"
Publisher="CN=053EFB0E-6705-4A11-94B9-980C4C9E0047"
Version="2.1.3.0" />
Version="2.1.4.0" />

<Properties>
<DisplayName>Natsurianko.FluentLauncher</DisplayName>
Expand All @@ -34,7 +34,7 @@
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Natsurainko.FluentLauncher"
DisplayName="Fluent Launcher"
Description="Natsurainko.FluentLauncher"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Automation.Provider;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.Xaml.Interactivity;
using Windows.Foundation.Collections;

namespace Natsurainko.FluentLauncher.Behaviors;

class SetComboBoxWidthFromItemsBehavior : Behavior<ComboBox>
{
public static readonly DependencyProperty SetComboBoxWidthFromItemsProperty =
DependencyProperty.RegisterAttached
(
"SetComboBoxWidthFromItems",
typeof(bool),
typeof(SetComboBoxWidthFromItemsBehavior),
new PropertyMetadata(false, OnSetComboBoxWidthFromItemsPropertyChanged)
);

public bool SetComboBoxWidthFromItems
{
get => (bool)GetValue(SetComboBoxWidthFromItemsProperty);
set => SetValue(SetComboBoxWidthFromItemsProperty, value);
}

protected override void OnAttached()
{
AssociatedObject.Loaded += OnComboBoxLoaded;
AssociatedObject.Items.VectorChanged += Items_VectorChanged;
}

public void Items_VectorChanged(IObservableVector<object> sender, IVectorChangedEventArgs e)
{
SetComboBoxWidth(AssociatedObject);
}

private static void OnComboBoxLoaded(object sender, RoutedEventArgs e)
{
SetComboBoxWidth((ComboBox)sender);
}

private static void OnSetComboBoxWidthFromItemsPropertyChanged(
DependencyObject dpo,
DependencyPropertyChangedEventArgs e)
{
SetComboBoxWidthFromItemsBehavior behavior = (SetComboBoxWidthFromItemsBehavior)dpo;
ComboBox comboBox = behavior.AssociatedObject;

bool newValue = (bool)e.NewValue;
bool oldValue = (bool)e.OldValue;

if (comboBox != null && newValue != oldValue)
{
if (newValue == true)
{
comboBox.Loaded += OnComboBoxLoaded;
comboBox.Items.VectorChanged += behavior.Items_VectorChanged;

}
else
{
comboBox.Loaded -= OnComboBoxLoaded;
comboBox.Items.VectorChanged -= behavior.Items_VectorChanged;
}
}
}

/// <summary>
/// Set the width of a ComboBox to the longest item in its drop down menu
/// </summary>
/// <param name="comboBox">Target</param>
private static void SetComboBoxWidth(ComboBox comboBox)
{
// Open ComboBox drop down and prepare ItemContainerGenerator
comboBox.IsDropDownOpen = true;
comboBox.ItemContainerGenerator.StartAt(new GeneratorPosition(0, 0), GeneratorDirection.Forward, true);

double maxWidth = 0;
ComboBoxItem? item;
while ((item = comboBox.ItemContainerGenerator.GenerateNext(out _) as ComboBoxItem) != null)
{
item.Measure(new Windows.Foundation.Size(double.PositiveInfinity, double.PositiveInfinity));
var size = item.DesiredSize;
if (size.Width > maxWidth)
{
maxWidth = size.Width;
}
}

maxWidth += 20; // This constant adds more space to include the drop down button and paddings
comboBox.Width = maxWidth > 70 ? maxWidth : 70; // Ensures a MinWidth of 70 when there is no content; Less width will result in issues with appearance
comboBox.ItemContainerGenerator.Stop();
comboBox.IsDropDownOpen = false;
}
}
11 changes: 2 additions & 9 deletions Natsurainko.FluentLauncher/Models/LaunchArrangement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
using WinUIEx;
using GameCore = Natsurainko.FluentLauncher.Components.FluentCore.GameCore;
using GameCoreLocator = Natsurainko.FluentLauncher.Components.FluentCore.GameCoreLocator;
Expand Down Expand Up @@ -182,15 +183,7 @@ public static void StartNew(GameCore core)
#if MICROSOFT_WINDOWSAPPSDK_SELFCONTAINED
var authlibPath = Path.Combine(Directory.GetCurrentDirectory(), "Assets", "Libs", "authlib-injector-1.2.1.jar");
#else
var authlibPath = Path.Combine(App.StoragePath, "Libraries", "authlib-injector-1.2.1.jar");
if (!File.Exists(authlibPath))
{
if (!Directory.Exists(Path.Combine(App.StoragePath, "Libraries")))
Directory.CreateDirectory(Path.Combine(App.StoragePath, "Libraries"));
File.Copy(Path.Combine(Package.Current.InstalledPath, "Natsurainko.FluentLauncher", "Assets", "Libs", "authlib-injector-1.2.1.jar"), authlibPath);
}
var authlibPath = (await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Libs/authlib-injector-1.2.1.jar"))).Path;
#endif
await foreach (var args in ((YggdrasilAccount)arrangement.LaunchSetting.Account).GetAuthlibArgumentsAsync(authlibPath))
arrangement.LaunchSetting.JvmSetting.AdvancedArguments.Add(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding CancelClickCommand}"
Foreground="Black"
Style="{ThemeResource AlternateCloseButtonStyle}" />
</Grid>
</ContentDialog>
1 change: 0 additions & 1 deletion Natsurainko.FluentLauncher/Views/Pages/Guides/Account.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
</Grid.ColumnDefinitions>
<ComboBox
HorizontalAlignment="Stretch"
FlowDirection="RightToLeft"
ItemsSource="{Binding Accounts}"
SelectedItem="{Binding CurrentAccount, Mode=TwoWay}">
<ComboBox.ItemTemplate>
Expand Down
2 changes: 0 additions & 2 deletions Natsurainko.FluentLauncher/Views/Pages/Guides/Basic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
</Grid.ColumnDefinitions>
<ComboBox
HorizontalAlignment="Stretch"
FlowDirection="RightToLeft"
ItemsSource="{Binding GameFolders}"
SelectedItem="{Binding CurrentGameFolder, Mode=TwoWay}">
<ComboBox.ItemTemplate>
Expand Down Expand Up @@ -105,7 +104,6 @@
</Grid.ColumnDefinitions>
<ComboBox
HorizontalAlignment="Stretch"
FlowDirection="RightToLeft"
IsDropDownOpen="{Binding DropOpen, Mode=TwoWay}"
ItemsSource="{Binding JavaRuntimes}"
SelectedItem="{Binding CurrentJavaRuntime, Mode=TwoWay}">
Expand Down
17 changes: 13 additions & 4 deletions Natsurainko.FluentLauncher/Views/Pages/Settings/Launch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:behaviors="using:Natsurainko.FluentLauncher.Behaviors"
xmlns:controls="using:Natsurainko.FluentLauncher.UserControls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:Natsurainko.FluentLauncher.Views.Pages.Settings"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.Pages.Settings"
Expand Down Expand Up @@ -41,19 +43,23 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="15" />
<ColumnDefinition Width="1*" />
<ColumnDefinition x:Name="container1" Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock
x:Uid="Settings_Launch_Item_1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="Current .minecraft folder:" />
<ComboBox
Grid.Column="2"
MaxWidth="{Binding ElementName=container1, Path=ActualWidth, Mode=OneTime}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FlowDirection="RightToLeft"
ItemsSource="{Binding GameFolders}"
SelectedItem="{Binding CurrentGameFolder, Mode=TwoWay}">
<i:Interaction.Behaviors>
<behaviors:SetComboBoxWidthFromItemsBehavior SetComboBoxWidthFromItems="True" />
</i:Interaction.Behaviors>
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="x:String">
<TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis" />
Expand Down Expand Up @@ -141,19 +147,22 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="15" />
<ColumnDefinition Width="1*" />
<ColumnDefinition x:Name="container2" Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock
x:Uid="Settings_Launch_Item_4"
VerticalAlignment="Center"
Text="Current Java runtime:" />
<ComboBox
Grid.Column="2"
MaxWidth="{Binding ElementName=container2, Path=ActualWidth, Mode=OneTime}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FlowDirection="RightToLeft"
ItemsSource="{Binding JavaRuntimes}"
SelectedItem="{Binding CurrentJavaRuntime, Mode=TwoWay}">
<i:Interaction.Behaviors>
<behaviors:SetComboBoxWidthFromItemsBehavior SetComboBoxWidthFromItems="True" />
</i:Interaction.Behaviors>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock TextTrimming="CharacterEllipsis">
Expand Down

0 comments on commit 033753f

Please sign in to comment.