Пример #1
0
        public async Task RunAsync(params string[] args)
        {
            _log = LogManager.GetCurrentClassLogger();

            _log.Info("Starting NadekoBot v" + StatsService.BotVersion);

            //create client
            Client = new ShardedDiscordClient(new DiscordSocketConfig
            {
                AudioMode = Discord.Audio.AudioMode.Outgoing,
                MessageCacheSize = 10,
                LogLevel = LogSeverity.Warning,
                TotalShards = Credentials.TotalShards,
                ConnectionTimeout = int.MaxValue
            });

            //initialize Services
            CommandService = new CommandService();
            Localizer = new Localization();
            Google = new GoogleApiService();
            CommandHandler = new CommandHandler(Client, CommandService);
            Stats = new StatsService(Client, CommandHandler);

            //setup DI
            var depMap = new DependencyMap();
            depMap.Add<ILocalization>(Localizer);
            depMap.Add<ShardedDiscordClient>(Client);
            depMap.Add<CommandService>(CommandService);
            depMap.Add<IGoogleApiService>(Google);


            //setup typereaders
            CommandService.AddTypeReader<PermissionAction>(new PermissionActionTypeReader());
            CommandService.AddTypeReader<Command>(new CommandTypeReader());
            CommandService.AddTypeReader<Module>(new ModuleTypeReader());
            CommandService.AddTypeReader<IGuild>(new GuildTypeReader());

            //connect
            await Client.LoginAsync(TokenType.Bot, Credentials.Token).ConfigureAwait(false);
            await Client.ConnectAsync().ConfigureAwait(false);
            await Client.DownloadAllUsersAsync().ConfigureAwait(false);

            _log.Info("Connected");

            //load commands and prefixes
            using (var uow = DbHandler.UnitOfWork())
            {
                ModulePrefixes = new ConcurrentDictionary<string, string>(uow.BotConfig.GetOrCreate().ModulePrefixes.ToDictionary(m => m.ModuleName, m => m.Prefix));
            }
            // start handling messages received in commandhandler
            await CommandHandler.StartHandling().ConfigureAwait(false);

            await CommandService.LoadAssembly(this.GetType().GetTypeInfo().Assembly, depMap).ConfigureAwait(false);
#if !GLOBAL_NADEKO
            await CommandService.Load(new Music(Localizer, CommandService, Client, Google)).ConfigureAwait(false);
#endif
            Ready = true;
            Console.WriteLine(await Stats.Print().ConfigureAwait(false));
        }
 public void Circle()
 {
     DependencyMap<string> map = new DependencyMap<string>();
     map.Add("A", "B");
     map.Add("B", "C");
     map.Add("C", "A");
     map.SortDependencies();
 }
Пример #3
0
    public async Task Install(DiscordSocketClient client)
    {
        var commands = new CommandService();
        var map      = new DependencyMap();

        map.Add(client);
        map.Add(commands);
        await commands.AddModulesAsync(Assembly.GetEntryAssembly());
    }
Пример #4
0
        public void Missing_dependency_fails()
        {
            var map = new DependencyMap <string>();

            map.Add("one", "1", new[] { "2" });
            map.Add("two", "2", new[] { "3" });

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            map.Invoking(x => x.Entries.ToList())
            .Should().Throw <ConfigurationException>().WithMessage("Entry '2' has a dependency on missing entry '3'.");
        }
Пример #5
0
    public async Task Install(DiscordSocketClient client)
    {
        var commands = new CommandService();
        var map      = new DependencyMap();

        map.Add <IDiscordClient>(client);
        var self = await client.GetCurrentUserAsync();

        map.Add <ISelfUser>(self);
        await commands.LoadAssembly(Assembly.GetCurrentAssembly(), map);
    }
Пример #6
0
        public void Direct_circular_dependency_is_detected()
        {
            var map = new DependencyMap <string>();

            map.Add("one", "1", new[] { "2" });
            map.Add("two", "2", new[] { "1" });

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            map.Invoking(x => x.Entries.ToList())
            .Should().Throw <ConfigurationException>().WithMessage("Circular dependency with items: 1, 2");
        }
        public void DegenerateCase()
        {
            DependencyMap<string> map = new DependencyMap<string>();
            map.Add("A", null);
            map.Add("B", null);
            map.Add("C", null);
            map.Add("D", null);
            map.Add("E", null);

            CheckSort("ABCDE", map);
        }
        public void WorstCase()
        {
            DependencyMap<string> map = new DependencyMap<string>();
            map.Add("A", "B");
            map.Add("B", "C");
            map.Add("C", "D");
            map.Add("D", "E");
            map.Add("E", null);

            CheckSort("EDCBA", map);
        }
Пример #9
0
 public bool Load()
 {
     Dispose();
     if (DM == null)
     {
         DM = new DependencyMap();
         DM.Add(this);
         DM.Add(new CMD());
     }
     return(true);
 }
Пример #10
0
 public bool Load()
 {
     Dispose();
     if (DM == null)
     {
         DM = new DependencyMap();
         DM.Add(this);
         DM.Add(new KeyboardHook());
         DM.Add(new CMD(
                    DM.Get <KeyboardHook>()));
     }
     return(true);
 }
Пример #11
0
        /// <summary>
        /// Finds any cell dependencies for the given cell.
        /// </summary>
        /// <param name="cell">A cell to find dependencies with.</param>
        /// <returns>A map of all connected dependencies.</returns>
        public static DependencyMap GetDependencies(Cell cell)
        {
            String formula = cell.CellFormula;
            Queue <FormulaToken> tokens       = Tokenize(formula);
            DependencyMap        dependencies = new DependencyMap(cell);

            foreach (FormulaToken t in tokens)
            {
                if (t.Type == TokenType.CELL)
                {
                    //Find the cell reference from map of SpreadSheet with index
                    dependencies.Add(new Dependency(ExtractCell(t.Token.Replace("-", "")), true));
                }
            }

            //For each direct dependency in dependencies, add their dependencies to ours as indirect.
            int count = dependencies.Count;

            for (int i = 0; i < count; i++)
            {
                foreach (Dependency d in dependencies[i].Cell.Dependencies)
                {
                    //Overwrites or adds a new Cell. By overwriting it to indirect, we can reduce the number of potential calls for Change.
                    dependencies[d.Cell.Name] = new Dependency(d.Cell, false);
                }
            }

            return(dependencies);
        }
Пример #12
0
        public async Task Start()
        {
            EnsureConfigExists();

            // Define the DiscordSocketClient
            client = new DiscordSocketClient(new DiscordSocketConfig
            {
                WebSocketProvider = Discord.Net.Providers.WS4Net.WS4NetProvider.Instance
            });

            // Login and connect to Discord.
            await client.LoginAsync(TokenType.Bot, Configuration.Load().Token);

            await client.ConnectAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);


            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #13
0
        public async Task Start()
        {
            //Define the DiscordSocketClient
            client = new DiscordSocketClient();

            var token = "Token";

            //Login and connect to discord
            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            //Console Log!
            Console.WriteLine($"{DateTime.UtcNow}: YourBot initiated...");

            //Block this program untill it is closed
            await Task.Delay(-1);
        }
