Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WorkbenchHelper.c
Go to the documentation of this file.
2{
3 protected static ref array<string> s_aTempStrings;
4
5 //------------------------------------------------------------------------------------------------
10 static void PrintDialog(string message, string caption = "", LogLevel level = LogLevel.WARNING)
11 {
12 Print("" + message, level);
13 Workbench.Dialog(caption, message);
14 }
15
16 //------------------------------------------------------------------------------------------------
24 static void PrintFormatDialog(string message, string param1, string param2 = "", string param3 = "", string caption = "", LogLevel level = LogLevel.WARNING)
25 {
26 message = string.Format(message, param1, param2, param3);
27 Print("" + message, level: level);
28 Workbench.Dialog(caption, message);
29 }
30
31 //------------------------------------------------------------------------------------------------
37 static int PrintOKCancelDialog(string message, string caption = "", LogLevel level = LogLevel.WARNING)
38 {
39 Print("" + message, level);
40 return Workbench.ScriptDialog(caption, message, new WorkbenchDialog_OKCancel());
41 }
42
43 //------------------------------------------------------------------------------------------------
51 static array<ResourceName> SearchWorkbenchResources(array<string> fileExtensions = null, array<string> searchStrArray = null, string rootPath = "", bool recursive = true)
52 {
53 if (fileExtensions && fileExtensions.Contains("c"))
54 {
55 Print("SCR_WorkbenchHelper.SearchWorkbenchResources() cannot search for script files as they are not registered, use SearchWorkbenchFiles instead", LogLevel.WARNING);
56 fileExtensions.RemoveItemOrdered("c");
57 }
58
59 if (fileExtensions && fileExtensions.Contains("layer"))
60 {
61 Print("SCR_WorkbenchHelper.SearchWorkbenchResources() cannot search for layer files as they are not registered, use SearchWorkbenchFiles instead", LogLevel.WARNING);
62 fileExtensions.RemoveItemOrdered("layer");
63 }
64
66 filter.fileExtensions = fileExtensions;
67 filter.recursive = recursive;
68 filter.rootPath = rootPath;
69 filter.searchStr = searchStrArray;
70
71 set<ResourceName> tempResult = new set<ResourceName>();
72 ResourceDatabase.SearchResources(filter, tempResult.Insert);
73
74 // remove unregistered entries
75 tempResult.RemoveItem(ResourceName.Empty);
76
77 // convert to array
78 array<ResourceName> result = {};
79 result.Reserve(tempResult.Count());
80 foreach (ResourceName resourceName : tempResult)
81 {
82 result.Insert(resourceName);
83 }
84
85 return result;
86 }
87
88 //------------------------------------------------------------------------------------------------
96 static array<string> SearchWorkbenchFiles(array<string> fileExtensions = null, array<string> searchStrArray = null, string rootPath = "", bool recursive = true)
97 {
99 filter.fileExtensions = fileExtensions;
100 filter.recursive = recursive;
101 filter.rootPath = rootPath;
102 filter.searchStr = searchStrArray;
103
104 s_aTempStrings = {};
105 ResourceDatabase.SearchResources(filter, SearchResourcesCallbackMethod);
106
107 array<string> result = {};
108 result.Copy(s_aTempStrings);
109 s_aTempStrings = null;
110
111 return result;
112 }
113
114 //
115 // Callbacks
116 //
117
118 //------------------------------------------------------------------------------------------------
120 protected static bool SearchResourcesCallbackMethod(ResourceName resourceName, string exactPath = "")
121 {
122 s_aTempStrings.Insert(exactPath);
123 return true;
124 }
125}
ResourceName resourceName
Definition SCR_AIGroup.c:66
static ref array< string > s_aTempStrings
static int PrintOKCancelDialog(string message, string caption="", LogLevel level=LogLevel.WARNING)
static array< string > SearchWorkbenchFiles(array< string > fileExtensions=null, array< string > searchStrArray=null, string rootPath="", bool recursive=true)
static array< ResourceName > SearchWorkbenchResources(array< string > fileExtensions=null, array< string > searchStrArray=null, string rootPath="", bool recursive=true)
static bool SearchResourcesCallbackMethod(ResourceName resourceName, string exactPath="")
SearchResourcesCallback method used by SearchWorkbenchFiles to get file (relative) PATHS (not Resourc...
static void PrintDialog(string message, string caption="", LogLevel level=LogLevel.WARNING)
static void PrintFormatDialog(string message, string param1, string param2="", string param3="", string caption="", LogLevel level=LogLevel.WARNING)
Object used for holding filtering params for ResourceDatabase.SearchResources() method.
Definition System.c:9
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
T3 param3
Definition tuple.c:93
T2 param2
Definition tuple.c:92
Tuple param1