예제 #1
0
        public void RubyConditionalRegistration()
        {
            locator.Register(Install.From("Installers\\ConditionalRegistrationTest.rb"));


            Assert.IsInstanceOf <TestCase2>(locator.GetInstance <ITestInterface>(new ContextArgument(new TestClasses.TestContext(TestEnum.Case2))));
        }
예제 #2
0
        void IInitializable <ApplicationConfiguration> .Initialized(ApplicationConfiguration application)
        {
            application.Services(services => services
                                 .Conventions(conventions => conventions
                                              .AddFromAssemblyOfThis <SendGridConfiguration>())
                                 .Advanced(advanced =>
            {
                if (_configurationProvider != null)
                {
                    advanced.Install(Install.Type(typeof(ISendGridSettingsProvider), _configurationProvider));
                }
                else
                {
                    advanced.Register <ISendGridSettingsProvider, ConfigurationServiceSendGridSettingsProvider>();
                }

                advanced.Install(Install.Instance(_state));

                if (_replaceEmailService)
                {
                    advanced.Register <IEmailService, SendGridEmailService>();
                }
            })
                                 );
        }
예제 #3
0
 public InstallationInfo(Install install, Boolean differentLanguage)
 {
     Install           = install;
     DifferentLanguage = differentLanguage;
     ExtractDirectory  = P.Combine(P.GetTempPath(), P.GetRandomFileName());
     // GetRandomFileName doesn't create anything unlike GetTempFileName
 }
예제 #4
0
        //File Handling. Methods for getting files from the game and parsing them.
        /// <summary>
        /// Gets a parsed file from the game and caches it. If it exists in the cache already then that is returned.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path"></param>
        /// <returns></returns>
        public object GetParsedFile <T>(string path, bool fromCpk, bool raiseEx = true) where T : new()
        {
            if (fromCpk)
            {
                return(Install.GetParsedFileFromGame(path, FileIO, fromCpk, raiseEx));
            }

            var cachedFile = fileManager.GetParsedFile <T>(path);

            if (cachedFile != null)
            {
                //File is already cached. Return that instance.
                return(cachedFile);
            }
            else
            {
                //File is not cached. So parse it, add it and then return it.
                var file = Install.GetParsedFileFromGame(path, FileIO, fromCpk, raiseEx);
                if (file != null)
                {
                    fileManager.AddParsedFile(path, file);
                }
                return(file);
            }
        }
예제 #5
0
        public override void Populate()
        {
            var          txtFileLines = File.ReadAllLines(Install.GetPath("roof.txt"));
            var          typeNames    = txtFileLines[1].Split(Separators);
            TileCategory category     = null;

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos = txtFileLines[i].Split('\t');

                if (infos[1] == "0")
                {
                    category      = new TileCategory(Int32.Parse(infos[2]));
                    category.Name = infos.Last();
                    Categories.Add(category);
                }
                var style = new TileStyle();
                category.AddStyle(style);
                style.Name  = infos.Last();
                style.Index = Int32.Parse(infos[1]);
                for (int j = 3; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileRoof {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.ChangeRoofPosition(j - 2);
                    }
                }
            }
        }
예제 #6
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(Install.GetPath("floors.txt"));
            var typeNames    = txtFileLines[1].Split(Separators);

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos    = txtFileLines[i].Split('\t');
                var category = new TileCategory();
                category.Name = infos.Last();

                var style = new TileStyle();
                category.AddStyle(style);

                for (int j = 1; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileFloor {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.ChangeFloorPosition(j);
                    }
                }
                Categories.Add(category);
            }
        }
예제 #7
0
        private async Task StartInstall()
        {
            //todo: for release build, make installer.Start call async
            //non-async call is for easy debuging

            try
            {
                //Reload tracker.
                GeneralInfo.LoadTracker();

                //Uninstall previous version (if already installed)
                if (isInstalled)
                {
                    Uninstall uninstall = new Uninstall(this, FileIO, fileManager);
                    await Task.Run(uninstall.Start);

                    //Do not uninstall jungle files. In the event of an error there would be no way to restore them.
                }

                //Install logic
                var installer = new Install(InstallerInfo, zipManager, this, FileIO, fileManager);
                //installer.Start();
                await Task.Run(new Action(installer.Start));

                ShutdownApp();
            }
            catch (Exception ex)
            {
                SaveErrorLog(ex.ToString());
                MessageBox.Show(string.Format("A critical exception occured that cannot be recovered from. The installer will now close.\n\nException:{0}", ex.ToString()), "Critical Exception", MessageBoxButton.OK, MessageBoxImage.Error);
                ShutdownApp();
            }
        }
