using System;
using System.IO;
using System.Windows.Forms;

namespace DevexpressPatchKeygen
{
    public class PrinterParserList
    {
        public string dVE;
        public int nfl;
        public Interpreter locals1;

        SchemaAdapter schemaAdapter;

        // Constructor
        public PrinterParserList()
        {
        }

        // Method to handle asset authentication
        internal void AssetAuthentication()
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
            {
                ShowNewFolderButton = false,
                Description = "Select a \"Microsoft Visual Studio\" Installation Folder..."
            };

            if (folderBrowserDialog.ShowDialog() != DialogResult.OK)
            {
                this.locals1.nofil = true;
                this.locals1.schemaAdapter.Invoke(new Collection(this.locals1.schemaAdapter.StartAuthentication), new object[2]);
                return;
            }

            this.dVE = folderBrowserDialog.SelectedPath + string.Format("\\{0}\\{1}\\Common7\\IDE\\Extensions\\", this.locals1.versione, this.locals1.edition);
            if (!Directory.Exists(this.dVE))
            {
                this.dVE = folderBrowserDialog.SelectedPath + "\\Common7\\IDE\\Extensions\\";
            }

            if (!Directory.Exists(this.dVE))
            {
                this.locals1.nofil = true;
                this.locals1.schemaAdapter.Invoke(new Collection(this.locals1.schemaAdapter.StartAuthentication), new object[2]);
                MessageBox.Show("Sorry!. Microsoft Visual Studio Extensions not Found!", "Error...", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
        }

        // Static method to patch reader
        internal static bool PatchReader()
        {
            return true;
        }

        // Static method to initialize reader
        internal static bool InitReader()
        {
            return false;
        }
    }
}
