using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Reflection;
using System.IO;

namespace iSTP_Core
{
    public partial class BugDlg : Form
    {
        public BugDlg()
        {
            InitializeComponent();
        }

        private void BugDlg_Load(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            var descriptionAttribute = assembly
                                      .GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)
                                      .OfType<AssemblyDescriptionAttribute>()
                                      .FirstOrDefault();
            Description_lbl.Text = descriptionAttribute.Description;
            AppName_lbl.Text = typeof(AboutDlg).Assembly.GetName().Name;
            AppVersion_lbl.Text = typeof(AboutDlg).Assembly.GetName().Version.ToString();
            var copyrightAttribute = assembly
                                      .GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)
                                      .OfType<AssemblyCopyrightAttribute>()
                                      .FirstOrDefault();
            Copyright_lbl.Text = copyrightAttribute.Copyright;

            try
            {
                ChangeList_txt.LoadFile(File.OpenRead(string.Format("{0}{1}BugsLists.txt", Directory.GetCurrentDirectory(), Path.DirectorySeparatorChar)), RichTextBoxStreamType.PlainText);
            }
            catch
            {
                MessageBox.Show("Error accessing resources!");
            }
        }
    }
}