Skip to content

Commit

Permalink
一括処理(リスト出力時など)で処理不能なファイルがあったときに、そこで処理が中断してしまう問題を修正。
Browse files Browse the repository at this point in the history
(主に旧PSO2のdataディレクトリで発生)
  • Loading branch information
logue committed Jul 14, 2022
1 parent 6d0ea61 commit d8ca10b
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 46 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Masashi Yoshikawa
Copyright (c) 2021-2022 Masashi Yoshikawa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions NgsPacker (Package)/NgsPacker (Package).wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>9b4f198f-785a-4203-ac41-ce8aa6c28217</ProjectGuid>
<TargetPlatformVersion>10.0.20348.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.22000.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<DefaultLanguage>ja-JP</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
Expand Down Expand Up @@ -119,7 +119,7 @@
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22414.2000-preview.rs-prerelease" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NgsPacker\NgsPacker.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion NgsPacker (Package)/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<Properties>
<DisplayName>NgsPacker (Package)</DisplayName>
<PublisherDisplayName>logue</PublisherDisplayName>
<PublisherDisplayName>Logue</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>

Expand Down
25 changes: 15 additions & 10 deletions NgsPacker/NgsPacker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<AssemblyName>NgsPacker</AssemblyName>
<Authors>Masashi Yoshikawa</Authors>
<Company>Logue</Company>
<Copyright>(c) 2021 Logue</Copyright>
<Copyright>(c) 2021-2022 Logue All rights reserved.</Copyright>
<Description>Data packer and unpacker for Phantasy Star Online 2 New Genesis.</Description>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<OutputType>WinExe</OutputType>
<PackageIcon>ice-cubes.png</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://logue.dev/NgsPacker</PackageProjectUrl>
<PackageProjectUrl>https://ngs.logue.dev/NgsPacker</PackageProjectUrl>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>PSO2;Phantasy Star Online2;Phantasy Star Online New Genesis;PSO2NGS;Packer;Unpacker</PackageTags>
Expand All @@ -20,24 +20,25 @@
<RootNamespace>NgsPacker</RootNamespace>
<StartupObject>NgsPacker.App</StartupObject>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
<UseWPF>true</UseWPF>
<Version>1.2.1</Version>
<IsPublishable>False</IsPublishable>
<Version>1.2.3</Version>
<IsPublishable>True</IsPublishable>
<PlatformTarget>AnyCPU</PlatformTarget>
<PackageReleaseNotes>dotnet6に移行。</PackageReleaseNotes>
<PackageReleaseNotes>一括処理(リスト出力時など)で処理不能なファイルがあったときに、そこで処理が中断してしまう問題を修正。
(主に旧PSO2のdataディレクトリで発生)</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<Content Include="ice-cubes.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentWPF" Version="0.9.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.1" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
<PackageReference Include="ModernWpfUIs.MessageBox" Version="0.5.2" />
<PackageReference Include="Prism.DryIoc" Version="8.1.97" />
<PackageReference Include="ReactiveProperty" Version="8.0.0" />
<PackageReference Include="WPFLocalizeExtension" Version="3.9.0" />
<PackageReference Include="ReactiveProperty" Version="8.1.2" />
<PackageReference Include="WPFLocalizeExtension" Version="3.9.4" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down Expand Up @@ -67,6 +68,10 @@
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\Readme-ja.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="Properties\DesignTimeResources.xaml">
<ContainsDesignTimeResources>True</ContainsDesignTimeResources>
<SubType>Designer</SubType>
Expand Down
47 changes: 32 additions & 15 deletions NgsPacker/Services/ZamboniService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -----------------------------------------------------------------------
// <copyright file="ZamboniService.cs" company="Logue">
// Copyright (c) 2021 Masashi Yoshikawa All rights reserved.
// Copyright (c) 2021-2022 Masashi Yoshikawa All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// -----------------------------------------------------------------------
Expand Down Expand Up @@ -270,34 +270,51 @@ public async Task<List<string>> Filelist(string inputPath)
+ fileInfo.Name + ",ICE" + num + ",";

// Iceファイルを読み込む
IceFile iceFile = IceFile.LoadIceFile(ms);
IceFile iceFile;
try
{
iceFile = IceFile.LoadIceFile(ms);
}
catch
{
ret.Add(ice + "0,[ERROR] Could not load ice file.");
continue;
}
if (iceFile == null)
{
ret.Add(ice + "0,ERROR");
ret.Add(ice + "0,[ERROR] Could not parse ice file.");
continue;
}

// グループ1のファイルをパース
if (iceFile.groupOneFiles != null)
{
byte[][] groupOneFiles = iceFile.groupOneFiles;
for (int f = 0; f < groupOneFiles.Length; ++f)
{
int int32 = BitConverter.ToInt32(groupOneFiles[f], 16);
string str2 = Encoding.ASCII.GetString(groupOneFiles[f], 64, int32).TrimEnd(new char[1]);
ret.Add(ice + "1," + str2);
try {
byte[][] groupOneFiles = iceFile.groupOneFiles;
for (int f = 0; f < groupOneFiles.Length; ++f)
{
int int32 = BitConverter.ToInt32(groupOneFiles[f], 16);
string str2 = Encoding.ASCII.GetString(groupOneFiles[f], 64, int32).TrimEnd(new char[1]);
ret.Add(ice + "1," + str2);
}
}catch {
ret.Add(ice + "1,[ERROR] Could not parse Group1 files.");
}
}

// グループ2のファイルをパース
if (iceFile.groupTwoFiles != null)
{
byte[][] groupTwoFiles = iceFile.groupTwoFiles;
for (int f = 0; f < groupTwoFiles.Length; ++f)
{
int int32 = BitConverter.ToInt32(groupTwoFiles[f], 16);
string str2 = Encoding.ASCII.GetString(groupTwoFiles[f], 64, int32).TrimEnd(new char[1]);
ret.Add(ice + "2," + str2);
try {
byte[][] groupTwoFiles = iceFile.groupTwoFiles;
for (int f = 0; f < groupTwoFiles.Length; ++f)
{
int int32 = BitConverter.ToInt32(groupTwoFiles[f], 16);
string str2 = Encoding.ASCII.GetString(groupTwoFiles[f], 64, int32).TrimEnd(new char[1]);
ret.Add(ice + "2," + str2);
}
} catch {
ret.Add(ice + "2,[ERROR] Could not parse Group2 files.");
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion NgsPacker/ViewModels/UnpackPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// -----------------------------------------------------------------------
// <copyright file="UnpackPageViewModel.cs" company="Logue">
// Copyright (c) 2021 Masashi Yoshikawa All rights reserved.
// Copyright (c) 2021-2022 Masashi Yoshikawa All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// -----------------------------------------------------------------------

using Microsoft.Toolkit.Uwp.Notifications;
using NgsPacker.Helpers;
using NgsPacker.Interfaces;
using NgsPacker.Views;
using Prism.Commands;
using Prism.Mvvm;
using System;
Expand Down Expand Up @@ -210,6 +211,8 @@ private async void ExecuteUnpackByFilelistCommand()
_ = Directory.CreateDirectory(outputPath);
}

ProgressDialog progressDialog = new();
_ = progressDialog.ShowAsync();
foreach (string file in fileList)
{
string path = picker.ResultPath + Path.DirectorySeparatorChar + file;
Expand All @@ -221,6 +224,7 @@ private async void ExecuteUnpackByFilelistCommand()
// アンパック
ZamboniService.Unpack(path, outputPath, false);
}
progressDialog.Hide();

// 完了通知
if (Properties.Settings.Default.NotifyComplete)
Expand Down
23 changes: 12 additions & 11 deletions NgsPacker/Views/ShellWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<ui:NavigationView
x:Name="NavView"
IsBackButtonVisible="Collapsed"
IsBackEnabled="False"
IsPaneOpen="True"
IsBackEnabled="False" PaneDisplayMode="Top"
>
PaneDisplayMode="Top">
<ui:NavigationView.Resources>
<SolidColorBrush x:Key="NavigationViewTopPaneBackground" Color="Transparent" />
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="{DynamicResource SystemListLowColor}" />
Expand All @@ -49,11 +49,15 @@
Name="Unpack"
Content="{lex:Loc UnpackText}"
Icon="FullScreen"
IsSelected="True"/>
IsSelected="True" />
<ui:NavigationViewItem
Name="Pack"
Content="{lex:Loc PackText}"
Icon="BackToWindow" />
<!--ui:NavigationViewItem
Name="Tool"
Content="{lex:Loc ToolText}"
Icon="Repair" /-->
</ui:NavigationView.MenuItems>
<ui:NavigationView.FooterMenuItems>
<ui:NavigationViewItem
Expand All @@ -62,15 +66,12 @@
Icon="Message" />
</ui:NavigationView.FooterMenuItems>

<Border Background="{DynamicResource SystemAltMediumLowColorBrush}"
CornerRadius="{DynamicResource ControlCornerRadius}">
<ScrollViewer>
<ui:SimpleStackPanel
Spacing="24"
Margin="24,32,24,0">
<Border Background="{DynamicResource SystemAltMediumLowColorBrush}">
<ui:SimpleStackPanel Margin="24,32,24,0" Spacing="24">
<ScrollViewer>
<ui:Frame prism:RegionManager.RegionName="ContentRegion" />
</ui:SimpleStackPanel>
</ScrollViewer>
</ScrollViewer>
</ui:SimpleStackPanel>
</Border>
</ui:NavigationView>
</fw:AcrylicWindow>
8 changes: 4 additions & 4 deletions Readme-ja.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NGSPacker

本プログラムは、PSO2NGS のデータファイルを解凍(アンパック)したり生成(パック)するものです。
本プログラムは、PSO2NGS のゲームデータファイルを解凍(アンパック)したり生成(パック)するものです。

動作には.net6.0 ランタイムが必要です。下記サイトからダウンロードしてください。
<https://dotnet.microsoft.com/download/dotnet>
Expand All @@ -17,11 +17,11 @@
- [PSO2 Modding Tutorial](http://www.pso-world.com/forums/showthread.php?237103-PSO2-Modding-Tutorial-2-0)
- [PSO2 File Directory](https://docs.google.com/spreadsheets/d/1GQwG49iYM1sgJhyAU5AWP-gboemzfIZjBGjTGEZSET4/edit?usp=sharing)
- [PSO2-Modding](https://discord.com/invite/cV3QRkB) - Discord ※日本語情報あり
- [Arks-Layer](https://arks-layer.com/) - Third party launcher. Required when enabling mods.
- [Arks-Layer](https://arks-layer.com/) - サードパーティー製ランチャーです。日本語や英語以外でプレイしたい場合や Mod を使用する場合必須です。
- [Phantasy Star Fleet](https://discord.com/invite/pso2) - Discord
- [Checksum File](http://www.mediafire.com/file/85m6h56u5w3181g/checksum.zip/file) - %%%Required when enabling mods.%%%
- [チェックサムファイル](http://www.mediafire.com/file/85m6h56u5w3181g/checksum.zip/file) - Required when enabling mods
- [PSO2 Modding Database](https://pso2mod.com/)
- [PSO2 Mod Manager](https://github.com/PolCPP/PSO2-Mod-Manager) - Official PSO2 Modding Database Client, But not maintained.
- [PSO2 Mod Manager](https://github.com/PolCPP/PSO2-Mod-Manager) - PSO2Mods.com 公式 Mod マネージャーですが長らくメンテナンスされていません。
- [PSO2NGS @ Nexus Mods](https://www.nexusmods.com/phantasystaronline2newgenesis)

## 免責事項
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It requires the .net 6.0 runtime to work. Please download from the following sit

- [PSO2 Modding Tutorial](http://www.pso-world.com/forums/showthread.php?237103-PSO2-Modding-Tutorial-2-0)
- [PSO2 File Directory](https://docs.google.com/spreadsheets/d/1GQwG49iYM1sgJhyAU5AWP-gboemzfIZjBGjTGEZSET4/edit?usp=sharing)
- [PSO2-Modding](https://discord.com/invite/cV3QRkB) - Discord ※日本語情報あり
- [PSO2-Modding](https://discord.com/invite/cV3QRkB) - Discord
- [Arks-Layer](https://arks-layer.com/) - Third party launcher. Required when enabling mods.
- [Phantasy Star Fleet](https://discord.com/invite/pso2) - Discord
- [Checksum File](http://www.mediafire.com/file/85m6h56u5w3181g/checksum.zip/file) - Required when enabling mods.
Expand Down

0 comments on commit d8ca10b

Please sign in to comment.