Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
creditsloader.c
Go to the documentation of this file.
2 {
3  protected static const string JSON_FILE_PATH = "scripts/data/credits.json";
4 
5  static void CreateTestJson()
6  {
7  string nameDepartment = "Department";
8  string nameSection = "Section";
9  string nameLine = "Line";
10 
11  JsonDataCredits data = new JsonDataCredits();
12  data.Departments = new array<ref JsonDataCreditsDepartment>;
13 
14  for (int index_dep = 0; index_dep < 3; ++index_dep)
15  {
17  department.Sections = new array<ref JsonDataCreditsSection>();
18  department.DepartmentName = (nameDepartment +" "+ index_dep);
19 
20  for (int index_sec = 0; index_sec < 4; ++index_sec)
21  {
23  section.SectionLines = new array<string>;
24  section.SectionName = (nameSection +" "+ index_sec);
25 
26  int linesCount = Math.RandomInt(3, 10);
27  for (int i = 0; i < linesCount; ++i)
28  {
29  section.SectionLines.Insert(nameLine +" "+ i);
30  }
31 
32  department.Sections.Insert(section);
33  }
34 
35  data.Departments.Insert(department);
36  }
37 
38  string errorMessage;
39  if (!JsonFileLoader<ref JsonDataCredits>.SaveFile(JSON_FILE_PATH, data, errorMessage))
40  ErrorEx(errorMessage);
41  }
42 
43  static JsonDataCredits GetData()
44  {
45  string errorMessage;
46  JsonDataCredits data;
47 
48  if (!JsonFileLoader<ref JsonDataCredits>.LoadFile(JSON_FILE_PATH, data, errorMessage))
49  ErrorEx(errorMessage);
50 
51  return data;
52  }
53 }
JsonDataCreditsDepartment
Definition: jsondatacreditsdepartment.c:1
ErrorEx
enum ShapeType ErrorEx
JsonDataCredits
Definition: jsondatacredits.c:1
array< ref JsonDataCreditsDepartment >
JsonDataCreditsSection
Definition: jsondatacreditssection.c:1
Math
Definition: enmath.c:6
CreditsLoader
Definition: creditsloader.c:1