DayZ 1.24
Loading...
Searching...
No Matches
ResaveTool.c
Go to the documentation of this file.
1[WorkbenchPluginAttribute("Re-Save Tool", "Saves all files with given extension", "", "", {"ResourceManager"})]
3{
4 [Attribute(".layout", "editbox", "File extension")]
5 string Extension;
7
8 void Resave(string file)
9 {
10 Print("Resaving: " + file);
11 m_module.SetOpenedResource(file);
12 m_module.Save();
13 }
14
15 override void Run()
16 {
17 if (Workbench.ScriptDialog("Resave", "Which files you want to resave?", this))
18 {
19 m_module = Workbench.GetModule("ResourceManager");
20 Workbench.SearchResources(Extension, Resave);
21 }
22 }
23
24 override void RunCommandline()
25 {
26 m_module = Workbench.GetModule("ResourceManager");
27
28 if (m_module.GetCmdLine("-extension", Extension))
29 Extension.Replace("\"", "");
30
31 Workbench.SearchResources(Extension, Resave);
32 Workbench.GetModule("ResourceManager").Close();
33 }
34
35 [ButtonAttribute("Re-Save")]
36 bool OK()
37 {
38 return true;
39 }
40
41 [ButtonAttribute("Cancel")]
42 bool Cancel()
43 {
44 return false;
45 }
46};
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition DayZTools.c:62
string Extension
Definition ResaveTool.c:5
WBModuleDef m_module
Definition ResaveTool.c:6
override void Run()
Definition ResaveTool.c:15
void Resave(string file)
Definition ResaveTool.c:8
override void RunCommandline()
Definition ResaveTool.c:24
bool Cancel()
Definition ResaveTool.c:42
proto native external bool SetOpenedResource(string filename)
proto native external bool Save()
proto external bool GetCmdLine(string name, out string value)
static proto native WBModuleDef GetModule(string type)
static proto bool SearchResources(string filter, func callback)
static proto int ScriptDialog(string caption, string text, Class data)
proto void Print(void var)
Prints content of variable to console/log.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.