BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
BrawlCrate.BrawlManagers.SongManager.SongManagerForm Class Reference
Inheritance diagram for BrawlCrate.BrawlManagers.SongManager.SongManagerForm:

Public Member Functions

 SongManagerForm (string path, bool loadNames, bool loadBrstms, bool groupSongs)
 
void dragEnter (object sender, DragEventArgs e)
 
void dragDrop (object sender, DragEventArgs e)
 

Static Public Attributes

static readonly string[] GCT_PATHS
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Constructor & Destructor Documentation

◆ SongManagerForm()

BrawlCrate.BrawlManagers.SongManager.SongManagerForm.SongManagerForm ( string  path,
bool  loadNames,
bool  loadBrstms,
bool  groupSongs 
)
inline
84 {
85 if (path == null && !string.IsNullOrEmpty(Properties.Settings.Default.BuildPath))
86 {
87 Environment.CurrentDirectory = Properties.Settings.Default.BuildPath;
88 }
89
90 path = path ?? Environment.CurrentDirectory;
91
92 InitializeComponent();
93
94 loadNamesFromInfopacToolStripMenuItem.Checked = songPanel1.LoadNames = loadNames;
95 loadBRSTMPlayerToolStripMenuItem.Checked = songPanel1.LoadBrstms = loadBrstms;
96 groupSongsByStageToolStripMenuItem.Checked = groupSongs;
97 listType = groupSongs ? ListType.GroupByStage : ListType.FilesInDir;
98
99 Text = "BrawlCrate Song Manager" +
100 Program.AssemblyTitleShort.Substring(
101 Program.AssemblyTitleShort.IndexOf(" ", StringComparison.Ordinal));
102
103 // Later commands to change the titlebar assume there is a hypen in the title somewhere
104 Text += " -";
105
106 loadNames = loadNamesFromInfopacToolStripMenuItem.Checked;
107 loadBrstms = loadBRSTMPlayerToolStripMenuItem.Checked;
108 autoplay = whenSongEndsStartPlayingNextSongToolStripMenuItem.Checked;
109
110 RightControl = ChooseLabel;
111
112 // Drag and drop for the left and right sides of the window. The dragEnter and dragDrop methods will check which panel the file is dropped onto.
113 listBox1.AllowDrop = true;
114 listBox1.DragEnter += dragEnter;
115 listBox1.DragDrop += dragDrop;
116
117 FormClosing += closing;
118 FormClosed += closed;
119
120 changeDirectory(path);
121 }
void dragEnter(object sender, DragEventArgs e)
Definition: SongManagerForm.cs:353
void dragDrop(object sender, DragEventArgs e)
Definition: SongManagerForm.cs:374

Member Function Documentation

◆ Dispose()

override void BrawlCrate.BrawlManagers.SongManager.SongManagerForm.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
14 {
15 if (disposing && (components != null)) {
16 components.Dispose();
17 }
18 base.Dispose(disposing);
19 }

◆ dragDrop()

void BrawlCrate.BrawlManagers.SongManager.SongManagerForm.dragDrop ( object  sender,
DragEventArgs  e 
)
inline
375 {
376 string[] s = (string[]) e.Data.GetData(DataFormats.FileDrop);
377 BeginInvoke(new Action(() =>
378 {
379 string filepath = s[0].ToLower();
380 if (sender == listBox1)
381 {
382 using (NameDialog nd = new NameDialog())
383 {
384 nd.EntryText =
385 s[0].Substring(s[0].LastIndexOf('\\') +
386 1); // Textbox on the dialog ("Text" is already used by C#)
387 if (nd.ShowDialog(this) == DialogResult.OK)
388 {
389 if (!nd.EntryText.ToLower().EndsWith(".brstm"))
390 {
391 nd.EntryText += ".brstm"; // Force .brstm extension so it shows up in the list
392 }
393
394 if (string.Equals(nd.EntryText, Path.GetFileName(songPanel1.RootPath),
395 StringComparison.InvariantCultureIgnoreCase))
396 {
397 songPanel1.Close(); // in case the file is already open
398 }
399
400 SongPanel.copyBrstm(filepath, CurrentDirectory + "\\" + nd.EntryText);
401 refreshDirectory();
402 }
403 }
404 }
405 }));
406 }
Definition: NameDialog.cs:8
string EntryText
Definition: NameDialog.cs:10
DialogResult ShowDialog(IWin32Window owner, string text)
Definition: NameDialog.cs:42
Definition: SongPanel.cs:14
void Close()
Definition: SongPanel.cs:94
string RootPath
If the file last requested is open, its path is stored here. If a fallback file is open,...
Definition: SongPanel.cs:60
static void copyBrstm(string src, string dest)
This method can handle WAV files, converting them to BRSTM using BrawlLib's converter.
Definition: SongPanel.cs:292

◆ dragEnter()

void BrawlCrate.BrawlManagers.SongManager.SongManagerForm.dragEnter ( object  sender,
DragEventArgs  e 
)
inline
354 {
355 if (e.Data.GetDataPresent(DataFormats.FileDrop))
356 {
357 // Must be a file
358 string[] s = (string[]) e.Data.GetData(DataFormats.FileDrop);
359 if (s.Length == 1)
360 {
361 // Can only drag and drop one file
362 string filename = s[0].ToLower();
363 if (filename.EndsWith(".brstm") || filename.EndsWith(".wav"))
364 {
365 if (sender == listBox1 /* || songPanel1.FileOpen*/)
366 {
367 e.Effect = DragDropEffects.Copy;
368 }
369 }
370 }
371 }
372 }

Member Data Documentation

◆ GCT_PATHS

readonly string [] BrawlCrate.BrawlManagers.SongManager.SongManagerForm.GCT_PATHS
static
Initial value:
=
{
"RSBE01.gct",
"/data/gecko/codes/RSBE01.gct",
"/codes/RSBE01.gct",
"/LegacyTE/RSBE01.gct",
"/LegacyXP/RSBE01.gct",
"../../../../codes/RSBE01.gct",
"../../../../../../../codes/RSBE01.gct",
"../../../RSBE01.gct",
"../../../../RSBE01.gct",
"../../../../../../RSBE01.gct",
"../../../../../../../RSBE01.gct"
}

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