Ejemplo n.º 1
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            string          WorkingDirectory = System.Windows.Forms.Application.StartupPath;
            int             MultiXID         = 1;
            int             WSPort           = 18080;
            string          ConfigFile       = "TpmConfig.xml";
            ServiceSettings Settings         = new ServiceSettings();

            if (Settings.MultiXTpmInstances != null)
            {
                foreach (InstanceSettings Instance in Settings.MultiXTpmInstances)
                {
                    if (Instance.ServiceName.ToLower().Trim() == ServiceName.ToLower())
                    {
                        if (Instance.MultiXID != 0)
                        {
                            MultiXID = Instance.MultiXID;
                        }
                        if (Instance.ConfigFileName != null && Instance.ConfigFileName.Trim().Length > 0)
                        {
                            ConfigFile = Instance.ConfigFileName.Trim();
                        }
                        if (Instance.WebServicePort != 0)
                        {
                            WSPort = Instance.WebServicePort;
                        }
                        if (Instance.WorkingDirectory != null && Instance.WorkingDirectory.Trim().Length > 0)
                        {
                            WorkingDirectory = Instance.WorkingDirectory.Trim();
                        }
                    }
                }
            }
            Tpm = new CMultiXTpmCtrlClass();
            Tpm.WorkingDirectory = WorkingDirectory;
            Tpm.ConfigFileName   = ConfigFile;
            Tpm.WebServicePort   = (ushort)WSPort;
            Tpm.StartWithID(MultiXID);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Set things in motion so your service can do its work.
 /// </summary>
 protected override void OnStart(string[] args)
 {
     // TODO: Add code here to start your service.
     string WorkingDirectory = System.Windows.Forms.Application.StartupPath;
     int MultiXID = 1;
     int WSPort = 18080;
     string ConfigFile = "TpmConfig.xml";
     ServiceSettings Settings = new ServiceSettings();
     if (Settings.MultiXTpmInstances != null)
     {
         foreach (InstanceSettings Instance in Settings.MultiXTpmInstances)
         {
             if (Instance.ServiceName.ToLower().Trim() == ServiceName.ToLower())
             {
                 if (Instance.MultiXID != 0)
                     MultiXID = Instance.MultiXID;
                 if (Instance.ConfigFileName != null && Instance.ConfigFileName.Trim().Length > 0)
                 {
                     ConfigFile = Instance.ConfigFileName.Trim();
                 }
                 if (Instance.WebServicePort != 0)
                     WSPort = Instance.WebServicePort;
                 if (Instance.WorkingDirectory != null && Instance.WorkingDirectory.Trim().Length > 0)
                 {
                     WorkingDirectory = Instance.WorkingDirectory.Trim();
                 }
             }
         }
     }
     Tpm = new CMultiXTpmCtrlClass();
     Tpm.WorkingDirectory	=	WorkingDirectory;
     Tpm.ConfigFileName	=	ConfigFile;
     Tpm.WebServicePort	=	(ushort)WSPort;
     Tpm.StartWithID(MultiXID);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Stop this service.
 /// </summary>
 protected override void OnStop()
 {
     // TODO: Add code here to perform any tear-down necessary to stop your service.
     Tpm.Shutdown(5);
     Tpm	=	null;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Stop this service.
 /// </summary>
 protected override void OnStop()
 {
     // TODO: Add code here to perform any tear-down necessary to stop your service.
     Tpm.Shutdown(5);
     Tpm = null;
 }