Example #1
0
        private void Put(object id)
        {
            ApiConfiguration    apiConfiguration = RouteData.DataTokens["apiConfiguration"] as ApiConfiguration;
            RouteConfiguration  route            = RouteData.DataTokens["routeConfiguration"] as RouteConfiguration;
            ActionConfiguration action           = RouteData.DataTokens["actionConfiguration"] as ActionConfiguration;

            if (route.Enabled && action.Enabled)
            {
                string json;
                using (StreamReader streamReader = new StreamReader(Request.Body))
                {
                    json = streamReader.ReadToEnd();
                }

                string sqlQuery = ControllerService.GetStringReplacedQuery(Request, route, action, id, json);

                SqlServerService sqlServerService = new SqlServerService(apiConfiguration.ConnectionString, route);

                sqlServerService.ExecuteNonQuery(sqlQuery);
            }
        }
Example #2
0
        public JsonRpcResponseData EnableUser(SimpleTenant payload, ApiAuthorization authorization)
        {
            SetupAuth();
            IsValidRequest(authorization.AppId, authorization.ApiKey);
            var apiController = new ControllerService();

            try
            {
                var newPassword = apiController.EnableUser(payload);
                return(new JsonRpcResponseData
                {
                    Message = $"User {payload.Username} Enabled",
                    Status = JsonRpcResponseData.OK,
                    TenantUid = payload.TenantUId
                });
            }
            catch (System.Exception ex)
            {
                throw HandleException(ex);
            }
        }
Example #3
0
        public JsonRpcResponseData DisableUser(SimpleTenant payload, ApiAuthorization authorization)
        {
            SetupAuth();
            IsValidRequest(authorization.AppId, authorization.ApiKey);
            var apiController = new ControllerService();

            try
            {
                apiController.DisableUser(payload);
                return(new JsonRpcResponseData
                {
                    Message = "User disabled",
                    Status = JsonRpcResponseData.OK,
                    Data = new { payload.Username }
                });
            }
            catch (System.Exception ex)
            {
                throw HandleException(ex);
            }
        }
Example #4
0
        public static void Ressurect(Player player, int type)
        {
            ControllerService.TrySetDefaultController(player);

            switch (type)
            {
            case 99:
            {
                // Ressurect to bind point
                Global.TeleportService.ForceTeleport(player, player.ClosestBindPoint);
            }
            break;

            case 100:
            {
                // Ressurect to current position
                Global.TeleportService.ForceTeleport(player, player.Position);
            }
            break;
            }
        }
        public override void AfterPropertiesSet()
        {
            base.AfterPropertiesSet();
            ParamChecker.AssertNotNull(ControllerService, "ControllerService");
            if (Method == null)
            {
                ParamChecker.AssertNotNull(MethodName, "MethodName");

                if (MethodParameters == null)
                {
                    Method = ControllerService.GetType().GetMethod(MethodName);
                }
                else
                {
                    Method = ControllerService.GetType().GetMethod(MethodName, MethodParameters);
                }
                if (Method == null)
                {
                    throw new ArgumentException("No method '" + MethodName + "' found on type '" + ControllerService.GetType().FullName);
                }
            }
        }
Example #6
0
        public JsonRpcResponseData RefreshAllTenants(ApiAuthorization authorization, string language = "en")
        {
            SetupAuth();
            IsValidRequest(authorization.AppId, authorization.ApiKey);
            var apiController = new ControllerService();

            try
            {
                int refreshed = apiController.RefreshAllTenants(language);

                return(new JsonRpcResponseData
                {
                    Message = $"All Tenants have been refreshed",
                    Status = JsonRpcResponseData.OK,
                    Data = new { Refreshed = refreshed }
                });
            }
            catch (System.Exception ex)
            {
                throw HandleException(ex);
            }
        }
Example #7
0
        public JsonRpcResponseData PurgeTenant(SimpleTenant payload, ApiAuthorization authorization)
        {
            SetupAuth();
            IsValidRequest(authorization.AppId, authorization.ApiKey);
            var apiController = new ControllerService();

            try
            {
                var purge = apiController.PurgeTenant(payload);
                return(new JsonRpcResponseData
                {
                    Message = "Tenant Purged from CMS",
                    Status = JsonRpcResponseData.OK,
                    TenantUid = payload.TenantUId,
                    Data = purge
                });
            }
            catch (System.Exception ex)
            {
                throw HandleException(ex);
            }
        }
Example #8
0
        public JsonRpcResponseData CreateUser(TenantUser payload, ApiAuthorization authorization)
        {
            SetupAuth();
            IsValidRequest(authorization.AppId, authorization.ApiKey);
            var apiController = new ControllerService();

            try
            {
                var assignedUmbracoUserId = apiController.CreateUser(payload);
                return(new JsonRpcResponseData
                {
                    Message = "User created",
                    Status = JsonRpcResponseData.OK,
                    TenantUid = payload.TenantUId.ToString(),
                    Data = assignedUmbracoUserId
                });
            }
            catch (System.Exception ex)
            {
                throw HandleException(ex);
            }
        }
Example #9
0
        public IActionResult GetAll()
        {
            ApiConfiguration    apiConfiguration = RouteData.DataTokens["apiConfiguration"] as ApiConfiguration;
            RouteConfiguration  route            = RouteData.DataTokens["routeConfiguration"] as RouteConfiguration;
            ActionConfiguration action           = RouteData.DataTokens["actionConfiguration"] as ActionConfiguration;

            if (route.Enabled && action.Enabled)
            {
                string sqlQuery = ControllerService.GetStringReplacedQuery(Request, route, action);

                SqlServerService sqlServerService = new SqlServerService(apiConfiguration.ConnectionString, route);

                DataTable resultSetDataTable = sqlServerService.ExecuteResultQuery(sqlQuery);

                return(new OkObjectResult(resultSetDataTable));
            }
            else
            {
                Response.StatusCode = 501;
                return(new ObjectResult(null));
            }
        }
Example #10
0
        private void Home_Load(object sender, EventArgs e)
        {
            pictureBox1.BorderStyle = BorderStyle.None;
            List <Controller> listPreferenceParameters = ControllerService.LoadData();

            foreach (Controller control in listPreferenceParameters)
            {
                if (!comboBoxRegion.Items.Contains(control.Region))
                {
                    comboBoxRegion.Items.Add(control.Region);
                }

                if (!comboBoxController.Items.Contains(control.ControllerName))
                {
                    comboBoxController.Items.Add(control.ControllerName);
                }

                if (!comboBoxField.Items.Contains(control.ProfessionalField))
                {
                    comboBoxField.Items.Add(control.ProfessionalField);
                }

                if (!comboBoxProperty.Items.Contains(control.PropertyName))
                {
                    comboBoxProperty.Items.Add(control.PropertyName);
                }

                if (!controllerComboBox.Items.Contains(control.ControllerName))
                {
                    controllerComboBox.Items.Add(control.ControllerName);
                }

                if (!propertyComboBox.Items.Contains(control.PropertyName))
                {
                    propertyComboBox.Items.Add(control.PropertyName);
                }
            }
        }
Example #11
0
        private void buttonSaveMoreData_Click(object sender, EventArgs e)
        {
            List <iGUIProDataAnalyzer.Model.Controller> listController = new List <Model.Controller>();
            List <TextBox> listTextbox = new List <TextBox>();

            listTextbox.Add(textBox16);
            listTextbox.Add(textBox17);
            listTextbox.Add(textBox18);
            listTextbox.Add(textBox19);
            listTextbox.Add(textBox20);
            listTextbox.Add(textBox21);
            listTextbox.Add(textBox22);
            listTextbox.Add(textBox23);
            listTextbox.Add(textBox24);
            listTextbox.Add(textBox25);
            listTextbox.Add(textBox26);
            listTextbox.Add(textBox27);
            listTextbox.Add(textBox28);
            listTextbox.Add(textBox29);
            listTextbox.Add(textBox30);

            ControllerService.AddUserPreferredData(listTextbox, listController, comboBoxField.SelectedItem.ToString(), comboBoxRegion.SelectedItem.ToString(), controllerComboBox.SelectedItem.ToString(), propertyComboBox.SelectedItem.ToString());


            string path2 = @"D:\\s2.xml";



            if (!(File.Exists(path2)))
            {
                ControllerService.CreateFile(path2, listController);
            }
            else
            {
                ControllerService.SaveData(path2, listController);
            }
        }
Example #12
0
        static void Main(string[] args)
        {
            ControllerService controllerService = new ControllerService();

            using (var dbContext = new TelecommunicationNetworkSimulatorContext())
            {
                List <Thread> threads = new List <Thread>();
                foreach (var user in dbContext.Users)
                {
                    threads.Add(
                        new Thread(
                            new ThreadStart(
                                () => user.StartChanceCalculation(controllerService)
                                )
                            )
                        );
                }

                foreach (var thr in threads)
                {
                    thr.Start();
                }
            }
        }
 public ProductController(ControllerService service, OnlineShoppingDbContext dbcontext)
 {
     Db       = dbcontext;
     _service = service;
 }
Example #14
0
        private static void RunServer()
        {
            Stopwatch sw = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            Console.WriteLine("----===== Revolution WorldServer =====----\n\n"
                              + "Copyright (C) 2013 Revolution Team\n\n"
                              + "This program is CLOSE SOURCE project.\n"
                              + "You DON'T have any right's, if you are NOT autor\n"
                              + "or authorized representative of him.\n"
                              + "Using that program without any right's is ILLEGAL\n\n"
                              + "Authors: Jenose, IMaster\n"
                              + "Authorized representative: netgame.in.th\n\n"
                              + "-------------------------------------------");

            Log.Info("Init Services...");
            AccountService     = new AccountService();
            AiService          = new AiService();
            ChatService        = new ChatService();
            ControllerService  = new ControllerService();
            FeedbackService    = new FeedbackService();
            MapService         = new MapService();
            ObserverService    = new ObserverService();
            PlayerService      = new PlayerService();
            TeamService        = new TeamService();
            SkillsLearnService = new SkillsLearnService();
            StatsService       = new StatsService();
            ShopService        = new ShopService();
            StorageService     = new StorageService();
            TeleportService    = new TeleportService();
            VisibleService     = new VisibleService();

            Log.Info("Init Engines...");
            ScriptEngine = new ScriptEngine.ScriptEngine();
            AdminEngine  = new AdminEngine.AdminEngine();
            SkillEngine  = new SkillEngine.SkillEngine();
            QuestEngine  = new QuestEngine.QuestEngine();
            Console.WriteLine("\n-------------------------------------------\n");

            GlobalLogic.ServerStart();
            Console.WriteLine("\n-------------------------------------------\n");

            CountryCode = (CountryCode)Enum.Parse(typeof(CountryCode), Settings.Default.COUNTRY_CODE);

            InnerNetworkOpcode.Init();
            OuterNetworkOpcode.Init();

            InnerClient = new InnerNetworkClient("127.0.0.1", 22323);
            InnerClient.BeginConnect();

            foreach (var channel in DataBaseServer.GetServerChannel(Settings.Default.SERVER_ID))
            {
                var OuterNetwork = new OuterNetworkListener("*", channel.port, channel.max_user);
                OuterNetwork.BeginListening();
                OuterNetworks.Add(OuterNetwork);
            }

            InnerNetworkClient.SendAllThread.Start();
            OuterNetworkConnection.SendAllThread.Start();

            sw.Stop();
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");
        }
Example #15
0
 public async Task <IActionResult> ActionResult()
 {
     return(await ControllerService.CreateActionResult(this.Controller, this.Action));
 }
Example #16
0
 public ControllerController(ApplicationContext context)
 {
     service = new ControllerService(context);
 }
Example #17
0
 public ServiceController(PAML01Context context, ControllerService service, ILogger <ServiceController> logger)
 {
     _context = context;
     _service = service;
     _logger  = logger;
 }
 public AccountController(ControllerService service)
 {
     _service = service;
 }
Example #19
0
 public FormListClients(ControllerClient service, ControllerSelection serviceR, ControllerService serviceS, ControllerValidation serviceV)
 {
     InitializeComponent();
     this.service  = service;
     this.serviceR = serviceR;
     this.serviceS = serviceS;
     this.serviceV = serviceV;
 }
Example #20
0
        private static void RunServer()
        {
            Data.Data.DataPath = "data/";

            Stopwatch sw = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            Console.WriteLine("----===== GameServer =====----\n\n"
                              + "Starting game server\n\n"
                              + "Loading data files.\n"
                              + "-------------------------------------------");

            TcpServer = new TcpServer("*", 11101, 1000);
            Connection.SendAllThread.Start();

            OpCodes.Init();

            #region global_components

            //services
            FeedbackService    = new FeedbackService();
            AccountService     = new AccountService();
            PlayerService      = new PlayerService();
            MapService         = new MapService();
            ChatService        = new ChatService();
            VisibleService     = new VisibleService();
            ControllerService  = new ControllerService();
            CraftService       = new CraftService();
            ItemService        = new ItemService();
            AiService          = new AiService();
            GeoService         = new GeoService();
            StatsService       = new StatsService();
            ObserverService    = new ObserverService();
            AreaService        = new AreaService();
            InformerService    = new InformerService();
            TeleportService    = new TeleportService();
            PartyService       = new PartyService();
            SkillsLearnService = new SkillsLearnService();
            CraftLearnService  = new CraftLearnService();
            GuildService       = new GuildService();
            EmotionService     = new EmotionService();
            RelationService    = new RelationService();
            DuelService        = new DuelService();
            StorageService     = new StorageService();
            TradeService       = new TradeService();
            MountService       = new MountService();

            //engines
            ActionEngine = new ActionEngine.ActionEngine();
            AdminEngine  = new AdminEngine.AdminEngine();
            SkillEngine  = new SkillEngine.SkillEngine();
            QuestEngine  = new QuestEngine.QuestEngine();

            #endregion

            GlobalLogic.ServerStart();

            TcpServer.BeginListening();

            try
            {
                ServiceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(23232));
                ServiceApplication.AddService <IInformerService, InformerService>((InformerService)InformerService);
                ServiceApplication.Start();
                Log.Info("InformerService started at *:23232.");
            }
            catch (Exception ex)
            {
                Log.ErrorException("InformerService can not be started.", ex);
            }

            sw.Stop();
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");
        }
