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

Защищенные члены

int GetTextType (string text)
 
bool IsString (string text)
 
bool IsParam (string text)
 
bool IsArray (string text)
 
bool IsFloat (string text)
 
bool IsInt (string text)
 
bool IsBool (string text)
 
string ParseToValueString (string param_value)
 
float ParseToValueFloat (string param_value)
 
int ParseToValueInt (string param_value)
 
bool ParseToValueBool (string param_value)
 
array< ref CfgParamParseToValueArray (string param_value)
 

Закрытые члены

void PluginConfigHandler ()
 
override void OnInit ()
 
override string GetFileName ()
 
void LoadConfigFile ()
 
void SaveConfigToFile ()
 
CfgParam GetParamByName (string name, int cfg_type)
 
array< ref CfgParamGetAllParams ()
 
void ClearParams ()
 
void RemoveParamByName (string name)
 
void RenameParam (string name, string new_name)
 
bool ParamExist (string name)
 
string ParseParam (CfgParam param)
 
CfgParam ParseText (string text)
 
void PluginLocalHistoryBase ()
 
void ~PluginLocalHistoryBase ()
 
override void OnInit ()
 
override string GetFileName ()
 
void AddNewLine (string text)
 
TStringArray GetAllLines ()
 
TStringArray GetLastLine ()
 
void PluginLocalProfile ()
 
override string GetFileName ()
 
override void OnInit ()
 
bool LoadConfigFile ()
 
void SaveConfigToFile ()
 
bool IsTextArray (string text)
 
TStringArray ParseTextToParameter (string text)
 
TStringArray ParseTextToArray (string text, out TStringArray ret)
 
array< ref map< string, string > > ParseTextArrayToParameters (string text)
 
string LoadParameter (string param_name)
 
TStringArray LoadParameterArray (string param_name)
 
string LoadSubParameter (string param_name, int sub_array_index, string sub_param_name)
 
void SaveParameter (string param_name, string value, bool save_in_file=true)
 
void SaveParameterArray (string param_name, TStringArray value, bool save_in_file=true)
 
void SaveSubParameterInArray (string param_name, int sub_array_index, string sub_param_name, string sub_param_value, bool save_in_file=true)
 
void RenameParameter (string old_name, string new_name, bool save_in_file=true)
 
void RenameParameterArray (string old_name, string new_name, bool save_in_file=true)
 
void RemoveParameter (string name, bool save_in_file=true)
 
void RemoveParameterArray (string name, bool save_in_file=true)
 
void SetParameterString (string name, string value, bool save_in_file=true)
 
void SetParameterInt (string name, int value, bool save_in_file=true)
 
void SetParameterFloat (string name, float value, bool save_in_file=true)
 
void SetParameterBool (string name, bool value, bool save_in_file=true)
 
void SetParameterArray (string name, TStringArray value, bool save_in_file=true)
 
void SetSubParameterInArray (string param_name, int sub_array_index, string sub_param_name, string sub_param_value, bool save_in_file=true)
 
string GetParameterString (string name)
 
int GetParameterInt (string name)
 
float GetParameterFloat (string name)
 
bool GetParameterBool (string name)
 
TStringArray GetParameterArray (string name)
 
string GetSubParameterInArrayString (string param_name, int sub_array_index, string sub_param_name)
 
TStringArray GetAllSubParametersInArrayString (string param_name, string sub_param_name)
 

Закрытые данные

ref array< ref CfgParamm_CfgParams
 
ref map< string, stringm_ConfigParams
 
ref map< string, ref TStringArraym_ConfigParamsArray
 
ref map< string, ref map< string, string > > m_ConfigParamsInArray
 
ref map< string, ref array< ref map< string, string > > > m_ConfigParamsArrayInArray
 

Подробное описание

Конструктор(ы)

◆ ~PluginLocalHistoryBase()

void ~PluginLocalHistoryBase ( )
inlineprivate
9 {
10 }

Методы

◆ AddNewLine()

void AddNewLine ( string text)
inlineprivate
24 {
25 // replace newline to \\n
26 text.Replace("\n", "\\n" );
27 m_FileContent.Insert(text);
28 SaveFile();
29 }
Definition EntityAI.c:95

◆ ClearParams()

void ClearParams ( )
inlineprivate
74 {
75 m_CfgParams.Clear();
76 }
ref array< ref CfgParam > m_CfgParams
Definition PluginConfigHandler.c:3

◆ GetAllLines()

TStringArray GetAllLines ( )
inlineprivate
32 {
33 // replace \\n to new line
35 for ( int i = 0; i < m_FileContent.Count(); i++)
36 {
37 string history_record = m_FileContent.Get(i);
38 history_record.Replace("\\n", "\n");
40 }
41 return console_history;
42 }
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
array< string > TStringArray
Definition EnScript.c:685

