Exemplo n.º 1
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            string serverConnectionString = "";

            if (string.IsNullOrEmpty(_config.Value.ConnectionString))
            {
                var filePath = Path.Combine("connection.json");
                if (!File.Exists(filePath))
                {
                    serverConnectionString =
                        @"Server=localhost;port=3306;Database=420_SDK;user=root;password=secretpassword;Convert Zero Datetime=true;SslMode=none;";
                }
                else
                {
                    var mainSettings = ConnectionStringManager.Read(filePath);
                    serverConnectionString = mainSettings?.ConnectionStrings?.DefaultConnection.Replace("Angular", "SDK");
                }
            }
            else
            {
                serverConnectionString = _config.Value.ConnectionString;
            }

            _serviceLogic = new ServiceLogic();

            _serviceLogic.Start(serverConnectionString);
            return(Task.CompletedTask);
        }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            string serverConnectionString = "";

            var filePath = Path.Combine("connection.json");

            if (!File.Exists(filePath))
            {
                Console.WriteLine("Enter database to use:");
                Console.WriteLine("> If left blank, it will use 'Microting'");
                Console.WriteLine("  Enter name of database to be used");
                string databaseName = Console.ReadLine();

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    if (databaseName.ToUpper() != "")
                    {
                        serverConnectionString = @"Server = localhost; port = 3306; Database = " + databaseName +
                                                 "; user = root; Convert Zero Datetime = true;";
                    }
                    if (databaseName.ToUpper() == "T")
                    {
                        serverConnectionString =
                            @"Server=localhost;port=3306;Database=MicrotingTest;user=root;Convert Zero Datetime=true;SslMode=none;";
                    }
                    if (databaseName.ToUpper() == "O")
                    {
                        serverConnectionString =
                            @"Server=localhost;port=3306;Database=MicrotingOdense;user=root;Convert Zero Datetime=true;SslMode=none;";
                    }
                    if (serverConnectionString == "")
                    {
                        serverConnectionString =
                            @"Server=localhost;port=3306;Database=420_SDK;user=root;Convert Zero Datetime=true;SslMode=none;";
                    }
                }
                else
                {
                    if (databaseName.ToUpper() != "")
                    {
                        serverConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=" + databaseName +
                                                 ";Integrated Security=True";
                    }
                    if (databaseName.ToUpper() == "T")
                    {
                        serverConnectionString =
                            @"Data Source=.\SQLEXPRESS;Initial Catalog=MicrotingTest;Integrated Security=True";
                    }
                    if (databaseName.ToUpper() == "O")
                    {
                        serverConnectionString =
                            @"Data Source=.\SQLEXPRESS;Initial Catalog=MicrotingOdense;Integrated Security=True";
                    }
                    if (serverConnectionString == "")
                    {
                        serverConnectionString =
                            @"Data Source=.\SQLEXPRESS;Initial Catalog=420_SDK;Integrated Security=True";
                    }
                }
            }
            else
            {
                var mainSettings = ConnectionStringManager.Read(filePath);
                serverConnectionString = mainSettings?.ConnectionStrings?.DefaultConnection.Replace("Angular", "SDK");
            }

            _serviceLogic = new ServiceLogic();

            _serviceLogic.Start(serverConnectionString);
            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();

            logic = new ServiceLogic();
        }