Exemplo n.º 1
0
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            if (ComboBox.SelectedItem == null)
            {
                return;
            }

            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }
            List <IFileSystem> filesystems = new List <IFileSystem>();
            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to mount...", new Task(() =>
            {
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    /*IStorage inStorage = nca.OpenStorage(index, IntegrityCheckLevel.ErrorOnInvalid);
                     * IFile outFile = new LocalFile("./tmp.bin", OpenMode.Write | OpenMode.AllowAppend);
                     * IStorage outStorage = outFile.AsStorage();
                     * inStorage.GetSize(out long size);
                     * long buffLen = 0x10000;
                     * for (int i = 0; i < (int)Math.Min(Math.Ceiling((double)size / buffLen), 5); i++)
                     * {
                     *  long off = i * buffLen;
                     *  long left = size - off;
                     *  long toRead = Math.Min(buffLen, left);
                     *
                     *  byte[] buff = new byte[toRead];
                     *
                     *  inStorage.Read(off, buff);
                     *  outStorage.Write(off, buff);
                     * }
                     * //inStorage.Dispose();
                     * outFile.Dispose();*/

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();
                LayeredFileSystem fs = new LayeredFileSystem(filesystems);
                string typeString    = sectionType.ToString();
                MountService.Mount(new MountableFileSystem(fs, $"Mounted {mountType.ToString().ToLower()}", typeString, OpenMode.Read));
            })));
        }
Exemplo n.º 2
0
        private void SaveDoubleClicked(object sender, MouseButtonEventArgs e)
        {
            SaveElement element = ListView.SelectedItem as SaveElement;
            ulong       view    = element.SaveId;

            if (view == 0)
            {
                view = element.TitleId;
            }
            MountService.Mount(new MountableFileSystem(element.Save, view.ToString("x16"), "Savefile", LibHac.IO.OpenMode.Read));
        }
Exemplo n.º 3
0
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            ulong view = Element.SaveId;

            if (view == 0)
            {
                view = Element.SaveId;
            }
            OpenType type = (OpenType)MountTypesComboBox.SelectedItem;
            OpenMode mode = OpenMode.Read;

            switch (type)
            {
            case OpenType.Writable:
                //mode = OpenMode.ReadWrite;
                break;
            }

            MountService.Mount(new MountableFileSystem(Element.Save, view.ToString("x16"), "Savefile", mode));
        }
Exemplo n.º 4
0
        private void MountPartition(object sender, RoutedEventArgs e)
        {
            if (MountService.CanMount())
            {
                MenuItem button                 = sender as MenuItem;
                int      partitionIndex         = int.Parse((string)button.Tag);
                FatFileSystemProvider partition = null;
                string partitionName            = "";
                switch (partitionIndex)
                {
                case 0:
                    partition     = NANDService.NAND.OpenProdInfoF();
                    partitionName = "PRODINFOF";
                    break;

                case 1:
                    partition     = NANDService.NAND.OpenSafePartition();
                    partitionName = "SAFE";
                    break;

                case 2:
                    partition     = NANDService.NAND.OpenSystemPartition();
                    partitionName = "SYSTEM";
                    break;

                case 3:
                    partition     = NANDService.NAND.OpenUserPartition();
                    partitionName = "USER";
                    break;

                default:
                    return;
                }

                MountService.Mount(new MountableFileSystem(partition, $"NAND ({partitionName})", "FAT32", OpenMode.Read));
            }
            else
            {
                MessageBox.Show("Dokan driver not installed.\nInstall it to use this feature.");
            }
        }
        public static void Create(string path, byte[] content)
        {
            string[] paths = path.Split('/');
            Praxis   p     = MountService.Get(paths[1]);

            if (p != null)
            {
                ulong sectors = p.nextAvailableSector;
                for (int i = 2; i < paths.Length; i++)
                {
                    if (paths[i] == "" && i != paths.Length - 1)
                    {
                    }
                    if (i == paths.Length - 1)
                    {
                        p.writeEntry(0xF0, Quicksilver.Impl.String.GetHashCode(paths[2]), sectors);
                        WriteFile(paths[2], sectors, content, p);
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }
            List <IFileSystem> filesystems = new List <IFileSystem>();
            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to mount...", new Task(() =>
            {
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    if (section.IsPatchSection())
                    {
                        MainNca.BaseNca = nca.Nca;
                    }

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();
                LayeredFileSystem fs = new LayeredFileSystem(filesystems);
                string typeString    = sectionType.ToString();
                MountService.Mount(new MountableFileSystem(fs, $"Mounted {mountType.ToString().ToLower()}", typeString, OpenMode.Read));
            })));
        }
        private void MountClicked(object sender, RoutedEventArgs e)
        {
            FatFileSystemProvider partition;
            string partitionName;
            string formatName;

            switch (ComboBox.SelectedValue)
            {
            case NANDMountType.PRODINFOF:
                partition     = NANDService.NAND.OpenProdInfoF();
                partitionName = "PRODINFOF";
                formatName    = "FAT12";
                break;

            case NANDMountType.SAFE:
                partition     = NANDService.NAND.OpenSafePartition();
                partitionName = "SAFE";
                formatName    = "FAT32";
                break;

            case NANDMountType.SYSTEM:
                partition     = NANDService.NAND.OpenSystemPartition();
                partitionName = "SYSTEM";
                formatName    = "FAT32";
                break;

            case NANDMountType.USER:
                partition     = NANDService.NAND.OpenUserPartition();
                partitionName = "USER";
                formatName    = "FAT32";
                break;

            default:
                return;
            }

            MountService.Mount(new MountableFileSystem(partition, $"NAND ({partitionName})", formatName, OpenMode.Read));
        }
