protected void Application_Start() { FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AppStartConfig.RegisterAutoFac(); }
protected void Application_Start() { AppStartConfig.ApplicationStart(Server); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
//************************************************************** // GetLatestInstalledVersion() //************************************************************** public static Version GetLatestInstalledVersion() { //Load the AppStart config File string ConfigFilePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); ConfigFilePath = Path.Combine(Directory.GetParent(ConfigFilePath).FullName, "AppStart.config"); AppStartConfig Config = AppStartConfig.Load(ConfigFilePath); AssemblyName AN = AssemblyName.GetAssemblyName(Config.AppExePath); return(AN.Version); }
protected void Application_Start() { HttpConfiguration config = GlobalConfiguration.Configuration; config.Formatters.JsonFormatter .SerializerSettings .ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; AreaRegistration.RegisterAllAreas(); AppStartConfig.RegisterAutoFac(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); }
//************************************************************** // RunThread() //************************************************************** public void RunThread() { Debug.WriteLine("APPMANAGER: Starting Update"); //Load the AppStart config File string ConfigFilePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); ConfigFilePath = Path.Combine(Directory.GetParent(ConfigFilePath).FullName, "AppStart.config"); Config = AppStartConfig.Load(ConfigFilePath); try { //Mark in the manifest that a download is in progress. Persisted in //manifest in case the app is stop & restarted during the download. if (AppMan.Manifest.State.Phase == UpdatePhases.Complete) { AppMan.Manifest.State.Phase = UpdatePhases.Scavenging; AppMan.Manifest.State.UpdateFailureCount = 0; AppMan.Manifest.State.UpdateFailureEncoutered = false; AppMan.Manifest.State.DownloadDestination = CreateTempDirectory(); if (AppMan.ChangeDetectionMode == ChangeDetectionModes.ServerManifestCheck) { ServerManifest SM = new ServerManifest(); SM.Load(AppMan.UpdateUrl); //download from the web and desserialise it into the object AppMan.Manifest.State.DownloadSource = SM.ApplicationUrl; //new: krishna added this to enable specifying files explicitly instead of deep copying //a directory using HTTP-DAV. AppMan.Manifest.State.FilesToDownload = SM.FilesToDownload; } else { AppMan.Manifest.State.DownloadSource = AppMan.UpdateUrl; } AppMan.Manifest.Update(); } //Scavenge Existing Directories if (AppMan.Manifest.State.Phase == UpdatePhases.Scavenging) { Debug.WriteLine("APPMANAGER: Scavaging older versions"); Scavenge(); AppMan.Manifest.State.Phase = UpdatePhases.Downloading; AppMan.Manifest.Update(); } //Download the New Version if (AppMan.Manifest.State.Phase == UpdatePhases.Downloading) { Debug.WriteLine("APPMANAGER: Downloading new version"); Download(); AppMan.Manifest.State.Phase = UpdatePhases.Validating; AppMan.Manifest.Update(); } //Validate the downloaded bits if (AppMan.Manifest.State.Phase == UpdatePhases.Validating) { Debug.WriteLine("APPMANAGER: Downloading new version"); Validate(); AppMan.Manifest.State.Phase = UpdatePhases.Merging; AppMan.Manifest.Update(); } //Merge the existing version into the new version if (AppMan.Manifest.State.Phase == UpdatePhases.Merging) { Debug.WriteLine("APPMANAGER: Merging current & new versions"); MergeDirectory(AppDomain.CurrentDomain.BaseDirectory, AppMan.Manifest.State.DownloadDestination); AppMan.Manifest.State.Phase = UpdatePhases.Finalizing; AppMan.Manifest.Update(); } //Finalize the update. Rename the new version directory, etc... if (AppMan.Manifest.State.Phase == UpdatePhases.Finalizing) { Debug.WriteLine("APPMANAGER: Finalizing update"); FinalizeUpdate(); } //Reset Update State AppMan.Manifest.State.Phase = UpdatePhases.Complete; AppMan.Manifest.State.UpdateFailureCount = 0; AppMan.Manifest.State.UpdateFailureEncoutered = false; AppMan.Manifest.State.DownloadSource = ""; AppMan.Manifest.State.DownloadDestination = ""; AppMan.Manifest.State.NewVersionDirectory = ""; AppMan.Manifest.Update(); } catch (ThreadAbortException) { Thread.ResetAbort(); Debug.WriteLine("APPMANAGER: ThreadAborted: Updater Thread stopped, stopping download."); return; } catch (Exception e) { UpdateEventArgs.FailureException = e; } if (AppMan.Manifest.State.Phase != UpdatePhases.Complete) { HandleUpdateFailure(); } else { HandleUpdateSuccess(); } }