예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            NameValueCollection appSettings = ConfigurationManager.AppSettings;

            appSettings.Set("GentleConfigFile", String.Format(@"{0}\gentle.config", PathManager.GetDataPath));

            string opt = null;

            if (args.Length >= 1)
            {
                opt = args[0];
            }

            if (opt != null && opt.ToUpperInvariant() == "/INSTALL")
            {
                TransactedInstaller ti = new TransactedInstaller();
                ProjectInstaller    mi = new ProjectInstaller();
                ti.Installers.Add(mi);
                String path = String.Format("/assemblypath={0}",
                                            System.Reflection.Assembly.GetExecutingAssembly().Location);
                String[]       cmdline = { path };
                InstallContext ctx     = new InstallContext("", cmdline);
                ti.Context = ctx;
                ti.Install(new Hashtable());
                return;
            }
            if (opt != null && opt.ToUpperInvariant() == "/UNINSTALL")
            {
                TransactedInstaller ti = new TransactedInstaller();
                ProjectInstaller    mi = new ProjectInstaller();
                ti.Installers.Add(mi);
                String path = String.Format("/assemblypath={0}",
                                            System.Reflection.Assembly.GetExecutingAssembly().Location);
                String[]       cmdline = { path };
                InstallContext ctx     = new InstallContext("", cmdline);
                ti.Context = ctx;
                ti.Uninstall(null);
                return;
            }
            // When using /DEBUG switch (in visual studio) the TvService is not run as a service
            // Make sure the real TvService is disabled before debugging with /DEBUG
            if (opt != null && opt.ToUpperInvariant() == "/DEBUG")
            {
                Service1 s = new Service1();
                s.DoStart(new string[] { "/DEBUG" });
                do
                {
                    Thread.Sleep(100);
                } while (true);
            }

            // More than one user Service may run within the same process. To add
            // another service to this process, change the following line to
            // create a second service object. For example,
            //
            //   ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
            //
            ServiceBase[] ServicesToRun = new ServiceBase[] { new Service1() };
            ServiceBase.Run(ServicesToRun);
        }
예제 #2
0
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    private static void Main(string[] args)
    {
      // Init Common logger -> this will enable TVPlugin to write in the Mediaportal.log file
      var loggerName = Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]);
      var dataPath = Log.GetPathName();
      var loggerPath = Path.Combine(dataPath, "log");
#if DEBUG
      if (loggerName != null) loggerName = loggerName.Replace(".vshost", "");
#endif
      CommonLogger.Instance = new CommonLog4NetLogger(loggerName, dataPath, loggerPath);

      
      NameValueCollection appSettings = ConfigurationManager.AppSettings;
      appSettings.Set("GentleConfigFile", String.Format(@"{0}\gentle.config", PathManager.GetDataPath));

      string opt = null;
      if (args.Length >= 1)
      {
        opt = args[0];
      }

      if (opt != null && opt.ToUpperInvariant() == "/INSTALL")
      {
        TransactedInstaller ti = new TransactedInstaller();
        ProjectInstaller mi = new ProjectInstaller();
        ti.Installers.Add(mi);
        String path = String.Format("/assemblypath={0}",
                                    System.Reflection.Assembly.GetExecutingAssembly().Location);
        String[] cmdline = { path };
        InstallContext ctx = new InstallContext("", cmdline);
        ti.Context = ctx;
        ti.Install(new Hashtable());
        return;
      }
      if (opt != null && opt.ToUpperInvariant() == "/UNINSTALL")
      {
        TransactedInstaller ti = new TransactedInstaller();
        ProjectInstaller mi = new ProjectInstaller();
        ti.Installers.Add(mi);
        String path = String.Format("/assemblypath={0}",
                                    System.Reflection.Assembly.GetExecutingAssembly().Location);
        String[] cmdline = { path };
        InstallContext ctx = new InstallContext("", cmdline);
        ti.Context = ctx;
        ti.Uninstall(null);
        return;
      }
      // When using /DEBUG switch (in visual studio) the TvService is not run as a service
      // Make sure the real TvService is disabled before debugging with /DEBUG
      if (opt != null && opt.ToUpperInvariant() == "/DEBUG")
      {
        Service1 s = new Service1();
        s.DoStart(new string[] { "/DEBUG" });
        do
        {
          Thread.Sleep(100);
        } while (true);
      }

      // More than one user Service may run within the same process. To add
      // another service to this process, change the following line to
      // create a second service object. For example,
      //
      //   ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
      //
      ServiceBase[] ServicesToRun = new ServiceBase[] { new Service1() };
      ServicesToRun[0].CanShutdown = true;    // Allow OnShutdown() 
      ServiceBase.Run(ServicesToRun);
    }
