概要
mindが謎なので調べてみた。
vistaに入れた。
開発環境作ってみた。
写真
サンプルコード
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using System.IO;
using System.Text;
using System.Collections;
using System.Diagnostics;
class form1: Form {
TextBox bo1;
form1() {
Text = "ohibar";
ClientSize = new Size(500, 300);
bo1 = new TextBox();
bo1.Location = new Point(50, 80);
bo1.Width = 370;
bo1.Height = 200;
bo1.Multiline = true;
bo1.Text = String.Join("\r\n", new string[] {
"メインとは",
" 文字列1は 文字列",
" 「>」を 表示し 文字列入力し 文字列1に 入れること。",
});
Controls.AddRange(new Control[] {
bo1
});
Button btn1 = new Button();
btn1.Location = new Point(50, 50);
btn1.Text = "save_run";
btn1.Click += btn1_Click;
Controls.AddRange(new Control[] {
btn1
});
}
void btn1_Click(object sender, System.EventArgs e) {
string fileContent = string.Empty;
string filePath = string.Empty;
using (SaveFileDialog openFileDialog = new SaveFileDialog()) {
openFileDialog.InitialDirectory = "c:\\";
openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
filePath = openFileDialog.FileName;
Stream fileStream = openFileDialog.OpenFile();
using (StreamWriter sw = new StreamWriter(fileStream, Encoding.GetEncoding("Shift_JIS"))) {
sw.WriteLine(bo1.Text);
sw.Close();
MessageBox.Show(filePath + "を保存しました。");
}
Process p = new Process();
p.StartInfo.FileName = @"C:\pmind\bin\mind.exe";
p.StartInfo.Arguments = filePath + " file";
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.Start();
string line;
line = p.StandardOutput.ReadToEnd();
p.WaitForExit();
MessageBox.Show(line);
string a;
a = Path.GetFileName(filePath);
string b;
b = Path.ChangeExtension(a, ".exe");
ProcessStartInfo app = new ProcessStartInfo();
app.FileName = b;
app.UseShellExecute = true;
Process.Start(app);
}
}
}
[STAThread]
public static void Main() {
Application.Run(new form1());
}
}
以上。