Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
autotestfixture.c
Go to the documentation of this file.
1
class
AutoTestFixture
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
g_Game
.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
}
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
AutoTestFixture
Definition
autotestfixture.c:2
AutoTestFixture::m_WorldName
static string m_WorldName
Definition
autotestfixture.c:6
AutoTestFixture::SaveXMLReport
static bool SaveXMLReport(string data, out string errorMessage)
Definition
autotestfixture.c:8
AutoTestFixture::GetWorldName
static string GetWorldName()
Definition
autotestfixture.c:44
AutoTestFixture::DATETIME_FORMAT
static const string DATETIME_FORMAT
Definition
autotestfixture.c:4
AutoTestFixture::LogRPT
static void LogRPT(string message)
Definition
autotestfixture.c:49
AutoTestFixture::SpawnEntityAI
static EntityAI SpawnEntityAI(string typeName, int flags=ECE_PLACE_ON_SURFACE)
Definition
autotestfixture.c:29
AutoTestFixture::SetWorldName
static void SetWorldName()
Definition
autotestfixture.c:35
AutoTestFixture::REPORT_FILE_NAME_TEMPLATE
static const string REPORT_FILE_NAME_TEMPLATE
Definition
autotestfixture.c:3
EntityAI
Definition
inventoryitem.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
PrintToRPT
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
FileMode
FileMode
Definition
ensystem.c:383
CloseFile
proto void CloseFile(FileHandle file)
Close the File.
FPrint
proto void FPrint(FileHandle file, void var)
Write to file.
OpenFile
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
FileHandle
int[] FileHandle
Definition
ensystem.c:390
string::ToLower
proto int ToLower()
Changes string to lowercase.
GetYearMonthDayUTC
proto void GetYearMonthDayUTC(out int year, out int month, out int day)
Returns UTC system date.
GetHourMinuteSecondUTC
proto void GetHourMinuteSecondUTC(out int hour, out int minute, out int second)
Returns UTC system time.
Games
Dayz
scripts
3_game
autotest
autotestfixture.c
Generated by
1.17.0