コード例 #1
0
ファイル: SongPanel.cs プロジェクト: Doyniish/BrawlManagers
 public void Rename()
 {
     using (NameDialog nd = new NameDialog()) {
         nd.EntryText = Path.GetFileName(RootPath);
         if (nd.ShowDialog(this) == DialogResult.OK)
         {
             if (!nd.EntryText.ToLower().EndsWith(".brstm"))
             {
                 nd.EntryText += ".brstm";                         // Force .brstm extension so it shows up in the list
             }
             string from = RootPath;
             Close();
             FileOperations.Rename(from, System.Environment.CurrentDirectory + "\\" + nd.EntryText);
         }
     }
 }
コード例 #2
0
ファイル: SongPanel.cs プロジェクト: liddictm/BrawlManagers
 public void Rename()
 {
     using (NameDialog nd = new NameDialog()) {
         nd.EntryText = Path.GetFileName(RootPath);
         if (nd.ShowDialog(this) == DialogResult.OK) {
             if (!nd.EntryText.ToLower().EndsWith(".brstm")) {
                 nd.EntryText += ".brstm"; // Force .brstm extension so it shows up in the list
             }
             string from = RootPath;
             Close();
             FileOperations.Rename(from, System.Environment.CurrentDirectory + "\\" + nd.EntryText);
         }
     }
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: liddictm/BrawlManagers
 public void dragDrop(object sender, DragEventArgs e)
 {
     string[] s = (string[])e.Data.GetData(DataFormats.FileDrop);
     string filepath = s[0].ToLower();
     string name;
     if (sender == listBox1) {
         NameDialog nd = new NameDialog();
         nd.Text = "Enter Filename"; // Titlebar
         nd.EntryText = s[0].Substring(s[0].LastIndexOf('\\')+1); // Textbox on the dialog ("Text" is already used by C#)
         nd.LabelText = "Enter the filename to copy to (with or without the .pac extension):";
         if (nd.ShowDialog(this) == DialogResult.OK) {
             if (!nd.EntryText.ToLower().EndsWith(".pac")) {
                 nd.EntryText += ".pac"; // Force .pac extension so it shows up in the list
             }
             if (FileOperations.Copy(filepath, CurrentDirectory + "\\" + nd.EntryText)) { // Use FileOperations (calls Windows shell -> asks for confirmation to overwrite)
                 MessageBox.Show(this, "File copied.");
                 ReloadDirectory();
             }
         }
     } else if (_rootPath != null) {
         name = new FileInfo(_rootPath).Name;
         if (_rootNode != null) {
             _rootNode.Dispose(); _rootNode = null; // Close the file before overwriting it!
         }
         if (filepath.EndsWith(".pac")) {
             FileOperations.Copy(filepath, CurrentDirectory + "\\" + name);
         } else if (filepath.EndsWith(".rel")) {
             FileOperations.Copy(filepath, stageInfoControl1.RelFile.FullName);
         } else if (Directory.Exists(filepath)) {
             importDir(filepath);
         }
         listBox1_SelectedIndexChanged(null, null);
     }
 }
コード例 #4
0
 public void generateName()
 {
     using (NameDialog n = new NameDialog()) {
         n.EntryText = "Battlefield";
         n.LabelText = "Enter the stage name. (Use \\n for a line break.)\nType just ] to launch genname.bat/genname.exe instead.";
         if (n.ShowDialog() == DialogResult.OK) {
             if (n.EntryText == "]") {
                 generateNameExternal();
             } else {
                 if (fontSettings == null) changeFrontStnameFont();
                 if (fontSettings == null) return;
                 Bitmap bmp = NameCreator.createImage(fontSettings, n.EntryText);
                 string tempfile = TempFiles.Create(".png");
                 bmp.Save(tempfile);
                 Replace(frontstname, tempfile);
             }
         }
     }
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: liddictm/BrawlManagers
 public void dragDrop(object sender, DragEventArgs e)
 {
     string[] s = (string[])e.Data.GetData(DataFormats.FileDrop);
     string filepath = s[0].ToLower();
     if (sender == listBox1) {
         using (NameDialog nd = new NameDialog()) {
             nd.EntryText = s[0].Substring(s[0].LastIndexOf('\\') + 1); // Textbox on the dialog ("Text" is already used by C#)
             if (nd.ShowDialog(this) == DialogResult.OK) {
                 if (!nd.EntryText.ToLower().EndsWith(".brstm")) {
                     nd.EntryText += ".brstm"; // Force .brstm extension so it shows up in the list
                 }
                 if (string.Equals(nd.EntryText, Path.GetFileName(songPanel1.RootPath), StringComparison.InvariantCultureIgnoreCase)) {
                     songPanel1.Close(); // in case the file is already open
                 }
                 SongPanel.copyBrstm(filepath, CurrentDirectory + "\\" + nd.EntryText);
                 refreshDirectory();
             }
         }
     }
 }