lipsync/LipSync/NicoComment/FConfig.cs

45 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace NicoComment {
public partial class FConfig : Form {
private string config = "";
public string ConfigString {
get {
return config;
}
}
public FConfig( string configure ) {
InitializeComponent();
string[] result = configure.Split( new char[] { '\n' } );
textBox1.Text = result[0];
//textBox2.Lines = configure.Split( new char[]{'\n'});
}
private void btnOK_Click( object sender, EventArgs e ) {
string path = textBox1.Text;
if ( File.Exists( path ) ) {
config = path;
using ( StreamReader sr = new StreamReader( path ) ) {
while ( sr.Peek() >= 0 ) {
config += '\n' + sr.ReadLine();
}
}
this.DialogResult = DialogResult.OK;
} else {
this.DialogResult = DialogResult.Cancel;
}
base.Close();
}
private void button1_Click( object sender, EventArgs e ) {
if ( openFileDialog1.ShowDialog() == DialogResult.OK ) {
textBox1.Text = openFileDialog1.FileName;
}
}
}
}