//originally created to open the file after it is decompiled but now it just looks cleaner public void openTheFile(string fileName) { Design design = new Design(designsList); using (StreamReader sr = new StreamReader(fileName)) { //MessageBox.Show(openFile.FileName); design.openFile(tabControl1, fileName, sr.ReadToEnd()); //richTextBox1.Text = sr.ReadToEnd(); sr.Close(); } }
private void playButton_T_Click(object sender, EventArgs e) { Design design = new Design(designsList); OpenFileDialog openFile = new OpenFileDialog { Title = "Open a new file.. ", Multiselect = true, //Filter = "DataType (*.BF;*.FLOW;*.MSG,*.BMD)|*.BF;*.FLOW;*.MSG;*.BMG|" + //"All files (*.*)|*.*" }; if (openFile.ShowDialog() == DialogResult.OK) { Code.AutoCompile(openFile.FileName); } }
private void openToolStripButton_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog { Title = "Open a new file.. ", Multiselect = true, Filter = "DataType (*.BF;*.FLOW;*.MSG,*.BMD)|*.BF;*.FLOW;*.MSG;*.BMG|" + "All files (*.*)|*.*" }; if (openFile.ShowDialog() == DialogResult.OK) { //this works string fileExt = Path.GetExtension(openFile.FileName); fileExt = fileExt.ToUpper(); //richTextBox1.Clear(); //this one gives me a bug i guess if (fileExt == ".BF" || fileExt == ".BMD") { Code.Decompile(openFile.FileNames); } else if (fileExt == ".FLOW" || fileExt == ".MSG") { Design design = new Design(designsList); using (StreamReader sr = new StreamReader(openFile.FileName)) { //MessageBox.Show(openFile.FileName); design.openFile(tabControl1, design.codeTextBox, openFile.FileName, sr.ReadToEnd()); //richTextBox1.Text = sr.ReadToEnd(); sr.Close(); } } else { MessageBox.Show("Wrong File Type" + "has the following ext (" + fileExt + ")."); } } }
public static bool SaveAs(Design design) { //ToDo Change that SaveFileDialog savefile = new SaveFileDialog() { Filter = "DataType (*.BF;*.BMD;*.FLOW;*.MSG)|*.FLOW;*.BF;*.BMG;*.MSG" }; savefile.Title = "Save file as.. "; if (savefile.ShowDialog() == DialogResult.OK) { //not sure design.path = savefile.FileName; design.tabTitle = Path.GetFileName(savefile.FileName); StreamWriter output = new StreamWriter(savefile.FileName); output.Write(design.codeTextBox.Text); output.Close(); design.isSaved = true; return(true); } return(false); }
public static bool Save(Design design) { if (File.Exists(design.path)) { //save in the already existing path StreamWriter output = new StreamWriter(design.path); output.Write(design.codeTextBox.Text); output.Close(); design.isSaved = true; MessageBox.Show("Saved"); return(true); } else { if (SaveAs(design)) { design.updateValues(); return(true); } return(false); } }
private void test_IDE_FormClosing(object sender, FormClosingEventArgs e) { Design.RemoveAll(designsList, e); }
private void newToolStripButton_Click(object sender, EventArgs e) { Design design = new Design(designsList); design.createNewFile(tabControl1); }
private void test_IDE_Load(object sender, EventArgs e) { Design design = new Design(designsList); design.createNewFile(tabControl1, design.codeTextBox); }