@@ -925,14 +925,17 @@ private static void ParameterEdit(string location, string parameter, string valu
925925 int lineCount = 0 ;
926926
927927 value = value . Replace ( "\\ \" " , "\" " ) ;
928- foreach ( string line in script ) {
929- if ( line . StartsWith ( parameter ) ) {
928+ foreach ( string line in script )
929+ {
930+ if ( line . StartsWith ( parameter ) )
931+ {
930932 string [ ] split = line . Split ( ' ' ) ;
931933 split [ 2 ] = value ;
932934 for ( int i = 3 ; i < split . Count ( ) ; i ++ ) split [ i ] = string . Empty ;
933935 script [ lineCount ] = string . Join ( " " , split ) ;
934936 break ;
935937 }
938+
936939 lineCount ++ ;
937940 }
938941
@@ -971,13 +974,16 @@ private static void ParameterRename(string location, string parameter, string _n
971974 string [ ] script = File . ReadAllLines ( location ) ;
972975 int lineCount = 0 ;
973976
974- foreach ( string line in script ) {
975- if ( line . StartsWith ( parameter ) ) {
977+ foreach ( string line in script )
978+ {
979+ if ( line . StartsWith ( parameter ) )
980+ {
976981 string [ ] split = line . Split ( ' ' ) ;
977982 split [ 0 ] = _new ;
978983 script [ lineCount ] = string . Join ( " " , split ) ;
979984 break ;
980985 }
986+
981987 lineCount ++ ;
982988 }
983989
@@ -1001,6 +1007,7 @@ private static void TextAdd(string location, string name, string placeholder, st
10011007 Text = text ,
10021008 Placeholder = placeholder
10031009 } ;
1010+
10041011 mst . entries . Add ( entry ) ;
10051012
10061013 mst . Save ( location , true ) ;
@@ -1019,21 +1026,25 @@ private static void TextEdit(string location, string name, string placeholder, s
10191026 mst . Load ( location ) ;
10201027
10211028 bool entryFound = false ;
1022- for ( int i = 0 ; i < mst . entries . Count ; i ++ ) {
1023- if ( mst . entries [ i ] . Name == name ) {
1029+ for ( int i = 0 ; i < mst . entries . Count ; i ++ )
1030+ {
1031+ if ( mst . entries [ i ] . Name == name )
1032+ {
10241033 entryFound = true ;
10251034 mst . entries [ i ] . Text = text ;
10261035 mst . entries [ i ] . Placeholder = placeholder ;
10271036 }
10281037 }
10291038
10301039 // If the entry doesn't exist, create a new one
1031- if ( ! entryFound ) {
1040+ if ( ! entryFound )
1041+ {
10321042 MSTEntries newEntry = new MSTEntries {
10331043 Name = name ,
10341044 Text = text ,
10351045 Placeholder = placeholder
10361046 } ;
1047+
10371048 mst . entries . Add ( newEntry ) ;
10381049 }
10391050
@@ -1068,12 +1079,15 @@ private static void PackageAdd(string location, string _type, string friendlyNam
10681079 S06Package pkg = new S06Package ( ) ;
10691080 pkg . Load ( location ) ;
10701081
1071- foreach ( var type in pkg . Types ) {
1072- if ( type . TypeName == _type ) {
1082+ foreach ( var type in pkg . Types )
1083+ {
1084+ if ( type . TypeName == _type )
1085+ {
10731086 S06FileEntry file = new S06FileEntry {
10741087 FilePath = filePath ,
10751088 FriendlyName = friendlyName
10761089 } ;
1090+
10771091 type . Files . Add ( file ) ;
10781092 }
10791093 }
@@ -1094,11 +1108,13 @@ private static void PackageEdit(string location, string _type, string friendlyNa
10941108 pkg . Load ( location ) ;
10951109
10961110 foreach ( var type in pkg . Types )
1111+ {
10971112 if ( type . TypeName == _type )
10981113 {
10991114 bool friendlyNameFound = false ;
11001115
11011116 for ( int i = 0 ; i < type . Files . Count ; i ++ )
1117+ {
11021118 if ( ! string . IsNullOrEmpty ( filePath ) )
11031119 {
11041120 // Replace file path if the friendly name exists
@@ -1109,17 +1125,28 @@ private static void PackageEdit(string location, string _type, string friendlyNa
11091125 }
11101126 }
11111127 else
1112- type . Files . RemoveAt ( i ) ;
1128+ {
1129+ // Replace file path if the friendly name exists
1130+ if ( type . Files [ i ] . FriendlyName == friendlyName )
1131+ {
1132+ friendlyNameFound = true ;
1133+ type . Files . RemoveAt ( i ) ;
1134+ }
1135+ }
1136+ }
11131137
11141138 // If the friendly name doesn't exist, create a new reference
1115- if ( ! friendlyNameFound ) {
1139+ if ( ! friendlyNameFound )
1140+ {
11161141 S06FileEntry newFile = new S06FileEntry {
11171142 FilePath = filePath ,
11181143 FriendlyName = friendlyName
11191144 } ;
1145+
11201146 type . Files . Add ( newFile ) ;
11211147 }
11221148 }
1149+ }
11231150
11241151 pkg . Save ( location , true ) ;
11251152 }
@@ -1153,7 +1180,9 @@ public static void DecompileLua(string _file)
11531180 string [ ] readText = File . ReadAllLines ( _file ) ; //Read the Lub into an array
11541181
11551182 if ( readText [ 0 ] . Contains ( "LuaP" ) )
1156- using ( Process process = new Process ( ) ) {
1183+ {
1184+ using ( Process process = new Process ( ) )
1185+ {
11571186 process . StartInfo . FileName = "java.exe" ;
11581187 process . StartInfo . Arguments = $ "-jar \" { Program . unlub } \" \" { _file } \" ";
11591188 process . StartInfo . UseShellExecute = false ;
@@ -1169,6 +1198,7 @@ public static void DecompileLua(string _file)
11691198
11701199 File . WriteAllText ( _file , outputBuilder . ToString ( ) ) ;
11711200 }
1201+ }
11721202 }
11731203 }
11741204
0 commit comments