예제 #8
0
        public void LogUserToInstall(Guid _installId, string _username)
        {
            InstallDAO dao = new InstallDAO(MongoDB);

            Install install = dao.Get(_installId);

            if (install == null)
            {
                install = new Install
                {
                    Guid      = _installId,
                    Usernames = new List <string> {
                        _username
                    }
                };

                dao.Persist(install);
            }
            else
            {
                if (!install.Usernames.Contains(_username))
                {
                    install.Usernames.Add(_username);

                    dao.Persist(install);
                }
            }
        }
예제 #9
0
 private Task <CreationResultStatus> EnterInstallFlowAsync()
 {
     Installer.InstallPackages(Install.ToList());
     //TODO: When an installer that directly calls into NuGet is available,
     //  return a more accurate representation of the outcome of the operation
     return(Task.FromResult(CreationResultStatus.Success));
 }
        private static string[] GenerateMsiConditions(WixItem item, HashSet <WixItem> processedItems)
        {
            List <string> conditions = new List <string>();

            if (!processedItems.Contains(item))
            {
                processedItems.Add(item);

                if (item.Group != null)
                {
                    conditions.AddRange(WixBackendCompilerServices.GenerateMsiConditions(item.Group, processedItems));
                }

                if (item.Parent != null)
                {
                    conditions.AddRange(WixBackendCompilerServices.GenerateMsiConditions(item.Parent, processedItems));
                }

                string condition = Install.GetCondition(item.Item);
                if (!String.IsNullOrEmpty(condition))
                {
                    conditions.Add(condition);
                }
            }

            return(conditions.ToArray());
        }
예제 #11
0
파일: Lightmap.cs 프로젝트: And-G/Magellan
 public Lightmap( int zoom, string filename, Install install )
     : base(install)
 {
     this.zoom = zoom;
     blocks = null;
     ReadBlocks( filename );
 }
예제 #12
0
        private static String GetUxFilename(Install install)
        {
            switch (install)
            {
            case Install.NT513English:
                return("nt51_x86_en.dll");

            case Install.NT513German:
                return("nt51_x86_de.dll");

            case Install.NT513Spanish:
                return("nt51_x86_es.dll");

            case Install.NT522English:
                return("nt52_x86_en.dll");

            case Install.NT522German:
                return("nt52_x86_de.dll");

            case Install.NT522X64English:
                return("nt52_x64_en.dll");

            default:
                return(null);
            }
        }
예제 #13
0
 public void Refresh()
 {
     RpcRoot.OfficialServer.FileUrlService.GetNTMinerFilesAsync(App.AppType, (ntminerFiles) => {
         this.NTMinerFiles = (ntminerFiles ?? new List <NTMinerFileData>()).Select(a => new NTMinerFileViewModel(a)).OrderByDescending(a => a.VersionData).ToList();
         if (this.NTMinerFiles == null || this.NTMinerFiles.Count == 0)
         {
             LocalIsLatest = true;
         }
         else
         {
             ServerLatestVm = this.NTMinerFiles.OrderByDescending(a => a.VersionData).FirstOrDefault();
             if (ServerLatestVm.VersionData > LocalNTMinerVersion)
             {
                 this.SelectedNTMinerFile = ServerLatestVm;
                 LocalIsLatest            = false;
             }
             else
             {
                 LocalIsLatest = true;
             }
         }
         OnPropertyChanged(nameof(IsBtnInstallVisible));
         IsReady = true;
         if (!string.IsNullOrEmpty(CommandLineArgs.NTMinerFileName))
         {
             NTMinerFileViewModel ntminerFileVm = this.NTMinerFiles.FirstOrDefault(a => a.FileName == CommandLineArgs.NTMinerFileName);
             if (ntminerFileVm != null)
             {
                 IsHistoryVisible         = Visibility.Visible;
                 this.SelectedNTMinerFile = ntminerFileVm;
                 Install.Execute(null);
             }
         }
     });
 }
