NEUTRINO_GUIs

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 0020155cb115a366f57f11ef8fb181a4204eb08e
parent 32f6b7ddb122653c57559c66656e8fa8922d6601
Author: Minerva_juppiter <94231606+minerva-jupiter@users.noreply.github.com>
Date:   Fri, 21 Jan 2022 22:07:12 +0900


Diffstat:
MForm1.Designer.cs | 8++++----
MForm1.cs | 24++++++++++++++----------
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/Form1.Designer.cs b/Form1.Designer.cs @@ -51,7 +51,7 @@ // this.musicFileSelect.BackColor = System.Drawing.SystemColors.Control; this.musicFileSelect.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.musicFileSelect.Location = new System.Drawing.Point(339, 145); + this.musicFileSelect.Location = new System.Drawing.Point(342, 276); this.musicFileSelect.Name = "musicFileSelect"; this.musicFileSelect.Size = new System.Drawing.Size(130, 30); this.musicFileSelect.TabIndex = 1; @@ -64,7 +64,7 @@ this.scorefile.AutoSize = true; this.scorefile.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.scorefile.ForeColor = System.Drawing.SystemColors.Control; - this.scorefile.Location = new System.Drawing.Point(142, 128); + this.scorefile.Location = new System.Drawing.Point(145, 259); this.scorefile.Name = "scorefile"; this.scorefile.Size = new System.Drawing.Size(532, 14); this.scorefile.TabIndex = 2; @@ -74,7 +74,7 @@ // this.runFileSellect.BackColor = System.Drawing.SystemColors.Control; this.runFileSellect.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.runFileSellect.Location = new System.Drawing.Point(339, 293); + this.runFileSellect.Location = new System.Drawing.Point(341, 165); this.runFileSellect.Name = "runFileSellect"; this.runFileSellect.Size = new System.Drawing.Size(130, 30); this.runFileSellect.TabIndex = 3; @@ -86,7 +86,7 @@ // this.whereRunfile.AutoSize = true; this.whereRunfile.ForeColor = System.Drawing.SystemColors.Control; - this.whereRunfile.Location = new System.Drawing.Point(233, 275); + this.whereRunfile.Location = new System.Drawing.Point(235, 147); this.whereRunfile.Name = "whereRunfile"; this.whereRunfile.Size = new System.Drawing.Size(359, 15); this.whereRunfile.TabIndex = 4; diff --git a/Form1.cs b/Form1.cs @@ -4,6 +4,7 @@ namespace NEUTRINO_GUIs { public partial class Form1 : Form { + string whereRun; public void Command(string command) { //引数を代入 @@ -22,7 +23,7 @@ namespace NEUTRINO_GUIs process.WaitForExit(); process.Close(); - MessageBox.Show("Done"); + } public Form1() { @@ -37,9 +38,10 @@ namespace NEUTRINO_GUIs private void RUN_Click(object sender, EventArgs e) { string fileNameR = whereRunfile.Text; - //親ファイルに移動 + //選択されたRunファイルを実行 + MessageBox.Show("実行が開始されました。"); Command(fileNameR); - + MessageBox.Show("Done"); } @@ -57,17 +59,18 @@ namespace NEUTRINO_GUIs } //配列に代入 - string[] lines = File.ReadAllLines("../Run.bat"); + string fileNameR = Path.GetFileNameWithoutExtension(whereRun); + string[] lines = File.ReadAllLines(whereRun); //Runファイルを書き換える bool streamWriterOption = false; - string fileName = openFileDialog.FileName; - StreamWriter sw = new StreamWriter(fileName, streamWriterOption); + string scoreFileName = Path.GetFileNameWithoutExtension(openFileDialog.FileName); + StreamWriter sw = new StreamWriter(whereRun, streamWriterOption); for (int a = 0; a < 5; a++) { sw.WriteLine(lines[a]); } //BASENAMEの行を書き換え - sw.WriteLine("set BASENAME = " + openFileDialog); + sw.WriteLine("set BASENAME = " + scoreFileName); //残りの行を書き換え for (int b = 6; b < lines.Length; b++) @@ -76,7 +79,7 @@ namespace NEUTRINO_GUIs } sw.Close(); - scorefile.Text = fileName; + scorefile.Text = scoreFileName; MessageBox.Show("ファイル選択が完了しました。"); } @@ -84,15 +87,16 @@ namespace NEUTRINO_GUIs { var openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "バッチファイル(*.bat)|*.bat|All files (*.*)|*.*"; - openFileDialog1.FilterIndex = 2; + openFileDialog1.FilterIndex = 1; openFileDialog1.Title = "Runファイル選択"; openFileDialog1.RestoreDirectory = true; - openFileDialog1.FileName = "sample1.musicxml"; + openFileDialog1.FileName = "Run.bat"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { Console.WriteLine(openFileDialog1.FileName); } + whereRun = openFileDialog1.FileName; whereRunfile.Text = openFileDialog1.FileName; MessageBox.Show("ファイル選択が完了しました。"); }