Skip to content

Commit

Permalink
push code
Browse files Browse the repository at this point in the history
  • Loading branch information
JurijDev2 committed Jun 4, 2023
1 parent aeefd71 commit aa4b432
Show file tree
Hide file tree
Showing 29 changed files with 600 additions and 33 deletions.
12 changes: 12 additions & 0 deletions MinecraftLauncherUniversal/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using MinecraftLauncherUniversal.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -33,6 +34,17 @@ public partial class App : Application
public App()
{
this.InitializeComponent();

Settings.GetSettings();
string text = File.ReadAllText(Settings.ThemeConfig);
if (text.Contains("1"))
{
App.Current.RequestedTheme = ApplicationTheme.Dark;
}
else if (text.Contains("0"))
{
App.Current.RequestedTheme = ApplicationTheme.Light;
}
}

/// <summary>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MinecraftLauncherUniversal/Assets/StevePfp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MinecraftLauncherUniversal/Assets/banner-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MinecraftLauncherUniversal/Assets/banner-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MinecraftLauncherUniversal/Assets/banner-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MinecraftLauncherUniversal/Assets/demo-1.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion MinecraftLauncherUniversal/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ namespace MinecraftLauncherUniversal
{
public class Globals
{
public static int Theme = 0;
public static int Theme = 1;
public static int DownloadRateLimit = 1024;
public static bool bIsFirstTimeRun = false;
public static List<string> Recents = new List<string>();

public static ElementSoundPlayerState SoundPlayerState;

public static string CurrentVersion { get; set; }

Expand Down
12 changes: 10 additions & 2 deletions MinecraftLauncherUniversal/Helpers/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void CreateSettings()

using (StreamWriter sw = File.CreateText(ThemeConfig))
{
//sw.Write(Wpf.Ui.Appearance.Theme.GetSystemTheme().ToString());
sw.Write(1);
sw.Close();
}

Expand All @@ -45,8 +45,16 @@ public static void GetSettings()
Globals.bIsFirstTimeRun = true;
}

string theme = File.ReadAllText(ThemeConfig);
Globals.Theme = Convert.ToInt32(theme);

string Username = File.ReadAllText(UsernameConfig);
Globals.Username = Username;

foreach (var item in File.ReadAllLines(RecentBuilds))
{
Globals.Recents.Add(item);
}
}

public static void ResetSettings()
Expand All @@ -69,7 +77,7 @@ public static void SaveNewTheme()
File.Delete(ThemeConfig);
using (StreamWriter sw = File.CreateText(ThemeConfig))
{
//sw.Write(Globals.UserTheme.ToString());
sw.Write(Globals.Theme.ToString());
sw.Close();
}
}
Expand Down
5 changes: 5 additions & 0 deletions MinecraftLauncherUniversal/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@
</NavigationViewItem>
</NavigationView.MenuItems>
<NavigationView.FooterMenuItems>
<NavigationViewItem Content="About">
<NavigationViewItem.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE779;"/>
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationView.FooterMenuItems>
<Frame x:Name="RootFrame" Margin="0,0,0,0"
>
Expand Down
3 changes: 3 additions & 0 deletions MinecraftLauncherUniversal/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public MainWindow()
MainNavigation.SelectedItem = HomeItem;
RootFrame.Navigate(typeof(HomePage));
NavigationService.UpdateBreadcrumb("Home", true);
MainNavigation.PaneTitle = Globals.Username;
}

private void MainNavigation_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
Expand Down Expand Up @@ -83,6 +84,8 @@ private void MainNavigation_ItemInvoked(NavigationView sender, NavigationViewIte
RootFrame.Navigate(typeof(AboutPage));
NavigationService.UpdateBreadcrumb("About", true);
}

sender.PaneTitle = Globals.Username;
}

private void MainBreadcrumb_ItemClicked(BreadcrumbBar sender, BreadcrumbBarItemClickedEventArgs args)
Expand Down
27 changes: 27 additions & 0 deletions MinecraftLauncherUniversal/MinecraftLauncherUniversal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,33 @@
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<Content Update="Assets\1.17.1-banner.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\banner-2.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\banner-3.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\banner-4.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\banner-5.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\banner-img1.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\demo-1.0.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\playBanner.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\StevePfp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\thumb.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
26 changes: 24 additions & 2 deletions MinecraftLauncherUniversal/Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,29 @@
mc:Ignorable="d"
Background="Transparent">

<Grid>

