BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
BrawlCrate.NodeWrappers.BaseWrapper Class Reference
Inheritance diagram for BrawlCrate.NodeWrappers.BaseWrapper:
BrawlCrate.NodeWrappers.GenericWrapper BrawlCrate.NodeWrappers.ADSJWrapper BrawlCrate.NodeWrappers.ARCWrapper BrawlCrate.NodeWrappers.ASLSWrapper BrawlCrate.NodeWrappers.BLOCEntryWrapper BrawlCrate.NodeWrappers.BLOCWrapper BrawlCrate.NodeWrappers.BRESGroupWrapper BrawlCrate.NodeWrappers.BRESWrapper BrawlCrate.NodeWrappers.CHR0EntryWrapper BrawlCrate.NodeWrappers.CHR0Wrapper BrawlCrate.NodeWrappers.CLR0MaterialEntryWrapper BrawlCrate.NodeWrappers.CLR0MaterialWrapper BrawlCrate.NodeWrappers.CLR0Wrapper BrawlCrate.NodeWrappers.CMMWrapper BrawlCrate.NodeWrappers.COSCWrapper BrawlCrate.NodeWrappers.CSSCEntryWrapper BrawlCrate.NodeWrappers.CSSCWrapper BrawlCrate.NodeWrappers.ClassicStageTblWrapper BrawlCrate.NodeWrappers.CollisionObjectWrapper BrawlCrate.NodeWrappers.CollisionWrapper BrawlCrate.NodeWrappers.EFLSEntryWrapper BrawlCrate.NodeWrappers.EFLSWrapper BrawlCrate.NodeWrappers.FCFGWrapper BrawlCrate.NodeWrappers.FolderWrapper BrawlCrate.NodeWrappers.GCAMWrapper BrawlCrate.NodeWrappers.GEG1Wrapper BrawlCrate.NodeWrappers.GIB2Wrapper BrawlCrate.NodeWrappers.GITMWrapper BrawlCrate.NodeWrappers.GSNDWrapper BrawlCrate.NodeWrappers.GWATWrapper BrawlCrate.NodeWrappers.HavokWrapper BrawlCrate.NodeWrappers.ItemFreqWrapper BrawlCrate.NodeWrappers.ItmFreqTableGroupWrapper BrawlCrate.NodeWrappers.ItmFreqTableWrapper BrawlCrate.NodeWrappers.MDL0EntryWrapper BrawlCrate.NodeWrappers.MDL0GroupWrapper BrawlCrate.NodeWrappers.MDL0MaterialRefWrapper BrawlCrate.NodeWrappers.MDL0PolygonWrapper BrawlCrate.NodeWrappers.MDL0Wrapper BrawlCrate.NodeWrappers.MDefActionGroupWrapper BrawlCrate.NodeWrappers.MDefActionListWrapper BrawlCrate.NodeWrappers.MDefActionOverrideListWrapper BrawlCrate.NodeWrappers.MDefEventParameterWrapper BrawlCrate.NodeWrappers.MDefEventWrapper BrawlCrate.NodeWrappers.MDefHurtboxListWrapper BrawlCrate.NodeWrappers.MDefMdlVisGroupWrapper BrawlCrate.NodeWrappers.MDefMdlVisRefWrapper BrawlCrate.NodeWrappers.MDefMdlVisSwitchWrapper BrawlCrate.NodeWrappers.MDefRefListWrapper BrawlCrate.NodeWrappers.MDefSubActionGroupWrapper BrawlCrate.NodeWrappers.MDefSubroutineListWrapper BrawlCrate.NodeWrappers.MDefUneditableWrapper BrawlCrate.NodeWrappers.MDefWrapper BrawlCrate.NodeWrappers.MRGWrapper BrawlCrate.NodeWrappers.MSBinWrapper BrawlCrate.NodeWrappers.MasqueradeEntryWrapper BrawlCrate.NodeWrappers.MasqueradeWrapper BrawlCrate.NodeWrappers.NoEditEntryWrapper BrawlCrate.NodeWrappers.NoEditFolderWrapper BrawlCrate.NodeWrappers.NoEditItemWrapper BrawlCrate.NodeWrappers.PAT0EntryWrapper BrawlCrate.NodeWrappers.PAT0TextureEntryWrapper BrawlCrate.NodeWrappers.PAT0TextureWrapper BrawlCrate.NodeWrappers.PAT0Wrapper BrawlCrate.NodeWrappers.PLT0Wrapper BrawlCrate.NodeWrappers.PluginWrapper BrawlCrate.NodeWrappers.RBNKWrapper BrawlCrate.NodeWrappers.REFFWrapper BrawlCrate.NodeWrappers.REFTImageWrapper BrawlCrate.NodeWrappers.REFTWrapper BrawlCrate.NodeWrappers.RELExternalMethodWrapper BrawlCrate.NodeWrappers.RELInheritanceWrapper BrawlCrate.NodeWrappers.RELMethodWrapper BrawlCrate.NodeWrappers.RELSectionWrapper BrawlCrate.NodeWrappers.RELWrapper BrawlCrate.NodeWrappers.RSARFolderWrapper BrawlCrate.NodeWrappers.RSARSoundWrapper BrawlCrate.NodeWrappers.RSARWrapper BrawlCrate.NodeWrappers.RSEQWrapper BrawlCrate.NodeWrappers.RSTCGroupWrapper BrawlCrate.NodeWrappers.RSTCWrapper BrawlCrate.NodeWrappers.RSTMWrapper BrawlCrate.NodeWrappers.RWSDSoundGroupWrapper BrawlCrate.NodeWrappers.RWSDWrapper BrawlCrate.NodeWrappers.RedirectWrapper BrawlCrate.NodeWrappers.SCLAWrapper BrawlCrate.NodeWrappers.SCN0CameraWrapper BrawlCrate.NodeWrappers.SCN0FogWrapper BrawlCrate.NodeWrappers.SCN0LightWrapper BrawlCrate.NodeWrappers.SCN0Wrapper BrawlCrate.NodeWrappers.SELBWrapper BrawlCrate.NodeWrappers.SELCTeamWrapper BrawlCrate.NodeWrappers.SHP0EntryWrapper BrawlCrate.NodeWrappers.SHP0VertexSetNodeWrapper BrawlCrate.NodeWrappers.SHP0Wrapper BrawlCrate.NodeWrappers.SLTCWrapper BrawlCrate.NodeWrappers.SRT0EntryWrapper BrawlCrate.NodeWrappers.SRT0TextureWrapper BrawlCrate.NodeWrappers.SRT0Wrapper BrawlCrate.NodeWrappers.STEXWrapper BrawlCrate.NodeWrappers.STPMWrapper BrawlCrate.NodeWrappers.SndBgmTitleDataFolderWrapper BrawlCrate.NodeWrappers.StageTableWrapper BrawlCrate.NodeWrappers.Subspace.BGMGWrapper BrawlCrate.NodeWrappers.TBWrapper BrawlCrate.NodeWrappers.TEVStageWrapper BrawlCrate.NodeWrappers.TEX0Wrapper BrawlCrate.NodeWrappers.TLSTWrapper BrawlCrate.NodeWrappers.TPLTextureNodeWrapper BrawlCrate.NodeWrappers.TPLWrapper BrawlCrate.NodeWrappers.TyDataListEntryWrapper BrawlCrate.NodeWrappers.TyDataListWrapper BrawlCrate.NodeWrappers.TySealWrapper BrawlCrate.NodeWrappers.U8FolderWrapper BrawlCrate.NodeWrappers.U8Wrapper BrawlCrate.NodeWrappers.VIS0Wrapper

