Exemple #1
0
        /// <summary>
        /// Saves the bot ability assembly.
        /// </summary>
        /// <param name="bot">The bot.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <returns></returns>
        public bool SaveBotAbilityAssembly(IBot bot, string fileName)
        {
            if (WorldCourt.JudgeBotAbilityAssembly(fileName))
            {
                var assemblyFileName = Path.GetFileName(fileName);
                var destFile         = Path.Combine(GetBotAbilitiesSourceDir(bot), assemblyFileName);

                CreateBotDirs(bot, ConfigHelper.BotsSourceRootDir);

                File.Copy(fileName, destFile, true);

                InitializeInstance();
                return(true);
            }

            return(false);
        }
Exemple #2
0
        /// <summary>
        /// Saves the bot assembly.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns></returns>
        public bool SaveBotAssembly(string fileName)
        {
            if (WorldCourt.JudgeBotAssembly(fileName))
            {
                var assemblyFileName = Path.GetFileName(fileName);
                var destFile         = Path.Combine(ConfigHelper.BotsSourceRootDir, assemblyFileName);

                File.Copy(fileName, destFile, true);

                InitializeInstance();

                var bot = GetBotByAssemblyFileName(destFile);
                OnBotAssemblySaved(new BotAssemblySavedEventArgs(bot));
                return(true);
            }

            return(false);
        }