81 lines
2.0 KiB
C#
81 lines
2.0 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace FileWatcher
|
|||
|
{
|
|||
|
public partial class NewFileGroup : Form
|
|||
|
{
|
|||
|
public bool setScriptDirectory = false;
|
|||
|
|
|||
|
public NewFileGroup()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
public String GetFileGroupName()
|
|||
|
{
|
|||
|
return textBox1.Text;
|
|||
|
}
|
|||
|
|
|||
|
public String GetFileGroupExtensions()
|
|||
|
{
|
|||
|
return textBox2.Text;
|
|||
|
}
|
|||
|
|
|||
|
public String GetFileGroupScript()
|
|||
|
{
|
|||
|
return textBox3.Text;
|
|||
|
}
|
|||
|
|
|||
|
private void NewFileGroup_KeyPress(object sender, KeyPressEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void createButton_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Directory.CreateDirectory(Path.GetDirectoryName(textBox3.Text));
|
|||
|
using (var fileStream = File.Open(textBox3.Text, FileMode.OpenOrCreate, FileAccess.ReadWrite));
|
|||
|
}
|
|||
|
|
|||
|
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
|
|||
|
{
|
|||
|
setScriptDirectory = true;
|
|||
|
}
|
|||
|
|
|||
|
private void textBox1_VisibleChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (setScriptDirectory && textBox3.Text.Length == 0)
|
|||
|
{
|
|||
|
setScriptDirectory = false;
|
|||
|
}
|
|||
|
|
|||
|
if (false == setScriptDirectory)
|
|||
|
{
|
|||
|
textBox3.Text = "scripts\\" + textBox1.Text.ToLower().Replace(' ', '_') + ".py";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
|||
|
{
|
|||
|
textBox3.Text = openFileDialog1.FileName;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|