Пример #1
0
        internal static void Main()
        {
            Process(out var provider);

            var swMessages      = Stopwatch.StartNew();
            var messagesBuilder =
                new ProtocolTypeMessageBuilder(
                    provider.Messages.Select(m => new TypeMessageParser(File.ReadAllLines(m))));

            messagesBuilder.ParseFiles();
            messagesBuilder.GenerateFiles();
            swMessages.Stop();

            var swTypes      = Stopwatch.StartNew();
            var typesBuilder =
                new ProtocolTypeMessageBuilder(provider.Types.Select(m => new TypeMessageParser(File.ReadAllLines(m))));

            typesBuilder.ParseFiles();
            typesBuilder.GenerateFiles(true);
            swTypes.Stop();

            var swEnums      = Stopwatch.StartNew();
            var enumsBuilder = new ProtocolEnumBuilder(provider.Enums.Select(m => new EnumParser(File.ReadAllText(m))));

            enumsBuilder.ParseFiles();
            enumsBuilder.GenerateFiles();
            swEnums.Stop();

            WriteLine($"> Messages generated in {swMessages.ElapsedMilliseconds}ms");
            WriteLine($"> Types generated in {swTypes.ElapsedMilliseconds}ms");
            WriteLine($"> Enums generated in {swEnums.ElapsedMilliseconds}ms");
            ReadKey();
        }
Пример #2
0
        internal static void GenerateNetwork()
        {
            var provider = new AsProvider(InputPath);

            if (!provider.Files.Any())
            {
                WriteLine($"Unable to find any ActionScript (.as) files in path '{InputPath}'");
                return;
            }
            TypeMessageIdsParser.ParseIds(InputPath + "/scripts/com/ankamagames/dofus/network/");

            var swMessages      = Stopwatch.StartNew();
            var messagesBuilder =
                new ProtocolTypeMessageBuilder(
                    provider.Messages.Select(m => new TypeMessageParser(File.ReadAllLines(m))));

            messagesBuilder.ParseFiles();
            messagesBuilder.GenerateFiles();
            swMessages.Stop();

            var swTypes      = Stopwatch.StartNew();
            var typesBuilder =
                new ProtocolTypeMessageBuilder(provider.Types.Select(m => new TypeMessageParser(File.ReadAllLines(m))));

            typesBuilder.ParseFiles();
            typesBuilder.GenerateFiles(true);
            swTypes.Stop();

            var swEnums      = Stopwatch.StartNew();
            var enumsBuilder = new ProtocolEnumBuilder(provider.Enums.Select(m => new EnumParser(File.ReadAllText(m))));

            enumsBuilder.ParseFiles();
            enumsBuilder.GenerateFiles();
            swEnums.Stop();

            WriteLine($"> Messages generated in {swMessages.ElapsedMilliseconds}ms");
            WriteLine($"> Types generated in {swTypes.ElapsedMilliseconds}ms");
            WriteLine($"> Enums generated in {swEnums.ElapsedMilliseconds}ms");
        }