Skip to content

Commit

Permalink
Source update
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos4503 committed Mar 24, 2024
1 parent a2a06fe commit b765540
Show file tree
Hide file tree
Showing 262 changed files with 188,886 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// O código foi gerado por uma ferramenta.
// Versão de Tempo de Execução:4.0.30319.42000
//
// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
// o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyTitleAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Gerado pela classe WriteCodeFragment do MSBuild.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d7a4e46ee2a5ba49ceb2f310497ae5a158148679
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0-windows
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = The_Last_Days_Updater
build_property.ProjectDir = D:\Visual-Studio\The Last Days Launcher\Add-Ons\The Last Days Updater\
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// O código foi gerado por uma ferramenta.
// Versão de Tempo de Execução:4.0.30319.42000
//
// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
// o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyTitleAttribute("The Last Days Updater")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Gerado pela classe WriteCodeFragment do MSBuild.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8b15a1572e4283e1fbb3198615982216c8827324
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0-windows
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = The_Last_Days_Updater
build_property.ProjectDir = D:\Visual-Studio\The Last Days Launcher\Add-Ons\The Last Days Updater\
Binary file not shown.
42 changes: 27 additions & 15 deletions The-Last-Days-Source/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,11 @@ private void DoModpackPatch()
//Build a list of unwanted files
List<string> unwantedFiles = new List<string>();
unwantedFiles.Add(".sl_password");
unwantedFiles.Add("icon.png");
unwantedFiles.Add("options.txt");
unwantedFiles.Add("usercache.json");
unwantedFiles.Add("usernamecache.json");
unwantedFiles.Add("local-current-version.txt");
//Build a list of unwanted folders
List<string> unwantedFolders = new List<string>();
Expand Down Expand Up @@ -1125,25 +1128,18 @@ private void FinishPatching()
editNick.Opacity = 1.0f;
editNick.IsHitTestVisible = true;
//Prepare the edit nickname button
editNick.Click += (s, e) =>
{
//Enable the interaction blocker
interactionBlocker.Visibility = Visibility.Visible;
//Open the window of Nickname change
WindowNickChange nickChange = new WindowNickChange(modpackPath);
nickChange.Closed += (s, e) =>
{
interactionBlocker.Visibility = Visibility.Collapsed;
UpdateAccountDisplay();
};
nickChange.Owner = this;
nickChange.Show();
};
editNick.Click += (s, e) => { OpenLoginCredentialsEdit(); };

//Prepare the play button
playButton.Click += (s, e) =>
{
//If don't have a password defined, cancel and open the login credentials edit
if (File.Exists((modpackPath + @"/Game/instances/The Last Days/.minecraft/.sl_password")) == false)
{
OpenLoginCredentialsEdit();
return;
}
//Try to launch the game
try
{
Expand Down Expand Up @@ -1216,6 +1212,22 @@ private void FinishPatching()

//Auxiliar methods

private void OpenLoginCredentialsEdit()
{
//Enable the interaction blocker
interactionBlocker.Visibility = Visibility.Visible;

//Open the window of Nickname change
WindowNickChange nickChange = new WindowNickChange(modpackPath);
nickChange.Closed += (s, e) =>
{
interactionBlocker.Visibility = Visibility.Collapsed;
UpdateAccountDisplay();
};
nickChange.Owner = this;
nickChange.Show();
}

private void ChangeLauncherPage(LauncherPage page)
{
//Disable all buttons
Expand Down
Binary file added The-Last-Days-Source/Resources/hint-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion The-Last-Days-Source/The Last Days Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>The_Last_Days_Launcher</RootNamespace>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyVersion>1.0.1</AssemblyVersion>
<AssemblyVersion>1.3.0</AssemblyVersion>
<ApplicationIcon>Resources\app-icon-32px.ico</ApplicationIcon>
<UseWindowsForms>True</UseWindowsForms>
</PropertyGroup>
Expand Down Expand Up @@ -142,6 +142,7 @@
<None Remove="Resources\docs-load-3.gif" />
<None Remove="Resources\edit-icon.png" />
<None Remove="Resources\github.png" />
<None Remove="Resources\hint-icon.png" />
<None Remove="Resources\link-donate.png" />
<None Remove="Resources\menu-background-footer.png" />
<None Remove="Resources\menu-background.png" />
Expand Down Expand Up @@ -510,6 +511,7 @@
<Resource Include="Resources\docs-load-3.gif" />
<Resource Include="Resources\edit-icon.png" />
<Resource Include="Resources\github.png" />
<Resource Include="Resources\hint-icon.png" />
<Resource Include="Resources\link-donate.png" />
<Resource Include="Resources\menu-background-footer.png" />
<Resource Include="Resources\menu-background.png" />
Expand Down
22 changes: 19 additions & 3 deletions The-Last-Days-Source/WindowNickChange.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@
xmlns:local="clr-namespace:The_Last_Days_Launcher"
xmlns:ValidableTextBox="clr-namespace:TS3_Dream_Launcher.Controls.ValidableTextBox" xmlns:BeautyButton="clr-namespace:TS3_Dream_Launcher.Controls.BeautyButton" x:Class="The_Last_Days_Launcher.WindowNickChange"
mc:Ignorable="d"
Title="Mudar Nome de Usuário" WindowStyle="ToolWindow" Icon="/Resources/mini-icon-32px.png" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="WidthAndHeight" Topmost="True" WindowStartupLocation="CenterScreen">
<Grid Width="324" Height="200">
<ValidableTextBox:ValidableTextBox x:Name="nickname" Margin="16,16,16,0" VerticalAlignment="Top" LabelName="Digite seu novo Nickname..." FontWeight="Normal"/>
Title="Editar Credenciais de Login" WindowStyle="ToolWindow" Icon="/Resources/mini-icon-32px.png" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="WidthAndHeight" Topmost="True" WindowStartupLocation="CenterScreen">
<Grid Width="328" Height="348">
<StackPanel VerticalAlignment="Top" Margin="16,16,16,0">
<ValidableTextBox:ValidableTextBox x:Name="nickname" LabelName="Nome de Usuário" FontWeight="Normal" VerticalAlignment="Top"/>
<ValidableTextBox:ValidableTextBox x:Name="password" LabelName="Senha" FontWeight="Normal" Margin="0,16,0,0"/>
<Grid Margin="0,16,0,0" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Height="20" Width="20" VerticalAlignment="Top" Margin="0,3,0,0">
<Image Source="/Resources/hint-icon.png"/>
</Grid>
<Grid Grid.Column="2" VerticalAlignment="Top">
<TextBlock TextWrapping="Wrap" Text="Esta senha é usada para fazer login automático em servidores multiplayer de The Last Days. Caso você não esteja registrado num servidor de The Last Days, essa senha será usada para te registrar automaticamente no primeiro acesso! É importante guarda-la!" VerticalAlignment="Top" TextAlignment="Justify" FontSize="11" Opacity="0.7"/>
</Grid>
</Grid>
</StackPanel>
<BeautyButton:BeautyButton x:Name="finish" Height="24" Width="128" Padding="0,0,0,2" Background="#FF00A027" BorderBrush="#FF005B16" HoverBackground="#FF00C12F" VerticalAlignment="Bottom" Margin="0,0,0,16" Cursor="Hand" HorizontalAlignment="Center" Content="PRONTO" FontWeight="Bold" Foreground="White" FontFamily="Segoe UI Variable Text Semibold" FontSize="14"/>
</Grid>
</Window>
101 changes: 81 additions & 20 deletions The-Last-Days-Source/WindowNickChange.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
Expand All @@ -22,6 +23,10 @@ namespace The_Last_Days_Launcher

public partial class WindowNickChange : Window
{
//Cache variables
private bool hasErrorInNickname = false;
private bool hasErrorInPassword = false;

//Private variables
private string modpackPath = "";
private AccountsData accountsData = null;
Expand All @@ -47,50 +52,103 @@ private void PrepareTheUI()

//Show the current nickname
nickname.textBox.Text = accountsData.loadedData.accounts[0].profile.name;
//Show the current password, if have the password file
if (File.Exists((modpackPath + @"/Game/instances/The Last Days/.minecraft/.sl_password")) == true)
password.textBox.Text = File.ReadAllText((modpackPath + @"/Game/instances/The Last Days/.minecraft/.sl_password"));

//Prepare the validation rules
//Prepare the validation rules for nickname
nickname.RegisterOnTextChangedValidationCallback((currentInput) =>
{
//Prepare the value to return
string toReturn = "";
//Check if is empty, cancel here
if (currentInput == "")
toReturn = "O campo não pode estar vazio!";
//If is not empty...
if (currentInput != "")
{
//Check if is too long
if (currentInput.Length > 16)
toReturn = "O Nome de Usuário é muito longo.";
//Check if is too short
if (currentInput.Length < 3)
toReturn = "O Nome de Usuário é muito curto.";
//Check if contains spaces
if (currentInput.Contains(" ") == true)
toReturn = "O Nome de Usuário não pode conter espaços";
//Check if have only allowed characters
if (Regex.IsMatch(currentInput, @"^[a-zA-Z0-9_]+$") == false)
toReturn = "O Nome de Usuário só pode conter caracteres de A à Z, de 0 à 9, e underlines.";
}
//Inform error
if (toReturn == "")
hasErrorInNickname = false;
if (toReturn != "")
hasErrorInNickname = true;
//Handle the button availability
HandleTheFinishButtonAvailability();
//Return the value
return toReturn;
});

//Prepare the validation rules for password
password.RegisterOnTextChangedValidationCallback((currentInput) =>
{
//Prepare the value to return
string toReturn = "";
//Check if is empty, cancel here
if (currentInput == "")
toReturn = "O campo não pode estar vazio!";
return toReturn;
//If is not empty...
if (currentInput != "")
{
//Check if is too long
if (currentInput.Length > 32)
toReturn = "A senha está muito longa.";
//Check if is too short
if (currentInput.Length < 8)
toReturn = "A senha está muito curta.";
}
//Check if is too long
if (currentInput.Length > 16)
toReturn = "O Nome de Usuário é muito longo.";
//Check if is too short
if (currentInput.Length < 3)
toReturn = "O Nome de Usuário é muito curto.";
//Check if contains spaces
if (currentInput.Contains(" ") == true)
toReturn = "O Nome de Usuário não pode conter espaços";
//Check if have only allowed characters
if (Regex.IsMatch(currentInput, @"^[a-zA-Z0-9_]+$") == false)
toReturn = "O Nome de Usuário só pode conter caracteres de A à Z, de 0 à 9, e underlines.";
//Disable or enable the finish button
//Inform error
if (toReturn == "")
finish.IsEnabled = true;
hasErrorInPassword = false;
if (toReturn != "")
finish.IsEnabled = false;
hasErrorInPassword = true;
//Handle the button availability
HandleTheFinishButtonAvailability();
//Return the value
return toReturn;
});

//Force first validation of fields
nickname.hasError();
password.hasError();

//Prepare the finish button
finish.Click += (s, e) => { FinishEdit(); };
}

private void HandleTheFinishButtonAvailability()
{
//If have errors, disable the finish button
if (hasErrorInNickname == true || hasErrorInPassword == true)
finish.IsEnabled = false;

//If don't have errors, enable the finish button
if (hasErrorInNickname == false && hasErrorInPassword == false)
finish.IsEnabled = true;
}

private void FinishEdit()
{
//If has erros on field, cancel
if (nickname.hasError() == true)
//If has erros on fields, cancel
if (nickname.hasError() == true || password.hasError() == true)
return;

//Change the username on the "accounts.json" file and save
Expand All @@ -104,6 +162,9 @@ private void FinishEdit()
//Save the nickname change
accountsData.Save();

//Save the password
File.WriteAllText((modpackPath + @"/Game/instances/The Last Days/.minecraft/.sl_password"), password.textBox.Text);

//Close this window
this.Close();
}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8BFD50D350D47445B57BB1D61BBDE41CEDA7AC43DC81FCE95BF1AC646D97D2A0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"description" : "AutoLaunch Protocols Preregistration",
"name" : "Protocol Preregistration",
"version" : "1.0.0.8"
}
Loading

0 comments on commit b765540

Please sign in to comment.