@@ -7,7 +7,8 @@ import { XMLParser } from 'fast-xml-parser';
77const parser = new XMLParser ( ) ;
88
99for ( const a of await fsP . readdir ( path . join ( process . argv [ 2 ] ) ) ) {
10- if ( ! a . startsWith ( 'A' ) ) continue ;
10+ if ( a . length !== 4 ) continue ;
11+ console . log ( a )
1112 const base = path . join ( process . argv [ 2 ] , a ) ;
1213 if ( fs . existsSync ( path . join ( base , 'title' ) ) ) {
1314 for ( const dir of await fsP . readdir ( path . join ( base , 'title' ) ) ) {
@@ -24,12 +25,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
2425 original . title [ id ] = {
2526 name : meta . TitleData . name . str . toString ( ) ,
2627 ver : meta . TitleData . releaseTagName . str . toString ( ) ,
27- disable : " false" ,
28+ disable : ' false'
2829 } ;
2930 }
3031 }
3132 }
32-
33+
3334 if ( fs . existsSync ( path . join ( base , 'chara' ) ) ) {
3435 for ( const dir of await fsP . readdir ( path . join ( base , 'chara' ) ) ) {
3536 if ( ! fs . existsSync ( path . join ( base , 'chara' , dir , 'Chara.xml' ) ) ) continue ;
@@ -42,12 +43,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
4243 } else {
4344 original . chara [ id ] = {
4445 name : meta . CharaData . name . str . toString ( ) ,
45- disable : " false" ,
46+ disable : ' false'
4647 } ;
4748 }
4849 }
4950 }
50-
51+
5152 if ( fs . existsSync ( path . join ( base , 'frame' ) ) ) {
5253 for ( const dir of await fsP . readdir ( path . join ( base , 'frame' ) ) ) {
5354 if ( ! fs . existsSync ( path . join ( base , 'frame' , dir , 'frame.xml' ) ) ) continue ;
@@ -60,12 +61,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
6061 } else {
6162 original . frame [ id ] = {
6263 name : meta . FrameData . name . str . toString ( ) ,
63- disable : " false" ,
64+ disable : ' false'
6465 } ;
6566 }
6667 }
6768 }
68-
69+
6970 if ( fs . existsSync ( path . join ( base , 'Icon' ) ) ) {
7071 for ( const dir of await fsP . readdir ( path . join ( base , 'Icon' ) ) ) {
7172 if ( ! fs . existsSync ( path . join ( base , 'Icon' , dir , 'Icon.xml' ) ) ) continue ;
@@ -78,12 +79,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
7879 } else {
7980 original . icon [ id ] = {
8081 name : meta . IconData . name . str . toString ( ) ,
81- disable : " false" ,
82+ disable : ' false'
8283 } ;
8384 }
8485 }
8586 }
86-
87+
8788 if ( fs . existsSync ( path . join ( base , 'Plate' ) ) ) {
8889 for ( const dir of await fsP . readdir ( path . join ( base , 'Plate' ) ) ) {
8990 if ( ! fs . existsSync ( path . join ( base , 'Plate' , dir , 'Plate.xml' ) ) ) continue ;
@@ -96,7 +97,25 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
9697 } else {
9798 original . plate [ id ] = {
9899 name : meta . PlateData . name . str . toString ( ) ,
99- disable : "false" ,
100+ disable : 'false'
101+ } ;
102+ }
103+ }
104+ }
105+
106+ if ( fs . existsSync ( path . join ( base , 'Partner' ) ) ) {
107+ for ( const dir of await fsP . readdir ( path . join ( base , 'Partner' ) ) ) {
108+ if ( ! fs . existsSync ( path . join ( base , 'Partner' , dir , 'Partner.xml' ) ) ) continue ;
109+ const meta = parser . parse ( await fsP . readFile ( path . join ( base , 'Partner' , dir , 'Partner.xml' ) , 'utf-8' ) ) ;
110+
111+ const id = meta . PartnerData . name . id . toString ( ) ;
112+ const origin = original . partner [ id ] ;
113+ if ( origin ) {
114+ origin . name = meta . PartnerData . name . str . toString ( ) ;
115+ } else {
116+ original . partner [ id ] = {
117+ name : meta . PartnerData . name . str . toString ( ) ,
118+ disable : 'false'
100119 } ;
101120 }
102121 }
0 commit comments