Exemplo n.º 1
0
        public static VirtualWebDir CreateWebSite(LimnorProject project, string websitename, Form owner)
        {
            bool          iisError = false;
            VirtualWebDir webSite  = project.GetTestWebSite(owner);

            if (webSite == null)
            {
                webSite = IisUtility.FindLocalWebSiteByName(owner, websitename, out iisError);
            }
            if (webSite == null && !iisError)
            {
                webSite = IisUtility.FindLocalWebSite(websitename);
                if (webSite == null)
                {
                    //create the web site
                    DialogProjectOutput dlg = new DialogProjectOutput();
                    dlg.LoadData(project, websitename);
                    if (dlg.ShowDialog(owner) == DialogResult.OK)
                    {
                        if (dlg.WebSite != null)
                        {
                            webSite = dlg.WebSite;
                        }
                    }
                }
            }
            return(webSite);
        }
        public void LoadData(LimnorProject project, string siteName)
        {
            _prj         = project;
            txtPrj.Text  = _prj.ProjectName;
            _webSiteName = siteName;
            VirtualWebDir vw = _prj.GetTestWebSite(this);

            if (vw != null)
            {
                _webSite = vw;
                if (!VirtualWebDir.IsNetworkDrive(vw.PhysicalDirectory))
                {
                    txtWebFolder.Text = vw.PhysicalDirectory;
                }
                if (string.IsNullOrEmpty(vw.WebName))
                {
                    txtWebName.Text = _webSiteName;
                }
                else
                {
                    txtWebName.Text = vw.WebName;
                }
                if (vw.IsValid)
                {
                    picWeb.Image = Resource1._webOK.ToBitmap();
                }
                else
                {
                    picWeb.Image = Resource1._webNotOK.ToBitmap();
                }
            }
            else
            {
                txtWebName.Text = _webSiteName;
                string sh = _prj.WebPhysicalFolder(this);
                if (!VirtualWebDir.IsNetworkDrive(sh))
                {
                    txtWebFolder.Text = sh;
                }
                picWeb.Image = Resource1._webNotOK.ToBitmap();
            }
            txtUrl.Text = string.Format(CultureInfo.InvariantCulture, "http://localhost/{0}", txtWebName.Text);
            IList <OutputFolder> lst = _prj.GetOutputFolders();

            foreach (OutputFolder f in lst)
            {
                checkedListBox1.Items.Add(f, !f.Disabled);
            }
        }