Beispiel #1
0
        static void Main(string[] args)
        {
            ServiceHost serviceHost;
            Program     service = new Program();

            if (Environment.UserInteractive)
            {
                serviceHost = new ServiceHost(service);

                Database ConfigurationDatabase = null;
                try
                {
                    ConfigurationDatabase = LocalConfigurationDatabase.GetConfigurationDatabase();
                }
                catch (Exception exception)
                {
                    Console.WriteLine("Failed to get configuration database. " + exception.Message);
                }

                if (ConfigurationDatabase != null)
                {
                    FileTypeTableInstallation.CreateFileTypeTable(ConfigurationDatabase);
                    ColumnTableInstallation.CreateColumnTable(ConfigurationDatabase);
                    FooterTableInstallation.CreateFooterTable(ConfigurationDatabase);
                    HeaderTableInstallation.CreateHeaderTable(ConfigurationDatabase);
                    SettingsTableInstallation.CreateSettingsTable(ConfigurationDatabase);
                    FileSourceTableInstallation.CreateFileSourceTable(ConfigurationDatabase);
                    Console.WriteLine("Installed tables!");
                }
                else
                {
                    Console.WriteLine("Failed to install tables.");
                }

                serviceHost.Open();
                service.OnStart(args);

                Console.ReadLine();
            }
            else
            {
                serviceHost = new ServiceHost(service);
                serviceHost.Open();
                Run(service);
            }
        }
Beispiel #2
0
        public ProjectInstaller()
        {
            process             = new ServiceProcessInstaller();
            process.Account     = ServiceAccount.LocalSystem;
            service             = new ServiceInstaller();
            service.ServiceName = "ethosIQ-File-Reader-Service";
            Installers.Add(process);
            Installers.Add(service);

            try
            {
                ConfigurationDatabase = LocalConfigurationDatabase.GetConfigurationDatabase();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Failed to get configuration database information. " + exception.Message);
            }

            if (ConfigurationDatabase != null)
            {
                FooterTableInstallation.CreateFooterTable(ConfigurationDatabase);
                Console.WriteLine("Created footer table.");

                SettingsTableInstallation.CreateSettingsTable(ConfigurationDatabase);
                Console.WriteLine("Created file settings table.");

                ColumnTableInstallation.CreateColumnTable(ConfigurationDatabase);
                Console.WriteLine("Created column table.");

                FileSourceTableInstallation.CreateFileSourceTable(ConfigurationDatabase);
                Console.WriteLine("Created file source table.");

                HeaderTableInstallation.CreateHeaderTable(ConfigurationDatabase);
                Console.WriteLine("Created header table.");

                FileTypeTableInstallation.CreateFileTypeTable(ConfigurationDatabase);
                Console.WriteLine("Created file type table.");

                CollectionDatabaseInstallation.CreateCollectionDatabaseTable(ConfigurationDatabase);
                Console.WriteLine("Created collection database table");
            }
        }