Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
ResaveMetaTool.c
Go to the documentation of this file.
1
[
WorkbenchPluginAttribute
(
"Re-Save Meta Tool"
,
"Saves all meta files with given extension"
,
""
,
""
, {
"ResourceManager"
},
""
,0xf0c7)]
2
class
ResaveMetaPlugin
: WorkbenchPlugin
3
{
4
[
Attribute
(uiwidget:
UIWidgets
.FileNamePicker,
desc
:
"Root directory to search"
,
params
:
"unregFolders"
)]
5
string
RootPath;
6
7
[
Attribute
(uiwidget:
UIWidgets
.EditBox,
desc
:
"File extensions (without .meta)"
)]
8
ref array<string> Extensions;
9
10
ResourceManager m_module;
11
ref array<string> m_files = {};
12
13
void
Find
(
ResourceName
resName,
string
file)
14
{
15
m_files.Insert(file);
16
}
17
18
void
Resave()
19
{
20
WBProgressDialog progress =
new
WBProgressDialog(
"Resaving..."
, m_module);
21
int
cnt = m_files.Count();
22
foreach
(
int
i,
string
file: m_files)
23
{
24
MetaFile mf = m_module.GetMetaFile(file);
25
if
(mf)
26
{
27
mf.Save();
28
mf.Release();
29
}
30
31
progress.SetProgress(i / cnt);
32
}
33
m_files.Clear();
34
}
35
36
override
void
Run
()
37
{
38
if
(Workbench.ScriptDialog(
"Resave"
,
"Which files metafiles you want to resave?"
,
this
))
39
{
40
m_module = Workbench.GetModule(ResourceManager);
41
42
SearchResourcesFilter
filter =
new
SearchResourcesFilter
();
43
filter.rootPath = RootPath;
44
filter.fileExtensions = Extensions;
45
ResourceDatabase
.SearchResources(filter, Find);
46
47
Resave();
48
}
49
}
50
51
override
void
RunCommandline
()
52
{
53
m_module = Workbench.GetModule(ResourceManager);
54
SearchResourcesFilter
filter =
new
SearchResourcesFilter
();
55
56
string
addonPathCli;
57
if
(m_module.GetCmdLine(
"-addonPath"
, addonPathCli))
58
{
59
if
(!
FilePath
.IsAbsolutePath(addonPathCli))
60
{
61
PrintFormat
(
"Argument 'addonPath' must be an absolute path, but its value is '%1'"
, addonPathCli, level:
LogLevel
.ERROR);
62
Workbench.Exit(1);
63
return
;
64
}
65
66
string
addonGuid, addonId, addonExactRoot;
67
bool
found =
AddonBuildInfoTool
.FindAddonByAbsolutePath(
68
addonPathCli, addonGuid, addonId, addonExactRoot
69
);
70
if
(found)
71
filter.rootPath = addonExactRoot;
72
}
73
74
string
ext;
75
if
(m_module.GetCmdLine(
"-extension"
, ext))
76
{
77
ext.Replace(
"\""
,
""
);
78
ext.Replace(
"."
,
""
);
79
Extensions = {ext};
80
}
81
82
filter.fileExtensions = Extensions;
83
ResourceDatabase
.SearchResources(filter, Find);
84
85
Resave();
86
Workbench.Exit(0);
87
}
88
89
[
ButtonAttribute
(
"Re-Save"
)]
90
bool
OK
()
91
{
92
return
true
;
93
}
94
95
[
ButtonAttribute
(
"Cancel"
)]
96
bool
Cancel()
97
{
98
return
false
;
99
}
100
}
RunCommandline
override void RunCommandline()
Definition
FlowmapTool.c:60
WorkbenchPluginAttribute
GenerateFlowMaps WorkbenchPlugin WorkbenchPluginAttribute("Regenerate river flow-maps", "Generate and save/overwrite river flow-maps", "", "", {"WorldEditor"}, "", 0xf773)
Definition
FlowmapTool.c:59
Run
override void Run()
Definition
SCR_ImageSetGenerator.c:297
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
OK
SCR_RespawnComponentClass OK
Result code for request/assign response.
Definition
EMoveError.c:14
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
ButtonAttribute
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
Definition
WorkbenchDialogs.c:30
AddonBuildInfoTool
Definition
AddonBuildInfoTool.c:8
FilePath
Definition
FilePath.c:13
ResaveMetaPlugin
Definition
ResaveMetaTool.c:3
ResourceDatabase
Definition
ResourceDatabase.c:13
ResourceName
Definition
ResourceName.c:13
SearchResourcesFilter
Object used for holding filtering params for ResourceDatabase.SearchResources() method.
Definition
System.c:9
UIWidgets
Definition
attributes.c:40
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
PrintFormat
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
Find
proto int Find(T value)
scripts
WorkbenchCommon
ResaveMetaTool.c
Generated by
1.17.0