예제 #3
0
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    private static void Main(string[] args)
    {
      NameValueCollection appSettings = ConfigurationManager.AppSettings;
      appSettings.Set("GentleConfigFile", String.Format(@"{0}\gentle.config", PathManager.GetDataPath));

      string opt = null;
      if (args.Length >= 1)
      {
        opt = args[0];
      }

      if (opt != null && opt.ToUpperInvariant() == "/INSTALL")
      {
        TransactedInstaller ti = new TransactedInstaller();
        ProjectInstaller mi = new ProjectInstaller();
        ti.Installers.Add(mi);
        String path = String.Format("/assemblypath={0}",
                                    System.Reflection.Assembly.GetExecutingAssembly().Location);
        String[] cmdline = {path};
        InstallContext ctx = new InstallContext("", cmdline);
        ti.Context = ctx;
        ti.Install(new Hashtable());
        return;
      }
      if (opt != null && opt.ToUpperInvariant() == "/UNINSTALL")
      {
        TransactedInstaller ti = new TransactedInstaller();
        ProjectInstaller mi = new ProjectInstaller();
        ti.Installers.Add(mi);
        String path = String.Format("/assemblypath={0}",
                                    System.Reflection.Assembly.GetExecutingAssembly().Location);
        String[] cmdline = {path};
        InstallContext ctx = new InstallContext("", cmdline);
        ti.Context = ctx;
        ti.Uninstall(null);
        return;
      }
      // When using /DEBUG switch (in visual studio) the TvService is not run as a service
      // Make sure the real TvService is disabled before debugging with /DEBUG
      if (opt != null && opt.ToUpperInvariant() == "/DEBUG")
      {
        Service1 s = new Service1();
        s.DoStart(new string[] {"/DEBUG"});
        do
        {
          Thread.Sleep(100);
        } while (true);
      }

      // More than one user Service may run within the same process. To add
      // another service to this process, change the following line to
      // create a second service object. For example,
      //
      //   ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
      //
      ServiceBase[] ServicesToRun = new ServiceBase[] {new Service1()};
      ServiceBase.Run(ServicesToRun);
    }
예제 #4
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static void Main(string[] args)
        {
            // Init Common logger -> this will enable TVPlugin to write in the Mediaportal.log file
            var loggerName = Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]);
            var dataPath   = Log.GetPathName();
            var loggerPath = Path.Combine(dataPath, "log");

#if DEBUG
            if (loggerName != null)
            {
                loggerName = loggerName.Replace(".vshost", "");
            }
#endif
            CommonLogger.Instance = new CommonLog4NetLogger(loggerName, dataPath, loggerPath);


            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            appSettings.Set("GentleConfigFile", String.Format(@"{0}\gentle.config", PathManager.GetDataPath));

            string opt = null;
            if (args.Length >= 1)
            {
                opt = args[0];
            }

            if (opt != null && opt.ToUpperInvariant() == "/INSTALL")
            {
                TransactedInstaller ti = new TransactedInstaller();
                ProjectInstaller    mi = new ProjectInstaller();
                ti.Installers.Add(mi);
                String path = String.Format("/assemblypath={0}",
                                            System.Reflection.Assembly.GetExecutingAssembly().Location);
                String[]       cmdline = { path };
                InstallContext ctx     = new InstallContext("", cmdline);
                ti.Context = ctx;
                ti.Install(new Hashtable());
                return;
            }
            if (opt != null && opt.ToUpperInvariant() == "/UNINSTALL")
            {
                TransactedInstaller ti = new TransactedInstaller();
                ProjectInstaller    mi = new ProjectInstaller();
                ti.Installers.Add(mi);
                String path = String.Format("/assemblypath={0}",
                                            System.Reflection.Assembly.GetExecutingAssembly().Location);
                String[]       cmdline = { path };
                InstallContext ctx     = new InstallContext("", cmdline);
                ti.Context = ctx;
                ti.Uninstall(null);
                return;
            }
            // When using /DEBUG switch (in visual studio) the TvService is not run as a service
            // Make sure the real TvService is disabled before debugging with /DEBUG
            if (opt != null && opt.ToUpperInvariant() == "/DEBUG")
            {
                Service1 s = new Service1();
                s.DoStart(new string[] { "/DEBUG" });
                do
                {
                    Thread.Sleep(100);
                } while (true);
            }

            // More than one user Service may run within the same process. To add
            // another service to this process, change the following line to
            // create a second service object. For example,
            //
            //   ServicesToRun = new ServiceBase[] {new Service1(), new MySecondUserService()};
            //
            ServiceBase[] ServicesToRun = new ServiceBase[] { new Service1() };
            ServicesToRun[0].CanShutdown = true; // Allow OnShutdown()
            ServiceBase.Run(ServicesToRun);
        }