Exemplo n.º 8
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("-------------------------------------------");
        }
Exemplo n.º 9
0
        public void UseSkill(IConnection connection, UseSkillArgs args)
        {
            Player player = connection.Player;
            Skill  skill  = args.GetSkill(player);

            if (skill == null)
            {
                return;
            }

            if (skill.ChargingStageList != null)
            {
                args.IsChargeSkill = true;
            }

            if (skill.Type == SkillType.Mount)
            {
                MountService.ProcessMount(player, skill.Id);
                new SpSkillCooldown(skill.Id, skill.Precondition.CoolTime).Send(player.Connection);
                return;
            }

            if (player.Attack != null && !player.Attack.IsFinished)
            {
                if (player.Attack.Args.IsDelaySkill)
                {
                    int stage = player.Attack.Stage;

                    if (player.Attack.Args.IsChargeSkill)
                    {
                        skill = player.Attack.Args.GetSkill(player);

                        if (skill.ChargingStageList != null && skill.ChargingStageList.ChargeStageList.Count > stage)
                        {
                            int useHp = (int)(skill.ChargingStageList.CostTotalHp *
                                              skill.ChargingStageList.ChargeStageList[stage].CostHpRate);

                            int useMp = (int)(skill.ChargingStageList.CostTotalMp *
                                              skill.ChargingStageList.ChargeStageList[stage].CostMpRate);

                            if (player.LifeStats.Hp <= useHp)
                            {
                                SystemMessages.YouCannotUseThatSkillAtTheMoment.Send(player.Connection);
                                stage = -1;
                            }
                            else if (player.LifeStats.Mp < useMp)
                            {
                                SystemMessages.NotEnoughMp.Send(player.Connection);
                                stage = -1;
                            }
                            else
                            {
                                if (useHp > 0)
                                {
                                    CreatureLogic.HpChanged(player, player.LifeStats.MinusHp(useHp));
                                }

                                if (useMp > 0)
                                {
                                    CreatureLogic.MpChanged(player, player.LifeStats.MinusMp(useMp));
                                }

                                args = new UseSkillArgs
                                {
                                    SkillId        = player.Attack.Args.SkillId + 10 + stage,
                                    StartPosition  = player.Position.Clone(),
                                    TargetPosition = player.Attack.Args.TargetPosition,
                                };
                            }
                        }
                        else
                        {
                            stage = -1;
                        }
                    }

                    player.Attack.Finish();

                    if (skill.BaseId == 20100 &&
                        (player.PlayerData.Class == PlayerClass.Berserker ||
                         player.PlayerData.Class == PlayerClass.Lancer))
                    {
                        player.EffectsImpact.ResetChanges(player); //Set IsBlockFrontAttacks
                    }

                    if (player.Attack.Args.IsChargeSkill && stage != -1)
                    {
                        UseSkill(connection, args);
                    }

                    return;
                }

                if (args.SkillId / 10000 == player.Attack.Args.SkillId / 10000)
                {
                    player.Attack.Finish();

                    if (player.Attack.Args.Targets.Count == 0)
                    {
                        return;
                    }

                    args.Targets = new List <Creature>(player.Attack.Args.Targets);
                    ProcessSkill(player, args, skill);
                }

                return;
            }

            if (!CheckRequirements(player, skill))
            {
                return;
            }

            args.StartPosition.CopyTo(player.Position);

            ProcessSkill(player, args, skill);
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Starts this instance.
        /// </summary>
        /// <returns>The task.</returns>
        public virtual async Task Start()
        {
            Logger.LogStart(">> Loading vocations");
            VocationXmlReader       vocationXmlReader = new VocationXmlReader();
            IEnumerable <IVocation> vocations         = await vocationXmlReader.LoadAsync(Settings.Default.Vocations_Xml);

            _vocationService = new VocationService(vocations);
            Logger.LogDone();

            Logger.LogStart(">> Loading items");
            ItemReader          itemReader = new ItemReader();
            IEnumerable <IItem> items      = await itemReader.LoadAsync(Settings.Default.Items_Otb);

            _itemService = new ItemService(items);
            ItemXmlReader itemXmlReader = new ItemXmlReader(_itemService);
            await itemXmlReader.LoadAsync(Settings.Default.Items_Xml);

            Logger.LogDone();

            Logger.LogStart(">> Loading spells");
            SpellXmlReader       spellXmlReader = new SpellXmlReader();
            IEnumerable <ISpell> spells         = await spellXmlReader.LoadAsync(Settings.Default.Spells_Xml);

            _spellService = new SpellService(spells);
            Logger.LogDone();

            Logger.LogStart(">> Loading monsters");
            MonsterXmlReader       monsterXmlReader = new MonsterXmlReader(_spellService);
            IEnumerable <IMonster> monsters         = await monsterXmlReader.LoadAsync(Settings.Default.Monsters_Xml);

            _monsterService = new MonsterService(monsters);
            Logger.LogDone();

            Logger.LogStart(">> Loading npcs");
            NpcXmlReader       npcXmlReader = new NpcXmlReader();
            IEnumerable <INpc> npcs         = await npcXmlReader.LoadAsync(Settings.Default.Npcs_Xml);

            _npcService = new NpcService(npcs);
            Logger.LogDone();

            Logger.LogStart(">> Loading map");
            MapReader mapReader = new MapReader(_itemService);
            WorldMap  map       = await mapReader.LoadAsync(Settings.Default.Map_Otb);

            Logger.LogDone();

            Logger.LogStart(">> Loading outfits");
            DrkOutfitReader       outfitReader = new DrkOutfitReader();
            IEnumerable <IOutfit> outfits      = await outfitReader.LoadAsync(Settings.Default.Outfits_Xml);

            _outfitService = new OutfitService(outfits);
            Logger.LogDone();

            Logger.LogStart(">> Loading mounts");
            DrkMountReader       mountReader = new DrkMountReader();
            IEnumerable <IMount> mounts      = await mountReader.LoadAsync(Settings.Default.Mounts_Xml);

            _mountService = new MountService(mounts);
            Logger.LogDone();

            Logger.LogStart(">> Loading channels");
            // TODO: Channels are broken. They should be handled by a category like ChannelType (e.g.: Public, Private, Guild, Party, etc.), then each category has an ID
            // TODO: Eventually loading channels this away should be replaced.
            // TODO Alternatively, we could move the specific implementation of LocalChannel to a scripting language (like Lua)
            // TODO: This could be also converted into a more modular approach (like a CS-Script)
            IDictionary <ChannelType, IChannel> channels = new Dictionary <ChannelType, IChannel>();

            channels.Add(ChannelType.Local, new LocalChannel());
            channels.Add(ChannelType.Loot, new LootChannel());
            channels.Add(ChannelType.Advertising, new AdvertisingChannel());
            channels.Add(ChannelType.AdvertisingRookgaard, new AdvertisingRookgaardChannel());
            channels.Add(ChannelType.English, new EnglishChannel());
            channels.Add(ChannelType.Help, new HelpChannel());
            channels.Add(ChannelType.World, new WorldChannel());
            Logger.LogDone();

            Logger.LogStart(">> Initializing town services");
            _townService = new TownService(map.Towns.Values);
            Logger.LogDone();

            Logger.LogStart(">> Initializing tile services");
            _tileService = new TileService(map.Tiles.Values);
            Logger.LogDone();

            // TODO: Remove this after project is complete
            InitializeTest();

            Logger.LogStart(">> Initializing repositories");
            _accountsRepository = new Repository <IAccount, uint>();

            // TODO: Remove this when repositories are implemented
            _accountsRepository.Create(_characterSpawn.Account);
            Logger.LogDone();

            Logger.LogStart(">> Initializing spawn services");
            SpawnXmlReader            spawnXmlReader = new SpawnXmlReader(_monsterService, _npcService);
            ICollection <SpawnSource> spawnSources   = (await spawnXmlReader.LoadAsync(Settings.Default.Spawns_Xml)).ToList();

            _creatureSpawnService = new CreatureSpawnService(spawnSources);
            RegisterSpawns(spawnSources);
            // TODO: Remove this when player repositories are implemented;
            _creatureSpawnService.RegisterCreature(_characterSpawn);
            Logger.LogDone();

            Logger.LogStart(">> Initializing communication services");
            _chatService    = new ChatService(_accountsRepository.GetAll(), channels);
            _commandService = new CommandService();
            _commandService.Register(new TeleportCommand(_townService, _creatureSpawnService));
            _commandService.Register(new TownListCommand(_townService));
            _commandService.Register(new PositionInfoCommand());
            _commandService.Register(new ChangeSexCommand());
            _commandService.Register(new BroadcastCommand(_creatureSpawnService));
            Logger.LogDone();

            Logger.LogStart(">> Initializing game server");
            _gameConnections = new List <GameConnection>();
            _gameListener    = new TcpListener(IPAddress.Any, Settings.Default.Network_Port_GameServer);
            _gameListener.Start();
            _gameListener.BeginAcceptSocket(OnGameMessageReceived, _gameListener);
            Logger.LogDone();

            Logger.LogStart(">> Initializing login server");
            _loginConnections = new List <LoginConnection>();
            _loginListener    = new TcpListener(IPAddress.Any, Settings.Default.Network_Port_LoginServer);
            _loginListener.Start();
            _loginListener.BeginAcceptSocket(OnLoginMessageReceived, _loginListener);
            Logger.LogDone();

            _onlineTimer = new Stopwatch();
        }
Exemplo n.º 11
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("----------------------------------------------------------------------------");
        }
Exemplo n.º 12
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("-------------------------------------------");
        }
Exemplo n.º 13
0
        /// <summary>
        ///     Parses the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="outfitService">The outfit service.</param>
        /// <param name="mountService">The mount service.</param>
        /// <returns>Th packet.</returns>
        public static AppearanceChangePacket Parse(NetworkMessage message, OutfitService outfitService, MountService mountService)
        {
            AppearanceChangePacket packet = new AppearanceChangePacket();

            packet.Outfit        = outfitService.GetOutfitBySpriteId(message.ReadUInt16());
            packet.Outfit.Head   = message.ReadByte();
            packet.Outfit.Body   = message.ReadByte();
            packet.Outfit.Legs   = message.ReadByte();
            packet.Outfit.Feet   = message.ReadByte();
            packet.Outfit.Addons = message.ReadByte();
            packet.Mount         = mountService.GetMountBySpriteId(message.ReadUInt16());

            return(packet);
        }