Skip to content

Commit

Permalink
Release 1.4.20230329.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BuIlDaLiBlE committed Mar 29, 2023
1 parent 7c39fee commit a54a283
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 74 deletions.
16 changes: 8 additions & 8 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace BetterHI3Launcher
{
public partial class App : Application
{
public static readonly LauncherVersion LocalLauncherVersion = new LauncherVersion("1.4.20230113.0");
public static readonly LauncherVersion LocalLauncherVersion = new LauncherVersion("1.4.20230329.0");
public static readonly string LauncherRootPath = AppDomain.CurrentDomain.BaseDirectory;
public static readonly string LocalLowPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}Low";
public static readonly string LauncherDataPath = Path.Combine(LocalLowPath, @"Bp\Better HI3 Launcher");
Expand Down
Binary file added Assets/Images/GitHubREADME.webp
Binary file not shown.
16 changes: 7 additions & 9 deletions BetterHI3Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>BetterHI3Launcher</RootNamespace>
<AssemblyName>BetterHI3Launcher</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -141,9 +141,7 @@
<Compile Include="Utility\Hi3Helper.Http\Class\Session\Session.cs" />
<Compile Include="Utility\Hi3Helper.Http\Class\Session\SessionManager.cs" />
<Compile Include="Utility\Hi3Helper.Http\Class\Session\SessionMerge.cs" />
<Compile Include="Utility\Hi3Helper.Http\Class\Session\SessionMetadata.cs" />
<Compile Include="Utility\Hi3Helper.Http\Class\Session\SessionTask.cs" />
<Compile Include="Utility\Hi3Helper.Http\Class\Session\SessionVerification.cs" />
<Compile Include="Utility\Hi3Helper.Http\Http.cs" />
<Compile Include="Utility\Hi3Helper.Http\HttpMulti.cs" />
<Compile Include="Utility\Hi3Helper.EncTool\mhyEncTool.cs" />
Expand Down Expand Up @@ -263,19 +261,19 @@
<Version>2.5.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.Platforms">
<Version>7.0.0</Version>
<Version>7.0.1</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.2</Version>
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="SharpCompress">
<Version>0.32.2</Version>
<Version>0.33.0</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.DiagnosticSource">
<Version>6.0.0</Version>
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="System.Globalization.Calendars">
<Version>4.3.0</Version>
Expand Down Expand Up @@ -305,7 +303,7 @@
<Version>4.3.2</Version>
</PackageReference>
<PackageReference Include="System.Text.Encoding.CodePages">
<Version>6.0.0</Version>
<Version>7.0.0</Version>
</PackageReference>
<PackageReference Include="System.Xml.ReaderWriter">
<Version>4.3.1</Version>
Expand All @@ -317,7 +315,7 @@
<Version>1.1.1</Version>
</PackageReference>
<PackageReference Include="XamlAnimatedGif">
<Version>2.1.0</Version>
<Version>2.1.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
17 changes: 8 additions & 9 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void ToggleUI(bool val)
LaunchButton.IsEnabled = val;
OptionsButton.IsEnabled = val;
ServerDropdown.IsEnabled = val;
if(Server != HI3Server.GLB && Server != HI3Server.SEA && Server != HI3Server.CN)
if(Server != HI3Server.GLB && Server != HI3Server.SEA)
{
MirrorDropdown.IsEnabled = false;
}
Expand Down Expand Up @@ -102,6 +102,7 @@ void ToggleProgressBar(bool val)
ProgressBar.IsIndeterminate = false;
ToggleLog(true);
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error;
FlashMainWindow();
break;
case LauncherStatus.CheckingUpdates:
ProgressText.Text = App.TextStrings["progresstext_checking_update"];
Expand Down Expand Up @@ -402,6 +403,9 @@ public MainWindow()
AnnouncementBox.Visibility = Visibility.Collapsed;

OptionsContextMenu.Items.Clear();
var CM_Screenshots = new MenuItem {Header = App.TextStrings["contextmenu_open_screenshots_dir"], InputGestureText = "Ctrl+S"};
CM_Screenshots.Click += (sender, e) => CM_Screenshots_Click(sender, e);
OptionsContextMenu.Items.Add(CM_Screenshots);
var CM_Download_Cache = new MenuItem{Header = App.TextStrings["contextmenu_download_cache"], InputGestureText = "Ctrl+D"};
CM_Download_Cache.Click += (sender, e) => CM_DownloadCache_Click(sender, e);
OptionsContextMenu.Items.Add(CM_Download_Cache);
Expand Down Expand Up @@ -574,7 +578,7 @@ public MainWindow()
}

var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full");
if(key == null || (int)key.GetValue("Release") < 394254)
if(key == null || (int)key.GetValue("Release") < 394802)
{
MessageBox.Show(App.TextStrings["msgbox_net_version_old_msg"], App.TextStrings["msgbox_start_error_title"], MessageBoxButton.OK, MessageBoxImage.Error);
Application.Current.Shutdown();
Expand Down Expand Up @@ -1436,7 +1440,7 @@ private void ServerDropdown_Changed(object sender, SelectionChangedEventArgs e)
Server = HI3Server.JP;
break;
}
if(Server != HI3Server.GLB && Server != HI3Server.SEA && Server != HI3Server.CN)
if(Server != HI3Server.GLB && Server != HI3Server.SEA)
{
MirrorDropdown.SelectedIndex = 0;
Mirror = HI3Mirror.miHoYo;
Expand All @@ -1456,11 +1460,6 @@ private void ServerDropdown_Changed(object sender, SelectionChangedEventArgs e)
private void MirrorDropdown_Opened(object sender, EventArgs e)
{
BpUtility.PlaySound(Properties.Resources.Click);
if(Server != HI3Server.GLB && Server != HI3Server.SEA && Server != HI3Server.CN)
{
new DialogWindow(App.TextStrings["label_mirror"], App.TextStrings["msgbox_feature_not_available_msg"]).ShowDialog();
return;
}
}

private void MirrorDropdown_Changed(object sender, SelectionChangedEventArgs e)
Expand All @@ -1475,7 +1474,7 @@ private void MirrorDropdown_Changed(object sender, SelectionChangedEventArgs e)
MirrorDropdown.SelectedIndex = (int)Mirror;
return;
}
if(Server != HI3Server.GLB && Server != HI3Server.SEA && (Server == HI3Server.CN && index > 1))
if(!(bool)OnlineVersionInfo.game_info.mirror.hi3mirror.available && index == 1)
{
MirrorDropdown.SelectedIndex = 0;
new DialogWindow(App.TextStrings["label_mirror"], App.TextStrings["msgbox_feature_not_available_msg"]).ShowDialog();
Expand Down
18 changes: 17 additions & 1 deletion Modules/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ namespace BetterHI3Launcher
{
public partial class MainWindow
{
private void CM_Screenshots_Click(object sender, RoutedEventArgs e)
{
var path = $@"{GameInstallPath}\ScreenShot";
if(Directory.Exists(path))
{
BpUtility.StartProcess(path, null, GameInstallPath, true);
}
else
{
new DialogWindow(App.TextStrings["contextmenu_open_screenshots_dir"], App.TextStrings["msgbox_no_screenshot_dir_msg"]).ShowDialog();
}
}

private void CM_DownloadCache_Click(object sender, RoutedEventArgs e)
{
if(Status != LauncherStatus.Ready)
Expand All @@ -29,7 +42,7 @@ private void CM_DownloadCache_Click(object sender, RoutedEventArgs e)
{
return;
}
if(Mirror == HI3Mirror.Hi3Mirror && Server != HI3Server.GLB && Server != HI3Server.SEA && Server != HI3Server.CN)
if(Mirror == HI3Mirror.Hi3Mirror && Server != HI3Server.GLB && Server != HI3Server.SEA)
{
new DialogWindow(App.TextStrings["contextmenu_download_cache"], App.TextStrings["msgbox_feature_not_available_msg"]).ShowDialog();
return;
Expand Down Expand Up @@ -147,6 +160,7 @@ await Task.Run(() =>
{
ProgressText.Text = string.Empty;
ProgressBar.Visibility = Visibility.Collapsed;
FlashMainWindow();
new DialogWindow(App.TextStrings["contextmenu_repair"], App.TextStrings["msgbox_repair_1_msg"]).ShowDialog();
}
else
Expand Down Expand Up @@ -295,6 +309,7 @@ await Task.Run(() =>
GameInstallPath = path;
WriteVersionInfo(false, true);
Log("Successfully moved game files");
Dispatcher.Invoke(() => {FlashMainWindow();});
GameUpdateCheck();
}
catch(Exception ex)
Expand Down Expand Up @@ -404,6 +419,7 @@ await Task.Run(() =>
ProgressBar.Visibility = Visibility.Collapsed;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
WindowState = WindowState.Normal;
FlashMainWindow();
new DialogWindow(App.TextStrings["msgbox_uninstall_title"], App.TextStrings["msgbox_uninstall_6_msg"] + delete_list).ShowDialog();
});
GameUpdateCheck();
Expand Down
6 changes: 3 additions & 3 deletions Modules/GameCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ await Task.Run(() =>
if(bad_files.Count > 0)
{
Log($"Finished verifying files, found corrupted/missing files: {bad_files.Count}");
FlashMainWindow();
if(new DialogWindow(App.TextStrings["contextmenu_download_cache"], string.Format(App.TextStrings["msgbox_repair_3_msg"], bad_files.Count, BpUtility.ToBytesCount(bad_files_size)), DialogWindow.DialogType.Question).ShowDialog() == true)
{
int downloaded_files = 0;
Expand Down Expand Up @@ -453,9 +454,6 @@ await Task.Run(async () =>
case 1:
server = "sea";
break;
case 2:
server = "cn";
break;
default:
throw new NotSupportedException("This server is not supported.");
}
Expand Down Expand Up @@ -500,6 +498,7 @@ await Task.Run(async () =>
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
});

FlashMainWindow();
if(downloaded_files == bad_files.Count)
{
Log($"Successfully downloaded {downloaded_files} file(s)");
Expand Down Expand Up @@ -532,6 +531,7 @@ await Task.Run(async () =>
ProgressBar.Visibility = Visibility.Collapsed;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
});
FlashMainWindow();
new DialogWindow(App.TextStrings["contextmenu_download_cache"], App.TextStrings["msgbox_repair_2_msg"]).ShowDialog();
}
Status = LauncherStatus.Ready;
Expand Down
4 changes: 1 addition & 3 deletions Modules/GameUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,6 @@ private async Task DownloadGameFile()
case 1:
url += "sea";
break;
case 2:
url += "cn";
break;
default:
throw new NotSupportedException("This server is not supported.");
}
Expand Down Expand Up @@ -687,6 +684,7 @@ await Task.Run(() =>
PatchDownload = false;
WriteVersionInfo(false, true);
Log("Successfully installed the game");
FlashMainWindow();
GameUpdateCheck();
});
});
Expand Down
13 changes: 6 additions & 7 deletions Modules/LauncherOnlineInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void Get(int timeout)

private async void FetchAnnouncements()
{
Status = LauncherStatus.Working;
ProgressBar.Visibility = Visibility.Collapsed;
try
{
await Task.Run(() =>
Expand Down Expand Up @@ -104,7 +102,7 @@ await Task.Run(() =>
}
if(App.Announcements.Count > 0)
{
Dispatcher.Invoke(() => { ShowAnnouncement(App.Announcements.First); });
Dispatcher.Invoke(() => {ShowAnnouncement(App.Announcements.First);});
}
else
{
Expand All @@ -116,8 +114,9 @@ private void ShowAnnouncement(dynamic announcement)
{
LegacyBoxActive = true;
AnnouncementBoxTitleTextBlock.Text = announcement.content.title;
AnnouncementBoxMessageTextBlock.Text = announcement.content.text;
TextBlockExt.SetFormattedText(AnnouncementBoxMessageTextBlock, announcement.content.text.ToString());
AnnouncementBox.Visibility = Visibility.Visible;
FlashMainWindow();
}

private async void FetchChangelog()
Expand All @@ -128,12 +127,12 @@ private async void FetchChangelog()
}

string changelog = null;
Dispatcher.Invoke(() => { ChangelogBoxTextBox.Text = App.TextStrings["changelogbox_2_msg"]; });
Dispatcher.Invoke(() => {ChangelogBoxTextBox.Text = App.TextStrings["changelogbox_2_msg"];});
await Task.Run(() =>
{
void Get(int timeout)
{
var web_client = new BpWebClient { Timeout = timeout };
var web_client = new BpWebClient {Timeout = timeout};
if(App.LauncherLanguage == "ru")
{
changelog = web_client.DownloadString(OnlineVersionInfo.launcher_info.changelog_url.ru.ToString());
Expand Down Expand Up @@ -173,7 +172,7 @@ void Get(int timeout)
Log($"Bp Network connection error, giving up...", true, 2);
changelog = App.TextStrings["changelogbox_3_msg"];
}
Dispatcher.Invoke(() => { ChangelogBoxTextBox.Text = changelog; });
Dispatcher.Invoke(() => {ChangelogBoxTextBox.Text = changelog;});
});
}
}
Expand Down
13 changes: 9 additions & 4 deletions Modules/LegacyBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ await Task.Run(() =>
if(corrupted_files.Count > 0)
{
Log($"Finished verifying files, found corrupted/missing files: {corrupted_files.Count}");
FlashMainWindow();
if(new DialogWindow(App.TextStrings["contextmenu_repair"], string.Format(App.TextStrings["msgbox_repair_3_msg"], corrupted_files.Count, BpUtility.ToBytesCount(corrupted_files_size)), DialogWindow.DialogType.Question).ShowDialog() == true)
{
string[] urls = OnlineRepairInfo.zip_urls.ToObject<string[]>();
Expand Down Expand Up @@ -208,6 +209,7 @@ await Task.Run(async () =>
});
if(!abort)
{
FlashMainWindow();
if(repaired_files == corrupted_files.Count)
{
Log($"Successfully repaired {repaired_files} file(s)");
Expand Down Expand Up @@ -239,6 +241,7 @@ await Task.Run(async () =>
ProgressText.Text = string.Empty;
ProgressBar.Visibility = Visibility.Collapsed;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
FlashMainWindow();
});
new DialogWindow(App.TextStrings["contextmenu_repair"], App.TextStrings["msgbox_repair_2_msg"]).ShowDialog();
}
Expand Down Expand Up @@ -326,10 +329,12 @@ async Task Generate()
!x.Name.Contains("AUDIO_Story") &&
!x.Name.Contains("AUDIO_Vanilla") &&
!x.Name.Contains("Blocks_") &&
!x.Name.Contains("EOSSDK") &&
!x.DirectoryName.Contains("Cache") &&
!x.DirectoryName.Contains("Predownload") &&
!x.DirectoryName.Contains("ScreenShot") &&
!x.DirectoryName.Contains("ThirdPartyNotice") &&
!x.DirectoryName.Contains("Video") &&
!x.DirectoryName.Contains("Cache")
!x.DirectoryName.Contains("Video")
).ToList();
dynamic json = new ExpandoObject();
json.repair_info = new ExpandoObject();
Expand Down Expand Up @@ -357,18 +362,18 @@ await Task.Run(() =>
Log($"Added: {json.repair_info.files.names[i]}");
}
File.WriteAllText(dialog.FileName, JsonConvert.SerializeObject(json));
Log("success!", false);
Log($"Saved JSON: {dialog.FileName}");
});
ProgressText.Text = string.Empty;
ProgressBar.Visibility = Visibility.Collapsed;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
FlashMainWindow();
if(new DialogWindow(App.TextStrings["contextmenu_repair"], App.TextStrings["msgbox_repair_7_msg"], DialogWindow.DialogType.Question).ShowDialog() == true)
{
ProgressBar.Visibility = Visibility.Visible;
await Task.Run(() =>
{
Log("Creating ZIP file...");
Log("Zipping, this will take a while...");
var zip_name = dialog.FileName.Replace(".json", ".zip");
DeleteFile(zip_name);
using(var archive = ZipFile.Open(zip_name, ZipArchiveMode.Create))
Expand Down
Loading

0 comments on commit a54a283

Please sign in to comment.