DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
AutoTestFixture.c
См. документацию.
2{
3 private static const string REPORT_FILE_NAME_TEMPLATE = "$mission:Autotest_%1.xml";
4 private static const string DATETIME_FORMAT = "%1%2%3T%4%5%6Z";
5
6 private static string m_WorldName;
7
8 static bool SaveXMLReport(string data, out string errorMessage)
9 {
10 int year, month, day, hour, minute, second;
11 GetYearMonthDayUTC(year, month, day);
12 GetHourMinuteSecondUTC(hour, minute, second);
13 string datetimeUTC = string.Format(DATETIME_FORMAT, year, month.ToStringLen(2), day.ToStringLen(2), hour.ToStringLen(2), minute.ToStringLen(2), second.ToStringLen(2));
14 string filename = string.Format(REPORT_FILE_NAME_TEMPLATE, datetimeUTC);
15
16 FileHandle handle = OpenFile(filename, FileMode.WRITE);
17 if (handle == 0)
18 {
19 errorMessage = string.Format("Cannot open file \"%1\" for writing", filename);
20 return false;
21 }
22
23 FPrint(handle, data);
24 CloseFile(handle);
25
26 return true;
27 }
28
29 static EntityAI SpawnEntityAI(string typeName, int flags = ECE_PLACE_ON_SURFACE)
30 {
31 EntityAI entity = EntityAI.Cast(g_Game.CreateObjectEx(typeName, g_Game.GetPlayer().GetPosition(), ECE_PLACE_ON_SURFACE));
32 return entity;
33 }
34
35 static void SetWorldName()
36 {
37 string worldName = "empty";
38 GetGame().GetWorldName(worldName);
39 worldName.ToLower();
40
41 m_WorldName = worldName;
42 }
43
44 static string GetWorldName()
45 {
46 return m_WorldName;
47 }
48
49 static void LogRPT(string message)
50 {
51 PrintToRPT(string.Format("[Autotest] %1", message));
52 }
53}
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZGame g_Game
Определения DayZGame.c:3868
static void LogRPT(string message)
Определения AutoTestFixture.c:49
static void SetWorldName()
Определения AutoTestFixture.c:35
static string GetWorldName()
Определения AutoTestFixture.c:44
static const string DATETIME_FORMAT
Определения AutoTestFixture.c:4
static bool SaveXMLReport(string data, out string errorMessage)
Определения AutoTestFixture.c:8
static EntityAI SpawnEntityAI(string typeName, int flags=ECE_PLACE_ON_SURFACE)
Определения AutoTestFixture.c:29
static const string REPORT_FILE_NAME_TEMPLATE
Определения AutoTestFixture.c:3
static string m_WorldName
Определения AutoTestFixture.c:6
Определения AutoTestFixture.c:2
proto void GetWorldName(out string world_name)
Определения Building.c:6
proto native CGame GetGame()
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
FileMode
Определения EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto void FPrint(FileHandle file, void var)
Write to file.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Определения EnSystem.c:390
proto int ToLower()
Changes string to lowercase. Returns length.
proto void GetYearMonthDayUTC(out int year, out int month, out int day)
Returns UTC system date.
proto void GetHourMinuteSecondUTC(out int hour, out int minute, out int second)
Returns UTC system time.