Skip to content

Commit

Permalink
chore: Removed old legacy character details page (Jorixon#327)
Browse files Browse the repository at this point in the history
fix: When navigating back from the character details page to the character overview, it will now correctly scroll the character into view (Jorixon#327)

feat: Added two new context items to the character overview right click menu. "Disable all mods" and "Open Folder..." (Jorixon#327)

chore(Genshin): Updated some existing character's images (Jorixon#327)

chore: Added a button to open the cached download folder that JASM uses on the settings page (Jorixon#327)
  • Loading branch information
Jorixon authored Jan 12, 2025
1 parent 75e1dca commit ed89b08
Show file tree
Hide file tree
Showing 31 changed files with 344 additions and 3,540 deletions.
2 changes: 1 addition & 1 deletion src/GIMI-ModManager.Core/Helpers/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public static class Constants

public static readonly string ModConfigFileName = ".JASM_ModConfig.json";
public static readonly string ShaderFixesFolderName = "ShaderFixes";
public static readonly string[] ScriptIniNames = ["Script.ini", "merged.ini"];
public static readonly string[] ScriptIniNames = ["Script.ini", "merged.ini", "mod.ini"];
public static readonly string UserIniFileName = "d3dx_user.ini";
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public ModArchiveRepository(ILogger logger, ArchiveService archiveService)
_logger = logger.ForContext<ModArchiveRepository>();
}

public Uri ArchiveDirectory => new(_modArchiveDirectory.FullName);

public async Task InitializeAsync(string appDataFolder, Action<SetupOptions>? setup = null)
{
Expand Down
3 changes: 0 additions & 3 deletions src/GIMI-ModManager.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
using Serilog;
using Serilog.Events;
using Serilog.Templates;
using CharacterDetailsPage = GIMI_ModManager.WinUI.Views.CharacterDetailsPage;
using CreateCommandViewModel = GIMI_ModManager.WinUI.ViewModels.SettingsViewModels.CreateCommandViewModel;
using GameBananaService = GIMI_ModManager.WinUI.Services.ModHandling.GameBananaService;
using NotificationManager = GIMI_ModManager.WinUI.Services.Notifications.NotificationManager;
Expand Down Expand Up @@ -241,8 +240,6 @@ public App()
services.AddTransient<NotificationsPage>();
services.AddTransient<CharactersViewModel>();
services.AddTransient<CharactersPage>();
services.AddTransient<CharacterDetailsViewModel>();
services.AddTransient<CharacterDetailsPage>();
services.AddTransient<DebugViewModel>();
services.AddTransient<DebugPage>();
services.AddTransient<CharacterManagerViewModel>();
Expand Down
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.
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.
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 not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@
"Sigewinne"
],
"ReleaseDate": "2024-06-05T00:00:00",
"Image": "Sigewinne.webp",
"Image": "Sigewinne.png",
"Rarity": 5,
"Element": "Hydro",
"Class": "Bow",
Expand Down
43 changes: 43 additions & 0 deletions src/GIMI-ModManager.WinUI/Assets/Games/Genshin/fixImages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import json
import os


charactersJson = json.load(open('characters.json'))

for character in charactersJson:
character['Image'] = character['Image'].replace("Character_", "").replace("_Thumb", "")
if (character['InGameSkins']):
for skin in character['InGameSkins']:
skin['Image'] = skin['Image'].replace("Character_", "").replace("_Thumb", "").replace("Skin_", "")

json.dump(charactersJson, open('characters.json', 'w'), indent=2)


# Update image files in Images folder
images_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'Images', 'Characters'))

for filename in os.listdir(images_folder):
new_filename = filename.replace("Character_", "").replace("_Thumb", "")
os.rename(os.path.join(images_folder, filename), os.path.join(images_folder, new_filename))


images_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'Images', 'AltCharacterSkins'))

for filename in os.listdir(images_folder):
new_filename = filename.replace("Character_Skin_", "").replace("_Thumb", "").replace("Skin_", "")
os.rename(os.path.join(images_folder, filename), os.path.join(images_folder, new_filename))


weaponsJson = json.load(open('weapons.json'))

for weapon in weaponsJson:
if (weapon['Image']):
weapon['Image'] = weapon['Image'].replace("Weapon_", "")

json.dump(weaponsJson, open('weapons.json', 'w'), indent=2)

images_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'Images', 'Weapons'))

for filename in os.listdir(images_folder):
new_filename = filename.replace("Weapon_", "")
os.rename(os.path.join(images_folder, filename), os.path.join(images_folder, new_filename))
4 changes: 0 additions & 4 deletions src/GIMI-ModManager.WinUI/GIMI-ModManager.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
<None Remove="Assets\Fonts\zh-cn2.ttf" />
<None Remove="Assets\Games\Honkai\Images\Start_Game.png" />
<None Remove="Styles\FontTypes.xaml" />
<None Remove="Views\CharacterDetailsPage.xaml" />
<None Remove="Views\CharacterDetailsPages\CharacterCard.xaml" />
<None Remove="Views\CharacterDetailsPages\CharacterDetailsPage.xaml" />
<None Remove="Views\CharacterDetailsPages\ModGrid.xaml" />
Expand Down Expand Up @@ -232,9 +231,6 @@
<Page Update="Views\Controls\ModListOverview.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Views\CharacterDetailsPage.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Views\CharactersPage.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ public class CharacterDetailsSettings
[JsonIgnore] public const string Key = "CharacterDetailsSettings";

public bool GalleryView { get; set; } = false;

public bool LegacyCharacterDetails { get; set; } = false;

public bool SingleSelect { get; set; }
public string? SortingMethod { get; set; }
public bool? SortByDescending { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using GIMI_ModManager.Core.Entities.Mods.Exceptions;
using GIMI_ModManager.Core.Entities.Mods.Helpers;
using GIMI_ModManager.Core.Helpers;
using GIMI_ModManager.WinUI.Models;
using GIMI_ModManager.WinUI.Services.Notifications;
using OneOf;
using OneOf.Types;
Expand All @@ -31,50 +30,6 @@ public ModSettingsService(ISkinManagerService skinManagerService,
}


public async Task<OneOf<Success, ModNotFound, Error<Exception>>> LegacySaveSettingsAsync(ModModel modModel)
{
var mod = _skinManagerService.GetModById(modModel.Id);

if (mod is null)
return new ModNotFound(modModel.Id);

if (!mod.Settings.TryGetSettings(out var modSettings))
return new Error<Exception>(new ModSettingsNotFoundException(mod.FullPath));


var modUrl = Uri.TryCreate(modModel.ModUrl, UriKind.Absolute, out var uriResult) &&
(uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)
? uriResult
: null;

modSettings = modSettings.DeepCopyWithProperties(
customName: NewValue<string?>.Set(EmptyStringToNull(modModel.Name)),
author: NewValue<string?>.Set(EmptyStringToNull(modModel.Author)),
modUrl: NewValue<Uri?>.Set(modUrl),
imagePath: NewValue<Uri?>.Set(modModel.ImagePath == ModModel.PlaceholderImagePath
? null
: modModel.ImagePath),
characterSkinOverride: NewValue<string?>.Set(EmptyStringToNull(modModel.CharacterSkinOverride))
);


try
{
await mod.Settings.SaveSettingsAsync(modSettings).ConfigureAwait(false);
return new Success();
}
catch (Exception e)
{
_logger.Error(e, "Failed to save settings for mod {modName}", mod.Name);

_notificationManager.ShowNotification($"Failed to save settings for mod {mod.Name}",
$"An Error Occurred. Reason: {e.Message}",
TimeSpan.FromSeconds(5));

return new Error<Exception>(e);
}
}

public async Task<OneOf<Success, NotFound, ModNotFound, Error<Exception>>> SetCharacterSkinOverrideLegacy(Guid modId,
string skinName)
{
Expand Down
6 changes: 2 additions & 4 deletions src/GIMI-ModManager.WinUI/Services/NavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using GIMI_ModManager.WinUI.Contracts.ViewModels;
using GIMI_ModManager.WinUI.Helpers;
using GIMI_ModManager.WinUI.Models.Settings;
using GIMI_ModManager.WinUI.ViewModels;
using GIMI_ModManager.WinUI.ViewModels.CharacterDetailsViewModels;
using GIMI_ModManager.WinUI.ViewModels.CharacterGalleryViewModels;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
Expand Down Expand Up @@ -153,9 +153,7 @@ public bool NavigateToCharacterDetails(string internalName, bool clearNavigation
return NavigateTo(typeof(CharacterGalleryViewModel).FullName!, internalName, clearNavigation: clearNavigation);
}

var pageKey = settings is null || !settings.LegacyCharacterDetails
? typeof(ViewModels.CharacterDetailsViewModels.CharacterDetailsViewModel).FullName
: typeof(CharacterDetailsViewModel).FullName;
var pageKey = typeof(CharacterDetailsViewModel).FullName;

return NavigateTo(pageKey!, internalName, clearNavigation);
}
Expand Down
1 change: 0 additions & 1 deletion src/GIMI-ModManager.WinUI/Services/PageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public PageService()
Configure<SettingsViewModel, SettingsPage>();
Configure<NotificationsViewModel, NotificationsPage>();
Configure<CharactersViewModel, CharactersPage>();
Configure<CharacterDetailsViewModel, CharacterDetailsPage>();
Configure<ViewModels.CharacterDetailsViewModels.CharacterDetailsViewModel,
Views.CharacterDetailsPages.CharacterDetailsPage>();
Configure<DebugViewModel, DebugPage>();
Expand Down
Loading

0 comments on commit ed89b08

Please sign in to comment.