예제 #14
0
파일: Lightmap.cs 프로젝트: And-G/Magellan
 public Lightmap( int zoom, Stream stream, Install install )
     : base(install)
 {
     this.zoom = zoom;
     blocks = null;
     ReadBlocks( stream );
 }
예제 #15
0
        public void RubyDefaultInstanceRegistration()
        {
            locator.Register(Install.From("Installers\\DefaultInstanceRegistrationTest.rb"));

            var instance = locator.GetInstance <ITestInterface>();

            Assert.IsInstanceOf <TestCase1>(instance);
        }
예제 #16
0
        public void RubyIConditionRegistration()
        {
            locator.Register(Install.From("Installers\\ConditionalGenericRegistrationTest.rb"));

            locator.AddContext(CreateContext(TestEnum.Case2));

            Assert.IsInstanceOf <TestCase2>(locator.GetInstance <ITestInterface>());
        }
예제 #17
0
 public PostProcessors(Install profile, bool isClient, ProgressCallback monitor)
 {
     this.Profile    = profile;
     this.IsClient   = isClient;
     this.Monitor    = monitor;
     this.Processors = profile.Processors;
     this.HasTasks   = this.Processors.Count != 0;
     this.Data       = new Dictionary <string, string>();
 }
예제 #18
0
        /// <summary>
        /// Generates the steps required to ensure the instance.
        /// </summary>
        /// <param name="arguments"></param>
        /// <param name="relativeRoot"></param>
        /// <returns></returns>
        internal IEnumerable <SqlDeploymentAction> Compile(IDictionary <string, string> arguments, string relativeRoot)
        {
            if (relativeRoot is null)
            {
                throw new ArgumentNullException(nameof(relativeRoot));
            }

            var context = new SqlDeploymentCompileContext(arguments, Name.Expand <string>(arguments), relativeRoot);

            if (Install != null)
            {
                foreach (var s in Install.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Configuration != null)
            {
                foreach (var s in Configuration.Compile(context))
                {
                    yield return(s);
                }
            }

            foreach (var i in LinkedServers)
            {
                foreach (var s in i.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Distributor != null)
            {
                foreach (var s in Distributor.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Publisher != null)
            {
                foreach (var s in Publisher.Compile(context))
                {
                    yield return(s);
                }
            }

            foreach (var i in Databases)
            {
                foreach (var s in i.Compile(context))
                {
                    yield return(s);
                }
            }
        }
예제 #19
0
        public void RubySingletonRegistration()
        {
            locator.Register(Install.From("Installers\\SingletonRegistrationTest.rb"));

            var instance  = locator.GetInstance <ITestInterface>();
            var instance2 = locator.GetInstance <ITestInterface>();

            Assert.IsInstanceOf <TestCase1>(instance);
            Assert.AreSame(instance, instance2);
        }
        public ActionResult Install(Install install)
        {
            string dbName = install.DatabaseName;

            if (ModelState.IsValid)
            {
                //Set connection string
                ConnectionString = ConnectionString.Replace("#DSOURCE", install.DatabaseHost).Replace("#USERID", install.Username).Replace("#PASSWORD", install.Password);

                if (IsCheckServerExists(install.DatabaseHost, 1433))
                {
                    if (!IsDatabaseExists(dbName))
                    {
                        //if (CreateDatabase(dbName))
                        //{
                        //    return SaveConfig(dbName);
                        //}
                        if (SaveConfig(dbName))
                        {
                            return(RedirectToAction("Users", "Register"));
                        }
                        else
                        {
                            ViewBag.invalidData = "Error occured while creating database.";
                        }
                    }
                    else
                    {
                        if (install.IsDBInstalled != "true")
                        {
                            ViewBag.invalidData     = "Database exist with same name, please enter different database.";
                            ViewBag.confirmRequired = true;
                        }
                        else
                        {
                            ViewBag.confirmRequired = false;
                            if (SaveConfig(dbName))
                            {
                                Request.RequestContext.HttpContext.Application["CurrentTheme"] = "Default";
                                return(RedirectToAction("Users", "Register"));
                            }
                        }
                    }
                }
                else
                {
                    ViewBag.invalidData = "No database server exist, please enter valid sql server address";
                }
            }
            else
            {
                ViewBag.invalidData = "Please enter required field value.";
            }
            return(View());
        }
예제 #21
0
 public byte[] GetBytes()
 {
     if (FileType == CachedFileType.Parsed)
     {
         return(Install.GetBytesFromParsedFile(Path, Data));
     }
     else
     {
         throw new Exception("CachedFile.GetBytes(): Invalid FileType = \n\nUse WriteSteam() for FileType.Stream." + FileType);
     }
 }
예제 #22
0
            internal bool Register()
            {
                if (MainDom != null)
                {
                    return(MainDom.Register(Install, Release));
                }

                // tests
                Install?.Invoke();
                return(true);
            }
 void IInitializable <ApplicationConfiguration> .Initialized(ApplicationConfiguration application)
 {
     application.Services(services => services
                          .Advanced(advanced => advanced
                                    .Register <SetPerformContextFilter>()
                                    .Register <IHangfirePerformContextProvider, HangfirePerformContextProvider>()
                                    .Install(Install.Service <HangfirePerThreadPerformContext>(x => x.LifestylePerThread())))
                          .Interceptors(interceptors => interceptors
                                        .InterceptService <IConsoleWriter, HangfireConsoleWriterInterceptor>()
                                        .InterceptService <ILogger, HangfireLoggerInterceptor>()));
 }
예제 #24
0
        void IInitializable <IWindsorContainer> .Initialized(IWindsorContainer container)
        {
            _configuration.ApplyServerOptions(container.Kernel);

            container.Install(_backgroundProcesses);
            container.Install(Install.Instance(_configuration));
            container.Install(Install.Service <IHangfireServerFactory, HangfireServerFactory>());

            // Assign a Storage as early as this, to support creating a brand-new Hangfire database part of the initial migration of Integration Service.
            GlobalConfiguration.Configuration.UseStorage(new DelegatingJobStorage(container, _configuration));
        }
        void IInitializable <ApplicationConfiguration> .Initialized(ApplicationConfiguration application)
        {
            DefaultConnection connection = _configuration.Disabled
                ? DefaultConnection.Disabled
                : _defaultConnection ?? new DefaultConnection(ConnectionString.FromName("IntegrationDb"));

            application.Services(services => services
                                 .Advanced(advanced => advanced
                                           .Install(Install.Instance <IIntegrationDatabaseConfiguration>(_configuration))
                                           .Install(new DbInstaller(connection))));
        }
예제 #26
0
        public void SaveInstall()
        {
            if (!CheckCarAvailability())
            {
                MessageBox.Show("Car name not found.");
                return;
            }

            if (myPartsList.Count == 0)
            {
                MessageBox.Show("Please add at least one part");
                return;
            }

            MainDatabaseSourceDataContext dbContext = new MainDatabaseSourceDataContext();
            int     myId    = GetMaxInstallId() + 1;
            Install install = new Install();

            install.ID                = myId;
            install.Car_ID            = GetCarIdByName(this.MyInstallModel.CarName);
            install.other_desc_fields = this.MyInstallModel.InstallDisc;
            dbContext.Installs.InsertOnSubmit(install);

            int instapPartID = GetMaxInstallPartId();

            foreach (var item in myPartsList)
            {
                Install_Detail install_Detail = new Install_Detail();

                install_Detail.ID = instapPartID + 1;

                instapPartID += 1;

                install_Detail.Part_ID = item.PartId;

                install_Detail.Other_desc_fields = item.Disc;

                install_Detail.Install_ID = myId;

                install.Install_Details.Add(install_Detail);

                dbContext.Install_Details.InsertOnSubmit(install_Detail);
            }
            dbContext.SubmitChanges();
            //--------------Confirmation message ------------------
            MessageBox.Show("saved successfuly");
            myPartsList.Clear();
            this.installPartModelw.PartName = "";
            this.installPartModelw.PartDesc = "";
            this.MyInstallModel.CarName     = "";
            this.MyInstallModel.InstallDisc = "";
            this.searchModel.MyPartsToDisp  = myPartsList;
        }
예제 #27
0
        public void RubyNamedInstanceRegistration()
        {
            locator.Register(Install.From("Installers\\NamedInstanceRegistrationTest.rb"));

            var instance = locator.GetInstance <ITestInterface>("Test");

            Assert.IsInstanceOf <TestCase2>(instance);

            instance = locator.GetInstance <ITestInterface>("Test1");

            Assert.IsInstanceOf <TestCase1>(instance);
        }
        internal ApplicationContext(Action <ApplicationConfiguration> application)
        {
            StartedAt = Time.UtcNow;

            _cancellation  = new CancellationTokenSource();
            _configuration = new ApplicationConfiguration();

            // Executes all client-specific configuration
            application?.Invoke(_configuration);

            // Apply all environment-specific configuration
            _configuration.Environment(environment => environment.Apply());

            // Will instruct all extension-points that client-specific configurations have been completed.
            _configuration.Extensibility(extensibility =>
            {
                foreach (var subject in extensibility.OfType <IInitializable <ApplicationConfiguration> >())
                {
                    subject.Initialized(_configuration);
                }
            });

            // Creates the DI container
            Container = new WindsorContainer();
            Container.Kernel.AddFacility <TypedFactoryFacility>();
            Container.Register(Component.For <ILazyComponentLoader>().ImplementedBy <LazyOfTComponentLoader>());

            // Allows all extension-points to initialize the DI container.
            _configuration.Extensibility(extensibility =>
            {
                foreach (var subject in extensibility.OfType <IInitializable <IWindsorContainer> >())
                {
                    subject.Initialized(Container);
                }
            });

            // Ensures that we "own" these specific service interfaces - which cannot be intercepted
            Container.Install(Install.Instance <IShutdown>(this, registration => registration.NamedAutomatically("Shutdown_23a911175572418588e212253a2dcf98")));
            Container.Install(Install.Instance <IUptime>(this, registration => registration.NamedAutomatically("Uptime_d097752484954f1cb727633cdefc87a4")));

            // Allows all extensions-points to run code after the Integration Service is fully configured.
            _configuration.Extensibility(extensibility =>
            {
                foreach (var subject in extensibility.OfType <IInitializable <IApplicationContext> >())
                {
                    subject.Initialized(this);
                }
            });

            // Report that we're live and kicking
            WriteLine("[Integration Service]: Started at {0} (UTC).", StartedAt);
        }
 private void Button1_Click(object sender, EventArgs e)
 {
     if (this.lstCydia.SelectedItems.Count != 0)
     {
         ListViewItem item    = this.lstCydia.SelectedItems[0];
         Install      install = new Install();
         install.installFromFile(string.Concat(AppConst.m_rootPath, "\\download\\", item.SubItems[0].Text), "", "");
     }
     else
     {
         Interaction.MsgBox("Please select file to install", MsgBoxStyle.OkOnly, null);
     }
 }
예제 #30
0
        public async Task InstallPackageForMultipleProjectAsync(IReadOnlyList <IExtensibleProject> projects, PackageIdentity package, CancellationToken token)
        {
            using (_batchToken = new BatchOperationToken())
            {
                foreach (var project in projects)
                {
                    await InstallPackageForProjectAsync(project, package, token);
                }
            }

            // raise supressed events
            foreach (var args in _batchToken.GetInvokationList <InstallNuGetProjectEventArgs>())
            {
                await Install.SafeInvokeAsync(this, args);
            }
        }
예제 #31
0
        public async Task <IActionResult> InstallAsync(Install model)
        {
            #region 参数验证
            Check.IfNullOrZero(model.AppId);
            Check.IfNullOrZero(model.DeskNum);
            #endregion
            var userContext = await GetUserContextAsync();

            await _appServices.InstallAppAsync(userContext.Id, model.AppId, model.DeskNum);

            return(Json(new ResponseSimple
            {
                IsSuccess = true,
                Message = "安装成功"
            }));
        }
예제 #32
0
        private void InstallFromFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                InitialDirectory = "c:\\\\",
                Filter           = "IPA Files (*.ipa)|*.ipa|All files (*.*)|*.*",
                FilterIndex      = 2,
                RestoreDirectory = true
            };

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Install install = new Install();
                install.installFromFile(openFileDialog.FileName, "", "");
            }
        }