<Grid Margin="58, 42, 58,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Expander HorizontalAlignment="Stretch" Grid.Row="1" x:Name="GameSettingsExpander" HorizontalContentAlignment="Stretch">
<Expander.Header>
<StackPanel Margin="8" CornerRadius="8">
<TextBlock Text="MinecraftLauncher" FontSize="15"/>
<TextBlock Text="by Jurij15" FontSize="12" Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
</StackPanel>
</Expander.Header>
<StackPanel>
<TextBlock FontWeight="Normal" FontSize="15" x:Name="VersionBox"/>
</StackPanel>
</Expander>
</Grid>
</Page>
2 changes: 2 additions & 0 deletions MinecraftLauncherUniversal/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public sealed partial class AboutPage : Page
public AboutPage()
{
this.InitializeComponent();

VersionBox.Text = "Version " + Globals.VersionString;
}
}
}
1 change: 0 additions & 1 deletion MinecraftLauncherUniversal/Pages/AllVersionsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<CheckBox x:Name="ReleasesOnly" Content="Releases Only" Unchecked="ReleasesOnly_Unchecked" Checked="ReleasesOnly_Checked"/>
<CheckBox x:Name="OptiFineOnly" Content="OptiFine Only" Unchecked="OptiFineOnly_Unchecked" Checked="OptiFineOnly_Checked"/>
</StackPanel>
</Grid>
<TextBlock Text="Total Versions: " x:Name="TotalCountBlock" Foreground="{ThemeResource TextFillColorTertiaryBrush}" VerticalAlignment="Bottom" Grid.Row="1"/>
Expand Down
80 changes: 59 additions & 21 deletions MinecraftLauncherUniversal/Pages/AllVersionsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ public void CreateCard(string VersionName)
ItemsPanel.ItemsSource = items;
}

public AllVersionsPage()
void LoadAllReleasesOnly()
{
this.InitializeComponent();


List<string> items = new List<string>();
foreach (var item in VersionsHelper.GetAllVersions())
{
Expand All @@ -79,6 +76,62 @@ public AllVersionsPage()
ReleasesOnly.IsChecked = true;
}

void LoadInstalledReleasesOnly()
{
List<string> items = new List<string>();
foreach (var item in VersionsHelper.GetAllVersions())
{
items.Add(item);
}
if (items.Count == 0)
{
HyperlinkButton refreshbtn = new HyperlinkButton();
refreshbtn.Click += Refreshbtn_Click;
ItemsPanel.Items.Add(refreshbtn);
}
foreach (var item in VersionsHelper.GetAllVersions())
{
if (VersionsHelper.bIsReleaseVersion(item))
{
if (VersionsHelper.bIsVersionInstalled(item))
{
CreateCard(item);
}
}
}

AllSortRadio.IsChecked = false;
ReleasesOnly.IsChecked = true;
}

void LoadAll()
{
List<string> items = new List<string>();
foreach (var item in VersionsHelper.GetAllVersions())
{
items.Add(item);
}
if (items.Count == 0)
{
HyperlinkButton refreshbtn = new HyperlinkButton();
refreshbtn.Click += Refreshbtn_Click;
ItemsPanel.Items.Add(refreshbtn);
}
foreach (var item in VersionsHelper.GetAllVersions())
{
CreateCard(item);
}

AllSortRadio.IsChecked = true;
ReleasesOnly.IsChecked = false;
}

public AllVersionsPage()
{
this.InitializeComponent();
LoadAllReleasesOnly();
}

private void Refreshbtn_Click(object sender, RoutedEventArgs e)
{
List<string> items = new List<string>();
Expand Down Expand Up @@ -128,29 +181,14 @@ private void CardAction_PointerPressed(object sender, PointerRoutedEventArgs e)
NavigationService.NavigateHiearchical(typeof(SelectedVersionPage),"Play "+version, false);
}

private void ViewCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{

}

private void ReleasesOnly_Unchecked(object sender, RoutedEventArgs e)
{

LoadAll();
}

private void ReleasesOnly_Checked(object sender, RoutedEventArgs e)
{

}

private void OptiFineOnly_Unchecked(object sender, RoutedEventArgs e)
{

}

private void OptiFineOnly_Checked(object sender, RoutedEventArgs e)
{

LoadInstalledReleasesOnly();
}

private void ItemsPanel_SizeChanged(object sender, SizeChangedEventArgs e)
Expand Down
Loading

0 comments on commit aa4b432

Please sign in to comment.