Public Member Functions

void Link (ResourceNode res)
 
void Unlink ()
 

Static Public Member Functions

static BaseWrapper[] GetAllNodes (BaseWrapper root)
 
static BaseWrapper Wrap (ResourceNode node)
 
static BaseWrapper Wrap (IWin32Window owner, ResourceNode node)
 

Static Public Attributes

static IWin32Window _owner
 

Protected Member Functions

 BaseWrapper ()
 

Static Protected Member Functions

static T GetInstance< T > ()
 
static IEnumerable< T > GetInstances< T > ()
 

Protected Attributes

bool _discovered
 
ResourceNode _resource
 

Static Protected Attributes

static readonly ContextMenuStrip _emptyMenu = new ContextMenuStrip()
 

Properties

ResourceNode Resource [get]
 
virtual ? Color DefaultBackColor [get]
 
virtual ? Color DefaultForeColor [get]
 

Constructor & Destructor Documentation

◆ BaseWrapper()

BrawlCrate.NodeWrappers.BaseWrapper.BaseWrapper ( )
inlineprotected
80 {
81 }

Member Function Documentation

◆ GetAllNodes()

static BaseWrapper[] BrawlCrate.NodeWrappers.BaseWrapper.GetAllNodes ( BaseWrapper  root)
inlinestatic
222 {
223 List<BaseWrapper> result = new List<BaseWrapper>();
224 result.Add(root);
225 foreach (TreeNode child in root.Nodes)
226 {
227 if (child is BaseWrapper b && b.Resource != null)
228 {
229 bool expanded = b.IsExpanded;
230 b.Expand();
231 result.AddRange(GetAllNodes(b));
232 if (!expanded)
233 {
234 b.Collapse();
235 }
236 }
237 }
238
239 return result.ToArray();
240 }
static BaseWrapper[] GetAllNodes(BaseWrapper root)
Definition: BaseWrapper.cs:221
BaseWrapper()
Definition: BaseWrapper.cs:79