◆ GetAllParams()

array< ref CfgParam > GetAllParams ( )
inlineprivate
69 {
70 return m_CfgParams;
71 }

◆ GetAllSubParametersInArrayString()

TStringArray GetAllSubParametersInArrayString ( string param_name,
string sub_param_name )
inlineprivate
579 {
581
583 {
585
587
588 for ( int i = 0; i < arrays_in_parameter.Count(); ++i )
589 {
591
592 string sub_param = STRING_EMPTY;
593
594 if ( sub_parameter.Contains(sub_param_name) )
595 {
597 }
598
599 ret_value.Insert(sub_param);
600 }
601 }
602
603 return ret_value;
604 }
ref map< string, ref array< ref map< string, string > > > m_ConfigParamsArrayInArray
Definition PluginLocalProfile.c:6
const string STRING_EMPTY
Definition constants.c:54

Перекрестные ссылки STRING_EMPTY.

◆ GetFileName() [1/3]

override string GetFileName ( )
inlineprivate
18 {
20 }
const string CFG_FILE_USER_PROFILE
Definition constants.c:238

Перекрестные ссылки CFG_FILE_USER_PROFILE.

Используется в PluginBase::LoadFile() и PluginBase::SaveFile().

◆ GetFileName() [2/3]

override string GetFileName ( )
inlineprivate
18 {
19 Error( "Cannot call GetFileName on Base class PluginLocalHistoryBase" );
20 return STRING_EMPTY;
21 }
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error() и STRING_EMPTY.

◆ GetFileName() [3/3]

override string GetFileName ( )
inlineprivate
17 {
19 }

Перекрестные ссылки CFG_FILE_USER_PROFILE.

◆ GetLastLine()

TStringArray GetLastLine ( )
inlineprivate
45 {
46 int count = m_FileContent.Count();
47 string ret = "";
48
49 if ( count > 0 )
50 {
51 ret = m_FileContent.Get(count - 1);
52 }
53
54 return NULL;
55 }

◆ GetParamByName()

CfgParam GetParamByName ( string name,
int cfg_type )
inlineprivate
49 {
51
52 for ( int i = 0; i < m_CfgParams.Count(); ++i )
53 {
54 param = m_CfgParams.Get(i);
55
56 if ( param.GetName() == name )
57 {
58 return param;
59 }
60 }
61
62 // cfg_type == -1 returns NULL
64 m_CfgParams.Insert(param);
65 return param;
66 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Definition CfgParam.c:9
static CfgParam CreateParam(string name, int cfg_type)
Definition CfgParam.c:38

Перекрестные ссылки CfgParam::CreateParam() и name.

◆ GetParameterArray()

TStringArray GetParameterArray ( string name)
inlineprivate
545 {
547
548 if ( m_ConfigParamsArray.Contains(name) )
549 {
551 }
552 else
553 {
556 }
557
558 return ret_value;
559 }
ref map< string, ref TStringArray > m_ConfigParamsArray
Definition PluginLocalProfile.c:4
void SetParameterArray(string name, TStringArray value, bool save_in_file=true)
Definition PluginLocalProfile.c:457

Перекрестные ссылки name.

◆ GetParameterBool()

bool GetParameterBool ( string name)
inlineprivate
524 {
526 bool ret_value = false;
527
528 if ( loaded_param != "" )
529 {
530 int v = loaded_param.ToInt();
531 if ( v == 1 )
532 {
533 ret_value = true;
534 }
535 }
536 else
537 {
539 }
540
541 return ret_value;
542 }
string LoadParameter(string param_name)
Definition PluginLocalProfile.c:304
void SetParameterBool(string name, bool value, bool save_in_file=true)
Definition PluginLocalProfile.c:452

Перекрестные ссылки name.

◆ GetParameterFloat()

float GetParameterFloat ( string name)
inlineprivate
507 {
509 float ret_value = 0;
510
511 if ( loaded_param != "" )
512 {
513 ret_value = loaded_param.ToFloat();
514 }
515 else
516 {
518 }
519
520 return ret_value;
521 }
void SetParameterFloat(string name, float value, bool save_in_file=true)
Definition PluginLocalProfile.c:447

Перекрестные ссылки name.

◆ GetParameterInt()

int GetParameterInt ( string name)
inlineprivate
490 {
492 int ret_value = 0;
493
494 if ( loaded_param != "" )
495 {
496 ret_value = loaded_param.ToInt();
497 }
498 else
499 {
501 }
502
503 return ret_value;
504 }
void SetParameterInt(string name, int value, bool save_in_file=true)
Definition PluginLocalProfile.c:442

Перекрестные ссылки name.

◆ GetParameterString()

string GetParameterString ( string name)
inlineprivate
468 {
470 string ret_value = STRING_EMPTY;
471
472 if ( loaded_param != "" )
473 {
475 loaded_param.Split("\"", arr);
476 if ( arr.Count() > 0 )
477 {
478 ret_value = arr.Get(0);
479 }
480 }
481 else
482 {
484 }
485
486 return ret_value;
487 }
void SetParameterString(string name, string value, bool save_in_file=true)
Definition PluginLocalProfile.c:436

Перекрестные ссылки name и STRING_EMPTY.

◆ GetSubParameterInArrayString()

string GetSubParameterInArrayString ( string param_name,
int sub_array_index,
string sub_param_name )
inlineprivate
562 {
564 string ret_value = STRING_EMPTY;
565
567
568 if ( loaded_param != "" )
569 {
570 arr.Clear();
571 loaded_param.Split("\"", arr);
572 ret_value = arr.Get(1);
573 }
574
575 return ret_value;
576 }
string LoadSubParameter(string param_name, int sub_array_index, string sub_param_name)
Definition PluginLocalProfile.c:326

Перекрестные ссылки STRING_EMPTY.

◆ GetTextType()

int GetTextType ( string text)
inlineprotected
282 {
283 int lenght = text.Length();
284
285 // Check Array
286 int pos1 = text.IndexOf("{");
287 if ( pos1 == 0 && text.Substring(lenght - 1, 1) == "}" )
288 {
289 return CFG_TYPE_ARRAY;
290 }
291
292 // Check String
293 pos1 = text.IndexOf("\"");
294
295 if ( pos1 == 0 && text.Substring(lenght - 1, 1) == "\"" )
296 {
297 string string_text = text.Substring(1, lenght - 2);
298 if ( string_text.IndexOf("\"") == -1 )
299 {
300 return CFG_TYPE_STRING;
301 }
302 }
303
304 // Check Param
305 pos1 = text.IndexOf("=");
306 if ( pos1 > -1 )
307 {
308 return CFG_TYPE_PARAM;
309 }
310
311 // Check Param True
312 pos1 = text.IndexOf("true");
313 if ( lenght == 4 && pos1 > -1 )
314 {
315 return CFG_TYPE_BOOL;
316 }
317
318 // Check Param False
319 pos1 = text.IndexOf("false");
320 if ( lenght == 5 && pos1 > -1 )
321 {
322 return CFG_TYPE_BOOL;
323 }
324
325 // Check Param Float
326 pos1 = text.IndexOf(".");
327 if ( pos1 > -1 )
328 {
329 return CFG_TYPE_FLOAT;
330 }
331
332 // Is Int
333 return CFG_TYPE_INT;
334 }
const int CFG_TYPE_BOOL
Definition CfgParam.c:4
const int CFG_TYPE_ARRAY
Definition CfgParam.c:5
const int CFG_TYPE_PARAM
Definition CfgParam.c:6
const int CFG_TYPE_INT
Definition CfgParam.c:2
const int CFG_TYPE_STRING
Definition CfgParam.c:1
const int CFG_TYPE_FLOAT
Definition CfgParam.c:3

Перекрестные ссылки CFG_TYPE_ARRAY, CFG_TYPE_BOOL, CFG_TYPE_FLOAT, CFG_TYPE_INT, CFG_TYPE_PARAM и CFG_TYPE_STRING.

◆ IsArray()

bool IsArray ( string text)
inlineprotected
357 {
359 {
360 return true;
361 }
362
363 return false;
364 }
int GetTextType(string text)
Definition PluginConfigHandler.c:281

Перекрестные ссылки CFG_TYPE_ARRAY.

◆ IsBool()

bool IsBool ( string text)
inlineprotected
387 {
389 {
390 return true;
391 }
392
393 return false;
394 }

Перекрестные ссылки CFG_TYPE_BOOL.

◆ IsFloat()

bool IsFloat ( string text)
inlineprotected
367 {
369 {
370 return true;
371 }
372
373 return false;
374 }

Перекрестные ссылки CFG_TYPE_FLOAT.

◆ IsInt()

bool IsInt ( string text)
inlineprotected
377 {
378 if ( GetTextType(text) == CFG_TYPE_INT )
379 {
380 return true;
381 }
382
383 return false;
384 }

Перекрестные ссылки CFG_TYPE_INT.

◆ IsParam()

bool IsParam ( string text)
inlineprotected
347 {
349 {
350 return true;
351 }
352
353 return false;
354 }

Перекрестные ссылки CFG_TYPE_PARAM.

◆ IsString()

bool IsString ( string text)
inlineprotected
337 {
339 {
340 return true;
341 }
342
343 return false;
344 }

Перекрестные ссылки CFG_TYPE_STRING.

◆ IsTextArray()

bool IsTextArray ( string text)
inlineprivate
206 {
207 if ( text.Length() > 0 && text.Substring(0, 1) == "{" )
208 {
209 if ( text.Substring(text.Length() - 1, 1) == "}" )
210 {
211 return true;
212 }
213 }
214
215 return false;
216 }

◆ LoadConfigFile() [1/2]

void LoadConfigFile ( )
inlineprivate
23 {
24 LoadFile();
25
26 m_CfgParams.Clear();
27
28 for ( int j = 0; j < m_FileContent.Count(); j++ )
29 {
30 m_CfgParams.Insert( ParseText(m_FileContent.Get(j)) );
31 }
32 }
CfgParam ParseText(string text)
Definition PluginConfigHandler.c:203

◆ LoadConfigFile() [2/2]

bool LoadConfigFile ( )
inlineprivate
29 {
30 TStringArray file_content = GetFileContent();
31
32 string line_content = "";
33 string param_name = "";
34 string param_value = "";
36 int pos_sep = -1;
37
38 for ( int i = 0; i < file_content.Count(); ++i )
39 {
41
43
44 if ( param_content.Count() == 0 )
45 {
46 PrintString(GetFileName()+"("+i.ToString()+"): Error in config -> Maybe missing '=' !");
47 return false;
48 }
49
52
53 //{{name = apple, damage = 0.5, quantity = 2},{name = banana, damage = 0.5, quantity = 2}}
54
57 //{name = apple, damage = 0.5, quantity = 2}
58 //{name = banana, damage = 0.5, quantity = 2}
59
61
62 if ( array_items.Count() > 0 )
63 {
65
66 for ( int j = 0; j < array_items.Count(); ++j )
67 {
68 string array_content = array_items.Get(j);
69 //{name = apple, damage = 0.5, quantity = 2}
70
71 array_content_raw.Clear();
72
74 //name = apple
75 //damage = 0.5
76 //quantity = 2
77
78 if ( array_content_raw.Count() > 0 )
79 {
81 {
83 }
84
87
88 for ( int k = 0; k < array_content_raw.Count(); ++k )
89 {
90 string params = array_content_raw.Get(k);
92
93 if ( p.Count() == 2 )
94 {
95 parameters.Set(p.Get(0), p.Get(1));
96 }
97 }
98
100 }
101 }
102 }
103 else
104 {
106 }
107 }
108
109 return true;
110 }
ref map< string, string > m_ConfigParams
Definition PluginLocalProfile.c:3
override string GetFileName()
Definition PluginConfigHandler.c:17
TStringArray ParseTextToParameter(string text)
Definition PluginLocalProfile.c:218
TStringArray ParseTextToArray(string text, out TStringArray ret)
Definition PluginLocalProfile.c:243
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
Definition EnScript.c:345

Перекрестные ссылки PluginLocalProfile::GetFileName() и PrintString().

◆ LoadParameter()

string LoadParameter ( string param_name)
inlineprivate
305 {
306 string ret_value = STRING_EMPTY;
307
308 if ( m_ConfigParams.Contains(param_name) )
309 {
311 }
312
313 return ret_value;
314 }

Перекрестные ссылки STRING_EMPTY.

◆ LoadParameterArray()

TStringArray LoadParameterArray ( string param_name)
inlineprivate
317 {
318 if ( m_ConfigParamsArray.Contains(param_name) )
319 {
321 }
322
323 return NULL;
324 }

◆ LoadSubParameter()

string LoadSubParameter ( string param_name,
int sub_array_index,
string sub_param_name )
inlineprivate
327 {
328 string ret_value = STRING_EMPTY;
331
333 {
335
336 if ( sub_arrays != NULL )
337 {
338 if ( sub_array_index < sub_arrays.Count() )
339 {
341
342 if ( param.Contains(sub_param_name) )
343 {
345 }
346 }
347 }
348 }
349
350 return ret_value;
351 }

Перекрестные ссылки STRING_EMPTY.

◆ OnInit() [1/3]

override void OnInit ( )
inlineprivate
13 {
14 super.OnInit();
15 }

◆ OnInit() [2/3]

override void OnInit ( )
inlineprivate
13 {
14 super.OnInit();
15 }

◆ OnInit() [3/3]

override void OnInit ( )
inlineprivate
22 {
23 super.OnInit();
24
26 }
void LoadConfigFile()
Definition PluginConfigHandler.c:22

◆ ParamExist()

bool ParamExist ( string name)
inlineprivate
107 {
109
110 for ( int i = 0; i < m_CfgParams.Count(); ++i )
111 {
112 param = m_CfgParams.Get(i);
113
114 if ( param.GetName() == name )
115 {
116 return true;
117 }
118 }
119
120 return false;
121 }

Перекрестные ссылки name.

◆ ParseParam()

string ParseParam ( CfgParam param)
inlineprivate
124 {
125 string text = STRING_EMPTY;
126
127 if ( param.GetName() != STRING_EMPTY )
128 {
129 text += param.GetName()+"=";
130 }
131
132 switch ( param.GetType() )
133 {
134 case CFG_TYPE_ARRAY:
135 {
136 CfgParamArray param_array = CfgParamArray.Cast( param );
138
139 text += "{";
140
141 for ( int i = 0; i < params.Count(); ++i )
142 {
143 if ( i > 0 )
144 {
145 text += ",";
146 }
147
148 text += ParseParam(params.Get(i));
149 }
150
151 text += "}";
152
153 break;
154 }
155 case CFG_TYPE_STRING:
156 {
157 CfgParamString param_string = CfgParamString.Cast( param );
158 text += "\""+param_string.GetValue()+"\"";
159
160 break;
161 }
162 case CFG_TYPE_INT:
163 {
164 CfgParamInt param_int = CfgParamInt.Cast( param );
165 text += param_int.GetValue().ToString();
166
167 break;
168 }
169 case CFG_TYPE_FLOAT:
170 {
171 CfgParamFloat param_float = CfgParamFloat.Cast( param );
172 string s = param_float.GetValue().ToString();
173
174 if ( s.IndexOf(".") == -1 )
175 {
176 s += ".0";
177 }
178
179 text += s;
180
181 break;
182 }
183 case CFG_TYPE_BOOL:
184 {
185 CfgParamBool param_bool = CfgParamBool.Cast( param );
186
187 if ( param_bool.GetValue() )
188 {
189 text += "true";
190 }
191 else
192 {
193 text += "false";
194 }
195
196 break;
197 }
198 }
199
200 return text;
201 }
string ParseParam(CfgParam param)
Definition PluginConfigHandler.c:123

Перекрестные ссылки CFG_TYPE_ARRAY, CFG_TYPE_BOOL, CFG_TYPE_FLOAT, CFG_TYPE_INT, CFG_TYPE_STRING и STRING_EMPTY.

◆ ParseText()

CfgParam ParseText ( string text)
inlineprivate
204 {
205 string param_name = STRING_EMPTY;
206 string param_value = text.Trim();;
208
209 //Log("ParseText -> text_type: "+itoa(text_type));
210
211 if ( text_type == CFG_TYPE_PARAM )
212 {
213 int pos = param_value.IndexOf("=");
214
215 if ( pos > 0 )
216 {
217 param_name = param_value.Substring(0, pos).Trim();
218 int pos_end = param_value.Length() - pos;
219 param_value = param_value.Substring(pos + 1, pos_end - 1).Trim();
220
221 //Log("ParseText -> param -> "+param_name+" = "+param_value);
222
224 param.SetName(param_name);
225
226 return param;
227 }
228 }
229 else if ( text_type == CFG_TYPE_ARRAY )
230 {
231 //Log("ParseText -> array -> "+param_name+" = "+param_value);
232
233 CfgParamArray param_array = new CfgParamArray(param_name);
235 param_array.SetParams(array_params);
236
237 return param_array;
238 }
239 else if ( text_type == CFG_TYPE_STRING )
240 {
241 //Log("ParseText -> string -> "+param_value);
242
243 CfgParamString param_string = new CfgParamString(param_name);
245
246 return param_string;
247 }
248 else if ( text_type == CFG_TYPE_INT )
249 {
250 //Log("ParseText -> int -> "+param_name+" = "+param_value);
251
252 CfgParamInt param_int = new CfgParamInt(param_name);
254
255 return param_int;
256 }
257 else if ( text_type == CFG_TYPE_FLOAT )
258 {
259 //Log("ParseText -> float -> "+param_name+" = "+param_value);
260
261 CfgParamFloat param_float = new CfgParamFloat(param_name);
263
264 return param_float;
265 }
266 else if ( text_type == CFG_TYPE_BOOL )
267 {
268 //Log("ParseText -> bool -> "+param_name+" = "+param_value);
269
270 CfgParamBool param_bool = new CfgParamBool(param_name);
272
273 return param_bool;
274 }
275
276 //Log("ParseText -> none -> "+param_name+" = "+param_value);
277
278 return NULL;
279 }
bool ParseToValueBool(string param_value)
Definition PluginConfigHandler.c:411
int ParseToValueInt(string param_value)
Definition PluginConfigHandler.c:406
array< ref CfgParam > ParseToValueArray(string param_value)
Definition PluginConfigHandler.c:421
float ParseToValueFloat(string param_value)
Definition PluginConfigHandler.c:401
string ParseToValueString(string param_value)
Definition PluginConfigHandler.c:396

Перекрестные ссылки CFG_TYPE_ARRAY, CFG_TYPE_BOOL, CFG_TYPE_FLOAT, CFG_TYPE_INT, CFG_TYPE_PARAM, CFG_TYPE_STRING и STRING_EMPTY.

◆ ParseTextArrayToParameters()

array< ref map< string, string > > ParseTextArrayToParameters ( string text)
inlineprivate
280 {
283
285
287
288 for ( int i = 0; i < array_items.Count(); ++i )
289 {
290 string param = array_items.Get(i);
292
293 string param_name = t_param.Get(0);
294 string param_value = t_param.Get(1);
295
297 }
298
299 ret.Insert(ret_param);
300
301 return ret;
302 }

◆ ParseTextToArray()

TStringArray ParseTextToArray ( string text,
out TStringArray ret )
inlineprivate
244 {
245 if ( !IsTextArray(text) )
246 {
247 return NULL;
248 }
249
250 text = text.Substring(1, text.Length() - 2);
251
252 int pos_array_start = text.IndexOf("{");
253 int pos_array_end = text.IndexOf("}");
254
255 if ( pos_array_start > -1 && pos_array_end > -1 )
256 {
257 while ( true )
258 {
259 string array_value = text.Substring(pos_array_start , pos_array_end - pos_array_start + 1 );
260 ret.Insert(array_value);
261
262 pos_array_start = text.IndexOfFrom(pos_array_end, "{");
263 pos_array_end = text.IndexOfFrom(pos_array_start, "}");
264
265 if ( pos_array_start == -1 )
266 {
267 break;
268 }
269 }
270 }
271 else
272 {
273 text.Split(",", ret);
274 }
275
276 return ret;
277 }
bool IsTextArray(string text)
Definition PluginLocalProfile.c:205

◆ ParseTextToParameter()

TStringArray ParseTextToParameter ( string text)
inlineprivate
219 {
221
222 int pos = text.IndexOf("=");
223
224 if ( pos > 0 )
225 {
226 string param_name = text.Substring(0, pos).Trim();
227 int pos_end = text.Length() - pos;
228 string param_value = text.Substring(pos + 1, pos_end - 1).Trim();
229
230 int lenght = param_value.Length();
231 if (lenght > 1 && param_value.Substring(0, 1) == "\"" && param_value.Substring(lenght - 1, 1) == "\"" )
232 {
233 param_value = param_value.Substring(1, lenght - 2);
234 }
235
236 ret.Insert(param_name);
237 ret.Insert(param_value);
238 }
239
240 return ret;
241 }

◆ ParseToValueArray()

array< ref CfgParam > ParseToValueArray ( string param_value)
inlineprotected
422 {
424
426
427 array<int> a = new array<int>;
428 array<int> b = new array<int>;
429
430 int pos_a = 0;
431 int pos_b = 0;
432 int element = 0;
433 int value_start = 0;
434 int value_end = 0;
435
436 while ( pos_a > -1 || pos_b > -1 )
437 {
438 pos_a = param_value.IndexOfFrom(pos_a, "{" );
439 if ( pos_a > -1 )
440 {
441 a.Insert(pos_a);
442 pos_a++;
443 }
444
445 pos_b = param_value.IndexOfFrom(pos_b, "}" );
446 if ( pos_b > -1 )
447 {
448 b.Insert(pos_b);
449 pos_b++;
450 }
451 }
452
453 pos_a = 0;
454 pos_b = 0;
455
456 for ( pos_a = 0; pos_a < a.Count(); ++pos_a )
457 {
458 if ( a.Get(pos_a) > b.Get(pos_b) )
459 {
460 element--;
461
462 if ( element <= 1 )
463 {
464 value_end = b.Get(pos_b) - value_start + 1;
465
466 //Log("1 -> "+substr(param_value, value_start, value_end))
467
468 strings.Insert( param_value.Substring(value_start, value_end) );
469
470 value_start = b.Get(pos_b) + 1;
471 }
472
473 pos_a--;
474 pos_b++;
475 }
476 else if ( a.Get(pos_a) < b.Get(pos_b) )
477 {
478 if ( pos_a == a.Count() - 1 && pos_b < b.Count() - 1 )
479 {
480 element--;
481
482 if ( element == 0 )
483 {
484 value_end = b.Get(pos_b) - value_start;
485
486 //Log("2 -> "+substr(param_value, value_start + 1, value_end))
487
488 strings.Insert( param_value.Substring(value_start + 1, value_end) );
489
490 value_start = b.Get(pos_b) + 1;
491 }
492
493 pos_a--;
494 pos_b++;
495 }
496 else
497 {
498 element++;
499
500 if ( element == 2 )
501 {
502 value_start = a.Get(pos_a);
503 }
504 }
505 }
506 }
507
508 //Log(param_value+" => "+itoa(a.Count())+" / "+itoa(b.Count())+" count: "+itoa(strings.Count()));
509
510 if ( strings.Count() == 0 )
511 {
512 //Log(param_value+" -> ZERO {}");
513
514 string param_value_content = param_value.Substring(1, param_value.Length() - 2);
515
516 //Log(param_value+" -> Trimmed -> "+param_value_content);
517
518 param_value_content.Split(",", strings);
519 }
520
521 for ( int i = 0; i < strings.Count(); ++i )
522 {
523 string str = strings.Get(i);
524
525 //Log("To Parse => "+str);
526
528
529 param_parent.Insert(param);
530 }
531
532 return param_parent;
533 }

◆ ParseToValueBool()

bool ParseToValueBool ( string param_value)
inlineprotected
412 {
413 if ( param_value.Contains("true") )
414 {
415 return true;
416 }
417
418 return false;
419 }

◆ ParseToValueFloat()

float ParseToValueFloat ( string param_value)
inlineprotected
402 {
403 return param_value.ToFloat();
404 }

◆ ParseToValueInt()

int ParseToValueInt ( string param_value)
inlineprotected
407 {
408 return param_value.ToInt();
409 }

◆ ParseToValueString()

string ParseToValueString ( string param_value)
inlineprotected
397 {
398 return param_value.Substring(1, param_value.Length() - 2);
399 }

◆ PluginConfigHandler()

void PluginConfigHandler ( )
inlineprivate

◆ PluginLocalHistoryBase()

void PluginLocalHistoryBase ( )
inlineprivate
4 {
5 m_ReadOnly = false;
6 }

◆ PluginLocalProfile()

void PluginLocalProfile ( )
inlineprivate

◆ RemoveParamByName()

void RemoveParamByName ( string name)
inlineprivate
79 {
80 for ( int i = 0; i < m_CfgParams.Count(); ++i )
81 {
83
84 if ( param.GetName() == name )
85 {
86 m_CfgParams.Remove( i );
87 return;
88 }
89 }
90 }

Перекрестные ссылки name.

◆ RemoveParameter()

void RemoveParameter ( string name,
bool save_in_file = true )
inlineprivate
417 {
418 m_ConfigParams.Remove(name);
419
420 if ( save_in_file )
421 {
423 }
424 }
void SaveConfigToFile()
Definition PluginConfigHandler.c:34

Перекрестные ссылки name.

◆ RemoveParameterArray()

void RemoveParameterArray ( string name,
bool save_in_file = true )
inlineprivate
427 {
429
430 if ( save_in_file )
431 {
433 }
434 }

Перекрестные ссылки name.

◆ RenameParam()

void RenameParam ( string name,
string new_name )
inlineprivate
93 {
94 for ( int i = 0; i < m_CfgParams.Count(); ++i )
95 {
97
98 if ( param.GetName() == name )
99 {
100 param.SetName( new_name );
101 return;
102 }
103 }
104 }

Перекрестные ссылки name.

◆ RenameParameter()

void RenameParameter ( string old_name,
string new_name,
bool save_in_file = true )
inlineprivate
391 {
392 if ( m_ConfigParams.Contains(old_name) )
393 {
394 m_ConfigParams.ReplaceKey(old_name, new_name);
395
396 if ( save_in_file )
397 {
399 }
400 }
401 }

◆ RenameParameterArray()

void RenameParameterArray ( string old_name,
string new_name,
bool save_in_file = true )
inlineprivate
404 {
405 if ( m_ConfigParamsArray.Contains(old_name) )
406 {
408
409 if ( save_in_file )
410 {
412 }
413 }
414 }

◆ SaveConfigToFile() [1/2]

void SaveConfigToFile ( )
inlineprivate
35 {
36 ClearFileNoSave();
37
38 for ( int i = 0; i < m_CfgParams.Count(); ++i )
39 {
40 string s = ParseParam(m_CfgParams.Get(i));
41
42 m_FileContent.Insert(s);
43 }
44
45 SaveFile();
46 }

◆ SaveConfigToFile() [2/2]

void SaveConfigToFile ( )
inlineprivate
113 {
114 ClearFileNoSave();
115
116 int i;
117 int j;
118 int k;
119
120 string variable_name;
121 string variable_value;
122 string text;
124
125 for ( i = 0; i < m_ConfigParams.Count(); ++i)
126 {
128 variable_value = m_ConfigParams.GetElement(i);
129
131
132 AddNewLineNoSave(text);
133 }
134
135 for ( i = 0; i < m_ConfigParamsArray.Count(); ++i)
136 {
139
141 {
142 continue;
143 }
144
145 text = variable_name + " = {";
146
147 for ( j = 0; j < variable_array.Count(); ++j )
148 {
149 if ( j > 0 )
150 {
151 text += ",";
152 }
153
154 text += variable_array.Get(j);
155 }
156
157 text += "}";
158
159 AddNewLineNoSave(text);
160 }
161
162 for ( i = 0; i < m_ConfigParamsArrayInArray.Count(); ++i)
163 {
166
167 text = variable_name + " = {";
168
169 if ( variable_param != NULL )
170 {
171 for ( j = 0; j < variable_param.Count(); ++j )
172 {
173 if ( j > 0 )
174 {
175 text += ",";
176 }
177 text += "{";
178
180 for ( k = 0; k < params.Count(); ++k )
181 {
182 if ( k > 0 )
183 {
184 text += ",";
185 }
186
187 string param_name = params.GetKey(k);
188 string param_value = params.GetElement(k);
189
191 }
192
193 text += "}";
194 }
195 }
196
197 text += "}";
198
199 AddNewLineNoSave(text);
200 }
201
202 SaveFile();
203 }

◆ SaveParameter()

void SaveParameter ( string param_name,
string value,
bool save_in_file = true )
inlineprivate
354 {
355 if ( param_name == "" || param_name == "scene_editor_scene" )
356 {
357 Log("SaveParameter: "+param_name+" = "+value, "");
358 }
359
361
362 if ( save_in_file )
363 {
365 }
366 }
class LogTemplates Log(string message, LogTemplateID template_id=0)
Creates debug log (optional) from LogTemplate which are registred.
Definition LogTemplates.c:75

Перекрестные ссылки Log().

◆ SaveParameterArray()

void SaveParameterArray ( string param_name,
TStringArray value,
bool save_in_file = true )
inlineprivate
369 {
371
372 if ( save_in_file )
373 {
375 }
376 }

◆ SaveSubParameterInArray()

void SaveSubParameterInArray ( string param_name,
int sub_array_index,
string sub_param_name,
string sub_param_value,
bool save_in_file = true )
inlineprivate

◆ SetParameterArray()

void SetParameterArray ( string name,
TStringArray value,
bool save_in_file = true )
inlineprivate
458 {
460 }
void SaveParameterArray(string param_name, TStringArray value, bool save_in_file=true)
Definition PluginLocalProfile.c:368

Перекрестные ссылки name.

◆ SetParameterBool()

void SetParameterBool ( string name,
bool value,
bool save_in_file = true )
inlineprivate
453 {
454 SaveParameter(name, value.ToString(), save_in_file);
455 }
void SaveParameter(string param_name, string value, bool save_in_file=true)
Definition PluginLocalProfile.c:353

Перекрестные ссылки name.

◆ SetParameterFloat()

void SetParameterFloat ( string name,
float value,
bool save_in_file = true )
inlineprivate
448 {
449 SaveParameter(name, value.ToString(), save_in_file);
450 }

Перекрестные ссылки name.

◆ SetParameterInt()

void SetParameterInt ( string name,
int value,
bool save_in_file = true )
inlineprivate
443 {
444 SaveParameter(name, value.ToString(), save_in_file);
445 }

Перекрестные ссылки name.

◆ SetParameterString()

void SetParameterString ( string name,
string value,
bool save_in_file = true )
inlineprivate
437 {
438 string s = "\""+value+"\"";
440 }

Перекрестные ссылки name.

◆ SetSubParameterInArray()

void SetSubParameterInArray ( string param_name,
int sub_array_index,
string sub_param_name,
string sub_param_value,
bool save_in_file = true )
inlineprivate
463 {
465 }
void SaveSubParameterInArray(string param_name, int sub_array_index, string sub_param_name, string sub_param_value, bool save_in_file=true)
Definition PluginLocalProfile.c:378

Поля

◆ m_CfgParams

ref array<ref CfgParam> m_CfgParams
private

◆ m_ConfigParams

ref map<string, string> m_ConfigParams
private

◆ m_ConfigParamsArray

ref map<string, ref TStringArray> m_ConfigParamsArray
private

◆ m_ConfigParamsArrayInArray

ref map<string, ref array<ref map<string, string> > > m_ConfigParamsArrayInArray
private

◆ m_ConfigParamsInArray

ref map<string, ref map<string, string> > m_ConfigParamsInArray
private

Объявления и описания членов классов находятся в файлах: