⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createfile.cs

📁 编译器
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace PlxCompiler
{
    public partial class CreateFile : UserControl
    {
        private string dir;
        PlxCompiler.Information infor1;
        PlxCompiler.Form1 form1;
        //Infor editFirst;
        public CreateFile(PlxCompiler.Form1 parent, PlxCompiler.Information infor,Infor inforPro)
        {
            InitializeComponent();
            this.Parent = parent;
            if (infor != null)
            {
                textBox2.Text = parent.getProjectFolder();
                textBox2.Enabled = false;
            }
            else textBox2.Enabled = true;
            textBox1.Text = "untitled.plx";
            infor1 = infor;
            form1 = parent;

        }

        private void confirm_Click(object sender, EventArgs e)
        {
            if (Directory.Exists(textBox2.Text) && textBox1.Text != null && !File.Exists(dir))
            {
                dir = textBox2.Text + "\\" + textBox1.Text;
                FileStream newFile = new FileStream(dir, FileMode.Create);
                PlxCompiler.Edit edit = new PlxCompiler.Edit(form1,dir);
                form1.registeEdit(edit);//editFirst.editFirst = edit;//获取第一个创建的文件

                edit.Name = dir;
                edit.Show();
                //show the plx file 
                infor1.AddNodes(dir);
                this.Hide(); this.Dispose();
            }

            else

                MessageBox.Show("Directory not exist....", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Warning);
   
        }

        private void cancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
        //
        private void browse_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.Description = "select a directory";
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {

                textBox2.Text = folderBrowserDialog1.SelectedPath;
                dir = textBox2.Text + "\\" + textBox1.Text;
            }
        }
        //获取新建文件信息
        public string getFileName()
        {
            return dir;
        }

       
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -