Beispiel #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            IContainerCore  containerCore  = new DIContainer(new ServiceModule());
            IControllerCore controllerCore = new ControllerCore(new ViewModule(), containerCore);

            Window mainView = controllerCore.ViewFactory.GetWindow <MainView>();

            mainView.Show();
        }
Beispiel #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            IContainerCore  container  = new DIContainer(new ServiceModule());
            IControllerCore controller = new ControllerCore(new ViewModule(), container);

            container.Bind <IControllerCore>().ToInstance(controller);

            Window window = controller.ViewFactory.GetWindow <MainView>();

            window.Show();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("WhiteCode - Controller");
            Console.WriteLine("Developed by Anderson, supported by XXX");
            Console.WriteLine("-----------------------------------------------");
            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config.ini"))
            {
                Console.WriteLine("ERROR: Cant find config.ini! Please provide the file in the same folder as your application!");
                Console.ReadLine();
                return;
            }
            iniManager iniFile = new iniManager(AppDomain.CurrentDomain.BaseDirectory + "config.ini");

            Console.WriteLine(iniFile.IniReadValue("Database", "IP"));
            displayCommands();


            while (bProgramIsRunning)
            {
                Console.Write(Environment.UserName + "@tbf-controller:");
                sChoice = Console.ReadLine();
                switch (sChoice)
                {
                case "/help":
                    displayCommands();
                    break;

                case "/start":
                    //Start Server
                    controllerManagement = new ControllerCore(13001, ';', '|', "m932B)§()d",
                                                              "mysql", "62.138.6.50", 3306, "sa", "bringMoflv45", "traineesbestfriend", AppDomain.CurrentDomain.BaseDirectory + "logs\\mainlog.log");
                    //Bei nicht erfolgreicher DB gibt es einen Obj. orientierten fehler, wegen dem return bei nicht erfolgreicher DB connection
                    controllerManagement.Start();

                    break;

                default:
                    break;
                }
            }
        }
Beispiel #4
0
        static bool StartServer()
        {
            List <string> Sections = GetSections(Path.Combine(Environment.CurrentDirectory, "config.ini"));

            Support.iniManager iniEngine = new Support.iniManager(Path.Combine(Environment.CurrentDirectory, "config.ini"));
            foreach (string item in Sections)
            {
                string ApplicationName = item;

                bool isActive = iniEngine.IniReadValue(item, "isActive") == "1";
                if (!isActive)
                {
                    continue;
                }

                int Version;
                if (!Int32.TryParse(iniEngine.IniReadValue(item, "Version"), out Version))
                {
                    continue;
                }

                short InputPort;
                if (!Int16.TryParse(iniEngine.IniReadValue(item, "InputPort"), out InputPort))
                {
                    continue;
                }
                char ProtocolDelimiter;
                if (!char.TryParse(iniEngine.IniReadValue(item, "ProtocolDelimiter"), out ProtocolDelimiter))
                {
                    continue;
                }
                string EncryptionKey = iniEngine.IniReadValue(item, "EncryptionKey");
                string EncryptionIV  = iniEngine.IniReadValue(item, "EncryptionIV");
                int    PingTimer;
                if (!int.TryParse(iniEngine.IniReadValue(item, "PingTimer"), out PingTimer))
                {
                    continue;
                }
                int SessionLength;
                if (!int.TryParse(iniEngine.IniReadValue(item, "SessionLength"), out SessionLength))
                {
                    continue;
                }
                string DatabaseDriver = iniEngine.IniReadValue(item, "DatabaseDriver");
                string DatabaseIP     = iniEngine.IniReadValue(item, "DatabaseIP");
                short  DatabasePort;
                if (!short.TryParse(iniEngine.IniReadValue(item, "DatabasePort"), out DatabasePort))
                {
                    continue;
                }
                string DatabaseLoginName = iniEngine.IniReadValue(item, "DatabaseLoginName");
                string DatabasePassword  = iniEngine.IniReadValue(item, "DatabasePassword");
                string DatabaseDefault   = iniEngine.IniReadValue(item, "DatabaseDefault");
                string LogFile           = iniEngine.IniReadValue(item, "LogFile");
                int    LogLevel;
                if (!int.TryParse(iniEngine.IniReadValue(item, "LogLevel"), out LogLevel))
                {
                    continue;
                }

                string PathGameDll = iniEngine.IniReadValue(item, "PathGameDll");


                ControllerCore Controller = new ControllerCore(ApplicationName, Version, InputPort, ProtocolDelimiter, EncryptionKey, EncryptionIV, PingTimer, SessionLength, DatabaseDriver, DatabaseIP, DatabasePort, DatabaseLoginName, DatabasePassword, DatabaseDefault, LogFile, LogLevel, PathGameDll);

                try
                {
                    Controller.Start();
                    AppsRunning.Add(Controller);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
            return(true);
        }