Beispiel #1
0
        /// <summary>
        /// Handle the installation activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Install(IDictionary state)
        {
            base.Install(state);

            installTools.InstallIniFile("LillTek.Datacenter.ConfigService.ini");
            NativeSysLogProvider.CreateLogs(Const.ConfigServiceName);
        }
Beispiel #2
0
        /// <summary>
        /// Handle the installation activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Install(IDictionary state)
        {
            base.Install(state);

            installTools.InstallIniFile("LillTek.Datacenter.DynDnsService.ini");
            InstallPerfCounters();
            NativeSysLogProvider.CreateLogs(Const.DynDnsName);
        }
Beispiel #3
0
        /// <summary>
        /// Handle the installation activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Install(IDictionary state)
        {
            base.Install(state);

            installTools.InstallIniFile("LillTek.Telephony.NeonSwitchCore.ini");
            InstallPerfCounters();
            NativeSysLogProvider.CreateLogs(SwitchConst.NeonSwitchName);
        }
Beispiel #4
0
        /// <summary>
        /// Handle the installation activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Install(IDictionary state)
        {
            //-----------------------------------------------------------------
            // Perform the activities.

            installTools.InstallIniFile("LillTek.GeoTracker.Service.ini");
            InstallPerfCounters();
            NativeSysLogProvider.CreateLogs(Const.GeoTrackerName);
        }
Beispiel #5
0
        /// <summary>
        /// Handle the uninstall activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Uninstall(IDictionary state)
        {
            try
            {
                PerformanceCounterCategory.Delete(Const.DynDnsPerf);
                NativeSysLogProvider.RemoveLogs(Const.DynDnsName);
            }
            catch
            {
                // Ignore any errors
            }

            base.Uninstall(state);
        }
Beispiel #6
0
        private static int Remove(string logSource)
        {
            try
            {
                NativeSysLogProvider.RemoveLogs(logSource);
            }
            catch (Exception e)
            {
                Program.Error("Error ({0}): {1}", e.GetType().Name, e.Message);
                return(1);
            }

            return(0);
        }
Beispiel #7
0
        static void Main()
        {
            Helper.InitializeApp(Assembly.GetExecutingAssembly());
            Config.SetConfigPath(Helper.GetEntryAssembly());
            NetTrace.Start();

            NativeSysLogProvider.CreateLogs("MessagingTest");
            SysLog.LogProvider = new NativeSysLogProvider("MessagingTest");

            Msg.LoadTypes(Assembly.GetExecutingAssembly());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            bool      fWait     = false;
            int       processID = 0;
            ArrayList commands;

            Helper.InitializeApp(Assembly.GetExecutingAssembly());

            args = CommandLine.ExpandFiles(args);

            if (args.Length == 0)
            {
                UsageForm.Show();
                Environment.Exit(1);
                return;
            }

            // Parse the commands

            commands = new ArrayList();
            for (int i = 0; i < args.Length; i++)
            {
                var command = args[i].Trim();

                if (command.StartsWith("-wait:"))
                {
                    fWait = true;
                    try
                    {
                        processID = (int)uint.Parse(command.Substring(6));
                    }
                    catch
                    {
                        MessageBox.Show(string.Format("Invalid process ID in [{0}].", command), Program.Name);
                        Environment.Exit(1);
                        return;
                    }
                }
                else if (command.StartsWith("-title:"))
                {
                    commands.Add(new Command("title", command.Substring(7)));
                }
                else if (command.StartsWith("-start:"))
                {
                    commands.Add(new Command("start", command.Substring(7)));
                }
                else if (command.StartsWith("-configdb:"))
                {
                    commands.Add(new Command("configdb", command.Substring(10)));
                }
                else if (command.StartsWith("-regeventsource:"))
                {
                    commands.Add(new Command("regeventsource", command.Substring(16)));
                }
                else
                {
                    MessageBox.Show(string.Format("Unknown command: {0}", command), Program.Name);
                    Environment.Exit(1);
                    return;
                }
            }

            // Wait for the process to exit if requested.

            if (fWait)
            {
                try
                {
                    var process = Process.GetProcessById(processID);

                    process.EnableRaisingEvents = true;

                    process.WaitForExit();
                }
                catch
                {
                    // The process must have already exited.
                }
            }

            // Process the rest of the commands.

            foreach (Command command in commands)
            {
                try
                {
                    switch (command.Op)
                    {
                    case "title":

                        title = command.Param;
                        break;

                    case "start":

                        StartForm.Show(command.Param);
                        break;

                    case "configdb":

                        string  cmdPath = Helper.EntryAssemblyFolder + Helper.PathSepString + "DBPackage.exe";
                        string  cmdArgs = "\"" + command.Param + "\"";
                        Process process;

                        process                     = new Process();
                        process.StartInfo           = new ProcessStartInfo(cmdPath, cmdArgs);
                        process.EnableRaisingEvents = true;

                        try
                        {
                            process.Start();
                        }
                        catch
                        {
                            throw new Exception(string.Format("Cannot launch process: {0} {1}", cmdPath, cmdArgs));
                        }

                        process.WaitForExit();
                        break;

                    case "regeventsource":

                        string eventSource = command.Param;

                        NativeSysLogProvider.CreateLogs(eventSource);
                        break;
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(string.Format("InstallHelper: Operation: [{0}]\r\n\r\nError:\r\n\\r\n{1}", command.Op, e.Message),
                                    "LillTek Install Helper",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// Handle the uninstall activities.
        /// </summary>
        /// <param name="state">The install state.</param>
        public override void Uninstall(IDictionary state)
        {
            NativeSysLogProvider.RemoveLogs(Const.ConfigServiceName);

            base.Uninstall(state);
        }
Beispiel #10
0
 /// <summary>
 /// Constructs a log provider that writes entries to the specified service host.
 /// </summary>
 /// <param name="serviceHost">The service host.</param>
 public ServiceSysLogProvider(IServiceHost serviceHost)
     : base()
 {
     this.serviceHost       = serviceHost;
     this.nativeLogProvider = new NativeSysLogProvider(serviceHost.Service.Name);
 }