DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetConfigRecursive()

TStringArray PluginBase::GetConfigRecursive ( string path,
string name,
string config_class_path,
string config_class,
local array< string > overridden,
int depth = 0,
local bool check_base_class_of_class = false )
inlineprivate

См. определение в файле PluginConfigViewer.c строка 153

154 {
155 string tabs = MakeTabs( depth + 1 );
156 string child_path = path;
157 int count = GetGame().ConfigGetChildrenCount( child_path );
158 int i = 0;
159
160 bool name_printed = false;
161
162 TStringArray result = new TStringArray;
163
164 for ( i = 0; i < count; i++ )
165 {
166 string child_name = "";
167 GetGame().ConfigGetChildName( child_path, i, child_name );
168 string c_child_path = child_path + " " + child_name;
169
170 string child_name_lower = child_name;
171 child_name_lower.ToLower();
172
173 if ( overridden.Find(child_name_lower) == -1 )
174 {
175 if ( !name_printed )
176 {
177 result.Insert( ":" + MakeTabs(depth, check_base_class_of_class) + "!" + name );
178 name_printed = true;
179 }
180 overridden.Insert( child_name_lower );
181
182 int type = GetGame().ConfigGetType( c_child_path );
183
184 if ( type != CT_CLASS )
185 {
186 if ( type != CT_ARRAY )
187 {
188 result.Insert( "-" + tabs + "!" + child_name + " = " + GetGame().ConfigGetTextOut(c_child_path) );
189 }
190 else
191 {
192 result.Insert( "-" + tabs + "!" + child_name + "[] = {" );
193
194 TStringArray strs = new TStringArray;
195 GetGame().ConfigGetTextArray( c_child_path, strs );
196 string tabs_array = MakeTabs( depth + 2 );
197 int j;
198 for ( j = 0; j < strs.Count(); j++ )
199 {
200 result.Insert( "-" + tabs + "!" + child_name + "[]" + j.ToStringLen(6) + "~" + strs.Get(j) + "," );
201 }
202
203 result.Insert( "-" + tabs + "!" + child_name + "[]" + j.ToStringLen(6) + "~}" );
204 }
205 }
206 else
207 {
208 array<string> overridden_sub = new array<string>;
209
210 if ( GetGame().ConfigGetChildrenCount(c_child_path) > 0 )
211 {
212 TStringArray config1 = GetConfigRecursive( c_child_path, child_name, config_class_path, config_class, overridden_sub, depth + 1 );
213 result.InsertAll( config1 );
214 }
215 else
216 {
217 result.Insert( ":" + tabs + "!" + child_name );
218 }
219
220 string cc_child_path = c_child_path;
221 string c_config_class_path = config_class_path;
222 string c_child_name = child_name;
223
224 int cc = 0;
225
226 while ( true )
227 {
228 string base_class = "";
229
230 GetGame().ConfigGetBaseName( cc_child_path, base_class );
231
232 int start = c_config_class_path.Length() + 1;
233 int len = cc_child_path.Length();
234 len -= c_config_class_path.Length() + c_child_name.Length();
235 len -= 2;
236
237 if ( base_class != "" )
238 {
239 string only_child_path = "";
240 if ( len < 0 )
241 {
242 only_child_path = base_class;
243 }
244 else
245 {
246 only_child_path = cc_child_path.Substring( start, len ) + " " + base_class;
247 }
248
249 string c_base_child_path = GetBaseClassPathCombined( cc_child_path, base_class );
250 string base_class_path = GetBaseClassPath( c_config_class_path, c_base_child_path, config_class );
251
252 if ( base_class_path != "" )
253 {
254 TStringArray config2 = GetConfigRecursive( base_class_path, base_class, base_class_path, config_class, overridden_sub, depth + 1, true );
255 result.InsertAll( config2 );
256 }
257 else
258 {
259 TStringArray config3 = GetConfigRecursive( base_class, base_class, base_class, config_class, overridden_sub, depth + 1, true );
260 result.InsertAll( config3 );
261
262 break;
263 }
264
265 cc_child_path = base_class_path;
266 c_child_name = base_class;
267 c_config_class_path = cc_child_path.Substring( 0, cc_child_path.Length() - only_child_path.Length() - 1);
268 }
269 else
270 {
271 break;
272 }
273 }
274 }
275 }
276 }
277
278 if ( name_printed )
279 {
280 result.Insert( ":" + MakeTabs(depth, check_base_class_of_class) + "#" + name );
281 }
282
283 if ( !check_base_class_of_class )
284 {
285 TStringArray full_path = new TStringArray;
286 GetGame().ConfigGetFullPath( child_path, full_path );
287
288 if ( full_path.Count() > 1 )
289 {
290 TStringArray config4 = GetConfigRecursive( config_class + " " + full_path.Get(1), full_path.Get(1), config_class + " " + full_path.Get(1), config_class, overridden, depth );
291 result.InsertAll( config4 );
292 }
293 }
294 else
295 {
296 string class_base_class = "";
297 GetGame().ConfigGetBaseName( child_path, class_base_class );
298
299 if ( class_base_class != "" )
300 {
301 string base_child_path = GetBaseClassPathCombined( child_path, class_base_class );
302 string cc_base_child_path = GetBaseClassPath( config_class_path, base_child_path, config_class );
303
304 if ( cc_base_child_path != "" )
305 {
306 TStringArray config5 = GetConfigRecursive( cc_base_child_path, class_base_class, cc_base_child_path, config_class, overridden, depth, true );
307 result.InsertAll( config5 );
308 }
309 else
310 {
311 TStringArray config6 = GetConfigRecursive( class_base_class, class_base_class, class_base_class, config_class, overridden, depth, true );
312 result.InsertAll( config6 );
313 }
314 }
315 }
316
317 return result;
318 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
string path
Определения OptionSelectorMultistate.c:142
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native void ConfigGetFullPath(string path, out TStringArray full_path)
proto bool ConfigGetBaseName(string path, out string base_name)
Get name of base class of config class on path.
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native int ConfigGetType(string path)
Returns type of config value.
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
string GetBaseClassPathCombined(string child_path, string base_class)
Определения PluginConfigViewer.c:70
string GetBaseClassPath(string config_class_path, string class_path, string config_class)
Определения PluginConfigViewer.c:46
TStringArray GetConfigRecursive(string path, string name, string config_class_path, string config_class, local array< string > overridden, int depth=0, local bool check_base_class_of_class=false)
Определения PluginConfigViewer.c:153
string MakeTabs(int count, bool inheritance=false)
Определения PluginConfigViewer.c:7
proto native CGame GetGame()
array< string > TStringArray
Определения EnScript.c:685
proto native int Length()
Returns length of string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto int ToLower()
Changes string to lowercase. Returns length.

Перекрестные ссылки CGame::ConfigGetBaseName(), CGame::ConfigGetChildName(), CGame::ConfigGetChildrenCount(), CGame::ConfigGetFullPath(), CGame::ConfigGetTextArray(), CGame::ConfigGetType(), GetBaseClassPath(), GetBaseClassPathCombined(), GetConfigRecursive(), GetGame(), string::Length(), MakeTabs(), name, path, string::Substring() и string::ToLower().

Используется в GetConfig() и GetConfigRecursive().