Example #21
0
 private void ResetEntries_Click(object sender, RoutedEventArgs e)
 {
     ControllerService.ResetEntries();
 }
Example #22
0
 /// Registers the ControllerService and asks to the inherited LocalDirector
 /// to register its own services
 ///
 protected override sealed void OnStartAddServicesState()
 {
     m_controllerService = m_serviceSupplier.RegisterService <ControllerService>();
     OnRegisteringLocalServices();
 }
Example #23
0
        private static void RunServer()
        {
            //Start ServerStartTime
            Stopwatch serverStartStopwatch = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            //CheckServerMode
            CheckServerMode();

            //ConsoleOutput-Infos
            PrintServerLicence();
            PrintServerInfo();

            //Initialize TcpServer
            TcpServer = new TcpServer("*", Configuration.Network.GetServerPort(), Configuration.Network.GetServerMaxCon());
            Connection.SendAllThread.Start();

            //Initialize Server OpCodes
            OpCodes.Init();
            Console.WriteLine("----------------------------------------------------------------------------\n"
                              + "---===== OpCodes - Revision: " + OpCodes.Version + " EU initialized!");

            //Global Services
            #region global_components
            //Services
            FeedbackService    = new FeedbackService();
            AccountService     = new AccountService();
            PlayerService      = new PlayerService();
            MapService         = new MapService();
            ChatService        = new ChatService();
            VisibleService     = new VisibleService();
            ControllerService  = new ControllerService();
            CraftService       = new CraftService();
            ItemService        = new ItemService();
            AiService          = new AiService();
            GeoService         = new GeoService();
            StatsService       = new StatsService();
            ObserverService    = new ObserverService();
            AreaService        = new AreaService();
            TeleportService    = new TeleportService();
            PartyService       = new PartyService();
            SkillsLearnService = new SkillsLearnService();
            CraftLearnService  = new CraftLearnService();
            GuildService       = new GuildService();
            EmotionService     = new EmotionService();
            RelationService    = new RelationService();
            DuelService        = new DuelService();
            StorageService     = new StorageService();
            TradeService       = new TradeService();
            MountService       = new MountService();

            //Engines
            ActionEngine = new ActionEngine.ActionEngine();
            AdminEngine  = new AdminEngine.AdminEngine();
            SkillEngine  = new SkillEngine.SkillEngine();
            QuestEngine  = new QuestEngine.QuestEngine();
            #endregion

            //Set SqlDatabase Connection
            GlobalLogic.ServerStart("SERVER=" + DAOManager.MySql_Host + ";DATABASE=" + DAOManager.MySql_Database + ";UID=" + DAOManager.MySql_User + ";PASSWORD="******";PORT=" + DAOManager.MySql_Port + ";charset=utf8");
            Console.ForegroundColor = ConsoleColor.Gray;

            //Start Tcp-Server Listening
            Console.WriteLine("----------------------------------------------------------------------------\n"
                              + "---===== Loading GameServer Service.\n"
                              + "----------------------------------------------------------------------------");
            TcpServer.BeginListening();

            //Stop ServerStartTime
            serverStartStopwatch.Stop();
            Console.WriteLine("----------------------------------------------------------------------------");
            Console.WriteLine("---===== GameServer start in {0}", (serverStartStopwatch.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("----------------------------------------------------------------------------");
        }
 public Task <IActionResult> ActionResult()
 {
     return(ControllerService.CreateActionResult(this.Controller, this.Action, this.Parameter));
 }
Example #25
0
        private static void RunServer()
        {
            Data.Data.DataPath = "data/";

            Stopwatch sw = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            Console.WriteLine("----===== Tera-Project C# GameServer Emulator =====----\n\n");
            Console.WriteLine("Starting Game Server!\n"
                              + "-------------------------------------------");

            TcpServer = new TcpServer("*", Config.GetServerPort(), Config.GetServerMaxCon());
            Connection.SendAllThread.Start();

            OpCodes.Init();
            Console.WriteLine("OpCodes - Revision 1725 initialized!\n"
                              + "-------------------------------------------\n");

            #region global_components

            //services
            FeedbackService    = new FeedbackService();
            AccountService     = new AccountService();
            PlayerService      = new PlayerService();
            MapService         = new MapService();
            ChatService        = new ChatService();
            VisibleService     = new VisibleService();
            ControllerService  = new ControllerService();
            CraftService       = new CraftService();
            ItemService        = new ItemService();
            AiService          = new AiService();
            GeoService         = new GeoService();
            StatsService       = new StatsService();
            ObserverService    = new ObserverService();
            AreaService        = new AreaService();
            InformerService    = new InformerService();
            TeleportService    = new TeleportService();
            PartyService       = new PartyService();
            SkillsLearnService = new SkillsLearnService();
            CraftLearnService  = new CraftLearnService();
            GuildService       = new GuildService();
            EmotionService     = new EmotionService();
            RelationService    = new RelationService();
            DuelService        = new DuelService();
            StorageService     = new StorageService();
            TradeService       = new TradeService();
            MountService       = new MountService();

            //engines
            ActionEngine = new ActionEngine.ActionEngine();
            AdminEngine  = new AdminEngine.AdminEngine();
            SkillEngine  = new SkillEngine.SkillEngine();
            QuestEngine  = new QuestEngine.QuestEngine();

            #endregion

            GlobalLogic.ServerStart("SERVER=" + Config.GetDatabaseHost() + ";DATABASE=" + Config.GetDatabaseName() + ";UID=" + Config.GetDatabaseUser() + ";PASSWORD="******";PORT=" + Config.GetDatabasePort() + ";charset=utf8");

            Console.WriteLine("-------------------------------------------\n"
                              + "Loading Tcp Service.\n"
                              + "-------------------------------------------");
            TcpServer.BeginListening();

            try
            {
                ServiceApplication = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(23232));
                ServiceApplication.AddService <IInformerService, InformerService>((InformerService)InformerService);
                ServiceApplication.Start();
                Log.Info("InformerService started at *:23232.");

                var webservices = new ServiceManager();
                webservices.Run();
            }
            catch (Exception ex)
            {
                Log.ErrorException("InformerService can not be started.", ex);
            }

            sw.Stop();
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");
        }
 public CartController(ControllerService service)
 {
     _service = service;
 }
Example #27
0
        /// <summary>
        /// ListenUDP
        /// </summary>
        private void ListenUDP()
        {
            try
            {
                bool done = false;

                //Hardcoding Controllers
                ControllerService _controllerService = new ControllerService();
                _controllerService.Controllers = controllerList;

                //Listening UDP Server
                ListenerService _listenerService = new ListenerService();
                _listenerService.StartService("UDP", port: 8888);

                string    sb    = string.Empty;
                long      ticks = 10 * 1000;
                Stopwatch sw    = new Stopwatch();
                sw.Start();

                while (!done)
                {
                    string content = _listenerService.ListenService();
                    if (content.Contains("Exception"))
                    {
                        for (int i = 0; i < controllerList.Count; i++)
                        {
                            Publish(i, Brushes.Red);
                        }
                    }
                    else
                    {
                        if (content.LastIndexOf('-') == content.Length - 3)
                        {
                            string[] data = content.Split('-');
                            if (data.Length == 3)
                            {
                                //Level based statistics
                                UpdateLevelStatistics(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]));
                            }
                            else
                            {
                                //Zone based statistics
                                UpdateZoneStatistics(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]), Convert.ToInt32(data[2]));
                            }
                        }
                        else
                        {
                            sb += content;

                            if (sw.ElapsedMilliseconds >= ticks)
                            {
                                for (int i = 0; i < _controllerService.Controllers.Count; i++)
                                {
                                    if (!sb.ToString().Contains(_controllerService.Controllers[i]))
                                    {
                                        Publish(i, Brushes.Red);
                                    }
                                    else
                                    {
                                        Publish(i, Brushes.LightGreen);
                                    }
                                }

                                sb = string.Empty;
                                sw.Restart();
                            }
                        }
                    }
                }

                sw.Stop();
                _listenerService.StopService();
            }
            catch (Exception ex)
            {
            }
        }