BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Properties | List of all members
BrawlCrate.NodeWrappers.U8Wrapper Class Reference
Inheritance diagram for BrawlCrate.NodeWrappers.U8Wrapper:
BrawlCrate.NodeWrappers.GenericWrapper BrawlCrate.NodeWrappers.BaseWrapper BrawlCrate.NodeWrappers.MultiSelectableWrapper

Public Member Functions

 U8Wrapper ()
 
U8FolderNode NewFolder ()
 
ARCNode NewARC ()
 
BRRESNode NewBRES ()
 
MSBinNode NewMSBin ()
 
void ImportARC ()
 
void ImportBRES ()
 
void ImportMSBin ()
 
override void OnExport (string outPath)
 
void PreviewAll ()
 
void ExportAll ()
 
void searchU8Folder (U8FolderNode u8, out bool hasModels, out bool hasTextures)
 
void ReplaceAll ()
 
- Public Member Functions inherited from BrawlCrate.NodeWrappers.GenericWrapper
 GenericWrapper (IWin32Window owner)
 
 GenericWrapper ()
 
virtual void Sort ()
 
void MoveUp ()
 
virtual void MoveUp (bool select)
 
void MoveDown ()
 
virtual void MoveDown (bool select)
 
void DeleteSelected ()
 
void ExportSelected ()
 
virtual string Export ()
 
virtual void OnExport (string outPath)
 
virtual void Replace ()
 
virtual void OnReplace (string inStream)
 
void Restore ()
 
virtual void Delete ()
 
void Rename ()
 
virtual ResourceNode Duplicate ()
 
virtual ResourceNode Duplicate (bool changeName)
 
- Public Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
void Link (ResourceNode res)
 
void Unlink ()
 

Static Protected Member Functions

static void NewBRESAction (object sender, EventArgs e)
 
static void NewARCAction (object sender, EventArgs e)
 
static void NewFolderAction (object sender, EventArgs e)
 
static void NewMSBinAction (object sender, EventArgs e)
 
static void ImportBRESAction (object sender, EventArgs e)
 
static void ImportARCAction (object sender, EventArgs e)
 
static void ImportMSBinAction (object sender, EventArgs e)
 
static void PreviewAllAction (object sender, EventArgs e)
 
static void ExportAllAction (object sender, EventArgs e)
 
static void ReplaceAllAction (object sender, EventArgs e)
 
- Static Protected Member Functions inherited from BrawlCrate.NodeWrappers.GenericWrapper
static void MoveUpAction (object sender, EventArgs e)
 
static void MoveDownAction (object sender, EventArgs e)
 
static void ExportAction (object sender, EventArgs e)
 
static void ExportSelectedAction (object sender, EventArgs e)
 
static void DeleteSelectedAction (object sender, EventArgs e)
 
static void DuplicateAction (object sender, EventArgs e)
 
static void ReplaceAction (object sender, EventArgs e)
 
static void RestoreAction (object sender, EventArgs e)
 
static void DeleteAction (object sender, EventArgs e)
 
static void RenameAction (object sender, EventArgs e)
 
static void SortAction (object sender, EventArgs e)
 
- Static Protected Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
static T GetInstance< T > ()
 
static IEnumerable< T > GetInstances< T > ()
 

Properties

override string ExportFilter [get]
 