예제 #33
0
        public ActionResult Install(Install model)
        {
            if (Globals.IsNewSite(ControllerContext.RequestContext.HttpContext))
            {
                if (ModelState.IsValid)
                {
                    using (XenonCMSContext DB = new XenonCMSContext())
                    {
                        string RequestDomain = Globals.GetRequestDomain(ControllerContext.RequestContext.HttpContext);
                        Site Site = new Site();
                        Site.AdminIPs = new List<SiteAdminIP>();
                        Site.BlogPosts = new List<SiteBlogPost>();
                        Site.Pages = new List<SitePage>();

                        SiteAdminIP NewAdminIP = new SiteAdminIP();
                        NewAdminIP.Address = ControllerContext.RequestContext.HttpContext.Request.UserHostAddress;
                        Site.AdminIPs.Add(NewAdminIP);

                        SiteBlogPost NewBlogPost = new SiteBlogPost();
                        NewBlogPost.DateLastUpdated = DateTime.Now;
                        NewBlogPost.DatePosted = DateTime.Now;
                        NewBlogPost.FullPostText = "XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!";
                        NewBlogPost.Slug = "xenoncms-installed";
                        NewBlogPost.Title = "XenonCMS Installed";
                        Site.BlogPosts.Add(NewBlogPost);

                        Site.ContactEmail = "contact@" + RequestDomain;
                        Site.Domain = RequestDomain;
                        Site.NavBarInverted = false;

                        SitePage NewPageHome = new SitePage();
                        NewPageHome.DateAdded = DateTime.Now;
                        NewPageHome.DateLastUpdated = DateTime.Now;
                        NewPageHome.DisplayOrder = 1;
                        NewPageHome.Html = "XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!";
                        NewPageHome.Layout = "JumbotronNoSidebar";
                        NewPageHome.Text = "Home";
                        NewPageHome.Slug = "home";
                        NewPageHome.ParentId = 0;
                        NewPageHome.RequireAdmin = false;
                        NewPageHome.RightAlign = false;
                        NewPageHome.ShowInMenu = true;
                        NewPageHome.ShowTitleOnPage = true;
                        NewPageHome.Title = "XenonCMS Installed";
                        Site.Pages.Add(NewPageHome);

                        SitePage NewPageBlog = new SitePage();
                        NewPageBlog.DateAdded = DateTime.Now;
                        NewPageBlog.DateLastUpdated = DateTime.Now;
                        NewPageBlog.DisplayOrder = 2;
                        NewPageBlog.Html = "N/A";
                        NewPageBlog.Layout = "NormalSidebar";
                        NewPageBlog.Text = "Blog";
                        NewPageBlog.Slug = "blog";
                        NewPageBlog.ParentId = 0;
                        NewPageBlog.RequireAdmin = false;
                        NewPageBlog.RightAlign = false;
                        NewPageBlog.ShowInMenu = true;
                        NewPageBlog.ShowTitleOnPage = true;
                        NewPageBlog.Title = "Blog";
                        Site.Pages.Add(NewPageBlog);

                        SitePage NewPageContact = new SitePage();
                        NewPageContact.DateAdded = DateTime.Now;
                        NewPageContact.DateLastUpdated = DateTime.Now;
                        NewPageContact.DisplayOrder = 3;
                        NewPageContact.Html = "N/A";
                        NewPageContact.Layout = "NormalSidebar";
                        NewPageContact.Text = "Contact";
                        NewPageContact.Slug = "contact";
                        NewPageContact.ParentId = 0;
                        NewPageContact.RequireAdmin = false;
                        NewPageContact.RightAlign = false;
                        NewPageContact.ShowInMenu = true;
                        NewPageContact.ShowTitleOnPage = true;
                        NewPageContact.Title = "Contact";
                        Site.Pages.Add(NewPageContact);

                        Site.Sidebar = "<div class=\"panel panel-default\"><div class=\"panel-heading\"><h3 class=\"panel-title\">XenonCMS Installed</h3></div><div class=\"panel-body\">XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!</div></div>";
                        Site.Theme = "Cerulean";
                        Site.Title = RequestDomain;

                        DB.Sites.Add(Site);
                        DB.SaveChanges();

                        DatabaseCache.AddSite(ControllerContext.RequestContext.HttpContext, Site);
                        DatabaseCache.ResetAdminIPs(ControllerContext.RequestContext.HttpContext);
                        DatabaseCache.ResetBlogPosts(ControllerContext.RequestContext.HttpContext);
                        DatabaseCache.ResetNavMenuItems(ControllerContext.RequestContext.HttpContext);
                        DatabaseCache.ResetSidebars(ControllerContext.RequestContext.HttpContext);
                    }

                    return RedirectToAction("Index");
                }
                else
                {
                    return View(model);
                }
            }
            else
            {
                return RedirectToAction("Index");
            }
        }
예제 #34
0
        public ActionResult Install(Install model)
        {
            if (Caching.GetSite() == null)
            {
                if (ModelState.IsValid)
                {
                    using (ApplicationDbContext DB = new ApplicationDbContext())
                    {
                        string RequestDomain = Globals.GetRequestDomain();
                        Site Site = new Site();

                        Site.ContactEmail = "website@" + RequestDomain;
                        Site.Domain = RequestDomain;
                        Site.NavBarInverted = false;
                        Site.Sidebar = "<div class=\"panel panel-default\"><div class=\"panel-heading\"><h3 class=\"panel-title\">XenonCMS Installed</h3></div><div class=\"panel-body\">XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!</div></div>";
                        Site.Theme = "Cerulean";
                        Site.Title = RequestDomain;

                        Site.BlogPosts.Add(new SiteBlogPost() {
                            DateLastUpdated = DateTime.Now,
                            DatePosted = DateTime.Now,
                            FullPostText = "XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!",
                            Slug = "xenoncms-installed",
                            Title = "XenonCMS Installed"

                        });

                        Site.Pages.Add(new SitePage() {
                            DateAdded = DateTime.Now,
                            DateLastUpdated = DateTime.Now,
                            DisplayOrder = 1,
                            Html = "<div class=\"jumbotron\"><h2>XenonCMS Installed</h2><p>XenonCMS has been successfully installed and is ready for use on " + RequestDomain + "!</p></div>",
                            LinkText = "Home",
                            ParentId = null,
                            RequireAdmin = false,
                            RightAlign = false,
                            ShowInMenu = true,
                            ShowTitleOnPage = false,
                            Slug = "home",
                            Title = "XenonCMS Installed"
                        });

                        Site.Pages.Add(new SitePage()
                        {
                            DateAdded = DateTime.Now,
                            DateLastUpdated = DateTime.Now,
                            DisplayOrder = 2,
                            Html = null,
                            LinkText = "Blog",
                            ParentId = null,
                            RequireAdmin = false,
                            RightAlign = false,
                            ShowInMenu = true,
                            ShowTitleOnPage = true,
                            Slug = "blog",
                            Title = RequestDomain + " Blog"
                        });

                        Site.Pages.Add(new SitePage()
                        {
                            DateAdded = DateTime.Now,
                            DateLastUpdated = DateTime.Now,
                            DisplayOrder = 3,
                            Html = null,
                            LinkText = "Contact",
                            ParentId = null,
                            RequireAdmin = false,
                            RightAlign = false,
                            ShowInMenu = true,
                            ShowTitleOnPage = true,
                            Slug = "contact",
                            Title = "Contact Form"
                        });

                        DB.Sites.Add(Site);
                        DB.SaveChanges();

                        Caching.ResetSite();
                        Caching.ResetBlogPosts();
                        Caching.ResetPages();
                        // TODOXXX Caching.ResetSidebars();
                    }

                    return Redirect("~");
                }
                else
                {
                    return View(model);
                }
            }
            else
            {
                return Redirect("~");
            }
        }