◆ GetInstance< T >()

static T BrawlCrate.NodeWrappers.BaseWrapper.GetInstance< T > ( )
inlinestaticprotected
Type Constraints
T :BaseWrapper 
85 {
86 return MainForm.Instance.resourceTree.SelectedNode as T;
87 }

◆ GetInstances< T >()

static IEnumerable< T > BrawlCrate.NodeWrappers.BaseWrapper.GetInstances< T > ( )
inlinestaticprotected
Type Constraints
T :BaseWrapper 
90 {
91 return MainForm.Instance.resourceTree.SelectedNodes.Select(n => n as T).Where(n => n != null);
92 }
Definition: MainForm.cs:34
ResourceTree resourceTree
Definition: MainForm.cs:2418
static MainForm Instance
Definition: MainForm.cs:36
new List< TreeNode > SelectedNodes
Definition: ResourceTree.cs:58

◆ Link()

void BrawlCrate.NodeWrappers.BaseWrapper.Link ( ResourceNode  res)
inline
95 {
96 Unlink();
97 if (res != null)
98 {
99 Text = res.Name;
100 TreeNodeCollection nodes = Nodes;
101
102 //Should we continue down the tree?
103 if (IsExpanded && res.HasChildren)
104 {
105 //Add/link each resource node
106 foreach (ResourceNode n in res.Children)
107 {
108 bool found = false;
109 foreach (BaseWrapper tn in nodes)
110 {
111 if (tn.Text == n.Name)
112 {
113 tn.Link(n);
114 found = true;
115 // Move node to bottom, to ensure that nodes are shown and saved in the same order as in the original data
116 nodes.Remove(tn);
117 nodes.Add(tn);
118 break;
119 }
120 }
121
122 if (!found)
123 {
124 nodes.Add(Wrap(_owner, n));
125 }
126 }
127
128 //Remove empty nodes
129 for (int i = 0; i < nodes.Count;)
130 {
131 BaseWrapper n = nodes[i] as BaseWrapper;
132 if (n._resource == null)
133 {
134 n.Remove();
135 }
136 else
137 {
138 i++;
139 }
140 }
141
142 _discovered = true;
143 }
144 else
145 {
146 //Node will be reset and undiscovered
147 nodes.Clear();
148 //Collapse();
149 if (res.HasChildren)
150 {
151 nodes.Add(new GenericWrapper());
152 _discovered = false;
153 }
154 else
155 {
156 _discovered = true;
157 }
158 }
159
160 SelectedImageIndex = ImageIndex = Icons.getImageIndex(res.ResourceFileType);
161
162 res.SelectChild += OnSelectChild;
163 res.ChildAdded += OnChildAdded;
164 res.ChildRemoved += OnChildRemoved;
165 res.ChildInserted += OnChildInserted;
166 res.Replaced += OnReplaced;
167 res.Restored += OnRestored;
168 res.Renamed += OnRenamed;
169 res.MovedUp += OnMovedUp;
170 res.MovedDown += OnMovedDown;
171 res.PropertyChanged += OnPropertyChanged;
172 res.UpdateProps += OnUpdateProperties;
173 res.UpdateControl += OnUpdateCurrentControl;
174 }
175
176 _resource = res;
177 if (DefaultBackColor != null)
178 {
179 BackColor = (Color)DefaultBackColor;
180 }
181
182 if (DefaultForeColor != null)
183 {
184 ForeColor = (Color)DefaultForeColor;
185 }
186 }
ResourceNode _resource
Definition: BaseWrapper.cs:76
virtual ? Color DefaultBackColor
Definition: BaseWrapper.cs:337
virtual ? Color DefaultForeColor
Definition: BaseWrapper.cs:338
void Unlink()
Definition: BaseWrapper.cs:188
static BaseWrapper Wrap(ResourceNode node)
Definition: BaseWrapper.cs:400
bool _discovered
Definition: BaseWrapper.cs:74
static IWin32Window _owner
Definition: BaseWrapper.cs:398
Definition: Icons.cs:11
static int getImageIndex(ResourceType resResourceFileType)
Definition: Icons.cs:178
Definition: ResourceNode.cs:129
virtual bool HasChildren
Definition: ResourceNode.cs:185
virtual ResourceType ResourceFileType
Definition: ResourceNode.cs:193
virtual string Name
Definition: ResourceNode.cs:223
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ Unlink()

void BrawlCrate.NodeWrappers.BaseWrapper.Unlink ( )
inline
189 {
190 if (_resource != null)
191 {
192 _resource.SelectChild -= OnSelectChild;
193 _resource.ChildAdded -= OnChildAdded;
194 _resource.ChildRemoved -= OnChildRemoved;
195 _resource.ChildInserted -= OnChildInserted;
196 _resource.Replaced -= OnReplaced;
197 _resource.Restored -= OnRestored;
198 _resource.Renamed -= OnRenamed;
199 _resource.MovedUp -= OnMovedUp;
200 _resource.MovedDown -= OnMovedDown;
201 _resource.PropertyChanged -= OnPropertyChanged;
202 _resource.UpdateProps -= OnUpdateProperties;
203 _resource.UpdateControl -= OnUpdateCurrentControl;
204 _resource = null;
205 }
206
207 foreach (BaseWrapper n in Nodes)
208 {
209 n.Unlink();
210 }
211 }

◆ Wrap() [1/2]

static BaseWrapper BrawlCrate.NodeWrappers.BaseWrapper.Wrap ( IWin32Window  owner,
ResourceNode  node 
)
inlinestatic
406 {
407 _owner = owner;
408 BaseWrapper w;
409 if (NodeWrapperAttribute.PluginTypeWrappers.ContainsKey(node.GetType()))
410 {
411 w = NodeWrapperAttribute.PluginTypeWrappers[node.GetType()].GetInstance();
412 }
413 else if (NodeWrapperAttribute.PluginResourceWrappers.ContainsKey(node.ResourceFileType))
414 {
415 w = NodeWrapperAttribute.PluginResourceWrappers[node.ResourceFileType].GetInstance();
416 }
417 else if (NodeWrapperAttribute.ResourceWrappers.ContainsKey(node.ResourceFileType))
418 {
419 w = Activator.CreateInstance(NodeWrapperAttribute.ResourceWrappers[node.ResourceFileType]) as
421 }
422 else
423 {
424 w = new GenericWrapper();
425 }
426
427 w.Link(node);
428 return w;
429 }

◆ Wrap() [2/2]

static BaseWrapper BrawlCrate.NodeWrappers.BaseWrapper.Wrap ( ResourceNode  node)
inlinestatic
401 {
402 return Wrap(null, node);
403 }

Member Data Documentation

◆ _discovered

bool BrawlCrate.NodeWrappers.BaseWrapper._discovered
protected

◆ _emptyMenu

readonly ContextMenuStrip BrawlCrate.NodeWrappers.BaseWrapper._emptyMenu = new ContextMenuStrip()
staticprotected

◆ _owner

IWin32Window BrawlCrate.NodeWrappers.BaseWrapper._owner
static

◆ _resource

ResourceNode BrawlCrate.NodeWrappers.BaseWrapper._resource
protected

Property Documentation

◆ DefaultBackColor

virtual ? Color BrawlCrate.NodeWrappers.BaseWrapper.DefaultBackColor
get

◆ DefaultForeColor

virtual ? Color BrawlCrate.NodeWrappers.BaseWrapper.DefaultForeColor
get

◆ Resource

ResourceNode BrawlCrate.NodeWrappers.BaseWrapper.Resource
get

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