override string ImportFilter [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.GenericWrapper
virtual ContextMenuStrip MultiSelectMenuStrip [get]
 
virtual string DefaultName [get]
 
virtual string ExportFilter [get]
 
virtual string ImportFilter [get]
 
virtual string ReplaceFilter [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.BaseWrapper
ResourceNode Resource [get]
 
virtual ? Color DefaultBackColor [get]
 
virtual ? Color DefaultForeColor [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.MultiSelectableWrapper
ContextMenuStrip MultiSelectMenuStrip [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
static BaseWrapper[] GetAllNodes (BaseWrapper root)
 
static BaseWrapper Wrap (ResourceNode node)
 
static BaseWrapper Wrap (IWin32Window owner, ResourceNode node)
 
- Static Public Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
static IWin32Window _owner
 
- Protected Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
 BaseWrapper ()
 
- Protected Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
bool _discovered
 
ResourceNode _resource
 
- Static Protected Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
static readonly ContextMenuStrip _emptyMenu = new ContextMenuStrip()
 

Constructor & Destructor Documentation

◆ U8Wrapper()

BrawlCrate.NodeWrappers.U8Wrapper.U8Wrapper ( )
inline
149 {
150 ContextMenuStrip = _menu;
151 }

Member Function Documentation

◆ ExportAll()

void BrawlCrate.NodeWrappers.U8Wrapper.ExportAll ( )
inline
250 {
251 string path = Program.ChooseFolder();
252 if (path == null)
253 {
254 return;
255 }
256
257 bool hasModels = false;
258 bool hasTextures = false;
259 foreach (ResourceNode r in _resource.Children)
260 {
261 if (hasModels && hasTextures)
262 {
263 break;
264 }
265
266 if (r is BRRESNode)
267 {
268 foreach (BRESGroupNode e in r.Children)
269 {
270 if (e.Type == BRESGroupNode.BRESGroupType.Textures)
271 {
272 hasTextures = true;
273 }
274 else if (e.Type == BRESGroupNode.BRESGroupType.Models)
275 {
276 hasModels = true;
277 }
278
279 if (hasModels && hasTextures)
280 {
281 break;
282 }
283 }
284 }
285 else if (r is U8FolderNode)
286 {
287 searchU8Folder((U8FolderNode) r, out bool hasModelsTemp, out bool hasTexturesTemp);
288 hasModels = hasModels || hasModelsTemp;
289 hasTextures = hasTextures || hasTexturesTemp;
290 }
291 }
292
293 string extensionTEX0 = ".tex0";
294 string extensionMDL0 = ".mdl0";
295
296 if (hasTextures)
297 {
298 ExportAllFormatDialog dialog =
299 new ExportAllFormatDialog("Export All", typeof(TEX0Node), FileFilters.TEX0);
300
301 if (dialog.ShowDialog() == DialogResult.OK)
302 {
303 extensionTEX0 = dialog.SelectedExtension;
304 }
305 else
306 {
307 return;
308 }
309 }
310
311 if (hasModels)
312 {
313 ExportAllFormatDialog dialog =
314 new ExportAllFormatDialog("Export All", typeof(MDL0Node), FileFilters.MDL0Export);
315
316 if (dialog.ShowDialog() == DialogResult.OK)
317 {
318 extensionMDL0 = dialog.SelectedExtension;
319 }
320 else
321 {
322 return;
323 }
324 }
325
326 ((U8Node) _resource).ExtractToFolder(path, extensionTEX0, extensionMDL0);
327 }
ResourceNode _resource
Definition: BaseWrapper.cs:76
void searchU8Folder(U8FolderNode u8, out bool hasModels, out bool hasTextures)
Definition: U8Wrapper.cs:329
string SelectedExtension
Definition: ExportAllAskFormat.cs:31
Definition: FileFilters.cs:8
static string TEX0
Definition: FileFilters.cs:38
static string MDL0Export
Definition: FileFilters.cs:35
Definition: BRRESNode.cs:777
BRESGroupType Type
Definition: BRRESNode.cs:828
BRESGroupType
Definition: BRRESNode.cs:857
Definition: BRRESNode.cs:19
Definition: MDL0Node.cs:24
Definition: ResourceNode.cs:129
List< ResourceNode > Children
Definition: ResourceNode.cs:262
Definition: TEX0Node.cs:22
Definition: U8Node.cs:14

◆ ExportAllAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.ExportAllAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
112 {
113 GetInstance<U8Wrapper>().ExportAll();
114 }

◆ ImportARC()

void BrawlCrate.NodeWrappers.U8Wrapper.ImportARC ( )
inline
198 {
199 if (Program.OpenFile(FileFilters.ARCImport, out string path))
200 {
201 NewARC().Replace(path);
202 }
203 }
ARCNode NewARC()
Definition: U8Wrapper.cs:164
static string ARCImport
Definition: FileFilters.cs:13
virtual void Replace(string fileName)
Definition: ResourceNode.cs:829

◆ ImportARCAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.ImportARCAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
97 {
98 GetInstance<U8Wrapper>().ImportARC();
99 }

◆ ImportBRES()

void BrawlCrate.NodeWrappers.U8Wrapper.ImportBRES ( )
inline
206 {
207 if (Program.OpenFile(FileFilters.BRES, out string path))
208 {
209 NewBRES().Replace(path);
210 }
211 }
BRRESNode NewBRES()
Definition: U8Wrapper.cs:175
static string BRES
Definition: FileFilters.cs:28

◆ ImportBRESAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.ImportBRESAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
92 {
93 GetInstance<U8Wrapper>().ImportBRES();
94 }

◆ ImportMSBin()

void BrawlCrate.NodeWrappers.U8Wrapper.ImportMSBin ( )
inline
214 {
215 if (Program.OpenFile(FileFilters.MSBin, out string path))
216 {
217 NewMSBin().Replace(path);
218 }
219 }
MSBinNode NewMSBin()
Definition: U8Wrapper.cs:186
static string MSBin
Definition: FileFilters.cs:68
override void Replace(string fileName)
Definition: MSBinNode.cs:120

◆ ImportMSBinAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.ImportMSBinAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
102 {
103 GetInstance<U8Wrapper>().ImportMSBin();
104 }

◆ NewARC()

ARCNode BrawlCrate.NodeWrappers.U8Wrapper.NewARC ( )
inline
165 {
166 ARCNode node = new ARCNode {Name = _resource.FindName("NewARChive"), FileType = ARCFileType.MiscData};
167 _resource.AddChild(node);
168
169 BaseWrapper w = FindResource(node, false);
170 w.EnsureVisible();
171 w.TreeView.SelectedNode = w;
172 return node;
173 }
BaseWrapper()
Definition: BaseWrapper.cs:79
Definition: ARCNode.cs:16
unsafe string FindName(string name)
Definition: ResourceNode.cs:1578
virtual void AddChild(ResourceNode child)
Definition: ResourceNode.cs:757
ARCFileType
Definition: ARC.cs:144

◆ NewARCAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.NewARCAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
77 {
78 GetInstance<U8Wrapper>().NewARC();
79 }

◆ NewBRES()

BRRESNode BrawlCrate.NodeWrappers.U8Wrapper.NewBRES ( )
inline
176 {
177 BRRESNode node = new BRRESNode {FileType = ARCFileType.MiscData};
178 _resource.AddChild(node);
179
180 BaseWrapper w = FindResource(node, false);
181 w.EnsureVisible();
182 w.TreeView.SelectedNode = w;
183 return node;
184 }

◆ NewBRESAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.NewBRESAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
72 {
73 GetInstance<U8Wrapper>().NewBRES();
74 }

◆ NewFolder()

U8FolderNode BrawlCrate.NodeWrappers.U8Wrapper.NewFolder ( )
inline
154 {
155 U8FolderNode node = new U8FolderNode {Name = _resource.FindName("NewFolder")};
156 _resource.AddChild(node);
157
158 BaseWrapper w = FindResource(node, false);
159 w.EnsureVisible();
160 w.TreeView.SelectedNode = w;
161 return node;
162 }

◆ NewFolderAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.NewFolderAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
82 {
83 GetInstance<U8Wrapper>().NewFolder();
84 }

◆ NewMSBin()

MSBinNode BrawlCrate.NodeWrappers.U8Wrapper.NewMSBin ( )
inline
187 {
188 MSBinNode node = new MSBinNode {FileType = ARCFileType.MiscData};
189 _resource.AddChild(node);
190
191 BaseWrapper w = FindResource(node, false);
192 w.EnsureVisible();
193 w.TreeView.SelectedNode = w;
194 return node;
195 }
Definition: MSBinNode.cs:9

◆ NewMSBinAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.NewMSBinAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
87 {
88 GetInstance<U8Wrapper>().NewMSBin();
89 }

◆ OnExport()

override void BrawlCrate.NodeWrappers.U8Wrapper.OnExport ( string  outPath)
inlinevirtual

Reimplemented from BrawlCrate.NodeWrappers.GenericWrapper.

222 {
223 if (outPath.Contains("."))
224 {
225 switch (outPath.Substring(outPath.ToLowerInvariant().LastIndexOf(".")))
226 {
227 case ".szs":
228 ((U8Node) _resource).ExportSZS(outPath);
229 break;
230 case ".pair":
231 ((U8Node) _resource).ExportPair(outPath);
232 break;
233 default:
234 ((U8Node) _resource).Export(outPath);
235 break;
236 }
237 }
238 else
239 {
240 ((U8Node) _resource).Export(outPath);
241 }
242 }

◆ PreviewAll()

void BrawlCrate.NodeWrappers.U8Wrapper.PreviewAll ( )
inline
245 {
246 new ModelForm().Show(_owner, ModelPanel.CollectModels(_resource));
247 }
static IWin32Window _owner
Definition: BaseWrapper.cs:398
static List< IModel > CollectModels(ResourceNode node)
Definition: ModelPanel.cs:1044

◆ PreviewAllAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.PreviewAllAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
107 {
108 GetInstance<U8Wrapper>().PreviewAll();
109 }

◆ ReplaceAll()

void BrawlCrate.NodeWrappers.U8Wrapper.ReplaceAll ( )
inline
369 {
370 string path = Program.ChooseFolder();
371 if (path == null)
372 {
373 return;
374 }
375
376 ((ARCNode) _resource).ReplaceFromFolder(path);
377 }

◆ ReplaceAllAction()

static void BrawlCrate.NodeWrappers.U8Wrapper.ReplaceAllAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
117 {
118 GetInstance<U8Wrapper>().ReplaceAll();
119 }

◆ searchU8Folder()

void BrawlCrate.NodeWrappers.U8Wrapper.searchU8Folder ( U8FolderNode  u8,
out bool  hasModels,
out bool  hasTextures 
)
inline
330 {
331 hasModels = false;
332 hasTextures = false;
333 foreach (ResourceNode r in u8.Children)
334 {
335 if (hasModels && hasTextures)
336 {
337 break;
338 }
339
340 if (r is BRRESNode)
341 {
342 foreach (BRESGroupNode e in r.Children)
343 {
344 if (e.Type == BRESGroupNode.BRESGroupType.Textures)
345 {
346 hasTextures = true;
347 }
348 else if (e.Type == BRESGroupNode.BRESGroupType.Models)
349 {
350 hasModels = true;
351 }
352
353 if (hasModels && hasTextures)
354 {
355 break;
356 }
357 }
358 }
359 else if (r is U8FolderNode)
360 {
361 searchU8Folder((U8FolderNode) r, out bool hasModelsTemp, out bool hasTexturesTemp);
362 hasModels = hasModels || hasModelsTemp;
363 hasTextures = hasTextures || hasTexturesTemp;
364 }
365 }
366 }

Property Documentation

◆ ExportFilter

override string BrawlCrate.NodeWrappers.U8Wrapper.ExportFilter
get

◆ ImportFilter

override string BrawlCrate.NodeWrappers.U8Wrapper.ImportFilter
get

The documentation for this class was generated from the following file: