protected void Application_Start() { // standard ASP.NET MVC setup AreaRegistration.RegisterAllAreas(); GlobalFilters.Filters.Add(new HandleErrorAttribute()); RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); // initialize settings and the skin-override mechanism ContentLocator.Current = new ContentLocator(Context.Server); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new SkinnableViewEngine()); Settings.ApplySkinSettings(); // set connection settings Connections.SetUrls(Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl); Log.Info("WebMediaPortal version {0} started with MAS {1} and TAS {2}", VersionUtil.GetFullVersionString(), Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl); Connections.LogServiceVersions(); // automatically reload changes to the configuration files, mainly so that we instantly pick up new/deleted users. Configuration.EnableChangeWatching(); // generate a random token, which we can use for security stuff Context.Application["randomToken"] = Guid.NewGuid(); }
// // GET: /Settings/ public ActionResult Index() { ViewBag.Version = VersionUtil.GetFullVersionString(); ServiceAvailability.Reload(); return(View(new SettingsViewModel(Settings.ActiveSettings))); }
public bool Open() { try { ServiceState.RegisterStartupCondition(STARTUP_CONDITION); Log.Debug("Opening MPExtended ServiceHost version {0}", VersionUtil.GetFullVersionString()); // always log uncaught exceptions that cause the program to exit AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Log.Error("Unhandled exception", (Exception)e.ExceptionObject); if (e.IsTerminating) { Log.Fatal("Terminating because of previous exception"); } }; // set the thread locale to English; we don't output any user-facing messages from the service anyway. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // TODO: Set CultureInfo.DefaultThreadCurrent{,UI}Culture when we switch to .NET4.5 // setup our environment EnvironmentSetup.SetupEnvironment(); // start watching the configuration files for changes Configuration.Load(); Configuration.EnableChangeWatching(); // reload logger configuration, now that we can load the diagnostic section from the configuration Log.TraceLogging = Configuration.Services.Diagnostic.EnableTraceLogging; Log.Setup(); // load and host all services foreach (var service in ServiceInstallation.Instance.GetServices()) { Task.Factory.StartNew(StartService, (object)service); } wcfHost = new WCFHost(); wcfHost.Start(ServiceInstallation.Instance.GetWcfServices()); // ensure a service dependency on the TVEngine is set Task.Factory.StartNew(() => TVEDependencyInstaller.EnsureDependencyStatus(TVEDependencyInstaller.DependencyStatus.NoDependencySet)); // log system version details Mediaportal.LogVersionDetails(); Log.Debug("Running on CLR {0} on {1}", Environment.Version, Environment.OSVersion); // finish ServiceState.StartupConditionCompleted(STARTUP_CONDITION); Log.Trace("Opened MPExtended ServiceHost"); return(true); } catch (Exception ex) { Log.Error("Failed to open MPExtended ServiceHost", ex); return(false); } }
public ActionResult Index(SettingsViewModel model) { ViewBag.Version = VersionUtil.GetFullVersionString(); if (!ModelState.IsValid) { return(View(new SettingsViewModel(Settings.ActiveSettings))); } model.SaveToConfiguration(); return(RedirectToAction("Index")); }
public ActionResult Services(ServiceAddressesViewModel model) { Configuration.WebMediaPortal.MASUrl = model.MAS; Configuration.WebMediaPortal.TASUrl = model.TAS; Configuration.WebMediaPortal.ServiceUsername = model.Username; Configuration.WebMediaPortal.ServicePassword = model.Password; Configuration.Save(); Connections.SetUrls(model.MAS, model.TAS); Log.Info("WebMediaPortal version {0} now connected with MAS {1} and TAS {2}", VersionUtil.GetFullVersionString(), Settings.ActiveSettings.MASUrl, Settings.ActiveSettings.TASUrl); Connections.LogServiceVersions(); return(View("ServicesSaved")); }
public bool Open() { try { ServiceState.RegisterStartupCondition(STARTUP_CONDITION); Log.Debug("Opening MPExtended ServiceHost version {0}", VersionUtil.GetFullVersionString()); // always log uncaught exceptions that cause the program to exit AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Log.Error("Unhandled exception", (Exception)e.ExceptionObject); if (e.IsTerminating) { Log.Fatal("Terminating because of previous exception"); } }; // start watching the configuration files for changes Configuration.Load(); Configuration.EnableChangeWatching(); // start the WCF services wcf.Start(Installation.GetAvailableServices().Where(x => x.WCFType != null)); // init all services var services = Installation.GetAvailableServices().Where(x => x.InitClass != null && x.InitMethod != null); foreach (var service in services) { BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod; service.InitClass.InvokeMember(service.InitMethod, flags, null, null, null); } // ensure a service dependency on the TVEngine is set Task.Factory.StartNew(TVEDependencyInstaller.EnsureDependencyIsInstalled); // log MP version details Mediaportal.LogVersionDetails(); // finish ServiceState.StartupConditionCompleted(STARTUP_CONDITION); Log.Trace("Opened MPExtended ServiceHost"); return(true); } catch (Exception ex) { Log.Error("Failed to open MPExtended ServiceHost", ex); return(false); } }
public MainWindow() { InitializeComponent(); Log.Debug("MPExtended configurator version {0} starting...", VersionUtil.GetFullVersionString()); SetupUSS(); if (StartupArguments.RunAsTrayApp && !StartupArguments.OpenOnStart) { Hide(); } HandleMediaPortalState(UserServices.USS.IsMediaPortalRunning()); // service control interface sci = new ServiceControlInterface("MPExtended Service", lblServiceState, btnStartStopService); if (!sci.IsServiceAvailable && Installation.GetFileLayoutType() == FileLayoutType.Installed) { Log.Error("MPExtended Service not installed"); MessageBox.Show(UI.ServiceNotInstalledPopup, "MPExtended", MessageBoxButton.OK, MessageBoxImage.Error); } else if (sci.IsServiceAvailable) { sci.StartServiceWatcher(); } // hide tabs and context menu items not applicable for current situation if (!Installation.IsServiceInstalled("MediaAccessService")) { tcMainTabs.Items.Remove(tiPlugin); tcMainTabs.Items.Remove(tiSocial); } if (!Installation.IsServiceInstalled("StreamingService")) { tcMainTabs.Items.Remove(tiStreaming); tcMainTabs.Items.Remove(tiSocial); } if (!Installation.IsProductInstalled(MPExtendedProduct.WebMediaPortal)) { tcMainTabs.Items.Remove(tiWebMediaPortal); taskbarItemContextMenu.Items.Remove(MenuOpenWebMP); } // initialize some tabs Pages.TabConfiguration.StartLoadingTranslations(); }
// // GET: /Settings/ public ActionResult Index() { ViewBag.Version = VersionUtil.GetFullVersionString(); return(View(new SettingsViewModel(Settings.ActiveSettings))); }
private void SetViewBagProperties(dynamic bag) { bag.Availability = ServiceAvailability; bag.FullVersion = VersionUtil.GetFullVersionString(); bag.Language = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; }