Пример #14
0
        public async Task Run()
        {
            _log.Info("Reading config");
            var config = Configuration.ReadConfig();

            _log.Info("Starting up bot");
            var client = new DiscordSocketClient(new DiscordSocketConfig
            {
                WebSocketProvider = Discord.Net.Providers.WS4Net.WS4NetProvider.Instance
            });

            await client.LoginAsync(TokenType.Bot, config.Token);

            await client.StartAsync();

            var map = new DependencyMap();

            map.Add(client);

            var handler = new CommandHandler();
            await handler.Install(map);

            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #15
0
        public async Task Start()
        {
            // Define the DiscordSocketClient with a DiscordSocketConfig
            client = new DiscordSocketClient(new DiscordSocketConfig()
            {
                LogLevel = LogSeverity.Info
            });

            var token = "token here";

            // Login and connect to Discord.
            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            // add logger
            client.Log += Log;

            // Log the invite URL on client ready
            client.Ready += Client_Ready;

            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #16
0
        public async Task Start()
        {
            Console.WriteLine("start");
            // Define the DiscordSocketClient
            client = new DiscordSocketClient();

            var token = File.ReadAllText("Token.txt");

            client.Connected += async() =>
            {
                await client.SetGameAsync("?help");
            };

            // Login and connect to Discord.
            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            Console.WriteLine("Connected");
            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #17
0
        public async Task Start()
        {
            DiscordClient = new DiscordSocketClient(new DiscordSocketConfig()
            {
                LogLevel = LogSeverity.Info
            });

            try {
                await DiscordClient.LoginAsync(TokenType.Bot, System.IO.File.ReadAllText("Resources/Token.txt"));
            } catch (Exception) {
                await Log(new LogMessage( LogSeverity.Critical, "Token", "Invalid Token File" ));
            }

            await DiscordClient.StartAsync();

            DependencyMap Map = new DependencyMap();

            Map.Add(DiscordClient);

            await new CommandHandler().Install(Map);

            DiscordClient.Log += Log;

            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #18
0
 public async Task InstallCommands()
 {
     map.Add(new InsultProvider());
     // Hook the MessageReceived Event into our Command Handler
     client.MessageReceived += HandleCommand;
     // Discover all of the commands in this assembly and load them.
     await commands.AddModulesAsync(Assembly.GetEntryAssembly());
 }
Пример #19
0
        public void Adding_duplicate_id_fails()
        {
            var map = new DependencyMap <string>();

            map.Add("one", "1");

            map.Invoking(x => x.Add("two", "1"))
            .Should().Throw <ArgumentException>().WithMessage("Item already added with with ID '1'.");
        }
Пример #20
0
        private async Task HandleCommand(SocketMessage s)
        {
            // Don't handle the command if it is a system message
            var msg = s as SocketUserMessage;

            if (msg == null)                                                // Check if the received message is from a user.
            {
                return;
            }

            var map = new DependencyMap();                                  // Create a new dependecy map.

            map.Add(_cmds);                                                 // Add the command service to the dependency map

            map.Add(_timer);                                                // Add our services to the dependency map

            var context = new SocketCommandContext(_client, msg);           // Create a new command context.

            int argPos = 0;                                                 // Check if the message has either a string or mention prefix.

            if (msg.HasStringPrefix(BotConfiguration.Load().Prefix, ref argPos) ||
                msg.HasMentionPrefix(_client.CurrentUser, ref argPos))
            {
                if (_logcommands)                    // only if logging is enabled in config and it's a bot message
                {
                    try
                    {
                        _da.LogCommand(context.Guild.Name, msg.Channel.Name, msg.Author.Username, msg.Content, msg.Timestamp.ToLocalTime().ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                // Try and execute a command with the given context.
                var result = await _cmds.ExecuteAsync(context, argPos, map);

                if (!result.IsSuccess)                                          // If execution failed, reply with the error message.
                {
                    await context.Channel.SendMessageAsync(result.ToString());
                }
            }
        }
Пример #21
0
        public async Task Start()
        {
            client = new DiscordSocketClient();
            map    = new DependencyMap();

            map.Add(client);
            map.Add <ICommands>(new Commands(map));

            string token = Environment.GetEnvironmentVariable("token");

            await map.Get <ICommands>().Install();

            await client.LoginAsync(TokenType.Bot, token);

            await client.ConnectAsync();

            await client.SetStatusAsync(UserStatus.Idle);

            await client.SetGameAsync("Message !help for help");
        }
Пример #22
0
        public async Task Run(string[] args)
        {
            // Init vars
            Cts = new CancellationTokenSource();
            Ct  = Cts.Token;

            _modSystem = new ModSystem();
            _logger    = new LogManager("discord-", "-tmodloader");

            // Setup objects
            _client = new DiscordSocketClient(new DiscordSocketConfig()
            {
                AlwaysDownloadUsers = true,
                LogLevel            = LogSeverity.Debug,
                MessageCacheSize    = 500
            });

            // Setup event handlers
            _client.Log             += ClientLog;
            _client.JoinedGuild     += ClientJoinGuild;
            _client.Ready           += ClientReady;
            _client.LatencyUpdated  += ClientLatencyUpdated;
            _client.ReactionAdded   += ClientReactionAdded;
            _client.ReactionRemoved += ClientReactionRemoved;
            // awaitable login
            await Login();

            var map = new DependencyMap();

            map.Add(_client);
            map.Add(_modSystem);
            map.Add(_logger);

            Handler = new CommandHandler();
            await Handler.Install(map);

            Console.Title = "The Guide - " + ConfigManager.Properties.Version;

            // Block program until it's closed or task is canceled
            await Task.Delay(-1, Ct);
        }
Пример #23
0
        public async Task Start(JsonConfiguration config, Gfycat.GfycatClientConfig gfyConfig)
        {
            DiscordSocketClient discordClient = new DiscordSocketClient();

            CommandHandler handler = new CommandHandler();

            DependencyMap map = new DependencyMap();

            map.Add(gfyConfig);
            map.Add(discordClient);
            discordClient.UsePaginator(map);

            await handler.Install(map);

            await discordClient.LoginAsync(TokenType.Bot, config.BotToken);

            await discordClient.StartAsync();

            Console.WriteLine("Bot Initialized");

            await Task.Delay(-1);
        }
Пример #24
0
        public async Task Start()
        {
            // As we are not using 4.6 we must include the Discord.Net WebSocketProvider.
            client = new DiscordSocketClient(new DiscordSocketConfig {
                WebSocketProvider = Discord.Net.Providers.WS4Net.WS4NetProvider.Instance,
                LogLevel          = LogSeverity.Verbose
            });
            // Writes detailed log to the console
            client.Log += (l)
                          => Task.Run(()
                                      => Console.WriteLine($"[{l.Severity}] {l.Source}: {l.Exception?.ToString() ?? l.Message}"));

            // Variable for token
            var token = "MjY0MjAwODI2NDI2MzU5ODA4.C3NZWg.hLb2Z8U66zcef7fgC43yAra6Ydo";

            // Use token to login, and then use asyncconnect to connect to discord
            await client.LoginAsync(TokenType.Bot, token);

            await client.ConnectAsync();

            // Create a new dependency map
            var map = new DependencyMap();

            map.Add(client);

            // Recall command handler and add the dependency map to it
            handler = new CommandHandler();
            await handler.Install(map);

            // Hooking into events

            client.UserJoined += async(e) =>
            {
                try
                {
                    ulong channelid = 266188297339011082;
                    e.Discord.GetChannel(channelid);
                    Console.WriteLine("Channel Found");
                }
                catch
                {
                    Console.WriteLine("Channel not found, or error with code");
                }
            };

            // Block the closing of the program until it is closed
            await Task.Delay(-1);
        }
        public async Task Start()
        {
            client = new DiscordSocketClient();

            await client.LoginAsync(TokenType.Bot, "TOKEN HERE");

            await client.ConnectAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            await Task.Delay(-1);
        }
        public void Typical()
        {
            DependencyMap<string> map = new DependencyMap<string>();
            map.Add("A", "C");  // Forward reference
            map.Add("B", "E");  // Forward reference
            map.Add("D", null); // No dependency
            map.Add("C", "B");  // Backward reference
            map.Add("E", null); // No dependency
            map.Add("F", "G");  // Dependent on something outside map

            CheckSort("DEFBCA", map);
        }
Пример #27
0
        public async Task Run(string[] args)
        {
            // Init vars
            CTS = new CancellationTokenSource();
            CT  = CTS.Token;

            // Setup objects
            _client = new DiscordSocketClient(new DiscordSocketConfig()
            {
                AlwaysDownloadUsers = true,
                LogLevel            = LogSeverity.Debug,
                MessageCacheSize    = 250
            });

            // Setup event handlers
            _client.Log         += ClientLog;
            _client.JoinedGuild += ClientJoinGuild;

            // Login and start bot
            // For a locally running bot, it's fine to use an environment variable, for ease of use
            // If you distribute your bot, using a config.json is recommended.
            // Since we will showcase more options, we will use a config.json
            // To use an env variable, you can do something like this: Properties.Resources.ResourceManager.GetString("BOT_TOKEN")
            // Our ConfigManager is static, see ConfigManager.cs
            // For your config.json file, make sure Copy to output directory is set to Always
            await ConfigManager.Read();

            // First login, then start
            // Similar order reverse: StopAsync, LogoutAsync
            await _client.LoginAsync(TokenType.Bot, ConfigManager.properties.Token);

            await _client.StartAsync();

            var map = new DependencyMap();

            map.Add(_client);

            handler = new CommandHandler();
            await handler.Install(map);

            Console.Title = "Example Bot - " + ConfigManager.properties.Version;

            // Block program until it's closed or task is canceled
            await Task.Delay(-1, CT);
        }
Пример #28
0
        public Paladin()
        {
            Author  = "krycess";
            Name    = "Paladin";
            Version = new Version("0.0.1.0");

            dm.Add(this);
            dm.Add(Common.Instance);
            dm.Add(Inventory.Instance);
            dm.Add(Lua.Instance);
            dm.Add(Navigation.Instance);
            dm.Add(ObjectManager.Instance);
            dm.Add(Spell.Instance);
            dm.Add(new PaladinManager(
                       dm.Get <Common>(),
                       dm.Get <Lua>(),
                       dm.Get <Navigation>(),
                       dm.Get <ObjectManager>(),
                       dm.Get <Spell>()));
        }
Пример #29
0
        public async Task Start()
        {
            try
            {
                Console.WriteLine("Welcome to Botnuki v2.0! Initiating. . .");
                // instantiate the client
                _client = new DiscordSocketClient(new DiscordSocketConfig
                {
                    WebSocketProvider = WS4NetProvider.Instance
                });

                // get the server token
                Console.WriteLine("Finding server path. . .");
                string path = AppDomain.CurrentDomain.BaseDirectory;
                path = path.Substring(0, path.Length - 10);
                var token = File.ReadAllText($@"{path}inukitvsrvid.txt");

                // log in and connect
                Console.WriteLine("Connecting to server. . .");
                await _client.LoginAsync(TokenType.Bot, token);

                await _client.StartAsync();

                // dependency map
                var map = new DependencyMap();
                map.Add(_client);

                // install commands using CommandHandler
                Console.WriteLine("Installing commands. . .");
                comms = new CommandHandler();
                await comms.Install(map);

                // block until program is closed
                Console.WriteLine("Connected!");
                await Task.Delay(-1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ErrorHandling.ThrowGenException("Program.cs", "Start()", ex.Message));
                Console.ReadKey();
            }
        }
Пример #30
0
        public async Task Start()
        {
            // Get BotConfig
            var config = Functions.GetBotConfig();

            // Console
            Console.Title = "DreamBot";

            // Define _config
            _config = new DiscordSocketConfig()
            {
                LogLevel = (LogSeverity)config.LogLevel
            };

            // Define _client
            _client = new DiscordSocketClient(_config);

            // Define _client.Log
            _client.Log += Log;

            // Events
            /*await new Events(_client).CreateEvents();*/

            // Login & Connect
            await _client.LoginAsync(TokenType.Bot, config.BotToken);

            await _client.StartAsync();

            // Define _map
            _map = new DependencyMap();
            _map.Add(_client);

            // Define _cmds
            _cmds = new CommandHandler();
            await _cmds.Install(_map);

            // Define _client.Ready
            _client.Ready += ClientReady;

            await Task.Delay(-1);
        }
Пример #31
0
        public Warrior()
        {
            Author  = "krycess";
            Name    = "Warrior";
            Version = new Version("0.0.1.0");

            dm.Add(this);
            dm.Add(Common.Instance);
            dm.Add(Lua.Instance);
            dm.Add(Navigation.Instance);
            dm.Add(ObjectManager.Instance);
            dm.Add(Spell.Instance);
            dm.Add(new WarriorManager(
                       dm.Get <Common>(),
                       dm.Get <Lua>(),
                       dm.Get <Navigation>(),
                       dm.Get <ObjectManager>(),
                       dm.Get <Spell>()));
        }
Пример #32
0
        public async Task Start()
        {
            // Define the DiscordSocketClient
            client = new DiscordSocketClient();

            var token = "token here";

            // Login and connect to Discord.
            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            // Block this program until it is closed.
            await Task.Delay(-1);
        }
Пример #33
0
        public async Task Start()
        {
            // Define the DiscordSocketClient
            client = new DiscordSocketClient();

            var token = "Token here";

            // Login and connect to Discord.
            await client.LoginAsync(TokenType.Bot, token);

            await client.StartAsync();

            client.Ready += async() =>
            {
                await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
            };
            client.JoinedGuild += async(e) =>
            {
                await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
            };
            client.LeftGuild += async(e) =>
            {
                await client.SetGameAsync($"-help | In guilds: {client.Guilds.Count}");
            };


            var map = new DependencyMap();

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);

            Console.WriteLine($"{DateTime.UtcNow}: YourBot initiated...");
            await Task.Delay(-1);
        }
Пример #34
0
        private CommandService commands;                                                                                    //  Stores a CommandService

        public async Task Run()
        {
            client = new DiscordSocketClient(new DiscordSocketConfig()                                                      //  Sets the client variable to be a new socketconfig with certain properties
            {
                LogLevel          = LogSeverity.Debug,                                                                      //  Sets the loglevel to be debug
                WebSocketProvider = () => new WS4NetProvider()                                                              //  This is done so the program works on windows 7
            });

            client.Log += Log;                                                                                      //  Makes a new event handler called Log

            commands = new CommandService();                                                                        //  Instantiates the commands

            string token = "";                                                                                      //  Our token gets stored

            await InstallCommands();                                                                                //  Call the InstallCommands function

            await client.LoginAsync(TokenType.Bot, token);                                                          //  Tells the program to login the bot

            await client.ConnectAsync();                                                                            //  Tells the program to connect

            var map = new DependencyMap();                                                                          //  Stores a new dependency map, that is used for our commands

            map.Add(client);                                                                                        //  adds the client to the map

            client.UserJoined += async(user) =>                                                                     //  Makes an event handler for when a user joins
            {
                SocketRole welcomeRole = user.Guild.GetRole(248434734240104459);                                    //  Stores the welcome role
                await user.AddRolesAsync(welcomeRole);                                                              //  Assigns the welcome role to the user who joined

                Discord.Rest.RestDMChannel dmchannel = await user.CreateDMChannelAsync();                           //  Makes a dmchannel with the newly joined user

                await dmchannel.SendMessageAsync($"Welcome to {user.Guild.ToString()}, {user.Mention.ToString()}"); //  Writes a message in the dmchannel
            };

            await Task.Delay(-1);                                                                                           //  Delays the task for minus 1 milisecond
        }
Пример #35
0
        private async Task Start()
        {
            //Instatiate WebSocket client
            client = new DiscordSocketClient();

            var token = "MzA0MzMxMzg4MjU1OTkzODU4.DCf3kA.50usYahstgxA-ovX1U5T3lVkF8c";

            client.Log += Log;

            //Connect to discord
            await client.LoginAsync(TokenType.Bot, token, true);

            await client.StartAsync();

            var map = new DependencyMap(); //something has been done to help with this error

            map.Add(client);

            handler = new CommandHandler();
            await handler.Install(map);


            await Task.Delay(-1);
        }
Пример #36
0
        private DependencyMap<string> ClassDependencyMap()
        {
            // Sort the units by class name before adding them to the map.
            // This ensures that classes with equivalent dependency depths
            // ultimately end up sorted by class name as well.
            IEnumerable<BuildUnit> sortedBuildUnits = BuildUnits.OrderBy(
                buildUnit => buildUnit.ClassName);

            DependencyMap<string> map = new DependencyMap<string>();
            foreach (BuildUnit buildFile in sortedBuildUnits)
            {
                map.Add(buildFile.ClassName, buildFile.BaseClassName);
            }
            return map;
        }