Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Threading;
- namespace WindowsFormsApplication6
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void flatButton3_Click(object sender, EventArgs e)
- {
- }
- private void open_Click(object sender, EventArgs e)
- {
- this.editor.Text = "";
- OpenFileDialog openFileDialog = new OpenFileDialog();
- openFileDialog.InitialDirectory = "c:\\documents";
- openFileDialog.Filter = "txt files (*.txt)|*.txt|Lua files (*.lua)|*.lua|All files (*.*)|*.*";
- openFileDialog.FilterIndex = 3;
- openFileDialog.RestoreDirectory = true;
- bool flag = openFileDialog.ShowDialog() == DialogResult.OK;
- if (flag)
- {
- try
- {
- Stream stream;
- bool flag2 = (stream = openFileDialog.OpenFile()) != null;
- if (flag2)
- {
- using (stream)
- {
- this.editor.Text = File.ReadAllText(openFileDialog.FileName);
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("The file could not be read: " + ex.Message);
- }
- }
- }
- private void clear_Click(object sender, EventArgs e)
- {
- this.editor.Text = "";
- }
- private void mini_Click(object sender, EventArgs e)
- {
- this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
- }
- private void close_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment