Ejemplo n.º 1
0
        public void Add(ProfileConfig profile, IPlugin plugin)
        {
            if (!_plugins.ContainsKey(profile.Name))
            {
                _plugins.TryAdd(profile.Name, new List <IPlugin>());
            }

            _plugins[profile.Name].Add(plugin);
            Logger.Info("Adding plugin \"{0}\" [{1}]", plugin.GetType().Name, profile.Name);
        }
Ejemplo n.º 2
0
 private void DBConfig_Load(object sender, EventArgs e)
 {
     tblLogin = ProfileConfig.Load();
     if (tblLogin.DBProfile.Count > 0)
     {
         txtServerName.Text   = tblLogin.DBProfile[0].ServerName;
         txtDatabaseName.Text = tblLogin.DBProfile[0].DataBase;
         txtUsername.Text     = tblLogin.DBProfile[0].DBLogin;
         txtPassword.Text     = tblLogin.DBProfile[0].DBPassword;
     }
 }
Ejemplo n.º 3
0
        public void Assign(IPlugin plugin, ProfileConfig profile)
        {
            if (!_plugins.Contains(plugin))
            {
                return;
            }
            if (!_profilePlugins.ContainsKey(profile.Name))
            {
                _profilePlugins.TryAdd(profile.Name, new List <IPlugin>());
            }

            _profilePlugins[profile.Name].Add(plugin);
            Logger.Debug("Assigned plugin \"{0}\" to \"{1}\" profile", plugin.GetType().Name, profile.Name);
        }
Ejemplo n.º 4
0
        public void CallMethod(NvGpuVmm vmm, GpuMethodCall methCall)
        {
            if (_methods.TryGetValue(methCall.Method, out NvGpuMethod method))
            {
                ProfileConfig profile = Profiles.GPU.EngineM2mf.CallMethod;

                profile.SessionItem = method.Method.Name;

                Profile.Begin(profile);
                method(vmm, methCall);
                Profile.End(profile);
            }
            else
            {
                WriteRegister(methCall);
            }
        }
        /// <summary>
        /// Finds and retrieves a ConfigEntry object inside the Config and Profile entries. </summary>
        /// <param name="key"> Key name of the config entry. eg. "playerName". This key is NOT case sensitive.</param>
        /// <returns>
        /// Returns a single ConfigEntry object that matches the key provided.</returns>
        public ConfigEntry this[string key]
        {
            get
            {
                key = key.ToLower();
                if (CfgConfig.Any(x => x.key == key))
                {
                    return(CfgConfig.Where(x => x.key == key).FirstOrDefault());
                }
                if (ProfileConfig.Any(x => x.key == key))
                {
                    return(ProfileConfig.Where(x => x.key == key).FirstOrDefault());
                }

                return(null);
            }
        }
Ejemplo n.º 6
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            bool IsChk = true;

            try
            {
                dbConString.ServerName = txtServerName.Text.Trim();
                dbConString.DBName     = txtDatabaseName.Text.Trim();
                dbConString.Sa         = txtUsername.Text.Trim();
                dbConString.SaPassword = txtPassword.Text.Trim();
                IsChk = dbConString.CheckOpenConn();
                if (IsChk)
                {
                    if (tblLogin.DBProfile.Count > 0)
                    {
                        tblLogin.DBProfile[0].ServerName = txtServerName.Text.Trim();
                        tblLogin.DBProfile[0].DataBase   = txtDatabaseName.Text.Trim();
                        tblLogin.DBProfile[0].DBLogin    = txtUsername.Text.Trim();
                        tblLogin.DBProfile[0].DBPassword = txtPassword.Text.Trim();
                    }
                    else
                    {
                        LoginDS.DBProfileRow dr = tblLogin.DBProfile.NewDBProfileRow();
                        dr.ServerName = txtServerName.Text.Trim();
                        dr.DataBase   = txtDatabaseName.Text.Trim();
                        dr.DBLogin    = txtUsername.Text.Trim();
                        dr.DBPassword = txtPassword.Text.Trim();
                        tblLogin.DBProfile.AddDBProfileRow(dr);
                    }
                    ProfileConfig.Save(tblLogin);
                    MessageBox.Show("บันทึกข้อูลตั้งค่า ระบบฐานข้อมูล", "POS_Smart", MessageBoxButtons.OK);
                }
            }
            catch
            {
                MessageBox.Show("ข้อูลตั้งค่า ระบบฐานข้อมูล ไม่ถูกต้องกรุณาตรวจสอบ", "คำเตือน", MessageBoxButtons.OK);
                txtServerName.Focus();
                return;
            }
        }
Ejemplo n.º 7
0
        public static Tuple <bool, string> Run(Config global, JobConfig job)
        {
            ProfileConfig     profile = global.Profiles.Where(p => p.Name.Equals(job.ProfileName)).FirstOrDefault();
            EnvironmentConfig config  = global.Environments.Where(p => p.Name.Equals(job.EnvironmentName)).FirstOrDefault();

            if (profile == null || config == null)
            {
                return(new Tuple <bool, string>(false, "Error running job, either Profile or Environment was not found. "));
            }

            OracleConnection      _conn;
            List <IDataProcessor> Processors = new List <IDataProcessor>();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            Logger.Write($"Processing Environment '{config.Name}'");

            /* ensure root directory exists */
            Directory.CreateDirectory(job.OutputFolder);

            VersionController versionController = new VersionController();

            versionController.InitRepository(job.OutputFolder, job.Repository);

            profileRepoPath = job.OutputFolder;

            /* First thing is to get DB connection */
            var connectionProvider = config.Connection.Provider;

            Logger.Write("Getting database connection...");
            var providerType = Type.GetType("Pivet.Data.Connection." + connectionProvider + "Connection");

            if (providerType == null)
            {
                Logger.Write("Unable to find the specified DB provider.");
                return(new Tuple <bool, string>(false, "Unable to find the specified DB provider."));
            }

            var dbProvider = Activator.CreateInstance(providerType) as IConnectionProvider;

            Dictionary <string, string> dbParams = new Dictionary <string, string>();

            dbProvider.SetParameters(config.Connection);
            var connectionResult = dbProvider.GetConnection();

            if (connectionResult.Item2 == false)
            {
                Logger.Write("Error connecting to database: " + connectionResult.Item3);
                return(new Tuple <bool, string>(false, "Error connecting to database: " + connectionResult.Item3));
            }

            _conn = connectionResult.Item1;
            Logger.Write("Connected to Database.");

            /* run each processor */
            var availableProcessors = FindProviders();

            foreach (var provider in profile.DataProviders)
            {
                IDataProcessor processor = availableProcessors.Where(p => p.ProcessorID == provider).FirstOrDefault();
                if (processor == null)
                {
                    Logger.Write("Could not find the data processor: " + provider);
                }
                else
                {
                    if (Program.ShowProgress)
                    {
                        processor.ProgressChanged += Processor_ProgressChanged;
                    }
                    Processors.Add(processor);
                    //int itemCount = processor.LoadItems(_conn, config.Filters, config.ModifyThreshold,versionState);
                    int itemCount = processor.LoadItems(_conn, profile.Filters);
                    Logger.Write("Found " + itemCount + " " + provider + " Definitions");
                }
            }

            Logger.Write("Definitions collected.");

            Logger.Write("Cleaning working directory.");
            foreach (var p in Processors)
            {
                p.ProcessDeletes(job.OutputFolder);
            }

            Logger.Write("Processing items.");
            Stopwatch sw2 = new Stopwatch();

            sw2.Start();
            List <ChangedItem> changedItems = new List <ChangedItem>();

            foreach (var p in Processors)
            {
                Logger.Write($"Saving {p.ItemName} Definitions...");
                Logger.Write(Environment.NewLine);
                changedItems.AddRange(p.SaveToDisk(job.OutputFolder));
                Console.CursorLeft = 0;
                Processor_ProgressChanged(new ProgressEvent()
                {
                    Progress = 100
                });
            }
            sw2.Stop();

            Logger.Write("Definitions saved to disk in: " + sw2.Elapsed.TotalSeconds + " seconds");

            versionController.ProcessChanges(changedItems);
            sw.Stop();
            Logger.Write("Environment processed in: " + sw.Elapsed.TotalSeconds + " seconds");
            return(new Tuple <bool, string>(true, ""));
        }
Ejemplo n.º 8
0
 public IEnumerable <T> Get <T>(ProfileConfig profile) where T : IPlugin
 => _plugins.TryGetValue(profile.Name, out var value) ? value.OfType <T>() : Enumerable.Empty <T>();
Ejemplo n.º 9
0
 public IEnumerable <IPlugin> Get(ProfileConfig profile) => Get <IPlugin>(profile);
Ejemplo n.º 10
0
        public void CallMethod(ServiceCtx context)
        {
            IIpcService service = this;

            if (_isDomain)
            {
                int domainWord0 = context.RequestData.ReadInt32();
                int domainObjId = context.RequestData.ReadInt32();

                int domainCmd       = (domainWord0 >> 0) & 0xff;
                int inputObjCount   = (domainWord0 >> 8) & 0xff;
                int dataPayloadSize = (domainWord0 >> 16) & 0xffff;

                context.RequestData.BaseStream.Seek(0x10 + dataPayloadSize, SeekOrigin.Begin);

                for (int index = 0; index < inputObjCount; index++)
                {
                    context.Request.ObjectIds.Add(context.RequestData.ReadInt32());
                }

                context.RequestData.BaseStream.Seek(0x10, SeekOrigin.Begin);

                if (domainCmd == 1)
                {
                    service = GetObject(domainObjId);

                    context.ResponseData.Write(0L);
                    context.ResponseData.Write(0L);
                }
                else if (domainCmd == 2)
                {
                    Delete(domainObjId);

                    context.ResponseData.Write(0L);

                    return;
                }
                else
                {
                    throw new NotImplementedException($"Domain command: {domainCmd}");
                }
            }

            long sfciMagic = context.RequestData.ReadInt64();
            int  commandId = (int)context.RequestData.ReadInt64();

            bool serviceExists = service.Commands.TryGetValue(commandId, out MethodInfo processRequest);

            if (ServiceConfiguration.IgnoreMissingServices || serviceExists)
            {
                ResultCode result = ResultCode.Success;

                context.ResponseData.BaseStream.Seek(_isDomain ? 0x20 : 0x10, SeekOrigin.Begin);

                if (serviceExists)
                {
                    Logger.Debug?.Print(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Name}");

                    ProfileConfig profile = Profiles.ServiceCall;

                    profile.SessionGroup = service.GetType().Name;
                    profile.SessionItem  = processRequest.Name;

                    Profile.Begin(profile);

                    result = (ResultCode)processRequest.Invoke(service, new object[] { context });

                    Profile.End(profile);
                }
                else
                {
                    string serviceName;

                    DummyService dummyService = service as DummyService;

                    serviceName = (dummyService == null) ? service.GetType().FullName : dummyService.ServiceName;

                    Logger.Warning?.Print(LogClass.KernelIpc, $"Missing service {serviceName}: {commandId} ignored");
                }

                if (_isDomain)
                {
                    foreach (int id in context.Response.ObjectIds)
                    {
                        context.ResponseData.Write(id);
                    }

                    context.ResponseData.BaseStream.Seek(0, SeekOrigin.Begin);

                    context.ResponseData.Write(context.Response.ObjectIds.Count);
                }

                context.ResponseData.BaseStream.Seek(_isDomain ? 0x10 : 0, SeekOrigin.Begin);

                context.ResponseData.Write(IpcMagic.Sfco);
                context.ResponseData.Write((long)result);
            }
            else
            {
                string dbgMessage = $"{service.GetType().FullName}: {commandId}";

                throw new ServiceNotImplementedException(context, dbgMessage);
            }
        }
        private void tsLogin_Click(object sender, EventArgs e)
        {
            bool IsCheckLogin = false;

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("กรุณากรอกรหัสผู้ใช้", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                txtUsername.Focus();
                return;
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("กรุณากรอกรหัสผ่าน", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                txtUsername.Focus();
                return;
            }



            if (!IsCheckLogin)
            {
                tblLogin = ProfileConfig.Load();
                if (tblLogin.DBProfile.Count > 0)
                {
                    dbConString.ServerName = tblLogin.DBProfile[0].ServerName;
                    dbConString.DBName     = tblLogin.DBProfile[0].DataBase;
                    dbConString.Sa         = tblLogin.DBProfile[0].DBLogin;
                    dbConString.SaPassword = tblLogin.DBProfile[0].DBPassword;

                    IsCheckLogin = dbConString.CheckOpenConn();
                    if (!IsCheckLogin)
                    {
                        DBConfig fConfig = new DBConfig();
                        fConfig.ShowDialog();
                        IsCheckLogin = dbConString.CheckOpenConn();
                        txtPassword.Focus();
                        return;
                    }
                }
                else
                {
                    DBConfig fConfig = new DBConfig();
                    fConfig.ShowDialog();
                    IsCheckLogin = dbConString.CheckOpenConn();
                    txtPassword.Focus();
                    return;
                }
            }

            if (IsCheckLogin)
            {
                try
                {
                    string sqlTmp = "";
                    sqlTmp = "SELECT * FROM tbUser WHERE UserName = '******' AND Password = '******' ";
                    DataSet Ds = new DataSet();
                    dbConString.Com             = new SqlCommand();
                    dbConString.Com.CommandType = CommandType.Text;
                    dbConString.Com.CommandText = sqlTmp;
                    dbConString.Com.Connection  = dbConString.mySQLConn;

                    SqlCommand cmd = new SqlCommand(sqlTmp, dbConString.mySQLConn);
                    //dr = dbConString.Com.ExecuteReader();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    tblUser.Clear();
                    da.Fill(tblUser, "tbUser");
                    da.Dispose();
                    if (tblUser.tbUser.Rows.Count > 0)
                    {
                        dbConString.UserID = tblUser.tbUser[0].UserID;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("รหัสผ่านไม่ถูกต้อง !!", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 12
0
        private void tsLogin_Click(object sender, EventArgs e)
        {
            bool IsCheckLogin = false;

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("กรุณากรอกรหัสผู้ใช้", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                txtUsername.Focus();
                return;
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("กรุณากรอกรหัสผ่าน", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                txtUsername.Focus();
                return;
            }



            if (!IsCheckLogin)
            {
                tblLogin = ProfileConfig.Load();
                if (tblLogin.DBProfile.Count > 0)
                {
                    dbConString.ServerName = tblLogin.DBProfile[0].ServerName;
                    dbConString.DBName     = tblLogin.DBProfile[0].DataBase;
                    dbConString.Sa         = tblLogin.DBProfile[0].DBLogin;
                    dbConString.SaPassword = tblLogin.DBProfile[0].DBPassword;

                    IsCheckLogin = dbConString.CheckOpenConn();
                    if (!IsCheckLogin)
                    {
                        DBConfig fConfig = new DBConfig();
                        fConfig.ShowDialog();
                        IsCheckLogin = dbConString.CheckOpenConn();
                    }
                }
                else
                {
                    DBConfig fConfig = new DBConfig();
                    fConfig.ShowDialog();
                    IsCheckLogin = dbConString.CheckOpenConn();
                }
            }

            if (IsCheckLogin)
            {
                try
                {
                    string sqlTmp = "";
                    sqlTmp = "SELECT * FROM tblUser WHERE Username = '******' AND User_Password = '******' ";
                    DataSet Ds = new DataSet();
                    dbConString.Com             = new SqlCommand();
                    dbConString.Com.CommandType = CommandType.Text;
                    dbConString.Com.CommandText = sqlTmp;
                    dbConString.Com.Connection  = dbConString.mySQLConn;

                    SqlCommand cmd = new SqlCommand(sqlTmp, dbConString.mySQLConn);
                    //dr = dbConString.Com.ExecuteReader();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    tblUser.Clear();
                    da.Fill(tblUser, "tblUser");
                    da.Dispose();
                    if (tblUser.tblUser.Rows.Count > 0)
                    {
                        //    if (tblUser.tblOrg.Rows.Count > 0)
                        //    {
                        //        dbConString.OrgName = tblUser.tblOrg[0].OrgName;
                        //        dbConString.TraderName = tblUser.tblOrg[0].TraderName;
                        //        dbConString.Address = tblUser.tblOrg[0].Address;
                        //        dbConString.TaxID = tblUser.tblOrg[0].TaxID;
                        //        dbConString.TaxRate = tblUser.tblOrg[0].TaxRate;
                        //        dbConString.Tel = tblUser.tblOrg[0].Tel;
                        //        dbConString.Fax = tblUser.tblOrg[0].Fax;

                        //        dbConString.EmpId = tblUser.uv_User[0].EmpID;
                        //        dbConString.EmpCode = tblUser.uv_User[0].EmpCode;
                        //        dbConString.EmpName = tblUser.uv_User[0].FullName;

                        //        dbConString.SerialPorts = tblUser.tblDrawerSetting[0].SerialPorts;
                        //        dbConString.Baudrates = Convert.ToInt32(tblUser.tblDrawerSetting[0].Baudrates);
                        //        dbConString.IsUsing = tblUser.tblDrawerSetting[0].IsUsing;

                        //        ((frmMain)this.Owner).rbMenuOnEnabled = true;
                        //        this.Close();
                        //    }
                    }
                    else
                    {
                        MessageBox.Show("รหัสผ่านไม่ถูกต้อง !!", dbConString.xMessage, MessageBoxButtons.OK, MessageBoxIcon.Question);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 13
0
        private void ReadConfigFile(bool superdefault = false)
        {
            // get stuff from json file
                        if (superdefault)
                            {
                                string surperDefault =
                                    "{\"Lang\": \"English\",\"DayStart\": \"Good morning @user\",\"LunchStart\": \"Have a good lunch.\",\"LunchEnd\": \"Welcome back from lunch @user\",\"DayEnd\": \"Have a nice day @user.\",\"TooEarlyOnDay\": \"You are way to early, use the website.\",\"TooEarlyLunch\": \"You cannot go to lunch yet, wait a little.\",\"TooEarlyLeave\": \"No escape, no surrender, you cannot go home yet.\",\"TooLateLogin\": \"You are outside the allotted time, use the website to login\",\"DoubleLunch\": \"Quite the hobbit are we?, only one lunch per day!\",\"DoubleLogin\": \"You have already logged in... one is enough.\",\"UnExpectedError9000\":\"What? How did you? Okay this is weird.\"}";

                                _profileConfig = JsonConvert.DeserializeObject<ProfileConfig>(surperDefault);
                                //json has been deserialized
                            }
        }
Ejemplo n.º 14
0
 private void ReadConfigFile()
 {
     // get stuff from json file
                 var fs = Directory.GetCurrentDirectory() + @"\Profiles\default.json";
                 if (! File.Exists(fs))
                     {
                         // if for some peculiar reason it does not exist!, then screw it, we have an english hardcoded superdefault!
                         ReadConfigFile(true);
                     }
                 else
                     {
                         using (StreamReader read = new StreamReader(fs))
                             {
                                 string dataz = read.ReadToEnd();
                                 _profileConfig = JsonConvert.DeserializeObject<ProfileConfig>(dataz); //json has been deserialized
                             }
                     }
 }
Ejemplo n.º 15
0
        private void ReadConfigFile(string username)
        {
            // get stuff from json file
                        var fs = Directory.GetCurrentDirectory() + $@"\Profiles\{username}.json";
                        if (! File.Exists(fs))
                            {
                                ReadConfigFile(); // if the custom profile does not exist, then use the default one.
                            }
                        else
                            {
                                using (StreamReader read = new StreamReader(fs))
                                    {
                                        string dataz = read.ReadToEnd();

                                        _profileConfig = JsonConvert.DeserializeObject<ProfileConfig>(dataz); //json has been deserialized
                                    }
                            }
        }
Ejemplo n.º 16
0
        public override void ProjectFinishedGenerating(Project project)
        {
            if (project != null)
            {
                VSProject vsProj = project.Object as VSProject;
                var       tables = new List <string>();

                Settings.Default.MVCWizardConnection = WizardForm.ServerExplorerConnectionSelected;
                Settings.Default.Save();

                if (_generalPane != null)
                {
                    _generalPane.Activate();
                }

                SendToGeneralOutputWindow("Starting project generation...");

                //Updating project references
                try
                {
                    vsProj.References.Add("MySql.Data");
                }
                catch
                {
                    var infoResult = InfoDialog.ShowDialog(
                        InfoDialogProperties.GetOkCancelDialogProperties(
                            InfoDialog.InfoType.Warning,
                            Resources.MySqlDataProviderPackage_ConnectorNetNotFoundError,
                            @"To use it you must download and install the MySQL Connector/Net package from http://dev.mysql.com/downloads/connector/net/",
                            Resources.MySqlDataProviderPackage_ClickOkOrCancel));
                    if (infoResult.DialogResult == DialogResult.OK)
                    {
                        ProcessStartInfo browserInfo = new ProcessStartInfo("http://dev.mysql.com/downloads/connector/net/");
                        System.Diagnostics.Process.Start(browserInfo);
                    }
                }

                double version = double.Parse(WizardForm.Wizard.GetVisualStudioVersion());
                if (version >= 12.0)
                {
                    References refs = vsProj.References;
                    foreach (Reference item in refs)
                    {
                        switch (item.Name)
                        {
                        case "System.Web.Razor":
                            if (item.Version.Equals("1.0.0.0"))
                            {
                                vsProj.References.Find("System.Web.Razor").Remove();
                            }
                            break;

                        case "System.Web.WebPages":
                            vsProj.References.Find("System.Web.WebPages").Remove();
                            break;

                        case "System.Web.Mvc":
                            vsProj.References.Find("System.Web.Mvc").Remove();
                            break;

                        case "System.Web.Helpers":
                            vsProj.References.Find("System.Web.Helpers").Remove();
                            break;
                        }
                    }

                    vsProj.References.Add("System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL");
                    vsProj.References.Add("System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL");
                    vsProj.References.Add("System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL");
                    vsProj.References.Add("System.Web.Razor");

#if NET_40_OR_GREATER
                    vsProj.Project.Save();
#endif
                }
                AddNugetPackage(vsProj, JQUERY_PKG_NAME, JQUERY_VERSION, false);
                var packagesPath = Path.Combine(Path.GetDirectoryName(ProjectPath), @"Packages\jQuery." + JQUERY_VERSION + @"\Content\Scripts");
                CopyPackageToProject(vsProj, ProjectPath, packagesPath, "Scripts");

                if (WizardForm.SelectedTables != null && WizardForm.DEVersion != DataEntityVersion.None)
                {
                    WizardForm.SelectedTables.ForEach(t => tables.Add(t.Name));

                    SendToGeneralOutputWindow("Generating Entity Framework model...");
                    if (tables.Count > 0)
                    {
                        if (WizardForm.DEVersion == DataEntityVersion.EntityFramework5)
                        {
                            CurrentEntityFrameworkVersion = ENTITY_FRAMEWORK_VERSION_5;
                        }
                        else if (WizardForm.DEVersion == DataEntityVersion.EntityFramework6)
                        {
                            CurrentEntityFrameworkVersion = ENTITY_FRAMEWORK_VERSION_6;
                        }

                        AddNugetPackage(vsProj, ENTITY_FRAMEWORK_PCK_NAME, CurrentEntityFrameworkVersion, true);
                        string modelPath = Path.Combine(ProjectPath, "Models");
                        GenerateEntityFrameworkModel(project, vsProj, new MySqlConnection(WizardForm.ConnectionStringForModel), WizardForm.ModelName, tables, modelPath);
                        GenerateMVCItems(vsProj);

                        if (WizardForm.DEVersion == DataEntityVersion.EntityFramework6)
                        {
                            project.DTE.SuppressUI = true;
                            project.Properties.Item("TargetFrameworkMoniker").Value = ".NETFramework,Version=v4.5";
                        }
                    }
                }

                else
                {
                    string indexPath = Language == LanguageGenerator.CSharp ? (string)(FindProjectItem(FindProjectItem(FindProjectItem(vsProj.Project.ProjectItems, "Views").ProjectItems,
                                                                                                                       "Home").ProjectItems, "Index.cshtml").Properties.Item("FullPath").Value) :
                                       (string)(FindProjectItem(FindProjectItem(FindProjectItem(vsProj.Project.ProjectItems, "Views").ProjectItems,
                                                                                "Home").ProjectItems, "Index.vbhtml").Properties.Item("FullPath").Value);

                    string contents = File.ReadAllText(indexPath);
                    contents = contents.Replace("$catalogList$", String.Empty);
                    File.WriteAllText(indexPath, contents);
                }

                var webConfig = new MySql.Data.VisualStudio.WebConfig.WebConfig(ProjectPath + @"\web.config");
                SendToGeneralOutputWindow("Starting provider configuration...");
                try
                {
                    try
                    {
                        string configPath = ProjectPath + @"\web.config";

                        if (WizardForm.CreateAdministratorUser)
                        {
                            SendToGeneralOutputWindow("Creating administrator user...");
                            using (AppConfig.Load(configPath))
                            {
                                var configFile = new FileInfo(configPath);
                                var vdm        = new VirtualDirectoryMapping(configFile.DirectoryName, true, configFile.Name);
                                var wcfm       = new WebConfigurationFileMap();
                                wcfm.VirtualDirectories.Add("/", vdm);
                                System.Configuration.Configuration config = WebConfigurationManager.OpenMappedWebConfiguration(wcfm, "/");
                                try
                                {
                                    if (!WizardForm.IncludeSensitiveInformation)
                                    {
                                        ConnectionStringsSection connectionStringsection = config.GetSection("connectionStrings") as ConnectionStringsSection;
                                        if (connectionStringsection != null)
                                        {
                                            connectionStringsection.ConnectionStrings[WizardForm.ConnectionStringNameForAspNetTables].ConnectionString = _fullconnectionstring;
                                            config.Save();
                                        }
                                    }
                                }
                                catch
                                { }

                                MembershipSection          section          = (MembershipSection)config.GetSection("system.web/membership");
                                ProviderSettingsCollection settings         = section.Providers;
                                NameValueCollection        membershipParams = settings[section.DefaultProvider].Parameters;
                                var provider = new MySQLMembershipProvider();

                                provider.Initialize(section.DefaultProvider, membershipParams);

                                //create the user
                                MembershipCreateStatus status;
                                if (!WizardForm.RequireQuestionAndAnswer)
                                {
                                    provider.CreateUser(WizardForm.AdminName, WizardForm.AdminPassword, "*****@*****.**", null, null, true, null, out status);
                                }
                                else
                                {
                                    provider.CreateUser(WizardForm.AdminName, WizardForm.AdminPassword, "*****@*****.**", WizardForm.UserQuestion, WizardForm.UserAnswer, true, null, out status);
                                }
                            }
                        }

                        // add creation of providers tables
                        if (WizardForm.IncludeProfilesProvider)
                        {
                            var profileConfig = new ProfileConfig();
                            profileConfig.Initialize(webConfig);
                            profileConfig.Enabled         = true;
                            profileConfig.DefaultProvider = "MySQLProfileProvider";

                            var options = new Options();
                            options.AppName               = @"\";
                            options.AutoGenSchema         = true;
                            options.ConnectionStringName  = WizardForm.ConnectionStringNameForAspNetTables;
                            options.ConnectionString      = WizardForm.ConnectionStringForAspNetTables;
                            options.EnableExpireCallback  = false;
                            options.ProviderName          = "MySQLProfileProvider";
                            options.WriteExceptionToLog   = WizardForm.WriteExceptionsToLog;
                            profileConfig.GenericOptions  = options;
                            profileConfig.DefaultProvider = "MySQLProfileProvider";
                            profileConfig.Save(webConfig);
                        }

                        if (WizardForm.IncludeRoleProvider)
                        {
                            var roleConfig = new RoleConfig();
                            roleConfig.Initialize(webConfig);
                            roleConfig.Enabled         = true;
                            roleConfig.DefaultProvider = "MySQLRoleProvider";

                            var options = new Options();
                            options.AppName              = @"\";
                            options.AutoGenSchema        = true;
                            options.ConnectionStringName = WizardForm.ConnectionStringNameForAspNetTables;
                            options.ConnectionString     = WizardForm.ConnectionStringForAspNetTables;
                            options.EnableExpireCallback = false;
                            options.ProviderName         = "MySQLRoleProvider";
                            options.WriteExceptionToLog  = WizardForm.WriteExceptionsToLog;
                            roleConfig.GenericOptions    = options;
                            roleConfig.DefaultProvider   = "MySQLRoleProvider";
                            roleConfig.Save(webConfig);
                        }
                        webConfig.Save();
                    }
                    catch (Exception ex)
                    {
                        MySqlSourceTrace.WriteAppErrorToLog(ex, null, Resources.WebWizard_UserCreationError, true);
                    }
                }
                catch (Exception ex)
                {
                    MySqlSourceTrace.WriteAppErrorToLog(ex, true);
                }
            }

            SendToGeneralOutputWindow("Finished project generation.");
            WizardForm.Dispose();
        }