Gostrondude

Untitled

Aug 15th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Runtime.InteropServices;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. using System.Threading;
  13.  
  14. namespace WindowsFormsApplication6
  15. {
  16.     public partial class Form1 : Form
  17.     {
  18.         public Form1()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.  
  23.         private void flatButton3_Click(object sender, EventArgs e)
  24.         {
  25.  
  26.         }
  27.  
  28.         private void open_Click(object sender, EventArgs e)
  29.         {
  30.             this.editor.Text = "";
  31.             OpenFileDialog openFileDialog = new OpenFileDialog();
  32.             openFileDialog.InitialDirectory = "c:\\documents";
  33.             openFileDialog.Filter = "txt files (*.txt)|*.txt|Lua files (*.lua)|*.lua|All files (*.*)|*.*";
  34.             openFileDialog.FilterIndex = 3;
  35.             openFileDialog.RestoreDirectory = true;
  36.             bool flag = openFileDialog.ShowDialog() == DialogResult.OK;
  37.             if (flag)
  38.             {
  39.                 try
  40.                 {
  41.                     Stream stream;
  42.                     bool flag2 = (stream = openFileDialog.OpenFile()) != null;
  43.                     if (flag2)
  44.                     {
  45.                         using (stream)
  46.                         {
  47.                             this.editor.Text = File.ReadAllText(openFileDialog.FileName);
  48.                         }
  49.                     }
  50.                 }
  51.                 catch (Exception ex)
  52.                 {
  53.                     MessageBox.Show("The file could not be read: " + ex.Message);
  54.                 }
  55.             }
  56.         }
  57.  
  58.         private void clear_Click(object sender, EventArgs e)
  59.         {
  60.             this.editor.Text = "";
  61.         }
  62.  
  63.         private void mini_Click(object sender, EventArgs e)
  64.         {
  65.             this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
  66.         }
  67.  
  68.         private void close_Click(object sender, EventArgs e)
  69.         {
  70.             Application.Exit();
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment