class CreditsLoader { protected static const string JSON_FILE_PATH = "scripts/data/credits.json"; static void CreateTestJson() { string nameDepartment = "Department"; string nameSection = "Section"; string nameLine = "Line"; JsonDataCredits data = new JsonDataCredits(); data.Departments = new array; for (int index_dep = 0; index_dep < 3; ++index_dep) { JsonDataCreditsDepartment department = new JsonDataCreditsDepartment(); department.Sections = new array(); department.DepartmentName = (nameDepartment +" "+ index_dep); for (int index_sec = 0; index_sec < 4; ++index_sec) { JsonDataCreditsSection section = new JsonDataCreditsSection(); section.SectionLines = new array; section.SectionName = (nameSection +" "+ index_sec); int linesCount = Math.RandomInt(3, 10); for (int i = 0; i < linesCount; ++i) { section.SectionLines.Insert(nameLine +" "+ i); } department.Sections.Insert(section); } data.Departments.Insert(department); } string errorMessage; if (!JsonFileLoader.SaveFile(JSON_FILE_PATH, data, errorMessage)) ErrorEx(errorMessage); } static JsonDataCredits GetData() { string errorMessage; JsonDataCredits data; if (!JsonFileLoader.LoadFile(JSON_FILE_PATH, data, errorMessage)) ErrorEx(errorMessage); return data; } }